summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-18 16:16:37 -0700
committerJosh Blum <josh@joshknows.com>2011-07-18 16:16:37 -0700
commitb25cb48e6e9b4c496d0360a11174f2f174e52df6 (patch)
tree9f7c5e5d16453c459f7678224df44db94f2d697e
parent951ed3d66c343460450d2c3bc022298c1ccb2490 (diff)
downloaduhd-b25cb48e6e9b4c496d0360a11174f2f174e52df6.tar.gz
uhd-b25cb48e6e9b4c496d0360a11174f2f174e52df6.tar.bz2
uhd-b25cb48e6e9b4c496d0360a11174f2f174e52df6.zip
udp: check for FastSendDatagramThreshold + print warning inside the wsa transport
-rw-r--r--host/lib/transport/udp_wsa_zero_copy.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/host/lib/transport/udp_wsa_zero_copy.cpp b/host/lib/transport/udp_wsa_zero_copy.cpp
index ccfed38ea..1acaa7eb1 100644
--- a/host/lib/transport/udp_wsa_zero_copy.cpp
+++ b/host/lib/transport/udp_wsa_zero_copy.cpp
@@ -33,6 +33,30 @@ namespace asio = boost::asio;
static const size_t DEFAULT_NUM_FRAMES = 32;
/***********************************************************************
+ * Check registry for correct fast-path setting
+ **********************************************************************/
+#include <atlbase.h> //CRegKey
+static void check_registry_for_fast_send_threshold(const size_t mtu){
+ static bool warned = false;
+ if (warned) return; //only allow one printed warning per process
+
+ CRegKey reg_key;
+ DWORD threshold = 1024; //system default when threshold is not specified
+ if (
+ reg_key.Open(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\AFD\\Parameters", KEY_READ) != ERROR_SUCCESS or
+ reg_key.QueryDWORDValue("FastSendDatagramThreshold", threshold) != ERROR_SUCCESS or threshold < mtu
+ ){
+ UHD_MSG(warning) << boost::format(
+ "The MTU (%d) is larger than the FastSendDatagramThreshold (%d)!\n"
+ "This will negatively affect the transmit performance.\n"
+ "See the transport application notes for more detail.\n"
+ ) % mtu % threshold << std::endl;
+ warned = true;
+ }
+ reg_key.Close();
+}
+
+/***********************************************************************
* Static initialization to take care of WSA init and cleanup
**********************************************************************/
struct uhd_wsa_control{
@@ -159,6 +183,7 @@ public:
_pending_recv_buffs(_num_recv_frames),
_next_send_buff_index(0)
{
+ check_registry_for_fast_send_threshold(this->get_send_frame_size());
UHD_MSG(status) << boost::format("Creating WSA UDP transport for %s:%s") % addr % port << std::endl;
static uhd_wsa_control uhd_wsa; //makes wsa start happen via lazy initialization