Commit graph

5848 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
Wade Fife
3132634bb4 rfnoc: Fix RAM port direction in YAML 2019-11-26 12:21:34 -08:00
Martin Braun
91f8a9b8b2 examples: gpio: Replace get_time_now() with steady_clock::now()
The gpio example would continously call get_time_now() to time a loop.
There is no need to query a device here, so we query the system timer
instead.

This fixes an issue where the large amounts of control traffic could
slow down TX, causing the TX and FDX tests to fail. This was only ever
seen on the X300_HG over 1GigE.
2019-11-26 12:21:34 -08:00
Martin Braun
9742e8ede5 examples: gpio: Fix minor issues
- Use GPIO_BIT(x) instead of 1<<x where appropriate
- Correctly use rx_buff/tx_buff in recv/send, respectively
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
113b3262d3 examples: benchmark_rate.py: Add ?x_stream_args args
This allows adding stream args to the Python version of benchmark_rate
in the same way as for the C++ version, e.g.:

python3 ./benchmark_rate.py \
    --args addr=192.168.40.2,num_poll_offload_threads=4 \
    --rx_stream_args \
        recv_offload=1,num_recv_frames=32,recv_offload_wait_mode=poll \
    --tx_stream_args \
        send_offload=1,num_send_frames=32,send_offload_wait_mode=poll \
    [... other arguments ...]
2019-11-26 12:21:33 -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
59a4360384 examples: gpio: Add note on which bank is being used
This will print the currently-used GPIO bank's name before starting the
test.
2019-11-26 12:21:33 -08:00
Martin Braun
879f021a02 devtest: Add test_messages_test to X310
- Fixes issues with test_messages_test (it had inverted the pass/fail
  condition)
- Improve Pylint scores in affected files
2019-11-26 12:21:33 -08:00
Martin Braun
e0a40fd1d7 devtest: Use with() statement to open files
This fixes warnings such as this during devtest:

/home/mbr0wn/src/uhddev/host/tests/devtest/uhd_test_base.py:112:
ResourceWarning: unclosed file <_io.TextIOWrapper
name='./results_x300_F457AD.log' mode='r' encoding='UTF-8'>
  self.results = yaml.safe_load(open(self.results_file).read()) or {}
  /path/to/uhd/host/tests/devtest/uhd_test_base.py:150:
  ResourceWarning: unclosed file <_io.TextIOWrapper
  name='./results_x300_F457AD.log' mode='w' encoding='UTF-8'>
    yaml.dump(self.results, default_flow_style=False))
    ok
2019-11-26 12:21:33 -08:00
Martin Braun
c8950c1e0b examples: Send only single packets in test_messages
For the burst ACK test, test_messages would send 3 packets. However,
that assumes that the underlying link is fast enough to send three
packets in time, and some devices are hard to operate without underruns
without also specifying a start-of burst timestamp. Often, test_messages
would report that no ACK was received, but instead, an underrun was
received.

test_messages also doesn't need to send three packets. The three packets
came from the "start of burst" flag, which no device in UHD supports.

The change is thus to send a single packet with an EOB marker for the
burst ACK test. This will work regardless of the link speed and CPU
power.
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
Wade Fife
74b0352c4a examples: Update x310_rfnoc_image_core.yml example 2019-11-26 12:21:33 -08:00
Wade Fife
47cacecd2a rfnoc: Update YAML to expose memory clock to blocks 2019-11-26 12:21:33 -08:00
Wade Fife
72e833e7bb rfnoc: Replace DDC/DUC YAML variants with single version 2019-11-26 12:21:33 -08:00
Wade Fife
8ae60e342b rfnoc: Fix YAML block settings 2019-11-26 12:21:33 -08:00
Wade Fife
be1745427a rfnoc: Add FIR block YAML 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
70ed069b6e tests: Add check for life on DPDK port 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
Martin Braun
77cb9836ab examples: gpio: Add --list-banks option
The gpio example can now list all available banks before running tests.
Use like this:

    gpio --args $args --list-banks
2019-11-26 12:21:33 -08:00
Martin Braun
d997c235b8 image builder: Add ability to pick up extra Makefile.srcs from YAMLS
The blocks that are neither OOT, nor core blocks (like the DDC/DUC,
etc.) require additional info to find their appropriate Makefile.srcs
files. We don't include them in every build, to avoid building IP for
the FFT, FIR, and other blocks when they're not needed. However, those
blocks are in-tree, and don't follow the same directory structure as
out-of-tree modules, either.

We therefore allow the YAML files for those blocks (which are shipped
with UHD) to contain a path hint to their appropriate Makefile.srcs. The
image builder uses those paths to amend the `make` command
appropriately.
2019-11-26 12:21:33 -08:00
Martin Braun
4693f9d1f0 utils: image builder: Factor out some data to top of image_builder.py
For easier maintenance, some constants like paths and maps were moved to
the top of the Python file.
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
98a510d68e rfnoc: image builder: Fix include paths
The -I option was broken in multiple ways:
- Multiple -I options would only keep the last one
- The call to make did not actually append RFNOC_OOT_MAKEFILE_SRCS
2019-11-26 12:21:33 -08:00
Wade Fife
73911aca19 utils: blocktool: Fix blocktool
- Fix mako paths to run from anywhere
- Correct code errors and clean up generated code
- Add support for port parameters
- Add support for axis_data interface
- Fix NoC shell reset handling
- Replace Python functions with Verilog $clog2
- Allow input and output to share port name
2019-11-26 12:21:33 -08:00
Martin Braun
8fb790c8c3 examples: benchmark_rate: Add --rx_spp and --tx_spp
These command line arguments control the spp values used for streaming.
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
Wade Fife
4e6177ed55 utils: image_builder: Support parameterized number of ports on blocks 2019-11-26 12:21:32 -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
Sugandha Gupta
a801d6b046 examples: Add example out-of-tree module for RFNoC modules
This subdirectory is its own, self-contained project. It is supposed to
work against the UHD version it is shipped with.

Co-Authored-By: Martin Braun <martin.braun@ettus.com>
Co-Authored-By: Wade Fife <wade.fife@ni.com>
2019-11-26 12:21:32 -08:00
Martin Braun
2a7e69d862 rfnoc: image_builder: Fix -I, allow devices/targets to bet set in YAML
- The -I switch now allows pointing to an OOT
- The image core file may now contain keys 'device' and
  'default_target', which the image builder can use as default values.
  Command line switches --device and --target are still honoured.
2019-11-26 12:21:32 -08:00