From 9b8e4e652c168e76f7cf2ca0a699640961b8e6ce Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 26 Jul 2019 15:08:18 -0700 Subject: 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). --- host/lib/rfnoc/radio_control_impl.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'host/lib/rfnoc/radio_control_impl.cpp') diff --git a/host/lib/rfnoc/radio_control_impl.cpp b/host/lib/rfnoc/radio_control_impl.cpp index 4ed0c4b60..f71c73289 100644 --- a/host/lib/rfnoc/radio_control_impl.cpp +++ b/host/lib/rfnoc/radio_control_impl.cpp @@ -170,10 +170,20 @@ radio_control_impl::radio_control_impl(make_args_ptr make_args) register_property(&_samp_rate_out.back()); register_property(&_type_in.back()); register_property(&_type_out.back()); - add_property_resolver({&_spp_prop.back()}, + add_property_resolver( + {&_spp_prop.back(), get_mtu_prop_ref({res_source_info::OUTPUT_EDGE, chan})}, {&_spp_prop.back()}, [this, chan, &spp = _spp_prop.back()]() { RFNOC_LOG_TRACE("Calling resolver for spp@" << chan); + const int mtu = + static_cast(get_mtu({res_source_info::OUTPUT_EDGE, chan})); + const int max_spp_per_mtu = mtu / (_samp_width / 8) - (mtu % _spc); + if (spp.get() > max_spp_per_mtu) { + RFNOC_LOG_WARNING("spp value " << spp.get() << " exceeds MTU of " + << mtu << "! Coercing to " + << max_spp_per_mtu); + spp = max_spp_per_mtu; + } if (spp.get() % _spc) { spp = spp.get() - (spp.get() % _spc); RFNOC_LOG_WARNING( -- cgit v1.2.3