diff options
| author | Josh Blum <josh@joshknows.com> | 2011-09-08 08:04:39 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2011-09-08 10:27:51 -0700 | 
| commit | 7d7a7e4069ce78a946762967530c121142db112b (patch) | |
| tree | 80082bd45b92102ef845b397b85ba20a542de258 | |
| parent | 13681fb7bb640eb778c1450532a35d2a85c630f8 (diff) | |
| download | uhd-7d7a7e4069ce78a946762967530c121142db112b.tar.gz uhd-7d7a7e4069ce78a946762967530c121142db112b.tar.bz2 uhd-7d7a7e4069ce78a946762967530c121142db112b.zip | |
udp: added check_registry_for_fast_send_threshold to non-wsa transport
| -rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 30 | 
1 files changed, 30 insertions, 0 deletions
| diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index bc73b96a8..e43a96dd0 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -33,6 +33,32 @@ namespace asio = boost::asio;  static const size_t DEFAULT_NUM_FRAMES = 32;  /*********************************************************************** + * Check registry for correct fast-path setting (windows only) + **********************************************************************/ +#ifdef UHD_PLATFORM_WIN32 +#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(); +} +#endif /*UHD_PLATFORM_WIN32*/ + +/***********************************************************************   * Reusable managed receiver buffer:   *  - Initialize with memory and a release callback.   *  - Call get new with a length in bytes to re-use. @@ -123,6 +149,10 @@ public:      {          UHD_LOG << boost::format("Creating udp transport for %s %s") % addr % port << std::endl; +        #ifdef UHD_PLATFORM_WIN32 +        check_registry_for_fast_send_threshold(this->get_send_frame_size()); +        #endif /*UHD_PLATFORM_WIN32*/ +          //resolve the address          asio::ip::udp::resolver resolver(_io_service);          asio::ip::udp::resolver::query query(asio::ip::udp::v4(), addr, port); | 
