Commit Graph

9480 Commits

Author SHA1 Message Date
Martin Braun
97160d6ade docs: Add shim Sphinx config for readthedocs
This adds a faux Sphinx project under host/docs. When invoking sphinx,
it will in fact forward the generator request to Doxygen. This is useful
for generating the UHD manual, e.g., on readthedocs.

To enable the latter service, .readthedocs.yaml and environment.yml
files were added as well.
2022-01-24 10:01:41 +01:00
Martin Braun
9321ce3c13 cmake: uhdboost: Fix check for UHD_BOOST_REQUIRED being set 2022-01-21 21:27:55 +01:00
Martin Braun
f23ab72129 fpga: x300: OR ATR signals going into db_control
Before this change, only the channel 0 ATR state was sent to the
db_control module. For TwinRX, this had the disadvantage that when only
Channel 1 was used, the FP- and LED-GPIOs could not track the radio's
ATR state (e.g., no LED would light up in this case).

Note that unlike UHD 3, there is only one db_control module per slot.
There are therefore no options to map GPIOs to track the ATR state of an
individual channel.
2021-12-07 12:11:35 -06:00
Andrew Lynch
7fb1e61a94 tests: Remove non-functional DPDK test 2021-12-06 13:22:03 -08:00
Andrew Lynch
0b0c0e0262 dpdk: disable warnings for using an experimental feature 2021-12-06 13:22:03 -08:00
Andrew Lynch
1f89be5345 docs: Update DPDK documentation 2021-12-06 13:22:03 -08:00
Andrew Lynch
b17d2dfa98 dpdk: Upgrade to DPDK 19.11 API
Support DPDK versions 19.11 and 20.11
2021-12-06 13:22:03 -08:00
Martin Braun
8ce91bc738 mpm: x4xx: Add checks before accessing self.dio_control
The X4x0 MPM code doesn't always load the object for the DIO control, it
only does that when certain checks pass (EEPROM readouts need to match
expected values). Therefore, `self.dio_control` may be NoneObject during
operations, and in other areas of the code, we already check if that's
the case.

The APIs added in c36fc5f don't have these checks, which means accessing
these new APIs may result in odd exceptions when trying to dereference
a NoneType object. By adding checks for the initialization state of
`self.dio_control`, we can avoid these and either substitute better
error messages / exception messages, or return safe values.

Note that mpmd_mb_controller also accesses this object indirectly by
checking the length of the return value of get_gpio_banks(). This check
is not affected by this change, as we now are guaranteed to return an
empty list if there is no self.dio_control.
2021-12-06 07:09:14 -08:00
Martin Braun
e1e1aad5c5 mpm: x4xx: Remove superfluous import 2021-12-06 07:09:14 -08:00
Martin Braun
5df498aeb9 rfnoc: Enable drop counter on chdr_ctrl_endpoint
This class has a member _num_drops, which can be read out using the
get_num_drops() API call. However, when dropping packets, this counter
was not incremented, which is fixed now.

This also includes a very minor optimization from 2 map<> lookups to
1 lookup (they are in O(log N)). Since there are usually a small
two-digit number of endpoints connected to the async message receiver,
this change is not expected to yield major improvements, but the lookup
*is* in a hot loop.
2021-12-03 11:35:04 -08:00
Martin Braun
b49e4f1eb6 docs: Improve documentation for properties and -propagation 2021-12-03 11:34:35 -08:00
Martin Anderseck
f249b73036 max287x: Fix key in table of freq ranges
The keys for the table of frequency ranges for each VCO value counts up
consecutively but key "1" was there twice while "2" was missing. This
is fixed here.
2021-12-03 11:33:26 -08:00
Martin Braun
74d25ea88a uhd: Remove superfluous boost/bind.hpp includes
On newer versions of Boost, they show deprecation notes. However,
they're not actually used any more so they can go.
2021-12-03 11:33:07 -08:00
Martin Braun
3b41e0b055 rfnoc: Change default block behaviour
The default block controller is used whenever no other block controller
is used. It currently defaults to dropping both property propagation and
actions.

When a custom block is injected into a graph like this for example:

    Radio -> DDC -> Custom Block -> Rx Streamer

This default behaviour causes the Rx Streamer to not be able to send
actions (like stream commands) nor does it allow MTU propagation (or any
other property's propagation).

The default block behaviour is ONE_TO_ONE, meaning that actions and
properties on input channel N will get forwarded to output channel N. In
absence of an actual block controller, this is more useful default than
setting the propagation to DROP for both actions and properties. Most
blocks that pass through data, or do some simple processing, will now
work in the absence of a block controller.
The new disadvantage is that blocks which would modify properties such as
sampling rate, scaling, or MTU will no longer work properly in the
absence of a block controller.

However, the recommended behaviour is anyway not to operate without a
block controller. For the cases where no block controller is present,
ONE_TO_ONE is considered the generally more useful default.
2021-12-02 06:44:25 -08:00
Virendra Kakade
3bd6afb51e mpm: x4xx: update mboard_max_rev
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2021-12-02 06:42:09 -08:00
Virendra Kakade
6d6fc2a01d uhd: add support for max10 variants
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2021-12-02 06:42:09 -08:00
Virendra Kakade
84323ef7bc uhd: update manifest for x410 cpld
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2021-12-02 06:42:09 -08:00
Martin Braun
d5f7b0cf90 mpmd: Add MTU plausibility check
We have noticed that on 1 GbE connections, MTU discovery can become
unreliable. Since we now use the MTU directly for deriving spp and other
values, a correct MTU is important.

Because we don't have a way of knowing if MTU discovery worked or not,
we add some heuristics in form of a plausibility check. For now, the
only rule in this check is if that the detected MTU is a bit larger than
1472 bytes, we coerce down to 1472, because this is such a standard
value (most 1 GbE interfaces default to an IPv4 MTU of 1500 bytes).

For the cases where the interface MTU is set to be between 1500 and 1528
bytes, this would cause a very minor performance loss. We accept this
performance loss as it is small, and those cases are very rare. MTUs are
usually 1500 bytes, or >= 8000 bytes for high-speed links using jumbo
frames.
2021-12-02 05:49:53 -08:00
Martin Braun
902c8456fb x300: Remove usage of CHDR_MAX_LEN_HDR
This constant was generally harmful, since it was only correct under
certain circumstances (64 bit CHDR with timestamps). The X3x0 code was
the last place it was being used, and we remove it without substitute
because it was not doing anything useful here.
2021-12-02 05:49:53 -08:00
Martin Braun
9f9c75ecd6 rfnoc: Clarify usage of MTU vs. max payload size, remove DEFAULT_SPP
These two values where being mixed up in the code. To summarize:
- The MTU is the max CHDR packet size, including header & timestamp.
- The max payload is the total number of bytes regular payload plus
  metadata that can be fit into into a CHDR packet. It is strictly
  smaller than the MTU. For example, for 64-bit CHDR widths, if
  a timestamp is desired, the max payload is 16 bytes smaller than
  the MTU.

The other issue was that we were using a magic constant (DEFAULT_SPP)
which was causing conflicts with MTUs and max payloads.
This constant was harmful in multiple ways:
- The explanatory comment was incorrect (it stated it would cap packets
  to 1500 bytes, which it didn't)
- It imposed random, hardcoded values that interfered with an 'spp
  discovery', i.e., the ability to derive a good spp value from MTUs
- The current value capped packet sizes to 8000 bytes CHDR packets, even
  when we wanted to use bigger ones

This patch changes the following:
- noc_block_base now has improved docs for MTU, and additional APIs
  (get_max_payload_size(), get_chdr_hdr_len()) which return the
  current payload size given MTU and CHDR width, and the CHDR header
  length.
- The internally used graph nodes for TX and RX streamers also get
  equipped with the same new two API calls.
- The radio, siggen, and replay block all where doing different
  calculations for their spp/ipp values. Now, they all use the max
  payload value to calculate spp/ipp. Unit tests where adapted
  accordingly. Usage of DEFAULT_SPP was removed.
- The replay block used a hardcoded 16 bytes for header lengths, which
  was replaced by get_chdr_hdr_len()
- The TX and RX streamers where discarding the MTU value and using the
  max payload size as the MTU, which then propagated throughout the
  graph. Now, both values are stored and can be used where appropriate.
2021-12-02 05:49:53 -08:00
Matthew Crymble
38825f4e56 tests: Add default length for automated streaming tests 2021-12-01 14:04:14 -08:00
Martin Braun
763eba025e rfnoc: replay block: Disable prop and action propagation
The replay block is more like the radio block than like a FIFO. In
particular, consider this flow graph:

    Replay -> DDC -> Replay

Imagine you're using the replay block to test the DDC block with
prerecorded data. If we treated the Replay Block like a FIFO, then we'd
have a loop in the graph (which is already wrong). If we used the DDC to
resample, then the input- and output sample rate of the Replay mismatch,
which is a legal way to use the Replay block, but not possible if we
treat the graph like a loop.
2021-12-01 13:34:59 -08:00
Martin Braun
746c896eaf examples: Improve rfnoc_rx_to_file
This example had some major issues since UHD 4, which are now fixed.
Mainly, the option to include a custom RFNoC block was not working.

The example was rehauled severely:
- Custom blocks are now usable again.
- UHD/RFNoC code is used for the connections, rather than a custom
  kludge.
- Sample rate is set via property propagation
- boost::format() was not helpful in this example, and was removed.
- A list of active connections is now printed
- The --block-args argument is dropped in favour of --block-props. The
  former never did anything useful, and "block args" are a UHD 3 thing.
2021-12-01 13:34:35 -08:00
Martin Braun
7f6e4917a1 rfnoc: Add more comments to rfnoc_graph
This adds some more explanatory comments around active and static
connections.
2021-12-01 13:34:35 -08:00
Martin Braun
bc6b453963 rfnoc: Fix issue in uhd::rfnoc::connect_through_blocks()
When connect_through_blocks() was called on blocks within a single
chain, there was a bug where the chain was incorrectly cropped. In
a standard FPGA image, say one was to use this API call to connect the
radio to the DDC. It would generate a chain of blocks hanging off the
radio as such:

Radio -> DDC -> SEP

What the code should do, and what this fix provides, is that the chain
gets cropped after the DDC, to look like this:

Radio -> DDC

With the current bug, it would assume the chain has a dangling edge, and
incorrectly throw an exception.
Note that this bug would not appear when source and destination block
are on separate chains (i.e., both have an SEP in their chain).

This patch includes minor logging and comment improvements around the
offending lines of code.
2021-12-01 13:34:35 -08:00
Humberto Jimenez
6fd9f37e1c fpga: x400: cpld: Add manufacturing support
This commit enables a special personality on the X410 motherboard CPLD required
for NI manufacturing purposes only.
2021-12-01 10:51:07 -06:00
Humberto Jimenez
e1ce4565db fpga: x400: Refactor CPLDs build process
This commit refactors the X410's CPLDs build process to make it similar to other
FPGA targets within the repo. The new process relies on basic Quartus build
utilities.
Additionally, this commit adds support for an alternative MAX10 CPLD for the
motherboard CPLD implementation. Both previous (10M04) and new variant
(10M08) are supported concurrently. The images package mapping is updated to
reflect these changes.
2021-12-01 10:51:07 -06:00
Humberto Jimenez
37feec8992 fpga: tools: Add Quartus build utilities 2021-12-01 10:51:07 -06:00
Matthew Crymble
f24d6561a8 tests: add automated streaming tests 2021-11-30 07:33:28 -08:00
Matthew Crymble
df7f65d858 tests: add streaming setup script for performance enhancements
This script is intended to be run before streaming.
- Manages network interfaces, memory buffers, and other
aspects of the system configuration to give the host machine
ideal performance during streaming.
- Installs/updates dpdk/util dependencies for the script
- Generates and writes uhd config files for dpdk
2021-11-30 07:33:28 -08:00
Martin Braun
3d2b53d4b1 rfnoc: radio: Fix async message handling channel checks
The async message handler and the async message validator would
erroneously compare channel numbers for RX async messages with the
number of valid TX channels. On TwinRX, where there are zero TX
channels, this would always fail. Elsewhere in the code, the comparisons
for TX and RX channels mixed up input and output ports.

The second issue is that the comparison made was a "greater than" rather
than "greater or equal".

The effect of these two bugs was that potentially, we could have
accepted async messages for an invalid port N, where N is the number of
valid ports of this block, and that for TwinRX/X300 users, async
messages on channel 1 would not get accepted (they would, however, get
accepted for channel 0 because of the second issue). This includes
overrun handling, which was broken for channel 1 and 3 on an X300.

Another effect of the bug was that EPIDs for async messages weren't
always programmed correctly.
2021-11-30 07:31:51 -08:00
michael-west
2feb7a3b8c multi_usrp_rfnoc: Reduce latency of get_time_now()
Getting the time from the mb_controller is slow, so try to get the time
from the Radio on the fast path first.

Signed-off-by: michael-west <michael.west@ettus.com>
2021-11-17 14:04:34 -08:00
michael-west
9b78da222f host: Add ability to get time from Radio block
Add API calls to Radio control to get ticks and time.

Signed-off-by: michael-west <michael.west@ettus.com>
2021-11-17 14:04:34 -08:00
michael-west
43ab4c8b43 fpga: Add ability to get time from Radio block
Added registers to read back radio time.  Bumped minor compat.

Signed-off-by: michael-west <michael.west@ettus.com>
2021-11-17 08:56:39 -06:00
Martin Braun
0d2779b2d3 tests: Remove skip_dram from streaming performance test script 2021-11-16 14:26:24 -08:00
Martin Braun
e3a96adb7b docs: Several minor manual improvements
- Remove documentation of skip_dram, skip_ddc, skip_duc, which are all
  obsolete since UHD 4
- Properly document serialize_init
- Add a table of valid args for X310 as with other devices
2021-11-16 14:26:24 -08:00
Wade Fife
d3424e8b66 examples: Use cmul for gain block in-tree IP example 2021-11-15 12:32:06 -06:00
Martin Braun
47a9e278f5 rfnoc: mgmt_portal: Fix order of validity checks
The order must:
- Check transaction has the right number of hops, then read hop
- Check hop has the right number of operations (at least 2), then read
  those ops
- Check the ops have the correct opcodes

The code was doing checks in the wrong order. Thanks to Github user
johnwstanford for pointing this out.
2021-11-15 10:31:37 -08:00
Martin Braun
09839fa232 rfnoc: Add CHDR width to make args
This provides every block controller with a copy of its CHDR width.

Note: mock blocks always get configured with a 64-bit CHDR width, to
retain API compatibility.
2021-11-12 12:11:33 -08:00
Martin Braun
bccc2b49ab rfnoc: Make chdr_w_to_bits() C++11-compatible
This allows consumers of UHD compiling with C++11 to include this file
(which is now included via noc_block_base) by turning a switch statement
into a functionally equivalent (albeit less readable) nested ternary
statement.
2021-11-12 12:11:33 -08:00
Martin Braun
1d7cba5c6c tests: Fix rfnoc_graph mock nodes stop-stream command
Thanks to Github user johnwstanford for pointing this out.
2021-11-12 11:56:34 -08:00
Martin Braun
d2762bd2b0 tools: Fix rfnoc dissector build
The recent removal of cruft in 78336d4 caused an implicit include to be
missing from this dissector, causing it to no longer compile. The
include is added to the dissector explicitly now.
2021-11-11 07:13:56 -08:00
michael-west
91a4f62882 B200: Re-sync times
The times on the device can glitch if either the tick rate changes or
the number of active chains changes.  This throws off the time if the
user gets streamers, changes the sample rate, or changes the tick rate
after synchronizing the time.  This change re-synchronizes the times
automatically in those cases.

Signed-off-by: michael-west <michael.west@ettus.com>
2021-11-10 13:43:48 -08:00
Wade Fife
7f8e7f97c8 python: multi_usrp: Add set_rx_spp() 2021-11-09 08:31:40 -08:00
Lane Kolbly
729ec7238e doc: x4xx: Document configuring eth0 static IP 2021-11-09 08:31:00 -08:00
Martin Braun
ef94c93a08 mpmd: Increase UHD-side MTU cap for 10 GbE and 1 GbE
This gets closer to what our hardware can actually support. See the
comments for further explanations.

This has the side-effect of patching an issue on X410 (using 200 MHz
images) where garbage samples would get injected (one per packet). It
is not, however, the final fix for that problem.
2021-11-08 07:37:31 -08:00
Lane Kolbly
abea5bb240 docs: x410: Document GPIO API and capabilities 2021-11-05 12:23:48 -07:00
Martin Braun
3063228cf6 docs: Collect all RFNoC block controllers in a module in the manual
This lets Doxygen create a page in the UHD manual that lists all RFNoC
block controllers. It will be accessible under Manual -> Modules ->
RFNoC -> RFNoC Blocks shipped with UHD.
2021-11-05 12:23:12 -07:00
Martin Braun
15d8fdc4b9 rfnoc: blocks: Minor cleanup (whitespace, typos) 2021-11-05 12:23:12 -07:00
Lane Kolbly
1a4d7e1489 host: python: Add gpio_voltage python API 2021-11-05 12:02:50 -07:00