Commit graph

3862 commits

Author SHA1 Message Date
Virendra Kakade
a98da1dfd4 rfnoc: fix incorrect long fifo wait timeouts
This fixes behavior where we would get long 100 sec timeouts
on fifo waits instead of 100 ms timeouts.

Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2019-11-26 12:21:35 -08:00
Martin Braun
4607c049fa mg: Turn the set-lock into a recursive mutex
Individual API calls might have to call each other (e.g., like
set_rate() will call set_rx_frequency()), which would cause a deadlock.
2019-11-26 12:21:34 -08:00
Martin Braun
66a9df7b16 mg: Always set MCR on both daughterboards
The N310 cannot set the MCR for its daughterboards separately. This
patch modifies the radio block controller such that any block
controller, when requested to change the master clock rate, will first
change Radio 0, and then Radio 1.

This fixes the following issues:
- In multi_usrp, calling set_master_clock_rate() will not necessarily
  call set_rate() on the radios in any particular order, which will
  break when calling Radio 1 first
- In RFNoC apps, it wasn't possible to run off of slot B alone without
  this change.

Note: When calling set_rate() on one radio, the other radio is in an
invalid state until its set_rate() is also called.
2019-11-26 12:21:34 -08:00
Alex Williams
911ca16adc lib: Add DPDK service queue
This is a data structure intended for use by the DPDK I/O service.
It uses DPDK's lockless ring in multi-producer, single-consumer mode
to allow clients to submit requests to the DPDK I/O service's worker
thread. Clients can specify a timeout for the requests to be fulfilled.
2019-11-26 12:21:34 -08:00
Ciro Nishiguchi
c730d7ba20 rfnoc: fix invalid access when sending packet with no samples 2019-11-26 12:21:34 -08:00
Martin Braun
79e34b4d00 mpmd: Fix get_mboard_name()
It used to produce the individual name of the USRP, but it should return
a product name.
2019-11-26 12:21:34 -08:00
Martin Braun
cd4b1bcd64 n310: Fix GPIO registers
This enables the use of the dboard and FP GPIOs. The problem was that
the register offset of 8 was not encoded.
2019-11-26 12:21:34 -08:00
Martin Braun
920198556e mg/rh/rfnoc: Harmonize peripheral registers
- Move the SPI addresses out of radio_control_impl
- Fix the GPIO address spaces for N310/N300
2019-11-26 12:21:34 -08:00
Martin Braun
8b929b2d4e gpio_atr_3000: Fix return value for pin control register
This fixes a bug where get_gpio_attr(bank, "CTRL") would return the
inverted value of what was written. Reason is that the underlying
register was an ATR disable register.
The fix is to invert the cached values of the register.

Now, the following Python code will work:

>>> U = uhd.usrp.MultiUSRP("type=x300")
>>> atr_enable = 0xF # Enable ATR on lower 4 pins, rest is GPIO
>>> U.set_gpio_attr("FP0A", "CTRL", atr_enable)
>>> U.get_gpio_attr("FP0A", "CTRL") == atr_enable
True
2019-11-26 12:21:34 -08:00
Martin Braun
59fae330b0 detail::graph: Add shutdown capability
In the existing graph, when the shutdown was simply a release. However,
any outstanding actions would trigger warnings (because released graphs
aren't supposed to still have actions being passed around), which would
sometimes be visible at the end of an application.

This is a safer solution than simply releasing, because it explicitly
sets a shutdown flag that all graph-affecting functions (property
propagation and action handling) respect. Once the flag is set, the
graph can no longer be booted up again.
2019-11-26 12:21:33 -08:00
Martin Braun
14fb3cc6f4 e310: Fix issues in MPM and UHD
- Remove superfluous INFO logging
- Improve formatting in many places
- Improve Pylint score in various places
- Add tear_down to DB object
- Simplify custom EEPROM code for E310
- Fix time source selection code
- Remove references to GPS_CTRL and GPS_STATUS (are E320 only)
- Move clock source control out of MboardRegs object
2019-11-26 12:21:33 -08:00
Martin Braun
ec488d49c0 mpm/mpmd: Remove token requirement for device info
This removes the token requirement for get_proto_ver() and
get_chdr_width().
2019-11-26 12:21:33 -08:00
Ciro Nishiguchi
837b89e2ec rfnoc: Rename thread affinity args
Rename thread affinity args such that they do not end with an integer.
Arg names ending with an integer are interpreted as being targeted at a
specific motherboard index in device_addr methods.
2019-11-26 12:21:33 -08:00
Ciro Nishiguchi
16c2bea50d uhd: Allow device args that have an integer in the name
Allow device args that contain an integer within the name, such as
recv_offload_thread_0_cpu. Previously this would cause an invalid format
exception.
2019-11-26 12:21:33 -08:00
Alex Williams
80ec3fee42 lib,tests: Remove old DPDK files from build
The DPDK files are left behind as a reference, for now.
2019-11-26 12:21:33 -08:00
Alex Williams
f5861562d9 transport: Add new base for DPDK links, based on 18.11
dpdk_ctx represents the central context and manager of all memory
and threads allocated via the DPDK EAL. In this commit, it parses
the user's arguments, configures all the ports, and brings them up.

dpdk_port represents each DPDK NIC port's configuration, and it
manages the allocation of individual queues and their flow rules.
It also would provide access to an ARP table and functions for
handling ARP requests and responses. The flow rules and ARP
functions are not yet implemented.
2019-11-26 12:21:33 -08:00
Alex Williams
07e04cd760 docs: Change DPDK version to 18.11 and make args use underscores
Swap out hyphens for underscores in the DPDK args. Also update list
of distributions with the correct DPDK version in the repos.
2019-11-26 12:21:33 -08:00
Martin Braun
2d110b1ded rfnoc_graph: Modify find_blocks() to sort return value
With this patch, the elements of of the return value of find_blocks()
are sorted lexicographically (specifically, using
uhd::rfnoc::block_id_it::operator<()).

The underlying block_container class stores the blocks in an unordered
set, so the return value for find_blocks() was always sorted randomly.
multi_usrp_rfnoc had to sort the return values every time find_blocks()
was used to get a useful return value.

Because find_blocks() had no contract for the order of returned blocks,
this change simply sorts the return value before returning it.
multi_usrp_rfnoc is modified to remove all the sorts that are now
superfluous.

A good way to see the change is to run uhd_usrp_probe, which will now
contain content like this:

|     _____________________________________________________
|    /
|   |       RFNoC blocks on this device:
|   |
|   |   * 0/DDC#0
|   |   * 0/DDC#1
|   |   * 0/DUC#0
|   |   * 0/DUC#1
|   |   * 0/DmaFIFO#0
|   |   * 0/Radio#0
|   |   * 0/Radio#1

Assuming the blocks don't change, the order of this list will always be
the same following this patch. Note that the order is unrelated to the
order on the control crossbar, which it never was.
2019-11-26 12:21:33 -08:00
Martin Braun
b7488af14e multi_usrp: Fix GPIO bank selection
When calling a multi_usrp object like this:

    usrp->set_gpio_attr("TXB", "CTRL", 0xFFFF);

Previously, it would only be able to address daughterboard A. Now, there
is a full backward-compatible solution (compatible with 3.15), that will
address either daughterboard's GPIOs.
2019-11-26 12:21:33 -08:00
Brent Stapleton
97d51cc9ee liberio: porting to I/O services
Fixes 85f0551 ("rfnoc: Add I/O service manager to X300 and MPMD")
2019-11-26 12:21:33 -08:00
Ciro Nishiguchi
a8e286b106 rfnoc: Make polling I/O service not block on flow control
Add a new method to io_service::send_io to check whether the destination
is ready for data, to make it possible to poll send_io rather than block
waiting for flow control credits.
2019-11-26 12:21:33 -08:00
Ciro Nishiguchi
10b9d2688b rfnoc: Make I/O services relinquish CPU while waiting 2019-11-26 12:21:33 -08:00
Martin Braun
d5580fcec8 multi_usrp: Add set_rx_spp() call
This API call is a more explicit way of setting the spp than passing in
an spp value in the args of the stream args when creating streamers. For
pre-RFNoC devices, this is done by injecting the spp arg back into the
stream args. For RFNoC devices, the set_property() call on the radio is
called.
2019-11-26 12:21:33 -08:00
Martin Braun
ea89fd0dd4 rfnoc: xports: Count FC bytes as multiples of CHDR width
SEPs on the FPGA can only occupy multiples of the CHDR width in their
FIFOs, unlike SW, where buffers are stored in RAM and can be aligned
anyhow. Therefore, we align the counting of bytes for FC purpose and
count multiples of CHDR width instead of the true number of bytes per
packet.
2019-11-26 12:21:32 -08:00
Ciro Nishiguchi
b4ef7ca804 rfnoc: Restrict to inline I/O service based on link restrictions
For links that do not support releasing buffers out of order, restrict
the I/O service manager to always select the inline I/O service.
2019-11-26 12:21:32 -08:00
Brent Stapleton
03dcda01e0 rfnoc: Use graph_utils in multi_usrp chan generation 2019-11-26 12:21:32 -08:00
Ciro Nishiguchi
7b95cbd7fd rfnoc: Merge I/O service device args with stream args
This makes it possible for users to put I/O service-related args in
either the device args or stream args.
2019-11-26 12:21:32 -08:00
Ciro Nishiguchi
1cd874911d rfnoc: Split up offload I/O service into multiple files 2019-11-26 12:21:32 -08:00
Martin Braun
72b45bb8de uhd: Remove all usages of boost::tuple and friends
This replaces all of the following with standard C++ features:

- boost::tuple
- boost::make_tuple
- boost::tuple::get
- #include <boost/tuple/tuple.hpp>

All usages were replaced with search-and-replace scripts (the usages of
get could be automatically replaced with a vim macro, the rest was
straightforward search-and-replace).
2019-11-26 12:21:32 -08:00
Martin Braun
d3a16b7022 uhd: Replace all occurrences of boost::bind with std::bind
Note: Replacing everything with a lambda would be even better, but that
can't be easily scripted so we'll do this as a first step to reduce the
Boost footprint.

This also removes occurences of #include <boost/bind.hpp>, and makes
sure all usages of std::bind have an #include <functional>. clang-format
wasn't always applied to minimize the changeset in this commit, however,
it was applied to the blocks of #includes.

Due to conflicts with other Boost libraries, the placeholders _1, _2,
etc. could not be directly used, but had to be explicitly called out
(as std::placeholders::_1, etc.). This makes the use of std::bind even
uglier, which serves as another reminder that using std::bind (and even
more so, boost::bind) should be avoided.

nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It
was not possible to remove it by simply doing a search and replace, so
it will be removed in a separate commit.
2019-11-26 12:21:32 -08:00
Brent Stapleton
2da99fad97 rfnoc: Adding rfnoc_graph utilities
Adding graph_utils to keep rfnoc_graph utilities to contain helper
function and commonly used algorithms for the rfnoc_graph. These
functions aren't core to the rfnoc_graph's functionality, so we'll keep
them out of its API.
2019-11-26 12:21:32 -08:00
Martin Braun
ba637e6d30 mpmd: Add skip_oldlog device arg
This device arg will avoid printing old log messages by dumping all log
messages in the buffer immediately after claiming a device. This can be
helpful because reading old log messages can be confusing during debug
situations, or simply during situations where we expect errors to
contain warnings or errors, but we want to hide them.

skip_oldlog defaults to off, i.e., the previous behaviour.
2019-11-26 12:21:32 -08:00
Martin Braun
1825f08852 mpmd: Skip generation of mb_controller and mb_iface for skip_init=1
The mpmd_mb_controller requires access to the fully functional FPGA,
which in turn assumes flawless initialization. skip_init doesn't init at
all, so inializing an mb_controller may not be possible, and shouldn't
be attempted. This skips init of both mb_iface and mb_controller for
skip_init, leaving it to the other code to figure out if they are
initialized.
2019-11-26 12:21:32 -08:00
Aaron Rossetto
0bd233e642 uhd: Introduce I/O service manager
- Implement I/O service detach link methods
- The I/O service manager instantiates new I/O services or connects
  links to existing I/O services based on options provided by the user
  in stream_args.
- Add a streamer ID parameter to methods to create transports so that
  the I/O service manager can group transports appropriately when using
  offload threads.
- Change X300 and MPMD to use I/O service manager to connect links to
  I/O services.
- There is now a single I/O service manager per rfnoc_graph (and it is
  also stored in the graph)
- The I/O service manager now also knows the device args for the
  rfnoc_graph it was created with, and can make decisions based upon
  those (e.g, use a specific I/O service for DPDK, share cores between
  streamers, etc.)
- The I/O Service Manager does not get any decision logic with this
  commit, though
- The MB ifaces for mpmd and x300 now access this global I/O service
  manager
- Add configuration of link parameters with overrides

Co-Authored-By: Martin Braun <martin.braun@ettus.com>
Co-Authored-By: Aaron Rossetto <aaron.rossetto@ni.com>
2019-11-26 12:21:32 -08:00
Ciro Nishiguchi
912ed28b3d rfnoc: Make trasnport safe to use with offload threads
Make transports safe to use with an offload thread by ensuring that the
callbacks and the API methods can execute concurrently. Also, ensure
that the transports release their I/O service clients prior to allowing
their other member variables be destroyed.
2019-11-26 12:21:32 -08:00
Aaron Rossetto
2f97f8bd01 transport: Implement eov indications for Rx and Tx streams 2019-11-26 12:21:32 -08:00
Martin Braun
f773cf9fb9 uhd: Replace boost::regex with std::regex
boost::regex was a requirement until the minimum version of gcc was
increased. Since it is at version 5.3 now, using Boost.Regex is no
longer necessary.
This change is a pure search-and-replace; Boost and std versions of
regex are compatible and use the same syntax.
2019-11-26 12:21:32 -08:00
Martin Braun
fcc2e9c602 uhd: Replace boost::function with std::function
This is mostly a search-and-replace operation, with few exceptions:
- boost::function has a clear() method. In C++11, this is achieved by
  assigning nullptr to the std::function object.
- The empty() method is replaced by std::function's bool() operator
2019-11-26 12:21:32 -08:00
Martin Braun
0c43030e71 uhd: Replace BOOST_FOREACH(v, c) with for(v : c)
Also removes all references to boost/foreach.hpp. BOOST_FOREACH is no
longer necessary since all headers require C++11 anyway.
2019-11-26 12:21:32 -08:00
Martin Braun
1fe98e8701 uhd: Replace usage of boost smart pointers with C++11 counterparts
This removes the following Boost constructs:
- boost::shared_ptr, boost::weak_ptr
- boost::enable_shared_from_this
- boost::static_pointer_cast, boost::dynamic_pointer_cast

The appropriate includes were also removed. All C++11 versions of these
require #include <memory>.
Note that the stdlib and Boost versions have the exact same syntax, they
only differ in the namespace (boost vs. std). The modifications were all
done using sed, with the exception of boost::scoped_ptr, which was
replaced by std::unique_ptr.

References to boost::smart_ptr were also removed.

boost::intrusive_ptr is not removed in this commit, since it does not
have a 1:1 mapping to a C++11 construct.
2019-11-26 12:21:32 -08:00
Ciro Nishiguchi
650c07cbcb transport: Implement an I/O service that uses an offload thread
The offload_io_service executes another I/O service instance within an
offload thread, and provides synchronization mechanisms to communicate
with clients. Frame buffers are passed from the offload thread to the
client and back via single-producer, single-consumer queues.
2019-11-26 12:21:31 -08:00
Alex Williams
f3a86a3294 rfnoc: Unify endianness of transports
Ethernet now uses the same serialization of the RFNoC stream as all
the other transports.
2019-11-26 12:21:31 -08:00
Aaron Rossetto
cb9329a681 uhd: Check property type at access; error if mismatch 2019-11-26 12:21:31 -08:00
Lars Amsel
f5c0640304 rfnoc: Port FFT controller
rfnoc used noc-script for FFT controller implementation. Because
erfnoc does not support noc-script yet, the implementation is done
as a rfnoc controller.
2019-11-26 12:16:25 -08:00
Martin Braun
f9f9cb0d2c rfnoc: Add DMA FIFO block controller 2019-11-26 12:16:25 -08:00
Martin Braun
7d69dcdcc3 Remove proto-RFNoC files
This commit removes all files and parts of files that are used by
proto-RFNoC only.

uhd: Fix include CMakeLists.txt, add missing files
2019-11-26 12:16:25 -08:00
Martin Braun
c256b9df65 x300/mpmd: Port all RFNoC devices to the new RFNoC framework
Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Brent Stapleton <brent.stapleton@ettus.com>
Co-Authored-By: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
2019-11-26 12:16:25 -08:00
Martin Braun
67dbaa41f2 rfnoc: radio: Add API call to disable timestamps
By calling radio_control::enable_rx_timestamps(false, chan), the radio
will not add timestamps to outgoing packets.
2019-11-26 11:49:46 -08:00
Martin Braun
96dd8f437e rfnoc: radio: Interpret MTU as max payload size
This matches the streamer code.
2019-11-26 11:49:46 -08:00
Alex Williams
ebef8c3419 transport: Port liberio to link_if 2019-11-26 11:49:46 -08:00