[IPoIB NDIS 6.0 CM]
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Nov 2009 12:26:59 +0000 (12:26 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Nov 2009 12:26:59 +0000 (12:26 +0000)
Fixing a bug when NDIS got stuck because of uncompleted sends. (mlnx 5108)

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2568 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp
ulp/ipoib_NDIS6_CM/kernel/ipoib_port.h

index 2c83811..5b86eae 100644 (file)
@@ -3264,11 +3264,10 @@ __pending_list_destroy(
                s_buf = (ipoib_send_NB_SG*) (PVOID) p_item; // TODO: Check this casting\r
                ASSERT(s_buf->p_port == p_port);\r
                ASSERT(s_buf->p_nbl);\r
-               IPOIB_DEC_NET_BUFFER_LIST_REF_COUNT(s_buf->p_nbl);\r
-               \r
-               \r
-               __send_complete_net_buffer(s_buf, NDIS_STATUS_RESET_IN_PROGRESS,send_complete_flags,TRUE);\r
 \r
+               \r
+               //__send_complete_net_buffer(s_buf, NDIS_STATUS_RESET_IN_PROGRESS,send_complete_flags,TRUE);\r
+               __send_complete_net_buffer(s_buf, NDIS_STATUS_FAILURE,send_complete_flags,TRUE);\r
        }\r
 \r
 \r
@@ -5298,7 +5297,8 @@ ipoib_port_send(
                \r
                cl_obj_unlock( &p_port->obj );\r
                \r
-               \r
+               IPOIB_PRINT( TRACE_LEVEL_VERBOSE, IPOIB_DBG_SEND,\r
+                       ("QP state isnt RTS, exiting from port_send\n"));\r
                NET_BUFFER_LIST_STATUS(p_net_buffer_list) = NDIS_STATUS_FAILURE;\r
                ipoib_inc_send_stat( p_port->p_adapter, IP_STAT_DROPPED, 0 );\r
                        \r
@@ -5448,25 +5448,7 @@ __send_complete_net_buffer(
                ("Processing send completion for NBL=0x%p .\n",  s_buf->p_nbl ));\r
        \r
        \r
-       //Free SGL element allocated by NDIS\r
-       NdisMFreeNetBufferSGList(\r
-                                                       s_buf->p_port->p_adapter->NdisMiniportDmaHandle,\r
-                                                       s_buf->p_sgl,\r
-                                                       s_buf->p_curr_nb);\r
-                                                       \r
-       if( s_buf->p_send_buf )\r
-       {\r
-               cl_perf_start( FreeSendBuf );\r
-               NdisFreeToNPagedLookasideList( &s_buf->p_port->buf_mgr.send_buf_list,\r
-                       s_buf->p_send_buf );\r
-               cl_perf_stop( &p_port->p_adapter->perf, FreeSendBuf );\r
-       }       \r
        \r
-       /* Dereference the enpoint used for the transfer. */\r
-       if( s_buf->p_endpt ) {\r
-               ipoib_endpt_deref( s_buf->p_endpt );\r
-       }\r
-\r
        \r
        // No need to delete p_sg_buf at this state, we will destroy the whole list at the end of the execution\r
        //NET_BUFFER_LIST_NEXT_NBL(p_desc->p_netbuf_list) = NULL;\r
@@ -5532,8 +5514,30 @@ __send_complete_net_buffer(
                        NdisMSendNetBufferListsCompleteX( s_buf->p_port->p_adapter->h_adapter,\r
                                s_buf->p_nbl, compl_flags );\r
                }\r
+       } else {\r
+               IPOIB_PRINT(TRACE_LEVEL_INFORMATION, IPOIB_DBG_SEND,\r
+               ("BAD BAD BAD COUNTER=%d for NBL=0x%p .\n",  s_buf->p_nbl, IPOIB_GET_NET_BUFFER_LIST_REF_COUNT(s_buf->p_nbl) ));\r
        }\r
 \r
+       \r
+       //Free SGL element allocated by NDIS\r
+               NdisMFreeNetBufferSGList(\r
+                                                               s_buf->p_port->p_adapter->NdisMiniportDmaHandle,\r
+                                                               s_buf->p_sgl,\r
+                                                               s_buf->p_curr_nb);\r
+                                                               \r
+               if( s_buf->p_send_buf )\r
+               {\r
+                       cl_perf_start( FreeSendBuf );\r
+                       NdisFreeToNPagedLookasideList( &s_buf->p_port->buf_mgr.send_buf_list,\r
+                               s_buf->p_send_buf );\r
+                       cl_perf_stop( &p_port->p_adapter->perf, FreeSendBuf );\r
+               }       \r
+               \r
+               /* Dereference the enpoint used for the transfer. */\r
+               if( s_buf->p_endpt ) {\r
+                       ipoib_endpt_deref( s_buf->p_endpt );\r
+               }\r
 #if 0  \r
        if (status == NDIS_STATUS_SUCCESS) {\r
                //++g_ipoib_send_SG_real;\r
index e468565..fa0562c 100644 (file)
@@ -913,6 +913,8 @@ __port_attr_to_mtu_size(uint32_t value)
 #if DBG\r
 // This function is only used to monitor send failures\r
 extern ULONG g_NBL_complete;\r
+extern ULONG g_NBL;\r
+\r
 static inline VOID NdisMSendNetBufferListsCompleteX(\r
        IN NDIS_HANDLE  MiniportAdapterHandle,\r
        IN PNET_BUFFER_LIST  NetBufferLists,\r
@@ -920,11 +922,15 @@ static inline VOID NdisMSendNetBufferListsCompleteX(
        ) \r
 {\r
        ASSERT(NET_BUFFER_LIST_NEXT_NBL(NetBufferLists) == NULL);\r
+       \r
        if (NET_BUFFER_LIST_STATUS(NetBufferLists) != NDIS_STATUS_SUCCESS) {\r
        IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_ALL,\r
                ("NBL completed with error %d to NDIS\n", NET_BUFFER_LIST_STATUS(NetBufferLists)));\r
        }\r
+       \r
        ++g_NBL_complete;\r
+       IPOIB_PRINT( TRACE_LEVEL_VERBOSE, IPOIB_DBG_SEND,\r
+                               ("Completing NBL=%x, g_NBL=%d, g_NBL_completed=%d \n", NetBufferLists, g_NBL, g_NBL_complete) );\r
        NdisMSendNetBufferListsComplete(MiniportAdapterHandle,NetBufferLists,SendCompleteFlags);\r
 }\r
 #else\r