aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-07-26 15:08:18 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:33 -0800
commit9b8e4e652c168e76f7cf2ca0a699640961b8e6ce (patch)
treec7ed65d9898aca0cddcc469b403dfe19c7292609 /host/tests
parentab87597e9e76854237b5d78f7d35959b14e9737b (diff)
downloaduhd-9b8e4e652c168e76f7cf2ca0a699640961b8e6ce.tar.gz
uhd-9b8e4e652c168e76f7cf2ca0a699640961b8e6ce.tar.bz2
uhd-9b8e4e652c168e76f7cf2ca0a699640961b8e6ce.zip
rfnoc: Add MTU tracking
MTUs are now tracked through the framework for all childs of noc_block_base. Every edge gets an 'mtu' property. MTU can be set and get either through the prop API, or through new API calls (get_mtu(), set_mtu()). It is also possible to create custom properties that depend on the MTU by asking for a reference to the MTU property, and then adding that to the input list of a property resolver. The radio_control_impl includes a change in this commit where it sets the spp based on the MTU. Blocks can also set an MTU forwarding policy. The DDC block includes a change in this commit that sets a forwarding policy of ONE_TO_ONE, meaning that the MTU on an input edge is forwarded to the corresponding output edge (but not the other edges, as with the tick rate).
Diffstat (limited to 'host/tests')
-rw-r--r--host/tests/rfnoc_blocks_test.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/host/tests/rfnoc_blocks_test.cpp b/host/tests/rfnoc_blocks_test.cpp
index caf50f2fa..c5c22f4cc 100644
--- a/host/tests/rfnoc_blocks_test.cpp
+++ b/host/tests/rfnoc_blocks_test.cpp
@@ -21,6 +21,8 @@ using namespace uhd::rfnoc;
namespace {
+constexpr size_t DEFAULT_MTU = 8000;
+
noc_block_base::make_args_ptr make_make_args(noc_id_t noc_id,
const std::string& block_id,
const size_t n_inputs,
@@ -32,6 +34,7 @@ noc_block_base::make_args_ptr make_make_args(noc_id_t noc_id,
make_args->noc_id = noc_id;
make_args->num_input_ports = n_inputs;
make_args->num_output_ports = n_outputs;
+ make_args->mtu = DEFAULT_MTU;
make_args->reg_iface = std::make_shared<mock_reg_iface_t>();
make_args->block_id = block_id;
make_args->ctrlport_clk_iface = std::make_shared<clock_iface>(cp_clock_name);
@@ -164,6 +167,7 @@ BOOST_AUTO_TEST_CASE(test_ddc_block)
BOOST_REQUIRE(ddc_reg_iface->write_memory.count(ddc_block_control::SR_DECIM_ADDR));
BOOST_CHECK_EQUAL(
ddc_reg_iface->write_memory.at(ddc_block_control::SR_DECIM_ADDR), 2 << 8 | 5);
+ BOOST_CHECK_EQUAL(test_ddc->get_mtu({res_source_info::INPUT_EDGE, 0}), DEFAULT_MTU);
// Now plop it in a graph
detail::graph_t graph{};
@@ -183,11 +187,16 @@ BOOST_AUTO_TEST_CASE(test_ddc_block)
"scaling", 1.0, {res_source_info::OUTPUT_EDGE, 0});
mock_source_term.set_edge_property<double>(
"samp_rate", 1.0, {res_source_info::OUTPUT_EDGE, 0});
+ constexpr size_t NEW_MTU = 4000;
+ mock_source_term.set_edge_property<size_t>(
+ "mtu", NEW_MTU, {res_source_info::OUTPUT_EDGE, 0});
- UHD_LOG_INFO("TEST", "Creating graph");
+ UHD_LOG_INFO("TEST", "Creating graph...");
graph.connect(&mock_source_term, test_ddc.get(), edge_info);
graph.connect(test_ddc.get(), &mock_sink_term, edge_info);
+ UHD_LOG_INFO("TEST", "Committing graph...");
graph.commit();
+ UHD_LOG_INFO("TEST", "Commit complete.");
// We need to set the decimation again, because the rates will screw it
// change it w.r.t. to the previous setting
test_ddc->set_property<int>("decim", TEST_DECIM, 0);
@@ -216,5 +225,15 @@ BOOST_AUTO_TEST_CASE(test_ddc_block)
// The frequency word is the phase increment, which will halve. We skirt
// around fixpoint/floating point accuracy issues by using CLOSE.
BOOST_CHECK_CLOSE(double(freq_word_1) / double(freq_word_2), 2.0, 1e-6);
+
+ UHD_LOG_INFO("TEST", "Testing DDC MTU propagation");
+ BOOST_CHECK_EQUAL(test_ddc->get_mtu({res_source_info::INPUT_EDGE, 0}), NEW_MTU);
+ BOOST_CHECK_EQUAL(test_ddc->get_mtu({res_source_info::OUTPUT_EDGE, 0}), NEW_MTU);
+ BOOST_CHECK_EQUAL(test_ddc->get_mtu({res_source_info::INPUT_EDGE, 1}), DEFAULT_MTU);
+ BOOST_CHECK_EQUAL(test_ddc->get_mtu({res_source_info::OUTPUT_EDGE, 1}), DEFAULT_MTU);
+ mock_source_term.set_edge_property<size_t>(
+ "mtu", NEW_MTU / 2, {res_source_info::OUTPUT_EDGE, 0});
+ BOOST_CHECK_EQUAL(test_ddc->get_mtu({res_source_info::INPUT_EDGE, 0}), NEW_MTU / 2);
+ BOOST_CHECK_EQUAL(test_ddc->get_mtu({res_source_info::OUTPUT_EDGE, 0}), NEW_MTU / 2);
}