diff options
author | michael-west <michael.west@ettus.com> | 2018-10-23 12:25:51 -0700 |
---|---|---|
committer | Ashish Chaudhari <ashish.chaudhari@ettus.com> | 2019-01-31 13:55:21 -0800 |
commit | 1292b3244f68c16086d325d5cdbec2d1f09c28a5 (patch) | |
tree | 31f6cf46380bebb0c7dfcdcf4b9e977dfaf395c5 | |
parent | ac025ebf40ad9ab6cb9945e25bad87016ae77128 (diff) | |
download | uhd-1292b3244f68c16086d325d5cdbec2d1f09c28a5.tar.gz uhd-1292b3244f68c16086d325d5cdbec2d1f09c28a5.tar.bz2 uhd-1292b3244f68c16086d325d5cdbec2d1f09c28a5.zip |
Device3: Fix flow control window and interval
Fixes streaming on E310 after BBFC changes.
Signed-off-by: michael-west <michael.west@ettus.com>
-rw-r--r-- | host/lib/usrp/device3/device3_flow_ctrl.hpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/device3/device3_io_impl.cpp | 20 |
2 files changed, 14 insertions, 9 deletions
diff --git a/host/lib/usrp/device3/device3_flow_ctrl.hpp b/host/lib/usrp/device3/device3_flow_ctrl.hpp index 535d7fbac..fd445effd 100644 --- a/host/lib/usrp/device3/device3_flow_ctrl.hpp +++ b/host/lib/usrp/device3/device3_flow_ctrl.hpp @@ -80,7 +80,8 @@ inline bool rx_flow_ctrl( // Update counters assuming the buffer is a consumed packet if (not packet_info.error) { - fc_cache->total_bytes_consumed += buff->size(); + const size_t bytes = 4 * (packet_info.num_header_words32 + packet_info.num_payload_words32); + fc_cache->total_bytes_consumed += bytes; fc_cache->total_packets_consumed++; } } diff --git a/host/lib/usrp/device3/device3_io_impl.cpp b/host/lib/usrp/device3/device3_io_impl.cpp index 3ea0d84e3..2bc59f1a8 100644 --- a/host/lib/usrp/device3/device3_io_impl.cpp +++ b/host/lib/usrp/device3/device3_io_impl.cpp @@ -165,10 +165,12 @@ static size_t get_rx_flow_control_window( "recv_buff_fullness must be in [0.01, 1] inclusive (1% to 100%)"); } - size_t window_in_bytes = (static_cast<size_t>(sw_buff_size * fullness_factor)); + size_t window_in_bytes = (static_cast<size_t>(fullness_factor * sw_buff_size)); if (rx_args.has_key("max_recv_window")) { window_in_bytes = std::min( - window_in_bytes, rx_args.cast<size_t>("max_recv_window", window_in_bytes)); + window_in_bytes, + pkt_size * rx_args.cast<size_t>("max_recv_window", 1) + ); } if (window_in_bytes < pkt_size) { throw uhd::value_error("recv_buff_size must be larger than the recv_frame_size."); @@ -351,7 +353,7 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t& args_) get_rx_flow_control_window(pkt_size, xport.recv_buff_size, rx_hints) - pkt_size; const size_t fc_handle_window = - std::max<size_t>(1, fc_window / stream_options.rx_fc_request_freq); + std::max<size_t>(pkt_size, fc_window / stream_options.rx_fc_request_freq); UHD_RX_STREAMER_LOG() << "Flow Control Window = " << (fc_window) << ", Flow Control Handler Window = " << fc_handle_window; blk_ctrl->configure_flow_control_out(true, @@ -419,7 +421,7 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t& args_) convert::get_bytes_per_item(args.otw_format); // bytes per item const size_t spp = std::min(args.args.cast<size_t>("spp", bpp / bpi), bpp / bpi); // samples per packet - UHD_RX_STREAMER_LOG() << "spp == " << spp; + UHD_RX_STREAMER_LOG() << "bpp == " << bpp << ", bpi == " << bpi << ", spp == " << spp; my_streamer = boost::make_shared<device3_recv_packet_streamer>( spp, recv_terminator, xport); @@ -588,12 +590,14 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_) blk_ctrl->sr_write(uhd::rfnoc::SR_CLEAR_RX_FC, 0x1, block_port); blk_ctrl->sr_write(uhd::rfnoc::SR_CLEAR_RX_FC, 0x0, block_port); // Configure flow control on downstream block + const size_t pkt_size = xport.send->get_send_frame_size(); const size_t fc_window = std::min(tx_hints.cast<size_t>("send_buff_size", fifo_size), fifo_size); const size_t fc_handle_window = - std::max<size_t>(1, fc_window / stream_options.tx_fc_response_freq); + std::max<size_t>(pkt_size, fc_window / stream_options.tx_fc_response_freq); UHD_TX_STREAMER_LOG() << "Flow Control Window = " << fc_window - << ", Flow Control Handler Window = " << fc_handle_window; + << ", Flow Control Handler Window = " << fc_handle_window + << ", FIFO size = " << fifo_size; blk_ctrl->configure_flow_control_in(fc_handle_window, /*bytes*/ block_port); // Add flow control transport @@ -669,13 +673,13 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_) // To calculate the max number of samples per packet, we assume the maximum // header length to avoid fragmentation should the entire header be used. const size_t bpp = - tx_hints.cast<size_t>("bpp", xport.send->get_send_frame_size()) + tx_hints.cast<size_t>("bpp", pkt_size) - stream_options.tx_max_len_hdr; const size_t bpi = convert::get_bytes_per_item(args.otw_format); // bytes per item const size_t spp = std::min(args.args.cast<size_t>("spp", bpp / bpi), bpp / bpi); // samples per packet - UHD_TX_STREAMER_LOG() << "spp == " << spp; + UHD_TX_STREAMER_LOG() << "bpp == " << bpp << ", bpi == " << bpi << ", spp == " << spp; my_streamer = boost::make_shared<device3_send_packet_streamer>( spp, send_terminator, xport, async_xport); |