From e86b9ff8d32e11815a71aa342d7fe664d4a96eaa Mon Sep 17 00:00:00 2001 From: tzachid Date: Mon, 10 Nov 2008 16:56:15 +0000 Subject: [PATCH] [ipoib] Usa a DPC when we poll too much on recv DPC. git-svn-id: svn://openib.tc.cornell.edu/gen1@1744 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- .../trunk/ulp/ipoib/kernel/ipoib_port.c | 54 ++++++++++++++----- .../trunk/ulp/ipoib/kernel/ipoib_port.h | 2 + 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.c b/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.c index f4dc2f9e..fe95ab55 100644 --- a/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.c +++ b/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.c @@ -70,6 +70,11 @@ ipoib_port_t *gp_ipoib_port; static void __port_mcast_garbage_dpc(KDPC *p_gc_dpc,void *context,void *s_arg1, void *s_arg2); static void __port_do_mcast_garbage(ipoib_port_t* const p_port ); + + +static void __recv_cb_dpc(KDPC *p_gc_dpc,void *context,void *s_arg1, void *s_arg2); + + /****************************************************************************** * * Declarations @@ -676,6 +681,10 @@ __port_init( p_adapter->p_ifc->get_err_str( status )) ); return status; } + + KeInitializeDpc(&p_port->recv_dpc,(PKDEFERRED_ROUTINE)__recv_cb_dpc,p_port); + + /* Initialize multicast garbage collector timer and DPC object */ KeInitializeDpc(&p_port->gc_dpc,(PKDEFERRED_ROUTINE)__port_mcast_garbage_dpc,p_port); KeInitializeTimerEx(&p_port->gc_timer,SynchronizationTimer); @@ -1602,6 +1611,22 @@ ipoib_return_packet( IPOIB_EXIT( IPOIB_DBG_RECV ); } +static void __recv_cb_dpc(KDPC *p_gc_dpc,void *context,void * s_arg1 , void * s_arg2) +{ + + ipoib_port_t *p_port = context; + + UNREFERENCED_PARAMETER(p_gc_dpc); + UNREFERENCED_PARAMETER(s_arg1); + UNREFERENCED_PARAMETER(s_arg2); + + + __recv_cb(NULL, p_port); + ipoib_port_deref( p_port, ref_recv_cb ); + + +} + static void __recv_cb( @@ -1666,7 +1691,7 @@ __recv_cb( recv_cnt += __recv_mgr_filter( p_port, p_wc, &done_list, &bad_list ); cl_perf_stop( &p_port->p_adapter->perf, FilterRecv ); - } while( !p_free ); + } while( (!p_free) && (recv_cnt < 128)); /* We're done looking at the endpoint map, release the reference. */ cl_atomic_dec( &p_port->endpt_rdr ); @@ -1745,18 +1770,23 @@ __recv_cb( } while( pkt_cnt ); cl_spinlock_release( &p_port->recv_lock ); - /* - * Rearm after filtering to prevent contention on the enpoint maps - * and eliminate the possibility of having a call to - * __endpt_mgr_insert find a duplicate. - */ - cl_perf_start( RearmRecv ); - status = p_port->p_adapter->p_ifc->rearm_cq( - p_port->ib_mgr.h_recv_cq, FALSE ); - cl_perf_stop( &p_port->p_adapter->perf, RearmRecv ); - CL_ASSERT( status == IB_SUCCESS ); + if (p_free ) { + /* + * Rearm after filtering to prevent contention on the enpoint maps + * and eliminate the possibility of having a call to + * __endpt_mgr_insert find a duplicate. + */ + cl_perf_start( RearmRecv ); + status = p_port->p_adapter->p_ifc->rearm_cq( + p_port->ib_mgr.h_recv_cq, FALSE ); + cl_perf_stop( &p_port->p_adapter->perf, RearmRecv ); + CL_ASSERT( status == IB_SUCCESS ); - ipoib_port_deref( p_port, ref_recv_cb ); + ipoib_port_deref( p_port, ref_recv_cb ); + } else { + // Please note the reference is still up + KeInsertQueueDpc(&p_port->recv_dpc, NULL, NULL); + } cl_perf_stop( &p_port->p_adapter->perf, RecvCb ); diff --git a/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.h b/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.h index 1b708b21..955a5d8a 100644 --- a/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.h +++ b/branches/WOF2-0/trunk/ulp/ipoib/kernel/ipoib_port.h @@ -502,6 +502,8 @@ typedef struct _ipoib_port ipoib_recv_mgr_t recv_mgr; ipoib_send_mgr_t send_mgr; + KDPC recv_dpc; + ipoib_endpt_mgr_t endpt_mgr; ipoib_endpt_t *p_local_endpt; -- 2.41.0