aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2022-01-26 09:57:43 +0100
committerAaron Rossetto <aaron.rossetto@ni.com>2022-02-01 14:40:41 -0600
commitcba3c8351d39a67262114a0d419b5c708cdb2c2b (patch)
tree4146e86c4363b6fa5349e48e48b2645a0f67801f /host/lib/rfnoc
parentc3327801ca43f3fdeca669e3aff470ce05e439a0 (diff)
downloaduhd-cba3c8351d39a67262114a0d419b5c708cdb2c2b.tar.gz
uhd-cba3c8351d39a67262114a0d419b5c708cdb2c2b.tar.bz2
uhd-cba3c8351d39a67262114a0d419b5c708cdb2c2b.zip
rfnoc: Set the default MTU forwarding policy to ONE_TO_ONE.
Previously, the default was DROP. For almost all RFNoC blocks, this is not a good default. It is very easy to crash USRPs by not properly propagating the MTU. For example, the following flow graph: Radio -> DDC -> FIR -> Streamer would crash an X310 when not manually setting an spp value. The reason is: The Radio block has an output buffer of 8192 bytes, capable of handling 2044 samples per packet. However, that's too big for the Ethernet portion of the X310, which would cause the X310 to lose connection between UHD and firmware. If the FIR were configured to propagate MTU, the Host->USRP connection (which has an MTU of <= 8000) would limit the MTU on all links, and the spp value would automatically be reduced to 1996 (or less). This commit uses the post_init() feature to check the user set an MTU in the constructor, and sets it to the default if that didn't happen. This doesn't solve all problems (the new default of ONE_TO_ONE) could also be incorrect, but is a much more suitable default. As a consequence, this has a minor change in how set_mtu_forwarding_policy() can be used: It now must be called during the constructor. Before, the rule was that it may only be called once, but that could also have happened, e.g., during the first property resolution. Now, the constructor is the last time block authors can choose an MTU forwarding policy.
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/noc_block_base.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/host/lib/rfnoc/noc_block_base.cpp b/host/lib/rfnoc/noc_block_base.cpp
index f854ca8d4..a43249e47 100644
--- a/host/lib/rfnoc/noc_block_base.cpp
+++ b/host/lib/rfnoc/noc_block_base.cpp
@@ -352,7 +352,12 @@ void noc_block_base::shutdown()
void noc_block_base::post_init()
{
- // nop
+ // Verify the block set its MTU forwarding policy. If not, set it to the
+ // default value.
+ if (!_mtu_fwd_policy_set) {
+ RFNOC_LOG_INFO("Setting default MTU forward policy.");
+ set_mtu_forwarding_policy(_mtu_fwd_policy);
+ }
}
std::shared_ptr<mb_controller> noc_block_base::get_mb_controller()