]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[IBAL, HCA] Provide HCA driver with UM CA handle for resource
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 10 Mar 2006 17:53:10 +0000 (17:53 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 10 Mar 2006 17:53:10 +0000 (17:53 +0000)
allocation verbs that take a CA handle.

Initially submitted by Leonid Keller (leonid@mellanox.co.il)

git-svn-id: svn://openib.tc.cornell.edu/gen1@237 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/core/al/al_cq.c
trunk/core/al/al_pd.c
trunk/core/al/al_verbs.h
trunk/core/al/kernel/al_ci_ca.c
trunk/hw/mt23108/kernel/hca_data.h
trunk/hw/mt23108/kernel/hca_driver.c
trunk/hw/mt23108/kernel/hca_verbs.c

index 7c527983c9e3dcc99b508880b5175f175027bb7b..6505266bde24c505b3c29c257ce2b4f523fb0074 100644 (file)
@@ -134,7 +134,7 @@ create_cq(
         * the h_cq handle may be destroryed by the client's asynchronous event\r
         * callback routine before call to verbs returns.\r
         */\r
-       status = verbs_create_cq( h_ca, p_cq_create, h_cq );\r
+       status = verbs_create_cq( h_ca, p_cq_create, h_cq, p_umv_buf );\r
        if( status != IB_SUCCESS )\r
        {\r
                h_cq->obj.pfn_destroy( &h_cq->obj, NULL );\r
index 08508712e73d32f66738cc0920a5a49c8b40755a..bce9adb1bc056213ba7ff0bfd70f4ff1f8e05af8 100644 (file)
@@ -125,7 +125,7 @@ alloc_pd(
        case IB_PDT_SQP:\r
        case IB_PDT_UD:\r
                /* Allocate the protection domain. */\r
-               status = verbs_allocate_pd(h_ca, h_pd);\r
+               status = verbs_allocate_pd( h_ca, h_pd, p_umv_buf );\r
                break;\r
 \r
        default:\r
index f5ce6c0d817bcc8c106378db92ace5a2eb908510..44690c7b85753ed0ba69deb35e64d756ffd27011 100644 (file)
@@ -34,6 +34,7 @@
 #define __AL_VERBS_H__\r
 \r
 #include "al_ca.h"\r
+#include "al_cq.h"\r
 #include "al_pd.h"\r
 #include "al_qp.h"\r
 \r
        h_ca->obj.p_ci_ca->verbs.modify_ca( h_ca->obj.p_ci_ca->h_ci_ca,\\r
                port_num, ca_mod, p_port_attr_mod )\r
 \r
-#define verbs_create_cq(h_ca, p_cq_create, h_cq) \\r
-       h_ca->obj.p_ci_ca->verbs.create_cq( h_ca->obj.p_ci_ca->h_ci_ca,\\r
-       h_cq, &p_cq_create->size, &h_cq->h_ci_cq, p_umv_buf )\r
+static inline ib_api_status_t\r
+verbs_create_cq(\r
+       IN              const   ib_ca_handle_t                          h_ca,\r
+       IN      OUT                     ib_cq_create_t* const           p_cq_create,\r
+       IN                              ib_cq_handle_t                          h_cq,\r
+       IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
+{\r
+       return h_ca->obj.p_ci_ca->verbs.create_cq(\r
+               (p_umv_buf) ? h_ca->h_um_ca : h_ca->obj.p_ci_ca->h_ci_ca,\r
+               h_cq, &p_cq_create->size, &h_cq->h_ci_cq, p_umv_buf );\r
+}\r
 \r
 #define verbs_check_cq(h_cq)   ((h_cq)->h_ci_cq)\r
 #define verbs_destroy_cq(h_cq) \\r
        h_qp->obj.p_ci_ca->verbs.bind_mw( h_mw->h_ci_mw,\\r
                h_qp->h_ci_qp, p_mw_bind, p_rkey )\r
 \r
-#define verbs_allocate_pd(h_ca, h_pd) \\r
-       h_ca->obj.p_ci_ca->verbs.allocate_pd(\\r
-                               h_ca->obj.p_ci_ca->h_ci_ca, h_pd->type, &h_pd->h_ci_pd, p_umv_buf )\r
+static inline ib_api_status_t\r
+verbs_allocate_pd(\r
+       IN              const   ib_ca_handle_t                          h_ca,\r
+       IN                              ib_pd_handle_t                          h_pd,\r
+       IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
+{\r
+       return h_ca->obj.p_ci_ca->verbs.allocate_pd(\r
+               (p_umv_buf) ? h_ca->h_um_ca : h_ca->obj.p_ci_ca->h_ci_ca,\r
+               h_pd->type, &h_pd->h_ci_pd, p_umv_buf );\r
+}\r
 \r
 /*\r
  * Reference the hardware PD.\r
@@ -304,6 +320,18 @@ verbs_create_qp(
                h_mcast->obj.p_ci_ca->verbs.detach_mcast( \\r
                        h_mcast->h_ci_mcast )\r
 \r
+static inline ib_api_status_t\r
+verbs_ci_call(\r
+       IN                              ib_ca_handle_t                          h_ca,\r
+       IN              const   void* __ptr64 *         const   handle_array    OPTIONAL,\r
+       IN                              uint32_t                                        num_handles,\r
+       IN                              ib_ci_op_t*                     const   p_ci_op,\r
+       IN                              ci_umv_buf_t*           const   p_umv_buf OPTIONAL )\r
+{\r
+       return h_ca->obj.p_ci_ca->verbs.vendor_call(\r
+               p_umv_buf ? h_ca->h_um_ca : h_ca->obj.p_ci_ca->h_ci_ca,\r
+               handle_array, num_handles, p_ci_op, p_umv_buf );\r
+}\r
 \r
 \r
 #else\r
@@ -338,9 +366,16 @@ verbs_create_qp(
 #define verbs_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod) \\r
        ual_modify_ca(h_ca, port_num, ca_mod, p_port_attr_mod)\r
 \r
-#define verbs_create_cq(h_ca, p_cq_create, h_cq) \\r
-       ual_create_cq(h_ca->obj.p_ci_ca, p_cq_create, h_cq); \\r
-       UNUSED_PARAM( p_umv_buf )\r
+static inline ib_api_status_t\r
+verbs_create_cq(\r
+       IN              const   ib_ca_handle_t                          h_ca,\r
+       IN      OUT                     ib_cq_create_t* const           p_cq_create,\r
+       IN                              ib_cq_handle_t                          h_cq,\r
+       IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
+{\r
+       UNUSED_PARAM( p_umv_buf );\r
+       return ual_create_cq( h_ca->obj.p_ci_ca, p_cq_create, h_cq );\r
+}\r
 \r
 \r
 #define verbs_check_cq(h_cq)   ((h_cq)->h_ci_cq || (h_cq)->obj.hdl)\r
@@ -432,9 +467,15 @@ verbs_create_qp(
 #define verbs_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey) \\r
        ual_bind_mw(h_mw, h_qp, p_mw_bind, p_rkey)\r
 \r
-#define verbs_allocate_pd(h_ca, h_pd) \\r
-       ual_allocate_pd(h_ca, h_pd->type, h_pd); \\r
-       UNUSED_PARAM( p_umv_buf )\r
+static inline ib_api_status_t\r
+verbs_allocate_pd(\r
+       IN              const   ib_ca_handle_t                          h_ca,\r
+       IN                              ib_pd_handle_t                          h_pd,\r
+       IN      OUT                     ci_umv_buf_t* const                     p_umv_buf )\r
+{\r
+       UNUSED_PARAM( p_umv_buf );\r
+       return ual_allocate_pd( h_ca, h_pd->type, h_pd );\r
+}\r
 \r
 /*\r
  * Get an alias to the kernel's hardware PD.\r
index dcac4afae146fe75b2836a38dbcae337d98269e7..8a078d8793e036b9c38d9dc3390b7121f48729ac 100644 (file)
@@ -31,6 +31,7 @@
  */\r
 \r
 #include "al_ci_ca.h"\r
+#include "al_verbs.h"\r
 #include "al_cq.h"\r
 #include "al_debug.h"\r
 #include "al_mad_pool.h"\r
@@ -486,9 +487,8 @@ ci_call(
 \r
        if( h_ca->obj.p_ci_ca->verbs.vendor_call )\r
        {\r
-               status = h_ca->obj.p_ci_ca->verbs.vendor_call(\r
-                       h_ca->obj.p_ci_ca->h_ci_ca, p_handle_array, num_handles,\r
-                       p_ci_op, p_umv_buf );\r
+               status = verbs_ci_call(\r
+                       h_ca, p_handle_array, num_handles, p_ci_op, p_umv_buf );\r
        }\r
        else\r
        {\r
index 15193593c2c5dfb1812a6db3889db569a1223008..89b2093c28bf29d8377f92cdea497a80d90612b2 100644 (file)
@@ -210,6 +210,8 @@ typedef struct _ib_um_ca
        MDL                                     *p_mdl;\r
        void                            *p_mapped_addr;\r
        HH_hca_hndl_t           hh_hndl;\r
+       mlnx_hob_t                      *hob_p;\r
+       /* The next two fields must be grouped together as the are mapped to UM. */\r
        HH_hca_dev_t            dev_info;\r
        uint8_t                         ul_hca_res[1];  // Beginning of UL resource buffer.\r
 \r
index 39fca4b893bba80e215c32fd2a740aa3097ed34a..519251cc9cb384f4f7f70302b79489de36da2137 100644 (file)
@@ -1310,7 +1310,10 @@ fw_access_ctrl(
        UNREFERENCED_PARAMETER(p_umv_buf);\r
 \r
        status =  STATUS_SUCCESS;\r
-       p_hob = (mlnx_hob_t *)(const void *)p_context;\r
+       if( p_umv_buf )\r
+               p_hob = ((mlnx_um_ca_t* __ptr64)p_context)->hob_p;\r
+       else\r
+               p_hob = (mlnx_hob_t *)(const void *)p_context;\r
 \r
        p_dev_obj = (DEVICE_OBJECT *)(const void *)p_hob->p_dev_obj;\r
        p_ci =  p_ci_op;\r
index 63625b2255a56db9316ace40fe035f54631e4866..ca9ce406009dcf506536ad87463419df51df889d 100644 (file)
@@ -520,8 +520,20 @@ mlnx_um_open(
 \r
        if( !p_umv_buf->command )\r
        {\r
+               p_um_ca = (mlnx_um_ca_t*)cl_zalloc( sizeof(mlnx_um_ca_t) );\r
+               if( !p_um_ca )\r
+               {\r
+                       p_umv_buf->status = IB_INSUFFICIENT_MEMORY;\r
+                       goto mlnx_um_open_err1;\r
+               }\r
+               /* Copy the dev info. */\r
+               p_um_ca->dev_info = *hca_ul_info;\r
+               p_um_ca->hob_p = hob_p;\r
+               *ph_um_ca = (ib_ca_handle_t)p_um_ca;\r
                p_umv_buf->status = IB_SUCCESS;\r
-               goto mlnx_um_open_err1;\r
+               p_umv_buf->output_size = 0;\r
+               HCA_EXIT( MLNX_DBG_TRACE );\r
+               return IB_SUCCESS;\r
        }\r
 \r
        /*\r
@@ -582,6 +594,7 @@ mlnx_um_open(
        {\r
                /* Copy the dev info. */\r
                p_um_ca->dev_info = *hca_ul_info;\r
+               p_um_ca->hob_p = hob_p;\r
                *ph_um_ca = (ib_ca_handle_t)p_um_ca;\r
                (*(void** __ptr64)p_umv_buf->p_inout_buf) = p_um_ca->p_mapped_addr;\r
                p_umv_buf->status = IB_SUCCESS;\r
@@ -622,11 +635,15 @@ mlnx_um_close(
        if( !p_um_ca )\r
                return;\r
 \r
+       if( !p_um_ca->p_mapped_addr )\r
+               goto done;\r
+\r
        THH_hob_free_ul_res( hh_hndl, p_um_ca->ul_hca_res );\r
 \r
 mlnx_um_close_cleanup:\r
        MmUnmapLockedPages( p_um_ca->p_mapped_addr, p_um_ca->p_mdl );\r
        IoFreeMdl( p_um_ca->p_mdl );\r
+done:\r
        cl_free( p_um_ca );\r
 \r
        HCA_EXIT( MLNX_DBG_TRACE );\r
@@ -644,7 +661,7 @@ mlnx_allocate_pd (
                OUT                     ib_pd_handle_t                          *ph_pd,\r
        IN      OUT                     ci_umv_buf_t                            *p_umv_buf )\r
 {\r
-       mlnx_hob_t                              *hob_p = (mlnx_hob_t *)h_ca;\r
+       mlnx_hob_t                              *hob_p;\r
        mlnx_hobul_t                    *hobul_p;\r
        HH_hca_dev_t                    *hca_ul_info;\r
        HHUL_pd_hndl_t                  hhul_pd_hndl = 0;\r
@@ -655,6 +672,11 @@ mlnx_allocate_pd (
 \r
        CL_ENTER(MLNX_DBG_TRACE, g_mlnx_dbg_lvl);\r
 \r
+       if( p_umv_buf )\r
+               hob_p = ((mlnx_um_ca_t *)h_ca)->hob_p;\r
+       else\r
+               hob_p = (mlnx_hob_t *)h_ca;\r
+       \r
        hobul_p = mlnx_hobs_get_hobul(hob_p);\r
        if (NULL == hobul_p) {\r
                status = IB_INVALID_CA_HANDLE;\r
@@ -1889,7 +1911,7 @@ mlnx_create_cq (
 {\r
        ib_api_status_t                 status;\r
 \r
-       mlnx_hob_t                              *hob_p = (mlnx_hob_t *)h_ca;\r
+       mlnx_hob_t                              *hob_p;\r
        u_int32_t                               cq_idx;\r
        u_int32_t                               cq_num;\r
        u_int32_t                               cq_size = 0;\r
@@ -1901,6 +1923,11 @@ mlnx_create_cq (
 \r
        CL_ENTER(MLNX_DBG_TRACE, g_mlnx_dbg_lvl);\r
 \r
+       if( p_umv_buf )\r
+               hob_p = ((mlnx_um_ca_t *)h_ca)->hob_p;\r
+       else\r
+               hob_p = (mlnx_hob_t *)h_ca;\r
+\r
        hobul_p = mlnx_hobs_get_hobul(hob_p);\r
        if (NULL == hobul_p) {\r
                status = IB_INVALID_CA_HANDLE;\r