From: ftillier Date: Mon, 12 Sep 2005 18:36:50 +0000 (+0000) Subject: - Fix bug in HCA driver where ib_query_cq would return X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=78e58ee19c405803964a1fe396b2195fdfaa9df0;p=~shefty%2Frdma-win.git - Fix bug in HCA driver where ib_query_cq would return the total size of the CQ without taking into account spare CQEs. - Add capability for ib_query_cq to be handled fully in user-mode. - Implement support in UVP for query cq to account for spare CQEs. git-svn-id: svn://openib.tc.cornell.edu/gen1@64 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/core/al/user/ual_cq.c b/trunk/core/al/user/ual_cq.c index c0ec5a9b..968453e6 100644 --- a/trunk/core/al/user/ual_cq.c +++ b/trunk/core/al/user/ual_cq.c @@ -305,7 +305,13 @@ ual_query_cq( if( h_cq->h_ci_cq && uvp_intf.pre_query_cq ) { /* Pre call to the UVP library */ - status = uvp_intf.pre_query_cq( h_cq->h_ci_cq, &cq_ioctl.in.umv_buf ); + status = uvp_intf.pre_query_cq( + h_cq->h_ci_cq, p_size, &cq_ioctl.in.umv_buf ); + if( status == IB_VERBS_PROCESSING_DONE ) + { + AL_EXIT( AL_DBG_CQ ); + return IB_SUCCESS; + } if( status != IB_SUCCESS ) { AL_EXIT( AL_DBG_CQ ); diff --git a/trunk/hw/mt23108/kernel/hca_verbs.c b/trunk/hw/mt23108/kernel/hca_verbs.c index 7be99228..993fdbaf 100644 --- a/trunk/hw/mt23108/kernel/hca_verbs.c +++ b/trunk/hw/mt23108/kernel/hca_verbs.c @@ -2130,6 +2130,14 @@ mlnx_query_cq ( status = IB_INVALID_PARAMETER; goto cleanup; } + + /* Query is fully handled in user-mode. */ + if( p_umv_buf && p_umv_buf->command ) + { + status = IB_INVALID_CQ_HANDLE; + goto cleanup; + } + VALIDATE_INDEX(hca_idx, MLNX_MAX_HCA, IB_INVALID_CQ_HANDLE, cleanup); hobul_p = mlnx_hobul_array[hca_idx]; if (NULL == hobul_p) { @@ -2147,19 +2155,13 @@ mlnx_query_cq ( cl_mutex_acquire(&hobul_p->cq_info_tbl[cq_idx].mutex); hhul_cq_hndl = hobul_p->cq_info_tbl[cq_idx].hhul_cq_hndl; - - if (HH_OK != THH_hob_query_cq(hobul_p->hh_hndl, cq_num, p_size)) { + if (HH_OK != THHUL_cqm_query_cq(hobul_p->hhul_hndl, hhul_cq_hndl, p_size)){ status = IB_ERROR; goto cleanup_locked; } cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex); - if( p_umv_buf && p_umv_buf->command ) - { - p_umv_buf->output_size = 0; - p_umv_buf->status = IB_SUCCESS; - } CL_EXIT(MLNX_DBG_TRACE, g_mlnx_dbg_lvl); return IB_SUCCESS; diff --git a/trunk/hw/mt23108/user/mlnx_ual_cq.c b/trunk/hw/mt23108/user/mlnx_ual_cq.c index 8766be36..b9c11ab2 100644 --- a/trunk/hw/mt23108/user/mlnx_ual_cq.c +++ b/trunk/hw/mt23108/user/mlnx_ual_cq.c @@ -48,7 +48,7 @@ mlnx_get_cq_interface ( p_uvp->pre_create_cq = mlnx_pre_create_cq; p_uvp->post_create_cq = mlnx_post_create_cq; - p_uvp->pre_query_cq = NULL; + p_uvp->pre_query_cq = mlnx_pre_query_cq; p_uvp->post_query_cq = NULL; p_uvp->pre_resize_cq = mlnx_pre_resize_cq; @@ -434,26 +434,18 @@ mlnx_post_resize_cq ( ib_api_status_t mlnx_pre_query_cq ( - IN const ib_cq_handle_t h_uvp_cq, - IN OUT ci_umv_buf_t *p_umv_buf) + IN const ib_cq_handle_t h_uvp_cq, + OUT uint32_t* const p_size, + IN OUT ci_umv_buf_t *p_umv_buf) { - FUNC_ENTER; - CL_ASSERT(p_umv_buf); - p_umv_buf->command = TRUE; - FUNC_EXIT; - return IB_SUCCESS; -} + mlnx_ual_cq_info_t *p_cq_info = (mlnx_ual_cq_info_t *)((void*) h_uvp_cq); + + FUNC_ENTER; + *p_size = p_cq_info->cq_size; -void -mlnx_post_query_cq ( - IN const ib_cq_handle_t h_uvp_cq, - IN ib_api_status_t ioctl_status, - IN OUT ci_umv_buf_t *p_umv_buf) -{ - FUNC_ENTER; - FUNC_EXIT; - return; + FUNC_EXIT; + return IB_VERBS_PROCESSING_DONE; } diff --git a/trunk/hw/mt23108/user/mlnx_ual_main.h b/trunk/hw/mt23108/user/mlnx_ual_main.h index 0c8a94e7..306588d9 100644 --- a/trunk/hw/mt23108/user/mlnx_ual_main.h +++ b/trunk/hw/mt23108/user/mlnx_ual_main.h @@ -250,14 +250,9 @@ mlnx_post_resize_cq ( ib_api_status_t mlnx_pre_query_cq ( - IN const ib_cq_handle_t h_uvp_cq, - IN OUT ci_umv_buf_t *p_umv_buf); - -void -mlnx_post_query_cq ( - IN const ib_cq_handle_t h_uvp_cq, - IN ib_api_status_t ioctl_status, - IN OUT ci_umv_buf_t *p_umv_buf); + IN const ib_cq_handle_t h_uvp_cq, + OUT uint32_t* const p_size, + IN OUT ci_umv_buf_t *p_umv_buf); ib_api_status_t mlnx_pre_destroy_cq ( diff --git a/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.c b/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.c index 7fc764e8..bcfa30f4 100644 --- a/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.c +++ b/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.c @@ -1547,7 +1547,7 @@ THHUL_cqm_count_cqe( /* parameters checks */ if (cq_p == NULL) { - MTL_ERROR1("THHUL_cqm_peek_cq: NULL CQ handle.\n"); + MTL_ERROR1("THHUL_cqm_count_cqe: NULL CQ handle.\n"); return IB_INVALID_CQ_HANDLE; } @@ -1608,6 +1608,29 @@ HH_ret_t THHUL_cqm_peek_cq( } +HH_ret_t THHUL_cqm_query_cq( + /*IN*/ HHUL_hca_hndl_t hca_hndl, + /*IN*/ HHUL_cq_hndl_t cq, + /*OUT*/ VAPI_cqe_num_t *num_o_cqes_p) +{ + THHUL_cq_t *cq_p= (THHUL_cq_t*)cq; + HH_ret_t ret=HH_OK; + + /* parameters checks */ + if (cq_p == NULL) { + MTL_ERROR1("THHUL_cqm_query_cq: NULL CQ handle.\n"); + return HH_EINVAL_CQ_HNDL; + } + + /* Find CQE and check ownership */ + MOSAL_spinlock_dpc_lock(&(cq_p->cq_lock)); + *num_o_cqes_p= ((1U << cq_p->cur_buf.log2_num_o_cqes) -1 - cq_p->cur_buf.spare_cqes) ; + + MOSAL_spinlock_unlock(&(cq_p->cq_lock)); + + return ret; +} + static void rearm_cq(THHUL_cq_t *cq_p, MT_bool solicitedNotification) { volatile u_int32_t chimeWords[2]; THH_uar_t uar = cq_p->uar; diff --git a/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.h b/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.h index 4ce3a0a1..170cc137 100644 --- a/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.h +++ b/trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.h @@ -110,6 +110,12 @@ THHUL_cqm_count_cqe( OUT uint32_t* const p_n_cqes ); #endif +DLL_API HH_ret_t THHUL_cqm_query_cq( + /*IN*/ HHUL_hca_hndl_t hca_hndl, + /*IN*/ HHUL_cq_hndl_t cq, + /*OUT*/ VAPI_cqe_num_t *num_o_cqes_p +); + DLL_API HH_ret_t THHUL_cqm_peek_cq( /*IN*/ HHUL_hca_hndl_t hca_hndl, /*IN*/ HHUL_cq_hndl_t cq, diff --git a/trunk/inc/user/iba/ib_uvp.h b/trunk/inc/user/iba/ib_uvp.h index d92a977f..93eae057 100644 --- a/trunk/inc/user/iba/ib_uvp.h +++ b/trunk/inc/user/iba/ib_uvp.h @@ -1739,6 +1739,7 @@ typedef void typedef ib_api_status_t (AL_API *uvp_pre_query_cq) ( IN const ib_cq_handle_t h_uvp_cq, + IN OUT uint32_t* const p_size, IN OUT ci_umv_buf_t *p_umv_buf ); /* @@ -1752,6 +1753,9 @@ typedef ib_api_status_t * h_uvp_cq * [in] Vendor's Handle to the already created CQ (in user-mode library). * +* p_size +* [out] Size of the CQ if processing ends in user-mode. +* * p_umv_buf * [in out] On input, UAL provides this buffer template. * On return from this function, p_umv_buf contains @@ -1765,6 +1769,9 @@ typedef ib_api_status_t * The CQ handle is invalid. * IB_INSUFFICIENT_RESOURCES * Insufficient resources in Vendor library to complete the call. +* IB_VERBS_PROCESSING_DONE +* The UVP fully processed the request. The post_query_cq handler +* will not be invoked. * * PORTABILITY * User mode.