aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/e300/e300_impl.cpp
diff options
context:
space:
mode:
authorMichael West <michael.west@ettus.com>2019-06-19 13:25:32 -0700
committermichael-west <michael.west@ettus.com>2019-06-28 08:21:09 -0700
commit3f7b937d3fbabe0a885bdcaf8137502528db6e68 (patch)
treeb10d741b615cf9707420a7e24276d0ca67858c4b /host/lib/usrp/e300/e300_impl.cpp
parent55b9f7309f6f49eccd1157e898b77dc9a6afd238 (diff)
downloaduhd-3f7b937d3fbabe0a885bdcaf8137502528db6e68.tar.gz
uhd-3f7b937d3fbabe0a885bdcaf8137502528db6e68.tar.bz2
uhd-3f7b937d3fbabe0a885bdcaf8137502528db6e68.zip
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 <michael.west@ettus.com>
Diffstat (limited to 'host/lib/usrp/e300/e300_impl.cpp')
-rw-r--r--host/lib/usrp/e300/e300_impl.cpp13
1 files changed, 11 insertions, 2 deletions
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<size_t>("mtu", params.send_frame_size));
+ } else if (type == RX_DATA) {
+ params.recv_frame_size = std::min(params.recv_frame_size,
+ hints.cast<size_t>("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;