aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Crymble <matthew.crymble@ni.com>2019-06-05 16:56:11 -0500
committermichael-west <michael.west@ettus.com>2019-06-12 01:40:26 -0700
commit1711ff33f4a1a646c427bf5b798f100c52eba730 (patch)
tree8fc35b7ca33ccec6c76642be8b8021d4ac52776a
parent5ad3cae70131380a1b18d7ced3e525a76bfa4d41 (diff)
downloaduhd-1711ff33f4a1a646c427bf5b798f100c52eba730.tar.gz
uhd-1711ff33f4a1a646c427bf5b798f100c52eba730.tar.bz2
uhd-1711ff33f4a1a646c427bf5b798f100c52eba730.zip
x310: fixed udp WSA buffer size assignment issue
-rw-r--r--host/lib/transport/udp_wsa_zero_copy.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/host/lib/transport/udp_wsa_zero_copy.cpp b/host/lib/transport/udp_wsa_zero_copy.cpp
index c1eeb7cb1..8f83ea5ef 100644
--- a/host/lib/transport/udp_wsa_zero_copy.cpp
+++ b/host/lib/transport/udp_wsa_zero_copy.cpp
@@ -21,7 +21,8 @@ namespace asio = boost::asio;
constexpr size_t UDP_ZERO_COPY_DEFAULT_NUM_FRAMES = 1;
constexpr size_t UDP_ZERO_COPY_DEFAULT_FRAME_SIZE =
1472; // Based on common 1500 byte MTU for 1GbE.
-
+constexpr size_t UDP_ZERO_COPY_DEFAULT_BUFF_SIZE =
+ 2500000; // 20ms of data for 1GbE link (in bytes)
/***********************************************************************
* Check registry for correct fast-path setting (windows only)
**********************************************************************/
@@ -234,8 +235,8 @@ public:
// ioctlsocket(_sock_fd, FIONBIO, &mode);
// resize the socket buffers
- const int recv_buff_size = int(hints.cast<double>("recv_buff_size", 0.0));
- const int send_buff_size = int(hints.cast<double>("send_buff_size", 0.0));
+ const int recv_buff_size = xport_params.recv_buff_size;
+ const int send_buff_size = xport_params.send_buff_size;
if (recv_buff_size > 0)
setsockopt(_sock_fd,
SOL_SOCKET,
@@ -427,6 +428,10 @@ udp_zero_copy::sptr udp_zero_copy::make(const std::string& addr,
size_t(hints.cast<double>("send_frame_size", default_buff_args.send_frame_size));
xport_params.num_send_frames =
size_t(hints.cast<double>("num_send_frames", default_buff_args.num_send_frames));
+ xport_params.recv_buff_size =
+ size_t(hints.cast<double>("recv_buff_size", default_buff_args.recv_buff_size));
+ xport_params.send_buff_size =
+ size_t(hints.cast<double>("send_buff_size", default_buff_args.send_buff_size));
if (xport_params.num_recv_frames == 0) {
UHD_LOG_TRACE("UDP",
@@ -451,6 +456,19 @@ udp_zero_copy::sptr udp_zero_copy::make(const std::string& addr,
xport_params.send_frame_size = UDP_ZERO_COPY_DEFAULT_FRAME_SIZE;
}
+ if (xport_params.recv_buff_size == 0) {
+ UHD_LOG_TRACE("UDP", "Using default value for recv_buff_size");
+ xport_params.recv_buff_size = std::max(UDP_ZERO_COPY_DEFAULT_BUFF_SIZE,
+ xport_params.num_recv_frames * MAX_ETHERNET_MTU);
+ UHD_LOG_TRACE("UDP",
+ "Using default value for recv_buff_size" << xport_params.recv_buff_size);
+ }
+ if (xport_params.send_buff_size == 0) {
+ UHD_LOG_TRACE("UDP", "default_buff_args has no send_buff_size");
+ xport_params.send_buff_size = std::max(UDP_ZERO_COPY_DEFAULT_BUFF_SIZE,
+ xport_params.num_send_frames * MAX_ETHERNET_MTU);
+ }
+
// extract buffer size hints from the device addr and check if they match up
size_t usr_recv_buff_size = size_t(hints.cast<double>("recv_buff_size", 0.0));
size_t usr_send_buff_size = size_t(hints.cast<double>("send_buff_size", 0.0));