aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/device3/device3_impl.hpp3
-rw-r--r--host/lib/usrp/device3/device3_io_impl.cpp54
-rw-r--r--host/lib/usrp/e300/e300_impl.cpp5
-rw-r--r--host/lib/usrp/e300/e300_impl.hpp3
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.cpp4
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.hpp3
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp7
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp3
8 files changed, 81 insertions, 1 deletions
diff --git a/host/lib/usrp/device3/device3_impl.hpp b/host/lib/usrp/device3/device3_impl.hpp
index 3bf6f6111..62fd399ac 100644
--- a/host/lib/usrp/device3/device3_impl.hpp
+++ b/host/lib/usrp/device3/device3_impl.hpp
@@ -206,6 +206,9 @@ protected:
//! Is called after a streamer is generated
virtual void post_streamer_hooks(uhd::direction_t) {}
+ //! get mtu
+ virtual size_t get_mtu(const size_t, const uhd::direction_t) = 0;
+
/***********************************************************************
* Channel-related
**********************************************************************/
diff --git a/host/lib/usrp/device3/device3_io_impl.cpp b/host/lib/usrp/device3/device3_io_impl.cpp
index ce8ff2cbf..081f881d5 100644
--- a/host/lib/usrp/device3/device3_io_impl.cpp
+++ b/host/lib/usrp/device3/device3_io_impl.cpp
@@ -338,6 +338,33 @@ 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);
+ UHD_RX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id()
+ << ": " << min_mtu;
+ 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>();
+ for (const boost::shared_ptr<uhd::rfnoc::source_block_ctrl_base>& node :
+ upstream_source_nodes) {
+ // Get MTU from Port 0 of the upstream nodes. This is okay for now as
+ // 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));
+ }
+ // 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["recv_frame_size"] = std::to_string(min_mtu);
+
// allocate sid and create transport
uhd::sid_t stream_address = blk_ctrl->get_address(block_port);
UHD_RX_STREAMER_LOG() << "creating rx stream " << rx_hints.to_string();
@@ -577,6 +604,33 @@ 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);
+ UHD_TX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id()
+ << ": " << min_mtu;
+ 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>();
+ for (const boost::shared_ptr<uhd::rfnoc::sink_block_ctrl_base>& node :
+ downstream_sink_nodes) {
+ // Get MTU from Port 0 of the downstream nodes. This is okay for now as
+ // 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));
+ }
+ 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["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
uhd::sid_t stream_address = blk_ctrl->get_address(block_port);
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp
index 59a8cec88..5a6376039 100644
--- a/host/lib/usrp/e300/e300_impl.cpp
+++ b/host/lib/usrp/e300/e300_impl.cpp
@@ -731,6 +731,11 @@ uhd::both_xports_t e300_impl::make_transport(
return xports;
}
+size_t e300_impl::get_mtu(const size_t /*mb_index*/, const uhd::direction_t dir) {
+ return (dir == RX_DIRECTION) ? _data_xport_params.recv_frame_size :
+ _data_xport_params.send_frame_size;
+}
+
void e300_impl::_update_clock_source(const std::string &source)
{
if (source != "internal") {
diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp
index 2e919cf9b..0a6f153eb 100644
--- a/host/lib/usrp/e300/e300_impl.hpp
+++ b/host/lib/usrp/e300/e300_impl.hpp
@@ -166,6 +166,9 @@ private: // methods
return uhd::ENDIANNESS_LITTLE;
};
+ //! get mtu
+ size_t get_mtu(const size_t, const uhd::direction_t);
+
/************************************************************************
* Helpers
***********************************************************************/
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp
index b8ce6cabd..2f3584498 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.cpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.cpp
@@ -348,6 +348,10 @@ void mpmd_impl::setup_rpc_blocks(
}
}
+size_t mpmd_impl::get_mtu(const size_t mb_index, const uhd::direction_t dir) {
+ return _mb[mb_index]->get_mtu(dir);
+}
+
/*****************************************************************************
* Factory & Registry
****************************************************************************/
diff --git a/host/lib/usrp/mpmd/mpmd_impl.hpp b/host/lib/usrp/mpmd/mpmd_impl.hpp
index f74627afa..bdb6bd691 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.hpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.hpp
@@ -246,6 +246,9 @@ public:
uhd::usrp::device3_impl::xport_type_t,
const uhd::device_addr_t&);
+ //! get mtu
+ size_t get_mtu(const size_t, const uhd::direction_t);
+
private:
uhd::device_addr_t get_rx_hints(size_t mb_index);
uhd::device_addr_t get_tx_hints(size_t mb_index);
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index 796d422ad..b9b4a06f9 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -1526,7 +1526,7 @@ uhd::both_xports_t x300_impl::make_transport(const uhd::sid_t& address,
// Increasing number of recv frames here because ctrl_iface uses it
// to determine how many control packets can be in flight before it
// must wait for an ACK
- default_buff_args.num_recv_frames =
+ default_buff_args.num_recv_frames =
uhd::rfnoc::CMD_FIFO_SIZE / uhd::rfnoc::MAX_CMD_PKT_SIZE;
} else if (xport_type == TX_DATA) {
size_t default_frame_size = conn.link_rate == x300::MAX_RATE_1GIGE
@@ -1993,6 +1993,11 @@ x300_impl::frame_size_t x300_impl::determine_max_frame_size(
return frame_size;
}
+size_t x300_impl::get_mtu(const size_t /*mb_index*/, const uhd::direction_t dir) {
+ return (dir == RX_DIRECTION) ? _max_frame_sizes.recv_frame_size :
+ _max_frame_sizes.send_frame_size;
+}
+
/***********************************************************************
* compat checks
**********************************************************************/
diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp
index c101b3032..8d50f9914 100644
--- a/host/lib/usrp/x300/x300_impl.hpp
+++ b/host/lib/usrp/x300/x300_impl.hpp
@@ -173,6 +173,9 @@ private:
const xport_type_t xport_type,
const uhd::device_addr_t& args);
+ //! get mtu
+ size_t get_mtu(const size_t, const uhd::direction_t);
+
struct frame_size_t
{
size_t recv_frame_size;