From: ftillier Date: Wed, 26 Jul 2006 22:19:43 +0000 (+0000) Subject: [WSD] Minimize allocations of CQ threads. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=29c235b70d77961570d99bfa882f9a903aa013b3;p=~shefty%2Frdma-win.git [WSD] Minimize allocations of CQ threads. git-svn-id: svn://openib.tc.cornell.edu/gen1@431 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/ulp/wsd/user/ibsp_iblow.c b/trunk/ulp/wsd/user/ibsp_iblow.c index 3dc8e13b..de059b94 100644 --- a/trunk/ulp/wsd/user/ibsp_iblow.c +++ b/trunk/ulp/wsd/user/ibsp_iblow.c @@ -622,6 +622,9 @@ ib_alloc_cq_tinfo( cq_tinfo->list_item.p_prev = &cq_tinfo->list_item; } + /* We will be assigned to a QP - set the QP count. */ + cq_tinfo->qp_count = 1; + /* Upon allocation, the new CQ becomes the primary. */ hca->cq_tinfo = cq_tinfo; @@ -733,7 +736,7 @@ static struct cq_thread_info * ib_acquire_cq_tinfo( struct ibsp_hca *hca ) { - struct cq_thread_info *cq_tinfo = NULL; + struct cq_thread_info *cq_tinfo = NULL, *cq_end; uint32_t cqe_size; ib_api_status_t status; @@ -745,56 +748,49 @@ ib_acquire_cq_tinfo( { cq_tinfo = ib_alloc_cq_tinfo( hca ); if( !cq_tinfo ) - { - IBSP_ERROR_EXIT( ("ib_alloc_cq_tinfo() failed\n") ); - cl_spinlock_release( &hca->cq_lock ); - return (NULL); - } + IBSP_ERROR( ("ib_alloc_cq_tinfo() failed\n") ); + cl_spinlock_release( &hca->cq_lock ); + IBSP_EXIT( IBSP_DBG_HW ); + return cq_tinfo; } - else - { - cq_tinfo = hca->cq_tinfo; - } - - CL_ASSERT( cq_tinfo != NULL ); + cq_tinfo = hca->cq_tinfo; + cq_end = cq_tinfo; cqe_size = (cq_tinfo->qp_count + 1) * IB_CQ_SIZE; - if( cq_tinfo->cqe_size < cqe_size ) + do { - status = ib_modify_cq( cq_tinfo->cq, &cqe_size ); - switch( status ) + if( cq_tinfo->cqe_size >= cqe_size ) { - case IB_INVALID_CQ_SIZE: - case IB_UNSUPPORTED: - cq_tinfo = ib_alloc_cq_tinfo( hca ); - if( !cq_tinfo ) - break; - cq_tinfo->qp_count++; - break; + cl_spinlock_release( &hca->cq_lock ); + IBSP_EXIT( IBSP_DBG_HW ); + return (cq_tinfo); + } + status = ib_modify_cq( cq_tinfo->cq, &cqe_size ); + switch( status ) + { case IB_SUCCESS: cq_tinfo->cqe_size = cqe_size; - cq_tinfo->qp_count++; - - fzprint(("%s():%d:0x%x:0x%x: New cq size=%d.\n", - __FUNCTION__, - __LINE__, GetCurrentProcessId(), - GetCurrentThreadId(), cq_tinfo->cqe_size)); break; default: IBSP_ERROR_EXIT( ("ib_modify_cq() returned %s\n", ib_get_err_str(status)) ); - cq_tinfo = NULL; + case IB_INVALID_CQ_SIZE: + case IB_UNSUPPORTED: + cq_tinfo = PARENT_STRUCT( + cl_qlist_next( &cq_tinfo->list_item ), struct cq_thread_info, + list_item ); + cqe_size = (cq_tinfo->qp_count + 1) * IB_CQ_SIZE; } - } - else - { - cq_tinfo->qp_count++; - } + + } while( cq_tinfo != cq_end ); + + if( cq_tinfo == cq_end ) + cq_tinfo = ib_alloc_cq_tinfo( hca ); cl_spinlock_release( &hca->cq_lock ); IBSP_EXIT( IBSP_DBG_HW ); diff --git a/trunk/ulp/wsd/user/ibspdefines.h b/trunk/ulp/wsd/user/ibspdefines.h index b8b197ec..3af02c3e 100644 --- a/trunk/ulp/wsd/user/ibspdefines.h +++ b/trunk/ulp/wsd/user/ibspdefines.h @@ -77,7 +77,7 @@ C_ASSERT( QP_ATTRIB_RQ_DEPTH <= 256 ); * for 100 QPs per CQ. */ #define IB_CQ_SIZE (QP_ATTRIB_SQ_DEPTH + QP_ATTRIB_RQ_DEPTH) -#define IB_INIT_CQ_SIZE (IB_CQ_SIZE * 100) +#define IB_INIT_CQ_SIZE (IB_CQ_SIZE * 500) /* CM timeouts */ #define CM_MIN_LOCAL_TIMEOUT (18)