diff options
Diffstat (limited to 'host/lib/usrp/device3/device3_io_impl.cpp')
-rw-r--r-- | host/lib/usrp/device3/device3_io_impl.cpp | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/host/lib/usrp/device3/device3_io_impl.cpp b/host/lib/usrp/device3/device3_io_impl.cpp index 081f881d5..9fc4e62cb 100644 --- a/host/lib/usrp/device3/device3_io_impl.cpp +++ b/host/lib/usrp/device3/device3_io_impl.cpp @@ -338,10 +338,12 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t& args_) // Setup the DSP transport hints device_addr_t rx_hints = get_rx_hints(mb_index); - // Traverse the upstream nodes for minimum mtu - size_t min_mtu = blk_ctrl->get_mtu(block_port); + // Search the device and all nodes for lowest MTU + size_t mtu = std::min( + get_mtu(mb_index, uhd::direction_t::RX_DIRECTION), + blk_ctrl->get_mtu(block_port)); UHD_RX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id() - << ": " << min_mtu; + << ": " << blk_ctrl->get_mtu(block_port); std::vector<boost::shared_ptr<uhd::rfnoc::source_block_ctrl_base>> upstream_source_nodes = blk_ctrl->find_upstream_node<uhd::rfnoc::source_block_ctrl_base>(); @@ -351,19 +353,16 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t& args_) // currently we use port 0 of a block in case of channel 1. UHD_RX_STREAMER_LOG() << "Maximum MTU supported by " << node->unique_id() << ": " << node->get_mtu(0); - min_mtu = std::min(min_mtu, node->get_mtu(0)); + mtu = std::min(mtu, node->get_mtu(0)); } - // Contraint min_mtu by device mtu - min_mtu = std::min(min_mtu, get_mtu(mb_index, uhd::direction_t::RX_DIRECTION)); - if (rx_hints.has_key("recv_frame_size")) { - if (rx_hints.cast<size_t>("recv_frame_size", min_mtu) > min_mtu) { - UHD_RX_STREAMER_LOG() << "Requested recv_frame_size of " << rx_hints["recv_frame_size"] - << " exceeds the maximum possible on this stream. Using " << min_mtu; - } - min_mtu = - std::min(min_mtu, rx_hints.cast<size_t>("recv_frame_size", min_mtu)); + rx_hints["mtu"] = std::to_string(mtu); + + // Make sure user supplied recv_frame_size is less than the MTU + if (rx_hints.cast<size_t>("recv_frame_size", mtu) > mtu) { + UHD_LOGGER_WARNING("STREAMER") << "Requested recv_frame_size of " << rx_hints["recv_frame_size"] + << " exceeds the maximum possible on this stream. Using " << mtu; + rx_hints["recv_frame_size"] = std::to_string(mtu); } - rx_hints["recv_frame_size"] = std::to_string(min_mtu); // allocate sid and create transport uhd::sid_t stream_address = blk_ctrl->get_address(block_port); @@ -605,10 +604,12 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_) // Setup the dsp transport hints device_addr_t tx_hints = get_tx_hints(mb_index); - // Traverse the downstream nodes for minimum mtu - size_t min_mtu = blk_ctrl->get_mtu(block_port); + // Search the device and all nodes for lowest MTU + size_t mtu = std::min( + get_mtu(mb_index, uhd::direction_t::TX_DIRECTION), + blk_ctrl->get_mtu(block_port)); UHD_TX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id() - << ": " << min_mtu; + << ": " << blk_ctrl->get_mtu(block_port); std::vector<boost::shared_ptr<uhd::rfnoc::sink_block_ctrl_base>> downstream_sink_nodes = blk_ctrl->find_downstream_node<uhd::rfnoc::sink_block_ctrl_base>(); @@ -618,18 +619,16 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_) // currently we use port 0 of a block in case of channel 1. UHD_TX_STREAMER_LOG() << "Maximum MTU supported by " << node->unique_id() << ": " << node->get_mtu(0); - min_mtu = std::min(min_mtu, node->get_mtu(0)); + mtu = std::min(mtu, node->get_mtu(0)); } - min_mtu = std::min(min_mtu, get_mtu(mb_index, uhd::direction_t::TX_DIRECTION)); - if (tx_hints.has_key("send_frame_size")) { - if (tx_hints.cast<size_t>("send_frame_size", min_mtu) > min_mtu) { - UHD_TX_STREAMER_LOG() << "Requested send_frame_size of " << tx_hints["send_frame_size"] - << " exceeds the maximum possible on this stream. Using " << min_mtu; - } - min_mtu = - std::min(min_mtu, tx_hints.cast<size_t>("send_frame_size", min_mtu)); + tx_hints["mtu"] = std::to_string(mtu); + + // Make sure user supplied send_frame_size is less than the MTU + if (tx_hints.cast<size_t>("send_frame_size", mtu) > mtu) { + UHD_LOGGER_WARNING("STREAMER") << "Requested send_frame_size of " << tx_hints["send_frame_size"] + << " exceeds the maximum possible on this stream. Using " << mtu; + tx_hints["send_frame_size"] = std::to_string(mtu); } - tx_hints["send_frame_size"] = std::to_string(min_mtu); const size_t fifo_size = blk_ctrl->get_fifo_size(block_port); // Allocate sid and create transport |