[WSD] Add IBWSD_POLL environment variable to allow provider to poll for
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Oct 2005 19:23:56 +0000 (19:23 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Oct 2005 19:23:56 +0000 (19:23 +0000)
completions, improving latencies.

Signed-off-by: Fab Tillier (ftillier@silverstorm.com)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@104 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/wsd/user/ibsp_duplicate.c
ulp/wsd/user/ibsp_iblow.c
ulp/wsd/user/ibspdll.c
ulp/wsd/user/ibspdll.h
ulp/wsd/user/ibspproto.h

index 9258da4..6a1d0ad 100644 (file)
@@ -57,7 +57,7 @@ setup_duplicate_socket(
 {\r
        char fname[100];\r
        HANDLE h = NULL;\r
-       int ret;\r
+       int ret, err;\r
        struct ibsp_duplicate_info *dup_info;\r
        ib_net64_t dest_port_guid;\r
        ib_path_rec_t path_rec;\r
@@ -176,6 +176,11 @@ setup_duplicate_socket(
                IBSP_ERROR( ("Failed to connect\n") );\r
                ret = WSAENETDOWN;\r
 err2:\r
+               g_ibsp.up_call_table.lpWPUCloseSocketHandle(\r
+                       socket_info->switch_socket, &err );\r
+               socket_info->switch_socket = INVALID_SOCKET;\r
+               STAT_DEC( wpusocket_num );\r
+\r
                ib_destroy_socket( socket_info );\r
        }\r
        else\r
index 54424bb..ca68250 100644 (file)
@@ -289,7 +289,7 @@ complete_wq(
 \r
 \r
 /* CQ completion handler. */\r
-void\r
+int\r
 ib_cq_comp(\r
                                        void                                            *cq_context )\r
 {\r
@@ -301,6 +301,7 @@ ib_cq_comp(
        io_comp_info_t                  info[WC_LIST_SIZE];\r
        int                                             cb_idx;\r
        int                                             i;\r
+       int                                             n_comp = 0;\r
 #ifdef _DEBUG_\r
        int                                             comp_count;\r
 #endif\r
@@ -387,6 +388,8 @@ ib_cq_comp(
                        }\r
                }\r
 \r
+               n_comp += i;\r
+\r
 #ifdef _DEBUG_\r
                if( comp_count > g_ibsp.max_comp_count )\r
                {\r
@@ -395,13 +398,6 @@ ib_cq_comp(
 #endif\r
        } while( !free_wclist );\r
 \r
-       status = ib_rearm_cq( cq_tinfo->cq, FALSE );\r
-       if( status != IB_SUCCESS )\r
-       {\r
-               IBSP_ERROR(\r
-                       ("ib_rearm_cq returned %s)\n", ib_get_err_str( status )) );\r
-       }\r
-\r
 done:\r
 \r
 #ifdef _DEBUG_\r
@@ -412,6 +408,7 @@ done:
 #endif\r
 \r
        IBSP_EXIT( IBSP_DBG_WQ );\r
+       return n_comp;\r
 }\r
 \r
 \r
@@ -420,8 +417,10 @@ static DWORD WINAPI
 ib_cq_thread(\r
                                        LPVOID                                          lpParameter )\r
 {\r
-       struct cq_thread_info *cq_tinfo = (struct cq_thread_info *)lpParameter;\r
-       cl_status_t cl_status;\r
+       struct cq_thread_info   *cq_tinfo = (struct cq_thread_info *)lpParameter;\r
+       cl_status_t                             cl_status;\r
+       ib_api_status_t                 status;\r
+       int                                             i;\r
 \r
        IBSP_ENTER( IBSP_DBG_HW );\r
 \r
@@ -447,9 +446,23 @@ ib_cq_thread(
                        fzprint(("%s():%d:0x%x:0x%x: Calling ib_cq_comp().\n", __FUNCTION__,\r
                                         __LINE__, GetCurrentProcessId(), GetCurrentThreadId()));\r
 \r
-                       ib_cq_comp( cq_tinfo );\r
+                       i = g_max_poll;\r
+                       do\r
+                       {\r
+                               if( ib_cq_comp( cq_tinfo ) )\r
+                                       i = g_max_poll;\r
+\r
+                       } while( i-- );\r
+\r
                        fzprint(("%s():%d:0x%x:0x%x: Done calling ib_cq_comp().\n", __FUNCTION__,\r
                                         __LINE__, GetCurrentProcessId(), GetCurrentThreadId()));\r
+\r
+                       status = ib_rearm_cq( cq_tinfo->cq, FALSE );\r
+                       if( status != IB_SUCCESS )\r
+                       {\r
+                               IBSP_ERROR(\r
+                                       ("ib_rearm_cq returned %s)\n", ib_get_err_str( status )) );\r
+                       }\r
                }\r
 \r
        } while( !cq_tinfo->ib_cq_thread_exit_wanted );\r
index 9aa2a04..e12a867 100644 (file)
@@ -48,6 +48,7 @@ static const GUID provider_guid = {
 \r
 static DWORD   no_read = 0;\r
 uint32_t               g_max_inline = 0xFFFFFFFF;\r
+uint32_t               g_max_poll = 0;\r
 \r
 /*\r
  * Function: DllMain\r
@@ -111,6 +112,10 @@ _DllMain(
                if( i && i <= 16 )\r
                        g_max_inline = _tcstoul( env_var, NULL, 10 );\r
 \r
+               i = GetEnvironmentVariable( "IBWSD_POLL", env_var, sizeof(env_var) );\r
+               if( i && i <= 16 )\r
+                       g_max_poll = _tcstoul( env_var, NULL, 10 );\r
+\r
                if( init_globals() )\r
                        return FALSE;\r
                break;\r
index e03a95c..0feaa3d 100644 (file)
@@ -56,5 +56,6 @@
 extern struct ibspdll_globals g_ibsp;\r
 \r
 extern uint32_t                g_max_inline;\r
+extern uint32_t                g_max_poll;\r
 \r
 #endif /* IBSPDLL_H */\r
index 43a254f..f799fe1 100644 (file)
@@ -133,7 +133,7 @@ void
 shutdown_and_destroy_socket_info(\r
        IN      OUT                     struct ibsp_socket_info         *socket_info );\r
 \r
-void\r
+int\r
 ib_cq_comp(\r
                                        void                                            *cq_context );\r
 \r