From f5e726b0ad83743c173231d9ac019c917a51be07 Mon Sep 17 00:00:00 2001 From: Ciro Nishiguchi Date: Tue, 13 Aug 2019 14:55:36 -0500 Subject: rfnoc: Implement flushing on overrun This modifies the overrun handling such that the RX streamer does not restart the radios until the packets that were buffered prior to the overrun are read by the user. When an RX streamer receives an overrun, it will run the following algorithm: 1. Stop all upstream producers. 2. Set an internal flag in the streamer that indicates that the producers have stopped due to an overrun. 3. Continue servicing calls to recv until it runs out of packets in the host buffer (packets that can be read from the transport using a 0 timeout). 4. Once the packets are exhausted, return an overrun error from recv. The radio, if it was in continuous streaming mode before the overrun, includes a flag in its initial action whether or not to restart streaming. 5. If the radio requested a restart, the streamer submits a restart request action upstream. This action will be received by the radio. The radio will then check the current time, and send a stream command action back downstream. 6. The RX streamer receives the stream command action, and uses it to send another stream command to all upstream producers. This way, all upstream producers receive a start command for the same time. --- host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp | 1 - host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'host/lib/include/uhdlib/rfnoc') diff --git a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp index 5440c1e37..5327105c8 100644 --- a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp +++ b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp @@ -324,7 +324,6 @@ private: std::unordered_map _rx_bandwidth; std::vector _last_stream_cmd; - std::vector _restart_cont; }; }} // namespace uhd::rfnoc diff --git a/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp b/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp index 1d1d0805d..d39d88f43 100644 --- a/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp +++ b/host/lib/include/uhdlib/rfnoc/rfnoc_rx_streamer.hpp @@ -10,8 +10,8 @@ #include #include #include -#include #include +#include namespace uhd { namespace rfnoc { @@ -75,16 +75,17 @@ public: */ bool check_topology(const std::vector& connected_inputs, const std::vector& connected_outputs); + private: void _register_props(const size_t chan, const std::string& otw_format); void _handle_rx_event_action( const res_source_info& src, rx_event_action_info::sptr rx_event_action); - void _handle_restart_request( - const res_source_info& src, action_info::sptr rx_event_action); void _handle_stream_cmd_action( const res_source_info& src, stream_cmd_action_info::sptr stream_cmd_action); + void _handle_overrun(); + // Properties std::vector> _scaling_in; std::vector> _samp_rate_in; @@ -98,6 +99,7 @@ private: const uhd::stream_args_t _stream_args; std::atomic _overrun_handling_mode{false}; + size_t _overrun_channel = 0; }; }} // namespace uhd::rfnoc -- cgit v1.2.3