]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[WSD] Minimize allocations of CQ threads.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 26 Jul 2006 22:19:43 +0000 (22:19 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 26 Jul 2006 22:19:43 +0000 (22:19 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@431 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/ulp/wsd/user/ibsp_iblow.c
trunk/ulp/wsd/user/ibspdefines.h

index 3dc8e13b1811fbb36e195d738de7c39061db38ae..de059b94295e8bbe27497f906cad05e188056b01 100644 (file)
@@ -622,6 +622,9 @@ ib_alloc_cq_tinfo(
                cq_tinfo->list_item.p_prev = &cq_tinfo->list_item;\r
        }\r
 \r
+       /* We will be assigned to a QP - set the QP count. */\r
+       cq_tinfo->qp_count = 1;\r
+\r
        /* Upon allocation, the new CQ becomes the primary. */\r
        hca->cq_tinfo = cq_tinfo;\r
 \r
@@ -733,7 +736,7 @@ static struct cq_thread_info *
 ib_acquire_cq_tinfo(\r
                                        struct ibsp_hca                         *hca )\r
 {\r
-       struct cq_thread_info   *cq_tinfo = NULL;\r
+       struct cq_thread_info   *cq_tinfo = NULL, *cq_end;\r
        uint32_t                                cqe_size;\r
        ib_api_status_t                 status;\r
 \r
@@ -745,56 +748,49 @@ ib_acquire_cq_tinfo(
        {\r
                cq_tinfo = ib_alloc_cq_tinfo( hca );\r
                if( !cq_tinfo )\r
-               {\r
-                       IBSP_ERROR_EXIT( ("ib_alloc_cq_tinfo() failed\n") );\r
-                       cl_spinlock_release( &hca->cq_lock );\r
-                       return (NULL);\r
-               }\r
+                       IBSP_ERROR( ("ib_alloc_cq_tinfo() failed\n") );\r
+               cl_spinlock_release( &hca->cq_lock );\r
+               IBSP_EXIT( IBSP_DBG_HW );\r
+               return cq_tinfo;\r
        }\r
-       else\r
-       {\r
-               cq_tinfo = hca->cq_tinfo;\r
-       }\r
-\r
-       CL_ASSERT( cq_tinfo != NULL );\r
 \r
+       cq_tinfo = hca->cq_tinfo;\r
+       cq_end = cq_tinfo;\r
        cqe_size = (cq_tinfo->qp_count + 1) * IB_CQ_SIZE;\r
 \r
-       if( cq_tinfo->cqe_size < cqe_size )\r
+       do\r
        {\r
-               status = ib_modify_cq( cq_tinfo->cq, &cqe_size );\r
-               switch( status )\r
+               if( cq_tinfo->cqe_size >= cqe_size )\r
                {\r
-               case IB_INVALID_CQ_SIZE:\r
-               case IB_UNSUPPORTED:\r
-                       cq_tinfo = ib_alloc_cq_tinfo( hca );\r
-                       if( !cq_tinfo )\r
-                               break;\r
-\r
                        cq_tinfo->qp_count++;\r
-                       break;\r
+                       cl_spinlock_release( &hca->cq_lock );\r
+                       IBSP_EXIT( IBSP_DBG_HW );\r
+                       return (cq_tinfo);\r
+               }\r
 \r
+               status = ib_modify_cq( cq_tinfo->cq, &cqe_size );\r
+               switch( status )\r
+               {\r
                case IB_SUCCESS:\r
                        cq_tinfo->cqe_size = cqe_size;\r
-\r
                        cq_tinfo->qp_count++;\r
-\r
-                       fzprint(("%s():%d:0x%x:0x%x: New cq size=%d.\n",\r
-                                        __FUNCTION__,\r
-                                        __LINE__, GetCurrentProcessId(),\r
-                                        GetCurrentThreadId(), cq_tinfo->cqe_size));\r
                        break;\r
 \r
                default:\r
                        IBSP_ERROR_EXIT(\r
                                ("ib_modify_cq() returned %s\n", ib_get_err_str(status)) );\r
-                       cq_tinfo = NULL;\r
+               case IB_INVALID_CQ_SIZE:\r
+               case IB_UNSUPPORTED:\r
+                       cq_tinfo = PARENT_STRUCT(\r
+                               cl_qlist_next( &cq_tinfo->list_item ), struct cq_thread_info,\r
+                               list_item );\r
+                       cqe_size = (cq_tinfo->qp_count + 1) * IB_CQ_SIZE;\r
                }\r
-       }\r
-       else\r
-       {\r
-               cq_tinfo->qp_count++;\r
-       }\r
+\r
+       } while( cq_tinfo != cq_end );\r
+\r
+       if( cq_tinfo == cq_end )\r
+               cq_tinfo = ib_alloc_cq_tinfo( hca );\r
 \r
        cl_spinlock_release( &hca->cq_lock );\r
        IBSP_EXIT( IBSP_DBG_HW );\r
index b8b197ec9ee2ecffb340760e2b1e62836a9735aa..3af02c3e059030cbda7c79ded287d8af94c087c9 100644 (file)
@@ -77,7 +77,7 @@ C_ASSERT( QP_ATTRIB_RQ_DEPTH <= 256 );
  * for 100 QPs per CQ.\r
  */\r
 #define IB_CQ_SIZE                     (QP_ATTRIB_SQ_DEPTH + QP_ATTRIB_RQ_DEPTH)\r
-#define IB_INIT_CQ_SIZE                (IB_CQ_SIZE * 100)\r
+#define IB_INIT_CQ_SIZE                (IB_CQ_SIZE * 500)\r
 \r
 /* CM timeouts */\r
 #define CM_MIN_LOCAL_TIMEOUT   (18)\r