diff options
author | michael-west <michael.west@ettus.com> | 2017-03-21 14:29:23 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-03-21 18:02:08 -0700 |
commit | 3870f16f6eb8959319629fdf7d4eb1f5583ed942 (patch) | |
tree | 372339b4f6f1c15063dea0789ed4e1c6db2ed77a | |
parent | 75495138932ba8536d7771409c26f4d3d98b7dff (diff) | |
download | uhd-3870f16f6eb8959319629fdf7d4eb1f5583ed942.tar.gz uhd-3870f16f6eb8959319629fdf7d4eb1f5583ed942.tar.bz2 uhd-3870f16f6eb8959319629fdf7d4eb1f5583ed942.zip |
UDP: Set default socket buffer size to number of frames * 9000 (maximum Ethernet MTU)
-rw-r--r-- | host/lib/transport/udp_common.hpp | 3 | ||||
-rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 16 |
2 files changed, 11 insertions, 8 deletions
diff --git a/host/lib/transport/udp_common.hpp b/host/lib/transport/udp_common.hpp index bf4712613..3ee568432 100644 --- a/host/lib/transport/udp_common.hpp +++ b/host/lib/transport/udp_common.hpp @@ -23,6 +23,9 @@ namespace uhd{ namespace transport{ + // Jumbo frames are limited to 9000; + static const size_t MAX_ETHERNET_MTU = 9000; + typedef boost::shared_ptr<boost::asio::ip::udp::socket> socket_sptr; /*! diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index 036a84a05..63044c1e3 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -310,22 +310,22 @@ udp_zero_copy::sptr udp_zero_copy::make( xport_params.num_send_frames = size_t(hints.cast<double>("num_send_frames", default_buff_args.num_send_frames)); //extract buffer size hints from the device addr - 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)); + size_t usr_recv_buff_size = size_t(hints.cast<double>("recv_buff_size", xport_params.num_recv_frames * MAX_ETHERNET_MTU)); + size_t usr_send_buff_size = size_t(hints.cast<double>("send_buff_size", xport_params.num_send_frames * MAX_ETHERNET_MTU)); if (hints.has_key("recv_buff_size")) { - if (usr_recv_buff_size < xport_params.recv_frame_size * xport_params.num_recv_frames) { + if (usr_recv_buff_size < xport_params.num_recv_frames * MAX_ETHERNET_MTU) { throw uhd::value_error((boost::format( - "recv_buff_size must be equal to or greater than (num_recv_frames * recv_frame_size) where num_recv_frames=%d, recv_frame_size=%d") - % xport_params.num_recv_frames % xport_params.recv_frame_size).str()); + "recv_buff_size must be equal to or greater than %d") + % (xport_params.num_recv_frames * MAX_ETHERNET_MTU)).str()); } } if (hints.has_key("send_buff_size")) { - if (usr_send_buff_size < xport_params.send_frame_size * xport_params.num_send_frames) { + if (usr_send_buff_size < xport_params.num_send_frames * MAX_ETHERNET_MTU) { throw uhd::value_error((boost::format( - "send_buff_size must be equal to or greater than (num_send_frames * send_frame_size) where num_send_frames=%d, send_frame_size=%d") - % xport_params.num_send_frames % xport_params.send_frame_size).str()); + "send_buff_size must be equal to or greater than %d") + % (xport_params.num_send_frames * MAX_ETHERNET_MTU)).str()); } } |