diff options
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/rfnoc/defaults.hpp | 1 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/noc_block_base.hpp | 61 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/noc_block_make_args.hpp | 3 | ||||
-rw-r--r-- | host/include/uhd/rfnoc/node.hpp | 9 |
4 files changed, 74 insertions, 0 deletions
diff --git a/host/include/uhd/rfnoc/defaults.hpp b/host/include/uhd/rfnoc/defaults.hpp index e1046ada2..99ac9791f 100644 --- a/host/include/uhd/rfnoc/defaults.hpp +++ b/host/include/uhd/rfnoc/defaults.hpp @@ -21,6 +21,7 @@ static const std::string PROP_KEY_TYPE("type"); static const std::string PROP_KEY_FREQ("freq"); static const std::string PROP_KEY_TICK_RATE("tick_rate"); static const std::string PROP_KEY_SPP("spp"); +static const std::string PROP_KEY_MTU("mtu"); static const std::string NODE_ID_SEP("SEP"); diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp index 485b2c8a3..4a8d2965f 100644 --- a/host/include/uhd/rfnoc/noc_block_base.hpp +++ b/host/include/uhd/rfnoc/noc_block_base.hpp @@ -98,6 +98,20 @@ public: */ double get_tick_rate() const; + /*! Return the current MTU on a given edge + * + * The MTU is determined by the block itself (i.e., how big of a packet can + * this block handle on this edge), but also the neighboring block, and + * possibly the transport medium between the blocks. This value can thus be + * lower than what the block defines as MTU, but never higher. + * + * \param edge The edge on which the MTU is queried. edge.type must be + * INPUT_EDGE or OUTPUT_EDGE! + * \returns the MTU as determined by the overall graph on this edge + * \throws uhd::value_error if edge is not referring to a valid edge + */ + size_t get_mtu(const res_source_info& edge); + /*! Return the arguments that were passed into this block from the framework */ uhd::device_addr_t get_block_args() const { return _block_args; } @@ -143,6 +157,43 @@ protected: */ void set_tick_rate(const double tick_rate); + /*! Change the way MTUs are forwarded + * + * The policy will have the following effect: + * - DROP: This means that the MTU of one port has no bearing on the MTU + * of another port. This is usually a valid choice if the FPGA is + * repacking data, for example, a block could be consuming continous + * streams of data, and producing small packets of a different type. + * - ONE_TO_ONE: This means the MTU is passed through from input to output + * and vice versa. This is typically a good choice if packets are being + * passed through without modifying their size. The DDC/DUC blocks will + * choose this policy, because the want to relay MTU information to the + * radio. + * - ONE_TO_ALL: This means the MTU is being set to the same value on all + * ports. + * - ONE_TO_FAN: This means the MTU is forwarded from any input port to + * all opposite side ports. This is an appropriate policy for the + * split-stream block. + * + * The default policy is DROP. + */ + void set_mtu_forwarding_policy(const forwarding_policy_t policy); + + /*! Update the MTU + * + * This is another data point in the MTU discovery process. This means that + * the MTU cannot be increased using the method, only decreased. + */ + void set_mtu(const res_source_info& edge, const size_t new_mtu); + + /*! Return a reference to an MTU property + * + * This can be used to make the MTU an input to a property resolver. For + * example, blocks that have an spp property, such as the radio, can now + * trigger a property resolver based on the MTU. + */ + property_base_t* get_mtu_prop_ref(const res_source_info& edge); + /*! Get access to the motherboard controller for this block's motherboard * * This will return a nullptr if this block doesn't have access to the @@ -211,6 +262,16 @@ private: // for all in- and output edges. std::vector<property_t<double>> _tick_rate_props; + //! Forwarding policy for the MTU properties + forwarding_policy_t _mtu_fwd_policy = forwarding_policy_t::DROP; + + //! Container for the 'mtu' property. This will hold one edge property + // for all in- and output edges. + std::vector<property_t<size_t> > _mtu_props; + + //! The actual MTU value + std::unordered_map<res_source_info, size_t> _mtu; + //! Reference to the ctrlport clock_iface object shared with the register_iface std::shared_ptr<clock_iface> _ctrlport_clock_iface; diff --git a/host/include/uhd/rfnoc/noc_block_make_args.hpp b/host/include/uhd/rfnoc/noc_block_make_args.hpp index 7ed191079..8878cc1a8 100644 --- a/host/include/uhd/rfnoc/noc_block_make_args.hpp +++ b/host/include/uhd/rfnoc/noc_block_make_args.hpp @@ -37,6 +37,9 @@ struct noc_block_base::make_args_t //! Number of output ports (gets reported from the FPGA) size_t num_output_ports; + //! Value of the MTU register + size_t mtu; + //! Register interface to this block's register space register_iface::sptr reg_iface; diff --git a/host/include/uhd/rfnoc/node.hpp b/host/include/uhd/rfnoc/node.hpp index eaeea20af..59836fbf6 100644 --- a/host/include/uhd/rfnoc/node.hpp +++ b/host/include/uhd/rfnoc/node.hpp @@ -217,6 +217,15 @@ protected: * property access is not violated. All properties can be read during * execution, but only properties in the \p outputs list can be written * to. + * - Resolvers are stored and executed in the same order they are added. + * That is to say, if two resolvers both share a condition that will + * trigger them, the first resolver to be added will be the first resolver + * to be executed. This allows to make some assumptions on the order of + * execution, in case resolvers have dependencies. + * - This method has no built-in thread safety, since it is typically only + * called in the constructor. If resolvers need to be added at runtime + * (which is considered advanced usage), then the block needs to serialize + * access to this function itself. * * \param inputs The properties that will cause this resolver to run * \param outputs The properties that this resolver will write to |