From 3f7b937d3fbabe0a885bdcaf8137502528db6e68 Mon Sep 17 00:00:00 2001 From: Michael West Date: Wed, 19 Jun 2019 13:25:32 -0700 Subject: Device3: Fix MTU and default frame sizes The latest changes to the get_*x_stream() functions to calculate the MTU for the channel caused default frame size values to be ignored. This change fixes that by changing the key from "send/recv_frame_size" to "mtu" and then changing the implementations of make_transport() constrain the frame size values based on the "mtu" value as well as any device and/or transport-specific limits. Signed-off-by: Michael West --- host/lib/usrp/e300/e300_impl.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/e300/e300_impl.cpp') diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 5a6376039..fadac719c 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -706,14 +706,23 @@ uhd::sid_t e300_impl::_allocate_sid( uhd::both_xports_t e300_impl::make_transport( const uhd::sid_t &address, const xport_type_t type, - const uhd::device_addr_t &) + const uhd::device_addr_t &hints) { uhd::both_xports_t xports; xports.endianness = ENDIANNESS_LITTLE; - const uhd::transport::zero_copy_xport_params params = + uhd::transport::zero_copy_xport_params params = (type == CTRL) ? _ctrl_xport_params : _data_xport_params; + // Constrain frame sizes to MTU if supplied + if (type == TX_DATA) { + params.send_frame_size = std::min(params.send_frame_size, + hints.cast("mtu", params.send_frame_size)); + } else if (type == RX_DATA) { + params.recv_frame_size = std::min(params.recv_frame_size, + hints.cast("mtu", params.recv_frame_size)); + } + xports.send_sid = _allocate_sid(address); xports.recv_sid = xports.send_sid.reversed(); xports.recv_buff_size = params.recv_frame_size * params.num_recv_frames; -- cgit v1.2.3