aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMatthew Crymble <matthew.crymble@ni.com>2019-06-05 16:56:11 -0500
committerMartin Braun <martin.braun@ettus.com>2019-07-17 11:43:23 -0700
commit667d23b730c15b4e9e448cb1e5d75efeb2930822 (patch)
treea44cf1ced6b696e9938357d0310f78b7e5bcd8b2 /host
parent7e1b567d538011df383c62239ca52fe6887d54d9 (diff)
downloaduhd-667d23b730c15b4e9e448cb1e5d75efeb2930822.tar.gz
uhd-667d23b730c15b4e9e448cb1e5d75efeb2930822.tar.bz2
uhd-667d23b730c15b4e9e448cb1e5d75efeb2930822.zip
x310: fixed udp WSA buffer size assignment issue
Diffstat (limited to 'host')
-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));