[IPoIB NDIS 6.0 CM] Add a function to track send completions. (mlnx 5105)
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Nov 2009 12:25:54 +0000 (12:25 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Nov 2009 12:25:54 +0000 (12:25 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2567 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

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

index 8612118..a3cfc3f 100644 (file)
@@ -336,6 +336,9 @@ ULONG                       g_ipoib_send_SG_real = 0;
 ULONG                  g_ipoib_send_SG_failed = 0;\r
 ULONG                  g_ipoib_send_reset = 0;\r
 \r
+ULONG                  g_NBL = 0;\r
+ULONG                  g_NBL_complete = 0;\r
+\r
 \r
 typedef struct _IPOIB_REG_ENTRY\r
 {\r
@@ -2752,8 +2755,8 @@ ipoib_query_info(
        \r
                default:\r
                        status = NDIS_STATUS_INVALID_OID;\r
-               //      IPOIB_PRINT( TRACE_LEVEL_ERROR,IPOIB_DBG_OID,\r
-                       //      ("Port %d received an invalid oid of 0x%.8X!\n", port_num, oid) );\r
+                       IPOIB_PRINT( TRACE_LEVEL_ERROR,IPOIB_DBG_ERROR,\r
+                               ("Port %d received an invalid oid of 0x%.8X!\n", port_num, oid) );\r
                        break;\r
                }\r
        \r
@@ -2908,7 +2911,6 @@ ipoib_reset(
        ipoib_adapter_t* p_adapter;\r
 \r
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
-//return NDIS_STATUS_SUCCESS;\r
        CL_ASSERT( p_addr_reset );\r
        CL_ASSERT( adapter_context );\r
        p_adapter = (ipoib_adapter_t*)adapter_context;\r
@@ -3291,7 +3293,9 @@ ipoib_send_net_buffer_list(
        if( p_adapter->ipoib_state == IPOIB_PAUSING ||\r
                p_adapter->ipoib_state == IPOIB_PAUSED)\r
        {\r
-               status = NDIS_STATUS_PAUSED; \r
+               status = NDIS_STATUS_PAUSED; //NDIS_STATUS_PAUSED; \r
+               IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+                               ("Got send during PAUSE, complete with error \n") );\r
                cl_obj_unlock( &p_adapter->obj );\r
                goto compl_status;\r
        }\r
@@ -3299,6 +3303,8 @@ ipoib_send_net_buffer_list(
        if( p_adapter->state != IB_PNP_PORT_ACTIVE || !p_adapter->p_port )\r
        {\r
                cl_obj_unlock( &p_adapter->obj );\r
+               IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+                               ("Got send during port non-active, complete with error \n") );\r
                status = NDIS_STATUS_FAILURE; \r
                goto compl_status;\r
        }\r
@@ -3306,8 +3312,6 @@ ipoib_send_net_buffer_list(
        p_port = p_adapter->p_port;\r
        ipoib_port_ref( p_port, ref_send_packets );\r
        cl_obj_unlock( &p_adapter->obj );\r
-       //IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
-       //                      ("Starting NET BUFFER LIST \n") );\r
 \r
 \r
        if (NET_BUFFER_LIST_NEXT_NBL(net_buffer_list) != NULL) {\r
@@ -3320,7 +3324,7 @@ ipoib_send_net_buffer_list(
                curr_net_buffer_list = next_net_buffer_list)\r
        {\r
 \r
-       \r
+               ++g_NBL;\r
                next_net_buffer_list = NET_BUFFER_LIST_NEXT_NBL(curr_net_buffer_list);\r
         KeMemoryBarrierWithoutFence();\r
                // Important issue, break the connection between the different nbls\r
@@ -3330,18 +3334,18 @@ ipoib_send_net_buffer_list(
                cl_perf_start( PortSend );\r
                \r
                ipoib_port_send( p_port, curr_net_buffer_list, send_flags);\r
-               cl_perf_stop( &adapter->perf, PortSend );\r
+               cl_perf_stop( &p_adapter->perf, PortSend );\r
        }\r
        ipoib_port_deref( p_port, ref_send_packets );\r
 \r
        cl_perf_stop( &p_adapter->perf, SendPackets );\r
 \r
-       cl_perf_log( &p_adapter->perf, SendBundle, num_packets );\r
+       cl_perf_log( &p_adapter->perf, SendBundle, 1 );\r
 \r
 compl_status:\r
     if (status != NDIS_STATUS_SUCCESS)\r
        {\r
-               //ASSERT(FALSE); //????\r
+\r
                IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                                ("Got bad status \n") );\r
                send_complete_flags = 0;\r
@@ -3350,22 +3354,23 @@ compl_status:
                                 curr_net_buffer_list != NULL;\r
                                 curr_net_buffer_list = next_net_buffer_list)\r
                {\r
+                       ++g_NBL;\r
                        next_net_buffer_list = NET_BUFFER_LIST_NEXT_NBL(curr_net_buffer_list);\r
                        NET_BUFFER_LIST_STATUS(curr_net_buffer_list) = status;\r
                        ipoib_inc_send_stat( p_adapter, IP_STAT_DROPPED, 0 );\r
+                      \r
+                        \r
                }\r
-\r
-\r
+               // Put attention, we complete here the LIST OF NBL at one shot\r
                if (NDIS_TEST_SEND_AT_DISPATCH_LEVEL(send_flags))\r
                {\r
                        ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);\r
                        NDIS_SET_SEND_COMPLETE_FLAG(send_complete_flags, NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL);\r
                }\r
-                     \r
-               NdisMSendNetBufferListsComplete(\r
+               NdisMSendNetBufferListsCompleteX(\r
                        p_adapter->h_adapter,\r
                        net_buffer_list,\r
-                       send_complete_flags);  \r
+                       send_complete_flags); \r
        }\r
        IPOIB_EXIT( IPOIB_DBG_SEND );\r
 }\r
index b10f772..2c83811 100644 (file)
@@ -5302,7 +5302,7 @@ ipoib_port_send(
                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
-               NdisMSendNetBufferListsComplete(\r
+               NdisMSendNetBufferListsCompleteX(\r
                        p_port->p_adapter->h_adapter,\r
                        p_net_buffer_list,\r
                        send_complete_flags);  \r
@@ -5345,7 +5345,7 @@ ipoib_port_send(
                if (s_buf == NULL) {\r
                        ASSERT(FALSE);\r
                        NET_BUFFER_LIST_STATUS(p_net_buffer_list) = NDIS_STATUS_RESOURCES;\r
-                       NdisMSendNetBufferListsComplete(\r
+                       NdisMSendNetBufferListsCompleteX(\r
                                p_port->p_adapter->h_adapter,\r
                                p_net_buffer_list,\r
                                send_complete_flags);   \r
@@ -5421,7 +5421,7 @@ ipoib_port_send(
                \r
                        /* fail net buffer list */\r
                        NET_BUFFER_LIST_STATUS(p_net_buffer_list) = status;\r
-                       NdisMSendNetBufferListsComplete(\r
+                       NdisMSendNetBufferListsCompleteX(\r
                                p_port->p_adapter->h_adapter,\r
                                p_net_buffer_list,\r
                                send_complete_flags);   \r
@@ -5525,11 +5525,11 @@ __send_complete_net_buffer(
                \r
                if (bLock) {\r
                        cl_spinlock_release( &s_buf->p_port->send_lock );\r
-                       NdisMSendNetBufferListsComplete( s_buf->p_port->p_adapter->h_adapter,\r
+                       NdisMSendNetBufferListsCompleteX( s_buf->p_port->p_adapter->h_adapter,\r
                                s_buf->p_nbl, compl_flags );\r
                        cl_spinlock_acquire( &s_buf->p_port->send_lock );  \r
                } else {\r
-                       NdisMSendNetBufferListsComplete( s_buf->p_port->p_adapter->h_adapter,\r
+                       NdisMSendNetBufferListsCompleteX( s_buf->p_port->p_adapter->h_adapter,\r
                                s_buf->p_nbl, compl_flags );\r
                }\r
        }\r
index 9a5dfc4..e468565 100644 (file)
@@ -905,4 +905,30 @@ __port_attr_to_mtu_size(uint32_t value)
                return  256;\r
        }\r
 }\r
+\r
+\r
+\r
+\r
+\r
+#if DBG\r
+// This function is only used to monitor send failures\r
+extern ULONG g_NBL_complete;\r
+static inline VOID NdisMSendNetBufferListsCompleteX(\r
+       IN NDIS_HANDLE  MiniportAdapterHandle,\r
+       IN PNET_BUFFER_LIST  NetBufferLists,\r
+       IN ULONG  SendCompleteFlags\r
+       ) \r
+{\r
+       ASSERT(NET_BUFFER_LIST_NEXT_NBL(NetBufferLists) == NULL);\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
+       ++g_NBL_complete;\r
+       NdisMSendNetBufferListsComplete(MiniportAdapterHandle,NetBufferLists,SendCompleteFlags);\r
+}\r
+#else\r
+#define NdisMSendNetBufferListsCompleteX NdisMSendNetBufferListsComplete\r
+#endif\r
+\r
 #endif /* _IPOIB_PORT_H_ */\r