]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
- Fix bug in HCA driver where ib_query_cq would return
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 12 Sep 2005 18:36:50 +0000 (18:36 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 12 Sep 2005 18:36:50 +0000 (18:36 +0000)
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

trunk/core/al/user/ual_cq.c
trunk/hw/mt23108/kernel/hca_verbs.c
trunk/hw/mt23108/user/mlnx_ual_cq.c
trunk/hw/mt23108/user/mlnx_ual_main.h
trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.c
trunk/hw/mt23108/vapi/Hca/hcahal/tavor/thhul_cqm/thhul_cqm.h
trunk/inc/user/iba/ib_uvp.h

index c0ec5a9b2cb02aa82c410da3ebb7507b17a94a7d..968453e6d8b61ce674c69ea140c665a5c3fecdeb 100644 (file)
@@ -305,7 +305,13 @@ ual_query_cq(
        if( h_cq->h_ci_cq && uvp_intf.pre_query_cq )\r
        {\r
                /* Pre call to the UVP library */\r
-               status = uvp_intf.pre_query_cq( h_cq->h_ci_cq, &cq_ioctl.in.umv_buf );\r
+               status = uvp_intf.pre_query_cq(\r
+                       h_cq->h_ci_cq, p_size, &cq_ioctl.in.umv_buf );\r
+               if( status == IB_VERBS_PROCESSING_DONE )\r
+               {\r
+                       AL_EXIT( AL_DBG_CQ );\r
+                       return IB_SUCCESS;\r
+               }\r
                if( status != IB_SUCCESS )\r
                {\r
                        AL_EXIT( AL_DBG_CQ );\r
index 7be9922805fac2fa88c3a59d868106884e4b6e75..993fdbaf89e61cbf85ec89099f1aa6604cee7ea9 100644 (file)
@@ -2130,6 +2130,14 @@ mlnx_query_cq (
                status = IB_INVALID_PARAMETER;\r
                goto cleanup;\r
        }\r
+\r
+       /* Query is fully handled in user-mode. */\r
+       if( p_umv_buf && p_umv_buf->command )\r
+       {\r
+               status = IB_INVALID_CQ_HANDLE;\r
+               goto cleanup;\r
+       }\r
+\r
        VALIDATE_INDEX(hca_idx,   MLNX_MAX_HCA, IB_INVALID_CQ_HANDLE, cleanup);\r
        hobul_p = mlnx_hobul_array[hca_idx];\r
        if (NULL == hobul_p) {\r
@@ -2147,19 +2155,13 @@ mlnx_query_cq (
        cl_mutex_acquire(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
 \r
        hhul_cq_hndl = hobul_p->cq_info_tbl[cq_idx].hhul_cq_hndl;\r
-\r
-       if (HH_OK != THH_hob_query_cq(hobul_p->hh_hndl, cq_num, p_size)) {\r
+       if (HH_OK != THHUL_cqm_query_cq(hobul_p->hhul_hndl, hhul_cq_hndl, p_size)){\r
                status = IB_ERROR;\r
                goto cleanup_locked;\r
        }\r
 \r
        cl_mutex_release(&hobul_p->cq_info_tbl[cq_idx].mutex);\r
 \r
-       if( p_umv_buf && p_umv_buf->command )\r
-       {\r
-               p_umv_buf->output_size = 0;\r
-               p_umv_buf->status = IB_SUCCESS;\r
-       }\r
        CL_EXIT(MLNX_DBG_TRACE, g_mlnx_dbg_lvl);\r
        return IB_SUCCESS;\r
 \r
index 8766be36a3e8263cdee5f627f7550aac782da2e8..b9c11ab260d31b2fd722d11f0ca134193466f6a4 100644 (file)
@@ -48,7 +48,7 @@ mlnx_get_cq_interface (
     p_uvp->pre_create_cq  = mlnx_pre_create_cq;\r
     p_uvp->post_create_cq = mlnx_post_create_cq;\r
   \r
-    p_uvp->pre_query_cq  = NULL;\r
+    p_uvp->pre_query_cq  = mlnx_pre_query_cq;\r
     p_uvp->post_query_cq = NULL;\r
 \r
     p_uvp->pre_resize_cq  = mlnx_pre_resize_cq;\r
@@ -434,26 +434,18 @@ mlnx_post_resize_cq (
 \r
 ib_api_status_t\r
 mlnx_pre_query_cq (\r
-    IN         const ib_cq_handle_t            h_uvp_cq,\r
-    IN OUT     ci_umv_buf_t                            *p_umv_buf)\r
+       IN              const   ib_cq_handle_t          h_uvp_cq,\r
+               OUT                     uint32_t* const         p_size,\r
+       IN      OUT                     ci_umv_buf_t            *p_umv_buf)\r
 {\r
-    FUNC_ENTER;\r
-    CL_ASSERT(p_umv_buf);\r
-    p_umv_buf->command = TRUE;\r
-    FUNC_EXIT;\r
-    return IB_SUCCESS;\r
-}\r
+       mlnx_ual_cq_info_t *p_cq_info = (mlnx_ual_cq_info_t *)((void*) h_uvp_cq);\r
+\r
+       FUNC_ENTER;\r
 \r
+       *p_size = p_cq_info->cq_size;\r
 \r
-void\r
-mlnx_post_query_cq (\r
-    IN         const ib_cq_handle_t            h_uvp_cq,\r
-    IN         ib_api_status_t                 ioctl_status,\r
-    IN OUT     ci_umv_buf_t                    *p_umv_buf)\r
-{\r
-    FUNC_ENTER;\r
-    FUNC_EXIT;\r
-    return;\r
+       FUNC_EXIT;\r
+       return IB_VERBS_PROCESSING_DONE;\r
 }\r
 \r
 \r
index 0c8a94e7723147215d722d6c5c9ecc4f0da1c947..306588d936848f6755debdfb781f06ca23577bec 100644 (file)
@@ -250,14 +250,9 @@ mlnx_post_resize_cq (
 \r
 ib_api_status_t  \r
 mlnx_pre_query_cq (\r
-    IN         const ib_cq_handle_t            h_uvp_cq,\r
-    IN OUT     ci_umv_buf_t                            *p_umv_buf);\r
-\r
-void  \r
-mlnx_post_query_cq (\r
-    IN         const ib_cq_handle_t            h_uvp_cq,\r
-    IN         ib_api_status_t                         ioctl_status,\r
-    IN OUT     ci_umv_buf_t                            *p_umv_buf);\r
+       IN              const   ib_cq_handle_t          h_uvp_cq,\r
+               OUT                     uint32_t* const         p_size,\r
+       IN      OUT                     ci_umv_buf_t            *p_umv_buf);\r
 \r
 ib_api_status_t  \r
 mlnx_pre_destroy_cq (\r
index 7fc764e8b3b33ee0c75fd61fa8ea6faa9053d74a..bcfa30f4fee774aacf2a8db142eff6554950fc04 100644 (file)
@@ -1547,7 +1547,7 @@ THHUL_cqm_count_cqe(
 \r
   /* parameters checks */\r
   if (cq_p == NULL) {\r
-    MTL_ERROR1("THHUL_cqm_peek_cq: NULL CQ handle.\n");\r
+    MTL_ERROR1("THHUL_cqm_count_cqe: NULL CQ handle.\n");\r
     return IB_INVALID_CQ_HANDLE;\r
   }\r
 \r
@@ -1608,6 +1608,29 @@ HH_ret_t THHUL_cqm_peek_cq(
 }\r
 \r
 \r
+HH_ret_t THHUL_cqm_query_cq( \r
+  /*IN*/ HHUL_hca_hndl_t hca_hndl, \r
+  /*IN*/ HHUL_cq_hndl_t cq, \r
+  /*OUT*/ VAPI_cqe_num_t *num_o_cqes_p)\r
+{\r
+  THHUL_cq_t *cq_p= (THHUL_cq_t*)cq;\r
+  HH_ret_t ret=HH_OK;\r
+\r
+  /* parameters checks */\r
+  if (cq_p == NULL) {\r
+    MTL_ERROR1("THHUL_cqm_query_cq: NULL CQ handle.\n");\r
+    return HH_EINVAL_CQ_HNDL;\r
+  }\r
+\r
+  /* Find CQE and check ownership */\r
+  MOSAL_spinlock_dpc_lock(&(cq_p->cq_lock));\r
+    *num_o_cqes_p=   ((1U << cq_p->cur_buf.log2_num_o_cqes) -1 - cq_p->cur_buf.spare_cqes) ;\r
+  \r
+  MOSAL_spinlock_unlock(&(cq_p->cq_lock));    \r
+\r
+  return ret; \r
+}\r
+\r
 static void  rearm_cq(THHUL_cq_t *cq_p, MT_bool solicitedNotification) {\r
         volatile u_int32_t chimeWords[2];\r
         THH_uar_t uar = cq_p->uar;\r
index 4ce3a0a166a86a6081d80040e0f36a6b0d6772d0..170cc137cb40f28084bad00ca30c82f32f0dabeb 100644 (file)
@@ -110,6 +110,12 @@ THHUL_cqm_count_cqe(
                OUT                     uint32_t* const                         p_n_cqes );\r
 #endif\r
 \r
+DLL_API HH_ret_t THHUL_cqm_query_cq( \r
+  /*IN*/ HHUL_hca_hndl_t hca_hndl, \r
+  /*IN*/ HHUL_cq_hndl_t cq, \r
+  /*OUT*/ VAPI_cqe_num_t *num_o_cqes_p\r
+);\r
+\r
 DLL_API HH_ret_t THHUL_cqm_peek_cq( \r
   /*IN*/ HHUL_hca_hndl_t hca_hndl, \r
   /*IN*/ HHUL_cq_hndl_t cq, \r
index d92a977f54e591f0c053021160259b31d2be34f6..93eae057b3aaaeb5871f4ec91d6d62681bfc9398 100644 (file)
@@ -1739,6 +1739,7 @@ typedef void
 typedef ib_api_status_t\r
 (AL_API *uvp_pre_query_cq) (\r
        IN              const   ib_cq_handle_t                          h_uvp_cq,\r
+       IN      OUT                     uint32_t* const                         p_size,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf );\r
 \r
 /*\r
@@ -1752,6 +1753,9 @@ typedef ib_api_status_t
 *      h_uvp_cq\r
 *              [in] Vendor's Handle to the already created CQ (in user-mode library).\r
 *\r
+*      p_size\r
+*              [out] Size of the CQ if processing ends in user-mode.\r
+*\r
 *      p_umv_buf\r
 *              [in out] On input, UAL provides this buffer template.\r
 *              On return from this function, p_umv_buf contains\r
@@ -1765,6 +1769,9 @@ typedef ib_api_status_t
 *              The CQ handle is invalid.\r
 *      IB_INSUFFICIENT_RESOURCES\r
 *              Insufficient resources in Vendor library to complete the call.\r
+*      IB_VERBS_PROCESSING_DONE\r
+*              The UVP fully processed the request.  The post_query_cq handler\r
+*              will not be invoked.\r
 *\r
 * PORTABILITY\r
 *      User mode.\r