diff options
-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()); } } |