[ipoib] Usa a DPC when we poll too much on recv DPC.
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Nov 2008 16:49:06 +0000 (16:49 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Nov 2008 16:49:06 +0000 (16:49 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1743 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_port.c
ulp/ipoib/kernel/ipoib_port.h

index f4dc2f9..fe95ab5 100644 (file)
@@ -70,6 +70,11 @@ ipoib_port_t *gp_ipoib_port;
 \r
 static void __port_mcast_garbage_dpc(KDPC *p_gc_dpc,void *context,void *s_arg1, void *s_arg2);\r
 static void __port_do_mcast_garbage(ipoib_port_t* const        p_port );\r
+\r
+\r
+static void __recv_cb_dpc(KDPC *p_gc_dpc,void *context,void *s_arg1, void *s_arg2);\r
+\r
+\r
 /******************************************************************************\r
 *\r
 * Declarations\r
@@ -676,6 +681,10 @@ __port_init(
                        p_adapter->p_ifc->get_err_str( status )) );\r
                return status;\r
        }\r
+\r
+        KeInitializeDpc(&p_port->recv_dpc,(PKDEFERRED_ROUTINE)__recv_cb_dpc,p_port);\r
+\r
+\r
         /* Initialize multicast garbage collector timer and DPC object */\r
         KeInitializeDpc(&p_port->gc_dpc,(PKDEFERRED_ROUTINE)__port_mcast_garbage_dpc,p_port);\r
         KeInitializeTimerEx(&p_port->gc_timer,SynchronizationTimer);\r
@@ -1602,6 +1611,22 @@ ipoib_return_packet(
        IPOIB_EXIT( IPOIB_DBG_RECV );\r
 }\r
 \r
+static void __recv_cb_dpc(KDPC *p_gc_dpc,void *context,void * s_arg1 , void * s_arg2)\r
+{\r
+\r
+       ipoib_port_t *p_port = context;\r
+\r
+       UNREFERENCED_PARAMETER(p_gc_dpc);\r
+       UNREFERENCED_PARAMETER(s_arg1);\r
+       UNREFERENCED_PARAMETER(s_arg2);\r
+\r
+\r
+       __recv_cb(NULL, p_port);\r
+       ipoib_port_deref( p_port, ref_recv_cb );\r
+\r
+\r
+}\r
+\r
 \r
 static void\r
 __recv_cb(\r
@@ -1666,7 +1691,7 @@ __recv_cb(
                recv_cnt += __recv_mgr_filter( p_port, p_wc, &done_list, &bad_list );\r
                cl_perf_stop( &p_port->p_adapter->perf, FilterRecv );\r
 \r
-       } while( !p_free );\r
+       } while( (!p_free) && (recv_cnt < 128));\r
 \r
        /* We're done looking at the endpoint map, release the reference. */\r
        cl_atomic_dec( &p_port->endpt_rdr );\r
@@ -1745,18 +1770,23 @@ __recv_cb(
        } while( pkt_cnt );\r
        cl_spinlock_release( &p_port->recv_lock );\r
 \r
-       /*\r
-        * Rearm after filtering to prevent contention on the enpoint maps\r
-        * and eliminate the possibility of having a call to\r
-        * __endpt_mgr_insert find a duplicate.\r
-        */\r
-       cl_perf_start( RearmRecv );\r
-       status = p_port->p_adapter->p_ifc->rearm_cq(\r
-               p_port->ib_mgr.h_recv_cq, FALSE );\r
-       cl_perf_stop( &p_port->p_adapter->perf, RearmRecv );\r
-       CL_ASSERT( status == IB_SUCCESS );\r
+       if (p_free ) {\r
+               /*\r
+                * Rearm after filtering to prevent contention on the enpoint maps\r
+                * and eliminate the possibility of having a call to\r
+                * __endpt_mgr_insert find a duplicate.\r
+                */\r
+               cl_perf_start( RearmRecv );\r
+               status = p_port->p_adapter->p_ifc->rearm_cq(\r
+                       p_port->ib_mgr.h_recv_cq, FALSE );\r
+               cl_perf_stop( &p_port->p_adapter->perf, RearmRecv );\r
+               CL_ASSERT( status == IB_SUCCESS );\r
 \r
-       ipoib_port_deref( p_port, ref_recv_cb );\r
+               ipoib_port_deref( p_port, ref_recv_cb );\r
+       } else {\r
+               // Please note the reference is still up\r
+               KeInsertQueueDpc(&p_port->recv_dpc, NULL, NULL);\r
+       }\r
 \r
        cl_perf_stop( &p_port->p_adapter->perf, RecvCb );\r
 \r
index 1b708b2..955a5d8 100644 (file)
@@ -502,6 +502,8 @@ typedef struct _ipoib_port
        ipoib_recv_mgr_t                recv_mgr;\r
        ipoib_send_mgr_t                send_mgr;\r
 \r
+       KDPC                                    recv_dpc;\r
+\r
        ipoib_endpt_mgr_t               endpt_mgr;\r
 \r
        ipoib_endpt_t                   *p_local_endpt;\r