aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport/udp_zero_copy_asio.cpp
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-07-27 16:10:36 -0700
committerNick Foster <nick@nerdnetworks.org>2010-07-27 16:15:51 -0700
commitaeedd5a53e017e2c14a86dff521353ff6016a849 (patch)
treec32cae63a6c7524210a6f859f0258b7ed1846622 /host/lib/transport/udp_zero_copy_asio.cpp
parentd8f3980e45458cf68c8efaa029e492a1b8d08354 (diff)
parentbbe7dd1c8f1bd8f42a0ae3d28f36c0334b0fd3c8 (diff)
downloaduhd-aeedd5a53e017e2c14a86dff521353ff6016a849.tar.gz
uhd-aeedd5a53e017e2c14a86dff521353ff6016a849.tar.bz2
uhd-aeedd5a53e017e2c14a86dff521353ff6016a849.zip
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhdpriv into usrp2px
Conflicts: host/lib/usrp/usrp2/mboard_impl.cpp
Diffstat (limited to 'host/lib/transport/udp_zero_copy_asio.cpp')
-rw-r--r--host/lib/transport/udp_zero_copy_asio.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/host/lib/transport/udp_zero_copy_asio.cpp b/host/lib/transport/udp_zero_copy_asio.cpp
index bfbcf62d8..bbbabf6d0 100644
--- a/host/lib/transport/udp_zero_copy_asio.cpp
+++ b/host/lib/transport/udp_zero_copy_asio.cpp
@@ -29,7 +29,11 @@ using namespace uhd::transport;
* Constants
**********************************************************************/
//enough buffering for half a second of samples at full rate on usrp2
-static const size_t MIN_SOCK_BUFF_SIZE = size_t(sizeof(boost::uint32_t) * 25e6 * 0.5);
+static const size_t MIN_RECV_SOCK_BUFF_SIZE = size_t(sizeof(boost::uint32_t) * 25e6 * 0.5);
+//Large buffers cause more underflow at high rates.
+//Perhaps this is due to the kernel scheduling,
+//but may change with host-based flow control.
+static const size_t MIN_SEND_SOCK_BUFF_SIZE = size_t(10e3);
static const double RECV_TIMEOUT = 0.1; //100 ms
/***********************************************************************
@@ -143,6 +147,10 @@ template<typename Opt> static void resize_buff_helper(
size_t target_size,
const std::string &name
){
+ size_t min_sock_buff_size = 0;
+ if (name == "recv") min_sock_buff_size = MIN_RECV_SOCK_BUFF_SIZE;
+ if (name == "send") min_sock_buff_size = MIN_SEND_SOCK_BUFF_SIZE;
+
//resize the buffer if size was provided
if (target_size > 0){
size_t actual_size = udp_trans->resize_buff<Opt>(target_size);
@@ -158,14 +166,14 @@ template<typename Opt> static void resize_buff_helper(
" The %s buffer is smaller than the requested size.\n"
" The minimum recommended buffer size is %d bytes.\n"
" See the USRP2 application notes on buffer resizing.\n"
- ) % name % MIN_SOCK_BUFF_SIZE << std::endl;
+ ) % name % min_sock_buff_size << std::endl;
}
//only enable on platforms that are happy with the large buffer resize
#if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)
//otherwise, ensure that the buffer is at least the minimum size
- else if (udp_trans->get_buff_size<Opt>() < MIN_SOCK_BUFF_SIZE){
- resize_buff_helper<Opt>(udp_trans, MIN_SOCK_BUFF_SIZE, name);
+ else if (udp_trans->get_buff_size<Opt>() < min_sock_buff_size){
+ resize_buff_helper<Opt>(udp_trans, min_sock_buff_size, name);
}
#endif /*defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)*/
}