diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-12-19 14:38:12 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:06:04 -0800 |
commit | 93c1b176ca7ef9a62b903ce1d942b94185db8a7c (patch) | |
tree | 8f4341b1df15aab6daf5c560e262515ff5519796 | |
parent | e9863e73a4f188632acf49de485a43844bd232fb (diff) | |
download | uhd-93c1b176ca7ef9a62b903ce1d942b94185db8a7c.tar.gz uhd-93c1b176ca7ef9a62b903ce1d942b94185db8a7c.tar.bz2 uhd-93c1b176ca7ef9a62b903ce1d942b94185db8a7c.zip |
mpmd: udp: Apply MTU to socket defaults
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp b/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp index d900467d3..4d1306f82 100644 --- a/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp +++ b/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp @@ -18,15 +18,23 @@ using namespace uhd::mpmd::xport; namespace { #if defined(UHD_PLATFORM_MACOS) || defined(UHD_PLATFORM_BSD) + //! Size of the host-side socket buffer for RX const size_t MPMD_RX_SW_BUFF_SIZE_ETH = 0x100000; // 1Mib #elif defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32) - //For an ~8k frame size any size >32MiB is just wasted buffer space: + //! Size of the host-side socket buffer for RX + // For an ~8k frame size any size >32MiB is just wasted buffer space const size_t MPMD_RX_SW_BUFF_SIZE_ETH = 0x2000000; // 32 MiB #endif - const size_t MPMD_10GE_DATA_FRAME_MAX_SIZE = 8000; // CHDR packet size in bytes + //! Maximum CHDR packet size in bytes + const size_t MPMD_10GE_DATA_FRAME_MAX_SIZE = 8000; - const double MPMD_MTU_DISCOVERY_TIMEOUT = 0.02; // seconds + //! Number of send/recv frames + const size_t MPMD_ETH_NUM_FRAMES = 32; + + //! For MTU discovery, the time we wait for a packet before calling it + // oversized (seconds). + const double MPMD_MTU_DISCOVERY_TIMEOUT = 0.02; std::vector<std::string> get_addrs_from_mb_args( const uhd::device_addr_t& mb_args @@ -182,11 +190,10 @@ mpmd_xport_ctrl_udp::make_transport( transport::zero_copy_xport_params default_buff_args; // Create actual UDP transport - // TODO don't hardcode these - default_buff_args.send_frame_size = 8000; - default_buff_args.recv_frame_size = 8000; - default_buff_args.num_recv_frames = 32; - default_buff_args.num_send_frames = 32; + default_buff_args.send_frame_size = get_mtu(uhd::TX_DIRECTION); + default_buff_args.recv_frame_size = get_mtu(uhd::RX_DIRECTION); + default_buff_args.num_recv_frames = MPMD_ETH_NUM_FRAMES; + default_buff_args.num_send_frames = MPMD_ETH_NUM_FRAMES; transport::udp_zero_copy::buff_params buff_params; auto recv = transport::udp_zero_copy::make( |