]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[IBAL, MTHCA, MT23108] Fix FMR implementation to properly represent
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 7 Jun 2006 23:52:27 +0000 (23:52 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 7 Jun 2006 23:52:27 +0000 (23:52 +0000)
that it is not IB standard, but rather a Mellanox specific optimization.
Make parameters to the mapping function consistent with physical memory
registration.  Add FMR stubs to MT23108 driver.

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

13 files changed:
trunk/core/al/al_mr.h
trunk/core/al/al_mr_shared.c
trunk/core/al/al_res_mgr.c
trunk/core/al/al_res_mgr.h
trunk/core/al/al_verbs.h
trunk/core/al/kernel/al_mr.c
trunk/core/bus/kernel/bus_pnp.c
trunk/hw/mt23108/kernel/hca_memory.c
trunk/hw/mthca/kernel/hca_memory.c
trunk/inc/iba/ib_al.h
trunk/inc/iba/ib_ci.h
trunk/inc/iba/ib_types.h
trunk/inc/kernel/iba/ib_al_ifc.h

index e3c257d3e00ffc730b8eed811c1d4ea078205422..f64dce424dace5900122a7ae97fd92086d3048ff 100644 (file)
@@ -152,51 +152,25 @@ reg_shmid(
 \r
 \r
 #ifdef CL_KERNEL\r
-\r
-typedef struct _ib_fmr\r
+typedef struct _mlnx_fmr\r
 {\r
        al_obj_t                                        obj;\r
-       ib_fmr_handle_t                         h_ci_fmr;       /* Actual HW handle. */\r
-}      ib_fmr_t;\r
+       mlnx_fmr_handle_t                       h_ci_fmr;       /* Actual HW handle. */\r
+\r
+}      mlnx_fmr_t;\r
+\r
 \r
 cl_status_t\r
-fmr_ctor(\r
+mlnx_fmr_ctor(\r
        IN                              void* const                                     p_object,\r
        IN                              void*                                           context,\r
                OUT                     cl_pool_item_t** const          pp_pool_item );\r
 \r
 \r
 void\r
-fmr_dtor(\r
+mlnx_fmr_dtor(\r
        IN              const   cl_pool_item_t* const           p_pool_item,\r
        IN                              void*                                           context );\r
-\r
-\r
-ib_api_status_t\r
-create_fmr(\r
-       IN              const   ib_pd_handle_t                          h_pd,\r
-       IN              const   ib_fmr_create_t* const          p_fmr_create,\r
-       OUT                             ib_fmr_handle_t* const          ph_fmr );\r
-\r
-\r
-ib_api_status_t\r
-map_phys_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr,\r
-       IN              const   void* __ptr64                                   paddr_list,\r
-       IN              const   int                                                     list_len,\r
-       IN      OUT             void** __ptr64 const                            p_vaddr,\r
-       OUT                     net32_t* const                                  p_lkey,\r
-       OUT                     net32_t* const                                  p_rkey);\r
-\r
-\r
-ib_api_status_t\r
-unmap_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr);\r
-\r
-ib_api_status_t\r
-destroy_fmr(\r
-       IN                              ib_fmr_handle_t const           ph_fmr );\r
-\r
 #endif\r
 \r
 \r
index 101d803194631c342e48332241e8e5a9dda6bef2..27afa988746bb04fcbf29983ba2a401e35666d28 100644 (file)
@@ -50,17 +50,6 @@ __return_mr(
        IN                              al_obj_t                                        *p_obj );\r
 \r
 \r
-#ifdef CL_KERNEL\r
-static void\r
-__cleanup_fmr(\r
-       IN                              struct _al_obj                          *p_obj );\r
-\r
-static void\r
-__return_fmr(\r
-       IN                              al_obj_t                                        *p_obj );\r
-#endif\r
-\r
-\r
 cl_status_t\r
 mr_ctor(\r
        IN                              void* const                                     p_object,\r
@@ -254,22 +243,6 @@ ib_reg_phys(
                OUT                     net32_t* const                          p_lkey,\r
                OUT                     net32_t* const                          p_rkey,\r
                OUT                     ib_mr_handle_t* const           ph_mr )\r
-{\r
-       return reg_phys(\r
-               h_pd, p_phys_create, p_vaddr, p_lkey, p_rkey, ph_mr, FALSE );\r
-}\r
-\r
-\r
-\r
-ib_api_status_t\r
-reg_phys(\r
-       IN              const   ib_pd_handle_t                          h_pd,\r
-       IN              const   ib_phys_create_t* const         p_phys_create,\r
-       IN      OUT                     uint64_t* const                         p_vaddr,\r
-               OUT                     net32_t* const                          p_lkey,\r
-               OUT                     net32_t* const                          p_rkey,\r
-               OUT                     ib_mr_handle_t* const           ph_mr,\r
-       IN                              boolean_t                                       um_call )\r
 {\r
        ib_mr_handle_t                  h_mr;\r
        ib_api_status_t                 status;\r
@@ -409,22 +382,6 @@ ib_rereg_phys(
                OUT                     net32_t* const                          p_lkey,\r
                OUT                     net32_t* const                          p_rkey,\r
        IN              const   ib_pd_handle_t                          h_pd OPTIONAL )\r
-{\r
-       return rereg_phys( h_mr, mr_mod_mask, p_phys_create, p_vaddr, p_lkey,\r
-               p_rkey, h_pd, FALSE );\r
-}\r
-\r
-\r
-ib_api_status_t\r
-rereg_phys(\r
-       IN              const   ib_mr_handle_t                          h_mr,\r
-       IN              const   ib_mr_mod_t                                     mr_mod_mask,\r
-       IN              const   ib_phys_create_t* const         p_phys_create OPTIONAL,\r
-       IN      OUT                     uint64_t* const                         p_vaddr,\r
-               OUT                     uint32_t* const                         p_lkey,\r
-               OUT                     uint32_t* const                         p_rkey,\r
-       IN              const   ib_pd_handle_t                          h_pd OPTIONAL,\r
-       IN                              boolean_t                                       um_call )\r
 {\r
        ib_api_status_t         status;\r
 \r
@@ -669,344 +626,3 @@ ib_query_mr(
        CL_EXIT( AL_DBG_MR, g_al_dbg_lvl );\r
        return status;\r
 }\r
-\r
-\r
-#ifdef CL_KERNEL\r
-cl_status_t\r
-fmr_ctor(\r
-       IN                              void* const                                     p_object,\r
-       IN                              void*                                           context,\r
-               OUT                     cl_pool_item_t** const          pp_pool_item )\r
-{\r
-       ib_api_status_t                 status;\r
-       ib_fmr_handle_t                 h_fmr;\r
-\r
-       UNUSED_PARAM( context );\r
-\r
-       h_fmr = (ib_fmr_handle_t)p_object;\r
-       cl_memclr( h_fmr, sizeof( ib_fmr_t ) );\r
-\r
-       construct_al_obj( &h_fmr->obj, AL_OBJ_TYPE_H_FMR );\r
-       status = init_al_obj( &h_fmr->obj, NULL, FALSE, NULL,\r
-               __cleanup_fmr, __return_fmr );\r
-       if( status != IB_SUCCESS )\r
-       {\r
-               return CL_ERROR;\r
-       }\r
-\r
-       *pp_pool_item = &((ib_fmr_handle_t)p_object)->obj.pool_item;\r
-\r
-       /* Release the reference taken in init_al_obj. */\r
-       deref_al_obj( &h_fmr->obj );\r
-\r
-       return CL_SUCCESS;\r
-}\r
-\r
-\r
-\r
-void\r
-fmr_dtor(\r
-       IN              const   cl_pool_item_t* const           p_pool_item,\r
-       IN                              void*                                           context )\r
-{\r
-       al_obj_t                                *p_obj;\r
-\r
-       UNUSED_PARAM( context );\r
-\r
-       p_obj = PARENT_STRUCT( p_pool_item, al_obj_t, pool_item );\r
-\r
-       /*\r
-        * The FMR is being totally destroyed.  Modify the free_cb to destroy the\r
-        * AL object.\r
-        */\r
-       p_obj->pfn_free = (al_pfn_free_t)destroy_al_obj;\r
-       ref_al_obj( p_obj );\r
-       p_obj->pfn_destroy( p_obj, NULL );\r
-}\r
-\r
-\r
-\r
-static void\r
-__cleanup_fmr(\r
-       IN                              struct _al_obj                          *p_obj )\r
-{\r
-       ib_api_status_t                 status;\r
-       ib_fmr_handle_t                 h_fmr;\r
-\r
-       CL_ASSERT( p_obj );\r
-       h_fmr = PARENT_STRUCT( p_obj, ib_fmr_t, obj );\r
-\r
-       /* Deregister the memory. */\r
-       if( verbs_check_fmr(h_fmr) )\r
-       {\r
-               status = verbs_destroy_fmr( h_fmr);\r
-               CL_ASSERT( status == IB_SUCCESS );\r
-\r
-               h_fmr->h_ci_fmr = NULL;\r
-       }\r
-}\r
-\r
-\r
-\r
-static void\r
-__return_fmr(\r
-       IN                              al_obj_t                                        *p_obj )\r
-{\r
-       ib_fmr_handle_t                 h_fmr;\r
-\r
-       h_fmr = PARENT_STRUCT( p_obj, ib_fmr_t, obj );\r
-       reset_al_obj( p_obj );\r
-       put_fmr( h_fmr );\r
-}\r
-\r
-\r
-\r
-ib_api_status_t\r
-ib_create_fmr(\r
-       IN              const   ib_pd_handle_t                          h_pd,\r
-       IN              const   ib_fmr_create_t*        const           p_fmr_create,\r
-       OUT                             ib_fmr_handle_t*        const           ph_fmr )\r
-{\r
-       ib_api_status_t                 status;\r
-\r
-       CL_ENTER( AL_DBG_MR, g_al_dbg_lvl );\r
-\r
-       if( AL_OBJ_INVALID_HANDLE( h_pd, AL_OBJ_TYPE_H_PD ) )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_PD_HANDLE\n") );\r
-               return IB_INVALID_PD_HANDLE;\r
-       }\r
-\r
-       status = create_fmr( h_pd, p_fmr_create, ph_fmr);\r
-\r
-       /* Release the reference taken in alloc_fmr for initialization. */\r
-       if( status == IB_SUCCESS )\r
-               deref_al_obj( &(*ph_fmr)->obj );\r
-\r
-       AL_EXIT( AL_DBG_MR );\r
-       return status;\r
-}\r
-\r
-\r
-\r
-ib_api_status_t\r
-create_fmr(\r
-       IN              const   ib_pd_handle_t                          h_pd,\r
-       IN              const   ib_fmr_create_t* const          p_fmr_create,\r
-       OUT                             ib_fmr_handle_t* const          ph_fmr)\r
-{\r
-       ib_fmr_handle_t                 h_fmr;\r
-       ib_api_status_t                 status;\r
-\r
-       CL_ENTER( AL_DBG_MR, g_al_dbg_lvl );\r
-\r
-       if( !p_fmr_create || !ph_fmr )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_PARAMETER\n") );\r
-               return IB_INVALID_PARAMETER;\r
-       }\r
-\r
-       /* Get a MR tracking structure. */\r
-       h_fmr = alloc_fmr();\r
-       if( !h_fmr )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl,\r
-                       ("unable to allocate memory handle\n") );\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       status = attach_al_obj( &h_pd->obj, &h_fmr->obj );\r
-       if( status != IB_SUCCESS )\r
-       {\r
-               h_fmr->obj.pfn_destroy( &h_fmr->obj, NULL );\r
-               AL_TRACE_EXIT( AL_DBG_ERROR,\r
-                       ("attach_al_obj returned %s.\n", ib_get_err_str(status)) );\r
-               return status;\r
-       }\r
-\r
-       /* Register the memory region. */\r
-       status = verbs_create_fmr( h_pd, p_fmr_create, h_fmr );\r
-       if( status != IB_SUCCESS )\r
-       {\r
-               h_fmr->obj.pfn_destroy( &h_fmr->obj, NULL );\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl,\r
-                       ("unable to register memory: %s\n", ib_get_err_str(status)) );\r
-               return status;\r
-       }\r
-\r
-       *ph_fmr = h_fmr;\r
-\r
-       CL_EXIT( AL_DBG_MR, g_al_dbg_lvl );\r
-       return IB_SUCCESS;\r
-}\r
-\r
-\r
-ib_api_status_t\r
-ib_map_phys_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr,\r
-       IN              const   void* __ptr64                                   paddr_list,\r
-       IN              const   int                                                     list_len,\r
-       IN      OUT             void** __ptr64 const                            p_vaddr,\r
-       OUT                     net32_t* const                                  p_lkey,\r
-       OUT                     net32_t* const                                  p_rkey)\r
-{\r
-       ib_api_status_t                 status;\r
-\r
-       CL_ENTER( AL_DBG_MR, g_al_dbg_lvl );\r
-\r
-       if( AL_OBJ_INVALID_HANDLE( h_fmr, AL_OBJ_TYPE_H_FMR ) )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
-               return IB_INVALID_FMR_HANDLE;\r
-       }\r
-\r
-       ref_al_obj( &h_fmr->obj );\r
-\r
-       status = map_phys_fmr( h_fmr, paddr_list, list_len, p_vaddr, p_lkey, p_rkey );\r
-\r
-       deref_al_obj( &h_fmr->obj );\r
-\r
-       AL_EXIT( AL_DBG_MR );\r
-       return status;\r
-}\r
-\r
-\r
-\r
-ib_api_status_t\r
-map_phys_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr,\r
-       IN              const   void* __ptr64                                   paddr_list,\r
-       IN              const   int                                                     list_len,\r
-       IN      OUT             void** __ptr64 const                            p_vaddr,\r
-       OUT                     net32_t* const                                  p_lkey,\r
-       OUT                     net32_t* const                                  p_rkey)\r
-{\r
-               ib_api_status_t                 status;\r
-\r
-       CL_ENTER( AL_DBG_MR, g_al_dbg_lvl );\r
-\r
-       if( !paddr_list || !p_vaddr  || !p_lkey || !p_rkey)\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_PARAMETER\n") );\r
-               return IB_INVALID_PARAMETER;\r
-       }\r
-\r
-       /* Register the memory region. */\r
-       status = verbs_map_phys_fmr( h_fmr, paddr_list, list_len, p_vaddr, p_lkey, p_rkey);\r
-       if( status != IB_SUCCESS )\r
-       {\r
-               //TODO: do we need to do something more about the error ?\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl,\r
-                       ("unable to map FMR: %s\n", ib_get_err_str(status)) );\r
-               return status;\r
-       }\r
-\r
-\r
-       CL_EXIT( AL_DBG_MR, g_al_dbg_lvl );\r
-       return IB_SUCCESS;\r
-}\r
-\r
-ib_api_status_t\r
-ib_unmap_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr)\r
-{\r
-       ib_api_status_t         status;\r
-\r
-       CL_ENTER( AL_DBG_MR, g_al_dbg_lvl );\r
-\r
-       if( AL_OBJ_INVALID_HANDLE( h_fmr, AL_OBJ_TYPE_H_FMR ) )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
-               return IB_INVALID_FMR_HANDLE;\r
-       }\r
-\r
-       ref_al_obj( &h_fmr->obj );\r
-\r
-       status = unmap_fmr( h_fmr );\r
-\r
-       deref_al_obj( &h_fmr->obj );\r
-\r
-       CL_EXIT( AL_DBG_MR, g_al_dbg_lvl );\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-unmap_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr)\r
-{\r
-       ib_api_status_t         status;\r
-\r
-       AL_ENTER( AL_DBG_MR );\r
-\r
-       if( !verbs_check_fmr(h_fmr) )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
-               return IB_INVALID_FMR_HANDLE;\r
-       }\r
-\r
-       status = verbs_unmap_fmr(h_fmr);\r
-\r
-       CL_EXIT( AL_DBG_MR, g_al_dbg_lvl );\r
-       return status;\r
-}\r
-\r
-\r
-ib_api_status_t\r
-ib_destroy_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr )\r
-{\r
-       ib_api_status_t         status;\r
-\r
-       CL_ENTER( AL_DBG_MR, g_al_dbg_lvl );\r
-\r
-       if( AL_OBJ_INVALID_HANDLE( h_fmr, AL_OBJ_TYPE_H_FMR ) )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
-               return IB_INVALID_FMR_HANDLE;\r
-       }\r
-\r
-       ref_al_obj( &h_fmr->obj );\r
-\r
-       status = destroy_fmr( h_fmr );\r
-       if( status != IB_SUCCESS )\r
-               deref_al_obj( &h_fmr->obj );\r
-\r
-       CL_EXIT( AL_DBG_MR, g_al_dbg_lvl );\r
-       return status;\r
-}\r
-\r
-\r
-\r
-ib_api_status_t\r
-destroy_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr )\r
-{\r
-       ib_api_status_t         status;\r
-\r
-       AL_ENTER( AL_DBG_MR );\r
-\r
-       if( !verbs_check_fmr(h_fmr) )\r
-       {\r
-               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
-               return IB_INVALID_FMR_HANDLE;\r
-       }\r
-\r
-       /* FMR's are destroyed synchronously */\r
-       status = verbs_destroy_fmr(h_fmr);\r
-\r
-       if( status == IB_SUCCESS )\r
-       {\r
-               h_fmr->h_ci_fmr = NULL;\r
-               /* We're good to destroy the object. */\r
-               h_fmr->obj.pfn_destroy( &h_fmr->obj, NULL );\r
-       }\r
-\r
-       CL_EXIT( AL_DBG_MR, g_al_dbg_lvl );\r
-       return status;\r
-}\r
-\r
-\r
-\r
-#endif\r
-\r
-\r
index 2656564af90eecc055266e53617d52a30fd5ccbf..98a2684511851adfe93b368d64acd377e0deab2c 100644 (file)
@@ -41,7 +41,7 @@
 #define AL_MR_POOL_SIZE                        (4096 / sizeof( ib_mr_t ))\r
 #define AL_AV_POOL_SIZE                        (4096 / sizeof( ib_av_t ))\r
 #ifdef CL_KERNEL\r
-#define AL_FMR_POOL_SIZE                       (4096 / sizeof( ib_fmr_t ))\r
+#define AL_FMR_POOL_SIZE               (4096 / sizeof( mlnx_fmr_t ))\r
 #endif\r
 \r
 al_res_mgr_t                   *gp_res_mgr;\r
@@ -114,8 +114,8 @@ create_res_mgr(
 #ifdef CL_KERNEL\r
        /* Initialize the pool of fast memory regions. */\r
        cl_status = cl_qpool_init( &gp_res_mgr->fmr_pool,\r
-               AL_FMR_POOL_SIZE, 0, AL_FMR_POOL_SIZE, sizeof( ib_fmr_t ),\r
-               fmr_ctor, fmr_dtor, gp_res_mgr );\r
+               AL_FMR_POOL_SIZE, 0, AL_FMR_POOL_SIZE, sizeof(mlnx_fmr_t),\r
+               mlnx_fmr_ctor, mlnx_fmr_dtor, gp_res_mgr );\r
        if( cl_status != CL_SUCCESS )\r
        {\r
                gp_res_mgr->obj.pfn_destroy( &gp_res_mgr->obj, NULL );\r
@@ -198,13 +198,13 @@ put_mr(
        deref_al_obj( &gp_res_mgr->obj );\r
 }\r
 \r
-#ifdef CL_KERNEL\r
 \r
+#ifdef CL_KERNEL\r
 /*\r
  * Get a fast memory region structure to track registration requests.\r
  */\r
-ib_fmr_handle_t\r
-alloc_fmr()\r
+mlnx_fmr_handle_t\r
+alloc_mlnx_fmr()\r
 {\r
        al_obj_t                                *p_obj;\r
        cl_pool_item_t                  *p_pool_item;\r
@@ -227,7 +227,7 @@ alloc_fmr()
         */\r
        ref_al_obj( p_obj );\r
 \r
-       return PARENT_STRUCT( p_obj, ib_fmr_t, obj );\r
+       return PARENT_STRUCT( p_obj, mlnx_fmr_t, obj );\r
 }\r
 \r
 \r
@@ -236,17 +236,17 @@ alloc_fmr()
  * Return a memory region structure to the available pool.\r
  */\r
 void\r
-put_fmr(\r
-       IN                              ib_fmr_handle_t                         h_fmr )\r
+put_mlnx_fmr(\r
+       IN                              mlnx_fmr_handle_t                       h_fmr )\r
 {\r
        cl_spinlock_acquire( &gp_res_mgr->obj.lock );\r
        cl_qpool_put( &gp_res_mgr->fmr_pool, &h_fmr->obj.pool_item );\r
        cl_spinlock_release( &gp_res_mgr->obj.lock );\r
        deref_al_obj( &gp_res_mgr->obj );\r
 }\r
-\r
 #endif\r
 \r
+\r
 /*\r
  * Get an address vector from the available pool.\r
  */\r
index 812cc9eca500633f5dc9facd8cc9358e1fe39010..0ceac0f30fb3833ff937cdd2a9c8ada74b9c8edc 100644 (file)
@@ -57,6 +57,7 @@ typedef struct _al_res_mgr
 #ifdef CL_KERNEL\r
        cl_qpool_t                                      fmr_pool;\r
 #endif\r
+\r
 }      al_res_mgr_t;\r
 \r
 \r
@@ -75,14 +76,13 @@ put_mr(
        IN                              ib_mr_handle_t                          h_mr );\r
 \r
 #ifdef CL_KERNEL\r
-ib_fmr_handle_t\r
-alloc_fmr(void);\r
+mlnx_fmr_handle_t\r
+alloc_mlnx_fmr(void);\r
 \r
 \r
 void\r
-put_fmr(\r
-       IN                              ib_fmr_handle_t                         h_fmr );\r
-\r
+put_mlnx_fmr(\r
+       IN                              mlnx_fmr_handle_t                       h_fmr );\r
 #endif\r
 \r
 ib_av_handle_t\r
index 69084e97302c6b18da1e1aab71aa67cb82c89c5c..33b3705f20390beb9d09c3d7502eac1d270744c0 100644 (file)
@@ -118,11 +118,10 @@ verbs_create_cq(
 #define verbs_register_pmr(h_pd, p_phys_create, p_vaddr,\\r
                                p_lkey, p_rkey, h_mr) \\r
        h_mr->obj.p_ci_ca->verbs.register_pmr( h_pd->h_ci_pd,\\r
-               p_phys_create, p_vaddr, p_lkey, p_rkey, &h_mr->h_ci_mr,\\r
-               um_call )\r
+               p_phys_create, p_vaddr, p_lkey, p_rkey, &h_mr->h_ci_mr, FALSE )\r
 \r
 #define verbs_check_mr(h_mr)   ((h_mr)->h_ci_mr)\r
-#define verbs_check_fmr(h_fmr) ((h_fmr)->h_ci_fmr)\r
+#define verbs_check_mlnx_fmr(h_fmr)    ((h_fmr)->h_ci_fmr)\r
 #define verbs_deregister_mr(h_mr) \\r
        h_mr->obj.p_ci_ca->verbs.deregister_mr( h_mr->h_ci_mr )\r
 \r
@@ -152,7 +151,7 @@ verbs_create_cq(
        p_vaddr, p_lkey, p_rkey, h_pd ) \\r
                h_mr->obj.p_ci_ca->verbs.modify_pmr( h_mr->h_ci_mr, mr_modify_mask, \\r
                        p_pmr_create, p_vaddr, p_lkey, p_rkey, \\r
-                       h_pd ? h_pd->h_ci_pd : NULL, um_call )\r
+                       h_pd ? h_pd->h_ci_pd : NULL, FALSE )\r
 \r
 #define verbs_register_smr(h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
        p_rkey, ph_mr ) \\r
@@ -160,19 +159,19 @@ verbs_create_cq(
                        access_ctrl, p_vaddr, p_lkey, p_rkey, &(ph_mr->h_ci_mr), \\r
                        um_call )\r
 \r
-#define verbs_create_fmr(h_pd, p_fmr_create, h_fmr) \\r
-       h_fmr->obj.p_ci_ca->verbs.alloc_fmr( h_pd->h_ci_pd,\\r
-               p_fmr_create, &h_fmr->h_ci_fmr)\r
+#define verbs_create_mlnx_fmr(h_pd, p_fmr_create, h_fmr ) \\r
+       h_fmr->obj.p_ci_ca->verbs.alloc_mlnx_fmr( h_pd->h_ci_pd,\\r
+               p_fmr_create, &h_fmr->h_ci_fmr )\r
 \r
-#define verbs_map_phys_fmr( h_fmr, plist_addr, list_len, p_vaddr, p_lkey, p_rkey) \\r
-       h_fmr->obj.p_ci_ca->verbs.map_phys_fmr( h_fmr->h_ci_fmr,\\r
-               plist_addr, list_len, p_vaddr, p_lkey, p_rkey)\r
+#define verbs_map_phys_mlnx_fmr( h_fmr, plist_addr, list_len, p_vaddr, p_lkey, p_rkey) \\r
+       h_fmr->obj.p_ci_ca->verbs.map_phys_mlnx_fmr( h_fmr->h_ci_fmr,\\r
+               plist_addr, list_len, p_vaddr, p_lkey, p_rkey )\r
 \r
-#define verbs_unmap_fmr( h_fmr) \\r
-       h_fmr->obj.p_ci_ca->verbs.unmap_fmr( h_fmr->h_ci_fmr)\r
+#define verbs_unmap_mlnx_fmr( h_fmr ) \\r
+       h_fmr->obj.p_ci_ca->verbs.unmap_mlnx_fmr( h_fmr->h_ci_fmr)\r
 \r
-#define verbs_destroy_fmr(h_fmr) \\r
-       h_fmr->obj.p_ci_ca->verbs.dealloc_fmr(h_fmr->h_ci_fmr)\r
+#define verbs_destroy_mlnx_fmr( h_fmr ) \\r
+       h_fmr->obj.p_ci_ca->verbs.dealloc_mlnx_fmr( h_fmr->h_ci_fmr )\r
        \r
 \r
 #define verbs_create_mw(h_pd, p_rkey, h_mw) \\r
@@ -429,8 +428,7 @@ verbs_create_cq(
        UNUSED_PARAM( p_vaddr ); \\r
        UNUSED_PARAM( p_lkey ); \\r
        UNUSED_PARAM( p_rkey ); \\r
-       UNUSED_PARAM( h_mr ); \\r
-       UNUSED_PARAM( um_call )\r
+       UNUSED_PARAM( h_mr )\r
 \r
 #define verbs_check_mr(h_mr)   ((h_mr)->h_ci_mr || (h_mr)->obj.hdl)\r
 #define verbs_deregister_mr(h_mr) \\r
@@ -457,8 +455,7 @@ verbs_create_cq(
                UNUSED_PARAM( p_vaddr ); \\r
                UNUSED_PARAM( p_lkey ); \\r
                UNUSED_PARAM( p_rkey ); \\r
-               UNUSED_PARAM( h_pd ); \\r
-               UNUSED_PARAM( um_call )\r
+               UNUSED_PARAM( h_pd )\r
 \r
 #define verbs_register_smr(h_mr, h_pd, access_ctrl, p_vaddr, p_lkey, \\r
        p_rkey, ph_mr ) \\r
index 8a30f3a62e67fc6303009896f795b924dddd8ab9..611c3e1b2ffc4025939edd58aa1a77eb5dc5ddac 100644 (file)
 #include "ib_common.h"\r
 \r
 \r
+static void\r
+__cleanup_mlnx_fmr(\r
+       IN                              struct _al_obj                          *p_obj );\r
+\r
+static void\r
+__return_mlnx_fmr(\r
+       IN                              al_obj_t                                        *p_obj );\r
+\r
+\r
 static al_shmid_t*\r
 __create_shmid(\r
        IN              const   int                                                     shmid );\r
@@ -50,6 +59,258 @@ __free_shmid(
        IN                              struct _al_obj                          *p_obj );\r
 \r
 \r
+cl_status_t\r
+mlnx_fmr_ctor(\r
+       IN                              void* const                                     p_object,\r
+       IN                              void*                                           context,\r
+               OUT                     cl_pool_item_t** const          pp_pool_item )\r
+{\r
+       ib_api_status_t                 status;\r
+       mlnx_fmr_handle_t                       h_fmr;\r
+\r
+       UNUSED_PARAM( context );\r
+\r
+       h_fmr = (mlnx_fmr_handle_t)p_object;\r
+       cl_memclr( h_fmr, sizeof(mlnx_fmr_t) );\r
+\r
+       construct_al_obj( &h_fmr->obj, AL_OBJ_TYPE_H_FMR );\r
+       status = init_al_obj( &h_fmr->obj, NULL, FALSE, NULL,\r
+               __cleanup_mlnx_fmr, __return_mlnx_fmr );\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               return CL_ERROR;\r
+       }\r
+\r
+       *pp_pool_item = &((mlnx_fmr_handle_t)p_object)->obj.pool_item;\r
+\r
+       /* Release the reference taken in init_al_obj. */\r
+       deref_al_obj( &h_fmr->obj );\r
+\r
+       return CL_SUCCESS;\r
+}\r
+\r
+\r
+\r
+void\r
+mlnx_fmr_dtor(\r
+       IN              const   cl_pool_item_t* const           p_pool_item,\r
+       IN                              void*                                           context )\r
+{\r
+       al_obj_t                                *p_obj;\r
+\r
+       UNUSED_PARAM( context );\r
+\r
+       p_obj = PARENT_STRUCT( p_pool_item, al_obj_t, pool_item );\r
+\r
+       /*\r
+        * The FMR is being totally destroyed.  Modify the free_cb to destroy the\r
+        * AL object.\r
+        */\r
+       p_obj->pfn_free = (al_pfn_free_t)destroy_al_obj;\r
+       ref_al_obj( p_obj );\r
+       p_obj->pfn_destroy( p_obj, NULL );\r
+}\r
+\r
+\r
+\r
+static void\r
+__cleanup_mlnx_fmr(\r
+       IN                              struct _al_obj                          *p_obj )\r
+{\r
+       ib_api_status_t                 status;\r
+       mlnx_fmr_handle_t                       h_fmr;\r
+\r
+       CL_ASSERT( p_obj );\r
+       h_fmr = PARENT_STRUCT( p_obj, mlnx_fmr_t, obj );\r
+\r
+       /* Deregister the memory. */\r
+       if( verbs_check_mlnx_fmr( h_fmr ) )\r
+       {\r
+               status = verbs_destroy_mlnx_fmr( h_fmr );\r
+               CL_ASSERT( status == IB_SUCCESS );\r
+\r
+               h_fmr->h_ci_fmr = NULL;\r
+       }\r
+}\r
+\r
+\r
+\r
+static void\r
+__return_mlnx_fmr(\r
+       IN                              al_obj_t                                        *p_obj )\r
+{\r
+       mlnx_fmr_handle_t                       h_fmr;\r
+\r
+       h_fmr = PARENT_STRUCT( p_obj, mlnx_fmr_t, obj );\r
+       reset_al_obj( p_obj );\r
+       put_mlnx_fmr( h_fmr );\r
+}\r
+\r
+\r
+\r
+ib_api_status_t\r
+mlnx_create_fmr(\r
+       IN              const   ib_pd_handle_t                          h_pd,\r
+       IN              const   mlnx_fmr_create_t*      const   p_fmr_create,\r
+       OUT                             mlnx_fmr_handle_t*      const   ph_fmr )\r
+{\r
+       mlnx_fmr_handle_t               h_fmr;\r
+       ib_api_status_t                 status;\r
+\r
+       AL_ENTER( AL_DBG_MR );\r
+\r
+       if( AL_OBJ_INVALID_HANDLE( h_pd, AL_OBJ_TYPE_H_PD ) )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_PD_HANDLE\n") );\r
+               return IB_INVALID_PD_HANDLE;\r
+       }\r
+\r
+       if( !p_fmr_create || !ph_fmr )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_PARAMETER\n") );\r
+               return IB_INVALID_PARAMETER;\r
+       }\r
+\r
+       /* Get a MR tracking structure. */\r
+       h_fmr = alloc_mlnx_fmr();\r
+       if( !h_fmr )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl,\r
+                       ("unable to allocate memory handle\n") );\r
+               return IB_INSUFFICIENT_MEMORY;\r
+       }\r
+\r
+       status = attach_al_obj( &h_pd->obj, &h_fmr->obj );\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               h_fmr->obj.pfn_destroy( &h_fmr->obj, NULL );\r
+               AL_TRACE_EXIT( AL_DBG_ERROR,\r
+                       ("attach_al_obj returned %s.\n", ib_get_err_str(status)) );\r
+               return status;\r
+       }\r
+\r
+       /* Register the memory region. */\r
+       status = verbs_create_mlnx_fmr( h_pd, p_fmr_create, h_fmr );\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               h_fmr->obj.pfn_destroy( &h_fmr->obj, NULL );\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl,\r
+                       ("unable to register memory: %s\n", ib_get_err_str(status)) );\r
+               return status;\r
+       }\r
+\r
+       *ph_fmr = h_fmr;\r
+       deref_al_obj( &(*ph_fmr )->obj );\r
+\r
+       AL_EXIT( AL_DBG_MR );\r
+       return IB_SUCCESS;\r
+}\r
+\r
+\r
+ib_api_status_t\r
+mlnx_map_phys_fmr(\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr,\r
+       IN              const   uint64_t* const                         paddr_list,\r
+       IN              const   int                                                     list_len,\r
+       IN      OUT                     uint64_t* const                         p_vaddr,\r
+               OUT                     net32_t* const                          p_lkey,\r
+               OUT                     net32_t* const                          p_rkey)\r
+{\r
+       ib_api_status_t                 status;\r
+\r
+       AL_ENTER( AL_DBG_MR );\r
+\r
+       if( AL_OBJ_INVALID_HANDLE( h_fmr, AL_OBJ_TYPE_H_FMR ) )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
+               return IB_INVALID_FMR_HANDLE;\r
+       }\r
+\r
+       if( !paddr_list || !p_vaddr  || !p_lkey || !p_rkey )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_PARAMETER\n") );\r
+               return IB_INVALID_PARAMETER;\r
+       }\r
+\r
+       ref_al_obj( &h_fmr->obj );\r
+\r
+       /* Register the memory region. */\r
+       status = verbs_map_phys_mlnx_fmr( h_fmr, paddr_list, list_len, p_vaddr, p_lkey, p_rkey);\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               //TODO: do we need to do something more about the error ?\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl,\r
+                       ("unable to map FMR: %s\n", ib_get_err_str(status)) );\r
+       }\r
+\r
+       deref_al_obj( &h_fmr->obj );\r
+\r
+       AL_EXIT( AL_DBG_MR );\r
+       return status;\r
+}\r
+\r
+\r
+ib_api_status_t\r
+mlnx_unmap_fmr(\r
+       IN              const   mlnx_fmr_handle_t                               h_fmr )\r
+{\r
+       ib_api_status_t         status;\r
+\r
+       AL_ENTER( AL_DBG_MR );\r
+\r
+       if( AL_OBJ_INVALID_HANDLE( h_fmr, AL_OBJ_TYPE_H_FMR ) )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
+               return IB_INVALID_FMR_HANDLE;\r
+       }\r
+\r
+       ref_al_obj( &h_fmr->obj );\r
+       status = verbs_unmap_mlnx_fmr( h_fmr );\r
+       deref_al_obj( &h_fmr->obj );\r
+\r
+       AL_EXIT( AL_DBG_MR );\r
+       return status;\r
+}\r
+\r
+\r
+ib_api_status_t\r
+mlnx_destroy_fmr(\r
+       IN              const   mlnx_fmr_handle_t                               h_fmr )\r
+{\r
+       ib_api_status_t         status;\r
+\r
+       AL_ENTER( AL_DBG_MR );\r
+\r
+       if( AL_OBJ_INVALID_HANDLE( h_fmr, AL_OBJ_TYPE_H_FMR ) )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
+               return IB_INVALID_FMR_HANDLE;\r
+       }\r
+\r
+       if( !verbs_check_mlnx_fmr( h_fmr ) )\r
+       {\r
+               CL_TRACE_EXIT( AL_DBG_ERROR, g_al_dbg_lvl, ("IB_INVALID_FMR_HANDLE\n") );\r
+               return IB_INVALID_FMR_HANDLE;\r
+       }\r
+\r
+       ref_al_obj( &h_fmr->obj );\r
+\r
+       /* FMR's are destroyed synchronously */\r
+       status = verbs_destroy_mlnx_fmr( h_fmr );\r
+\r
+       if( status == IB_SUCCESS )\r
+       {\r
+               h_fmr->h_ci_fmr = NULL;\r
+               /* We're good to destroy the object. */\r
+               h_fmr->obj.pfn_destroy( &h_fmr->obj, NULL );\r
+       }\r
+       deref_al_obj( &h_fmr->obj );\r
+\r
+       AL_EXIT( AL_DBG_MR );\r
+       return status;\r
+}\r
+\r
+\r
 \r
 ib_api_status_t\r
 ib_create_shmid(\r
index 816bf9f2e5e29c15c8d46d7a8bf2277bcbac8b51..2ff55a8547c1487f2434dc686d5f0dcac6249b17 100644 (file)
@@ -674,10 +674,10 @@ al_set_ifc(
        p_ifc->close_al = ib_close_al;\r
        p_ifc->get_err_str = ib_get_err_str;\r
        p_ifc->get_wc_status_str = ib_get_wc_status_str;\r
-       p_ifc->create_fmr = ib_create_fmr;\r
-       p_ifc->map_phys_fmr = ib_map_phys_fmr;\r
-       p_ifc->unmap_fmr = ib_unmap_fmr;\r
-       p_ifc->destroy_fmr = ib_destroy_fmr;\r
+       p_ifc->create_mlnx_fmr = mlnx_create_fmr;\r
+       p_ifc->map_phys_mlnx_fmr = mlnx_map_phys_fmr;\r
+       p_ifc->unmap_mlnx_fmr = mlnx_unmap_fmr;\r
+       p_ifc->destroy_mlnx_fmr = mlnx_destroy_fmr;\r
 \r
        BUS_EXIT( BUS_DBG_PNP );\r
 }\r
index f20ed9a8fd05d6d1aaa2176b2f1d9ff106868535..0250f126bcbd1f53838ab67fae16c1ba124ceaf7 100644 (file)
@@ -691,6 +691,61 @@ cleanup:
        return status;\r
 }\r
 \r
+\r
+\r
+ib_api_status_t\r
+mlnx_alloc_fmr(\r
+       IN              const   ib_pd_handle_t                          h_pd,\r
+       IN              const   mlnx_fmr_create_t* const        p_fmr_create,\r
+               OUT                     mlnx_fmr_handle_t*      const   ph_fmr\r
+       )\r
+{\r
+       UNUSED_PARAM( h_pd );\r
+       UNUSED_PARAM( p_fmr_create );\r
+       UNUSED_PARAM( ph_fmr );\r
+       return IB_UNSUPPORTED;\r
+}\r
+\r
+\r
+ib_api_status_t\r
+mlnx_map_phys_fmr (\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr,\r
+       IN              const   uint64_t* const                         page_list,\r
+       IN              const   int                                                     list_len,\r
+       IN      OUT                     uint64_t* const                         p_vaddr,\r
+               OUT                     net32_t* const                          p_lkey,\r
+               OUT                     net32_t* const                          p_rkey\r
+       )\r
+{\r
+       UNUSED_PARAM( h_fmr );\r
+       UNUSED_PARAM( page_list );\r
+       UNUSED_PARAM( list_len );\r
+       UNUSED_PARAM( p_vaddr );\r
+       UNUSED_PARAM( p_lkey );\r
+       UNUSED_PARAM( p_rkey );\r
+       return IB_UNSUPPORTED;\r
+}\r
+\r
+\r
+ib_api_status_t\r
+mlnx_unmap_fmr (\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr)\r
+{\r
+       UNUSED_PARAM( h_fmr );\r
+       return IB_UNSUPPORTED;\r
+}\r
+\r
+\r
+ib_api_status_t\r
+mlnx_dealloc_fmr (\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr\r
+       )\r
+{\r
+       UNUSED_PARAM( h_fmr );\r
+       return IB_UNSUPPORTED;\r
+}\r
+\r
+\r
 /*\r
 *      Memory Window Verbs.\r
 */\r
@@ -912,6 +967,11 @@ mlnx_memory_if(
        p_interface->register_smr = mlnx_register_smr;\r
        p_interface->deregister_mr = mlnx_deregister_mr;\r
 \r
+       p_interface->alloc_mlnx_fmr = mlnx_alloc_fmr;\r
+       p_interface->map_phys_mlnx_fmr = mlnx_map_phys_fmr;\r
+       p_interface->unmap_mlnx_fmr = mlnx_unmap_fmr;\r
+       p_interface->dealloc_mlnx_fmr = mlnx_dealloc_fmr;\r
+\r
        p_interface->create_mw = mlnx_create_mw;\r
        p_interface->query_mw = mlnx_query_mw;\r
        p_interface->destroy_mw = mlnx_destroy_mw;\r
index b4b23afcc976dae8b3b926462ea1884a283bb468..2a55c963295cd432a7a860f479d69550256f9215 100644 (file)
@@ -318,10 +318,10 @@ err_unsupported:
 }\r
 \r
 ib_api_status_t\r
-mlnx_alloc_fmr (\r
+mlnx_alloc_fmr(\r
        IN              const   ib_pd_handle_t                          h_pd,\r
-       IN              const   ib_fmr_create_t                         *p_fmr_create,\r
-       OUT                             ib_fmr_handle_t*        const           ph_fmr\r
+       IN              const   mlnx_fmr_create_t* const        p_fmr_create,\r
+               OUT                     mlnx_fmr_handle_t*      const   ph_fmr\r
        )\r
 {\r
        ib_api_status_t         status;\r
@@ -366,7 +366,7 @@ mlnx_alloc_fmr (
        }\r
 \r
        // results\r
-       if (ph_fmr)     *ph_fmr = (ib_fmr_handle_t)fmr_p;\r
+       if (ph_fmr)     *ph_fmr = (mlnx_fmr_handle_t)fmr_p;\r
        status = IB_SUCCESS;\r
 \r
 err_alloc_fmr:\r
@@ -380,19 +380,18 @@ err_unsupported:
 \r
 ib_api_status_t\r
 mlnx_map_phys_fmr (\r
-       IN              const   ib_fmr_handle_t                         h_fmr,\r
-       IN              const   void* __ptr64                                   page_list,\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr,\r
+       IN              const   uint64_t* const                         page_list,\r
        IN              const   int                                                     list_len,\r
-       IN      OUT             void** __ptr64 const                            p_vaddr,\r
-       OUT                     net32_t* const                                  p_lkey,\r
-       OUT                     net32_t* const                                  p_rkey\r
+       IN      OUT                     uint64_t* const                         p_vaddr,\r
+               OUT                     net32_t* const                          p_lkey,\r
+               OUT                     net32_t* const                          p_rkey\r
        )\r
 {\r
        int err;\r
        ib_api_status_t         status;\r
        struct ib_fmr *ib_fmr = (struct ib_fmr *)h_fmr;\r
-       void *vaddr = PAGE_ALIGN(*p_vaddr);\r
-       uint64_t                        *paddr_list = (uint64_t *__ptr64)page_list;\r
+       uint64_t vaddr = (*p_vaddr) & ~(PAGE_SIZE - 1);\r
        PREP_IBDEV_FOR_PRINT(ib_fmr->device)\r
 \r
        HCA_ENTER(HCA_DBG_MEMORY);\r
@@ -405,7 +404,7 @@ mlnx_map_phys_fmr (
 \r
        \r
        // mapping      \r
-       err = ibv_map_phys_fmr(ib_fmr, paddr_list, list_len, (uint64_t)(ULONG_PTR)vaddr);\r
+       err = ibv_map_phys_fmr(ib_fmr, (u64*)page_list, list_len, (uint64_t)(ULONG_PTR)vaddr);\r
        if (err) {\r
                status = errno_to_iberr(err);\r
                HCA_PRINT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY  ,\r
@@ -425,15 +424,13 @@ err_unsupported:
        HCA_PRINT_EXIT(TRACE_LEVEL_ERROR  , HCA_DBG_MEMORY,\r
                ("completes with ERROR status %s\n", IB_GET_ERR_STR(status)));\r
        return status;\r
-       \r
-       \r
 }\r
 \r
 \r
 \r
 ib_api_status_t\r
 mlnx_unmap_fmr (\r
-       IN              const   ib_fmr_handle_t                         h_fmr)\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr)\r
 {\r
        ib_api_status_t         status;\r
        int err;\r
@@ -475,7 +472,7 @@ err_unsupported:
        \r
 ib_api_status_t\r
 mlnx_dealloc_fmr (\r
-       IN                              ib_fmr_handle_t const           h_fmr\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr\r
        )\r
 {\r
        ib_api_status_t         status;\r
@@ -569,10 +566,10 @@ mlnx_memory_if(
        p_interface->register_smr = mlnx_register_smr;\r
        p_interface->deregister_mr = mlnx_deregister_mr;\r
 \r
-       p_interface->alloc_fmr = mlnx_alloc_fmr;\r
-       p_interface->map_phys_fmr = mlnx_map_phys_fmr;\r
-       p_interface->unmap_fmr = mlnx_unmap_fmr;\r
-       p_interface->dealloc_fmr = mlnx_dealloc_fmr;\r
+       p_interface->alloc_mlnx_fmr = mlnx_alloc_fmr;\r
+       p_interface->map_phys_mlnx_fmr = mlnx_map_phys_fmr;\r
+       p_interface->unmap_mlnx_fmr = mlnx_unmap_fmr;\r
+       p_interface->dealloc_mlnx_fmr = mlnx_dealloc_fmr;\r
 \r
        p_interface->create_mw = mlnx_create_mw;\r
        p_interface->query_mw = mlnx_query_mw;\r
index ce02bfe6f6f3fb92c45475e5264e8c60df941827..b1ccb4091ede4b6cc3cc93ec92651ba77f6b639a 100644 (file)
@@ -2304,22 +2304,23 @@ ib_dereg_mr(
 *      ib_reg_mem, ib_reg_phys, ib_reg_shared\r
 *****/\r
 \r
+\r
 #ifdef CL_KERNEL\r
 \r
-/****f* Access Layer/ib_create_fmr\r
+/****f* Access Layer/mlnx_create_fmr\r
 * NAME\r
-*      ib_create_fmr\r
+*      mlnx_create_fmr\r
 *\r
 * DESCRIPTION\r
-*      Modifies the attributes of an existing memory region.\r
+*      Creates a Mellanox fast memory region.\r
 *\r
 * SYNOPSIS\r
 */\r
 AL_EXPORT ib_api_status_t AL_API\r
-ib_create_fmr(\r
+mlnx_create_fmr(\r
        IN              const   ib_pd_handle_t                          h_pd,\r
-       IN              const   ib_fmr_create_t* const          p_fmr_create,\r
-       OUT                             ib_fmr_handle_t* const                          ph_fmr);\r
+       IN              const   mlnx_fmr_create_t* const        p_fmr_create,\r
+               OUT                     mlnx_fmr_handle_t* const        ph_fmr );\r
 /*\r
 * PARAMETERS\r
 *      h_pd\r
@@ -2363,16 +2364,16 @@ ib_create_fmr(
 *              The memory region has windows bound to it.\r
 *\r
 * NOTES\r
-*      //TODO \r
+*      This is a Mellanox specific extension to verbs.\r
 *\r
 * SEE ALSO\r
-*      ib_destroy_fmr, ib_fmr_create_t\r
+*      mlnx_destroy_fmr, mlnx_fmr_create_t\r
 *****/\r
 \r
 \r
-/****f* Access Layer/ib_map_fmr\r
+/****f* Access Layer/mlnx_map_fmr\r
 * NAME\r
-*      ib_map_fmr\r
+*      mlnx_map_fmr\r
 *\r
 * DESCRIPTION\r
 *      //TODO\r
@@ -2380,13 +2381,13 @@ ib_create_fmr(
 * SYNOPSIS\r
 */\r
 AL_EXPORT ib_api_status_t AL_API\r
-ib_map_phys_fmr(\r
-       IN              const   ib_fmr_handle_t                 h_fmr,\r
-       IN              const   void* __ptr64                           paddr_list,\r
-       IN              const   int                                             list_len,\r
-       IN      OUT             void** __ptr64 const                    p_vaddr,\r
-       OUT                     net32_t* const                          p_lkey,\r
-       OUT                     net32_t* const                          p_rkey);\r
+mlnx_map_phys_fmr(\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr,\r
+       IN              const   uint64_t* const                         paddr_list,\r
+       IN              const   int                                                     list_len,\r
+       IN      OUT                     uint64_t* const                         p_vaddr,\r
+               OUT                     net32_t* const                          p_lkey,\r
+               OUT                     net32_t* const                          p_rkey );\r
 /*\r
 * PARAMETERS\r
 *      h_fmr\r
@@ -2406,7 +2407,6 @@ ib_map_phys_fmr(
 *              [out] A key that may be used by a remote end-point when performing\r
 *              RDMA or atomic operations to this registered memory region.\r
 *\r
-\r
 * RETURN VALUES\r
 *      IB_SUCCESS\r
 *              The memory region attributes were modified successfully.\r
@@ -2438,16 +2438,16 @@ ib_map_phys_fmr(
 *              The memory region has windows bound to it.\r
 *\r
 * NOTES\r
-*      //TODO \r
+*      This is a Mellanox specific extension to verbs.\r
 *\r
 * SEE ALSO\r
-*      ib_destroy_fmr, ib_fmr_create_t\r
+*      mlnx_destroy_fmr, mlnx_fmr_create_t\r
 *****/\r
 \r
 \r
-/****f* Access Layer/ib_unmap_fmr\r
+/****f* Access Layer/mlnx_unmap_fmr\r
 * NAME\r
-*      ib_unmap_fmr\r
+*      mlnx_unmap_fmr\r
 *\r
 * DESCRIPTION\r
 *      //TODO\r
@@ -2455,8 +2455,8 @@ ib_map_phys_fmr(
 * SYNOPSIS\r
 */\r
 AL_EXPORT ib_api_status_t AL_API\r
-ib_unmap_fmr(\r
-       IN              const   ib_fmr_handle_t                         h_fmr);\r
+mlnx_unmap_fmr(\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr );\r
 /*\r
 * PARAMETERS\r
 *      h_fmr\r
@@ -2492,25 +2492,25 @@ ib_unmap_fmr(
 *              The memory region has windows bound to it.\r
 *\r
 * NOTES\r
-*      //TODO \r
+*      This is a Mellanox specific extension to verbs.\r
 *\r
 * SEE ALSO\r
-*      ib_destroy_fmr, ib_fmr_create_t\r
+*      mlnx_destroy_fmr, mlnx_fmr_create_t\r
 *****/\r
 \r
 \r
-/****f* Access Layer/ib_destroy_fmr\r
+/****f* Access Layer/mlnx_destroy_fmr\r
 * NAME\r
-*      ib_destroy_fmr\r
+*      mlnx_destroy_fmr\r
 *\r
 * DESCRIPTION\r
-*      Modifies the attributes of an existing memory region.\r
+*      Destroys an existing Mellanox fast memory region.\r
 *\r
 * SYNOPSIS\r
 */\r
 AL_EXPORT ib_api_status_t AL_API\r
-ib_destroy_fmr(\r
-       IN              ib_fmr_handle_t const                           h_fmr);\r
+mlnx_destroy_fmr(\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr );\r
 /*\r
 * PARAMETERS\r
 *      h_fmr\r
@@ -2547,13 +2547,13 @@ ib_destroy_fmr(
 *              The memory region has windows bound to it.\r
 *\r
 * NOTES\r
-*      //TODO \r
+*      This is a Mellanox specific extension to verbs.\r
 *\r
 * SEE ALSO\r
-*      ib_destroy_fmr, ib_fmr_create_t\r
+*      mlnx_destroy_fmr, mlnx_fmr_create_t\r
 *****/\r
 \r
-#endif\r
+#endif /* CL_KERNEL */\r
 \r
 /****f* Access Layer/ib_create_mw\r
 * NAME\r
index 41524f8ab98348bb4f28307df772d7b51cc5a608..74b2b5d3a9a7fb1e27fc00d43ad921a37dec2200 100644 (file)
@@ -1569,19 +1569,18 @@ typedef ib_api_status_t
 ******\r
 */\r
 \r
-#ifdef CL_KERNEL\r
 \r
-/****f* Verbs/ci_alloc_fmr\r
+#ifdef CL_KERNEL\r
+/****f* Verbs/ci_alloc_mlnx_fmr\r
 * NAME\r
-*      ci_alloc_fmr -- Allocate a fast memory region with the HCA.\r
+*      ci_alloc_mlnx_fmr -- Allocate a Mellanox fast memory region with the HCA.\r
 * SYNOPSIS\r
 */\r
-\r
 typedef ib_api_status_t\r
-(*ci_alloc_fmr) (\r
+(*ci_alloc_mlnx_fmr) (\r
        IN              const   ib_pd_handle_t                          h_pd,\r
-       IN                              ib_fmr_create_t const           *p_fmr_ctreate,\r
-       OUT                             ib_fmr_handle_t*        const           ph_fmr);\r
+       IN                              mlnx_fmr_create_t const         *p_fmr_ctreate,\r
+               OUT                     mlnx_fmr_handle_t* const        ph_fmr);\r
 /*\r
 * DESCRIPTION\r
 *      //TODO \r
@@ -1595,6 +1594,7 @@ typedef ib_api_status_t
 *      ph_fmr\r
 *              [out] Handle to the fast memory region. This handle is used when\r
 *              mapin/unmaping fmr\r
+* \r
 * RETURN VALUE\r
 *      IB_SUCCESS\r
 *              Registration with the adapter was successful.\r
@@ -1606,33 +1606,38 @@ typedef ib_api_status_t
 *              Invalid pd handle\r
 *      IB_INVALID_PERMISSION\r
 *              Invalid access rights.\r
+*\r
 * NOTES\r
 *      The Alloc operation does not map nor pinned any memory.\r
-*      In order to use the FMR the user need to call map \r
+*      In order to use the FMR the user need to call map\r
+*\r
+*      This is a Mellanox specific extension to verbs.\r
 *\r
 * SEE ALSO\r
-*      ci_dealloc_fmr, ci_map_phys_fmr, ci_unmap_fmr\r
+*      ci_dealloc_mlnx_fmr, ci_map_phys_mlnx_fmr, ci_unmap_mlnx_fmr\r
 ******\r
 */\r
 \r
 \r
-/****f* Verbs/ci_map_phys_fmr\r
+/****f* Verbs/ci_map_phys_mlnx_fmr\r
 * NAME\r
-*      ci_map_phys_fmr -- Map a fast memory region with given page list.\r
+*      ci_map_phys_mlnx_fmr -- Map a Mellanox fast memory region with a\r
+*      given page list.\r
+*\r
 * SYNOPSIS\r
 */\r
-\r
 typedef ib_api_status_t\r
-(*ci_map_phys_fmr) (\r
-       IN              const   ib_fmr_handle_t                         h_fmr,\r
-       IN              const   void* __ptr64                                   paddr_list,\r
+(*ci_map_phys_mlnx_fmr) (\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr,\r
+       IN              const   uint64_t* const                         paddr_list,\r
        IN              const   int                                                     list_len,\r
-       IN      OUT             void** __ptr64 const                            p_vaddr,\r
-       OUT                     net32_t* const                                  p_lkey,\r
-       OUT                     net32_t* const                                  p_rkey);\r
+       IN      OUT                     uint64_t* const                         p_vaddr,\r
+               OUT                     net32_t* const                          p_lkey,\r
+               OUT                     net32_t* const                          p_rkey);\r
 /*\r
 * DESCRIPTION\r
-*      //TODO \r
+*      //TODO\r
+*\r
 * PARAMETERS\r
 *      h_fmr\r
 *              [in] Handle to the fast memory region that  these pages map to \r
@@ -1662,28 +1667,31 @@ typedef ib_api_status_t
 *              Invalid pd handle\r
 *      IB_INVALID_PERMISSION\r
 *              Invalid access rights.\r
+*\r
 * NOTES\r
 *      The Alloc operation does not map nor pinned any memory.\r
 *      In order to use the FMR the user need to call map \r
 *\r
+*      This is a Mellanox specific extension to verbs.\r
+*\r
 * SEE ALSO\r
-*      ci_dealloc_fmr, ci_alloc_fmr, ci_unmap_fmr\r
+*      ci_dealloc_mlnx_fmr, ci_alloc_mlnx_fmr, ci_unmap_mlnx_fmr\r
 ******\r
 */\r
 \r
 \r
-/****f* Verbs/ci_unmap_fmr\r
+/****f* Verbs/ci_unmap_mlnx_fmr\r
 * NAME\r
-*      ci_unmap_fmr -- UnMap a fast memory region with given page list.\r
+*      ci_unmap_mlnx_fmr -- UnMap a Mellanox fast memory region.\r
 * SYNOPSIS\r
 */\r
-\r
 typedef ib_api_status_t\r
-(*ci_unmap_fmr) (\r
-       IN              const   ib_fmr_handle_t                         h_fmr);\r
+(*ci_unmap_mlnx_fmr) (\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr);\r
 /*\r
 * DESCRIPTION\r
-*      //TODO \r
+*      //TODO\r
+*\r
 * PARAMETERS\r
 *      h_fmr\r
 *              [in] Handle to the fast memory region that  these pages map to \r
@@ -1699,32 +1707,37 @@ typedef ib_api_status_t
 *              Invalid pd handle\r
 *      IB_INVALID_PERMISSION\r
 *              Invalid access rights.\r
+*\r
 * NOTES\r
 *      The Alloc operation does not map nor pinned any memory.\r
 *      In order to use the FMR the user need to call map \r
 *\r
+*      This is a Mellanox specific extension to verbs.\r
+*\r
 * SEE ALSO\r
-*      ci_dealloc_fmr, ci_alloc_fmr, ci_map_phy_fmr\r
+*      ci_dealloc_mlnx_fmr, ci_alloc_mlnx_fmr, ci_map_phy_mlnx_fmr\r
 ******\r
 */\r
 \r
 \r
-/****f* Verbs/ci_dealloc_fmr\r
+/****f* Verbs/ci_dealloc_mlnx_fmr\r
 * NAME\r
-*      ci_dealloc_fmr -- Deallocate a fast memory region with the HCA.\r
+*      ci_dealloc_mlnx_fmr -- Deallocate a Mellanox fast memory region.\r
+*\r
 * SYNOPSIS\r
 */\r
-\r
 typedef ib_api_status_t\r
-(*ci_dealloc_fmr) (\r
-       IN                      ib_fmr_handle_t const           h_fmr);\r
+(*ci_dealloc_mlnx_fmr) (\r
+       IN                      mlnx_fmr_handle_t       const           h_fmr);\r
 /*\r
 * DESCRIPTION\r
-*      //TODO \r
+*      //TODO\r
+*\r
 * PARAMETERS\r
-       h_fmr\r
-*              [out] Handle to the fast memory region. This handle is used when\r
+*      h_fmr\r
+*              [in] Handle to the fast memory region. This handle is used when\r
 *              mapin/unmaping fmr\r
+*\r
 * RETURN VALUE\r
 *      IB_SUCCESS\r
 *              Registration with the adapter was successful.\r
@@ -1736,16 +1749,17 @@ typedef ib_api_status_t
 *              Invalid pd handle\r
 *      IB_INVALID_PERMISSION\r
 *              Invalid access rights.\r
+*\r
 * NOTES\r
-*      //TODO\r
-\r
+*      This is a Mellanox specific extension to verbs.\r
+*\r
 * SEE ALSO\r
-*      ci_dealloc_fmr, ci_map_phys_fmr, ci_unmap_fmr\r
+*      ci_dealloc_mlnx_fmr, ci_map_phys_mlnx_fmr, ci_unmap_mlnx_fmr\r
 ******\r
 */\r
-\r
 #endif\r
 \r
+\r
 /****f* Verbs/ci_create_mw\r
 * NAME\r
 *      ci_create_mw -- Create a memory window entry for later use\r
@@ -2438,6 +2452,10 @@ typedef ib_api_status_t
 *****/\r
 \r
 \r
+#define        MAX_LIB_NAME            32\r
+\r
+#ifdef CL_KERNEL\r
+\r
 /****s* Verbs/ci_interface_t\r
 * NAME\r
 *      ci_interface_t -- Interface holding Channel Interface API's\r
@@ -2446,7 +2464,6 @@ typedef ib_api_status_t
 *      providing verbs functionality.\r
 * SOURCE\r
 */\r
-#define        MAX_LIB_NAME            32\r
 \r
 typedef struct _ci_interface\r
 {\r
@@ -2528,17 +2545,14 @@ typedef struct _ci_interface
        ci_register_smr         register_smr;\r
        ci_deregister_mr        deregister_mr;\r
 \r
-#ifdef CL_KERNEL\r
-\r
        /*\r
-        * Fast Memory Management Verbs\r
+        * Mellanox Fast Memory Management Verbs\r
         */\r
-       ci_alloc_fmr            alloc_fmr;\r
-       ci_map_phys_fmr map_phys_fmr;\r
-       ci_unmap_fmr            unmap_fmr;\r
-       ci_dealloc_fmr          dealloc_fmr;\r
+       ci_alloc_mlnx_fmr               alloc_mlnx_fmr;\r
+       ci_map_phys_mlnx_fmr    map_phys_mlnx_fmr;\r
+       ci_unmap_mlnx_fmr               unmap_mlnx_fmr;\r
+       ci_dealloc_mlnx_fmr             dealloc_mlnx_fmr;\r
 \r
-#endif\r
 \r
        /*\r
         * Memory Window Verbs\r
@@ -2578,6 +2592,7 @@ typedef struct _ci_interface
 } ci_interface_t;\r
 /********/\r
 \r
+\r
 /****f* Verbs/ib_register_ca\r
 * NAME\r
 *      ib_register_ca -- Inform the IB Access Layer about a new HCA\r
@@ -2654,6 +2669,7 @@ ib_deregister_ca (
 * SEE ALSO\r
 *      ib_register_ca, ci_interface_t\r
 *******/\r
+#endif /* CL_KERNEL */\r
 \r
 \r
 #ifdef __cplusplus\r
index 33802e230692a29ea82a706887e301196d940f6e..a314aa4d733d432b0d0da84b2808867ff16a7f19 100644 (file)
@@ -7192,7 +7192,7 @@ typedef struct _ib_port_counters
 typedef struct _ib_ca* __ptr64                 ib_ca_handle_t;\r
 typedef struct _ib_pd* __ptr64                 ib_pd_handle_t;\r
 typedef struct _ib_mr* __ptr64                 ib_mr_handle_t;\r
-typedef struct _ib_fmr* __ptr64                        ib_fmr_handle_t;\r
+typedef struct _mlnx_fmr* __ptr64              mlnx_fmr_handle_t;\r
 typedef struct _ib_mw* __ptr64                 ib_mw_handle_t;\r
 typedef struct _ib_qp* __ptr64                 ib_qp_handle_t;\r
 typedef struct _ib_cq* __ptr64                 ib_cq_handle_t;\r
@@ -9248,23 +9248,23 @@ typedef struct _ib_mr_create
 \r
 #ifdef CL_KERNEL\r
 \r
-/****s* Access Layer/ib_fmr_create_t\r
+/****s* Access Layer/mlnx_fmr_create_t\r
 * NAME\r
-*      ib_fmr_create_t\r
+*      mlnx_fmr_create_t\r
 *\r
 * DESCRIPTION\r
-*      Information required to create a fast memory region.\r
+*      Information required to create a Mellanox fast memory region.\r
 *\r
 * SYNOPSIS\r
 */\r
-typedef struct _ib_fmr_create\r
+typedef struct _mlnx_fmr_create\r
 {\r
        int                                     max_pages;\r
        int                                     max_maps;\r
        uint8_t                         page_size;\r
        ib_access_t                     access_ctrl;\r
 \r
-}      ib_fmr_create_t;\r
+}      mlnx_fmr_create_t;\r
 /*\r
 * FIELDS\r
 *      max_pages\r
@@ -9279,6 +9279,9 @@ typedef struct _ib_fmr_create
 *      access_ctrl\r
 *              Access rights of the registered region.\r
 *\r
+* NOTES\r
+*      This is a Mellanox specific extension to verbs.\r
+*\r
 * SEE ALSO\r
 *      ib_access_t\r
 *****/\r
index e00b9735468fce108a68504acb6b37d774d3d286..e3378fced548bbf15a76f1c62235bc0b4d6d5a54 100644 (file)
@@ -253,27 +253,27 @@ typedef ib_api_status_t
        IN              const   ib_mr_handle_t                          h_mr );\r
 \r
 typedef ib_api_status_t\r
-(*ib_pfn_create_fmr_t)(\r
+(*mlnx_pfn_create_fmr_t)(\r
        IN              const   ib_pd_handle_t                          h_pd,\r
-       IN              const   ib_fmr_create_t* const          p_fmr_create,\r
-       OUT                             ib_fmr_handle_t* const                          ph_mr);\r
+       IN              const   mlnx_fmr_create_t* const        p_fmr_create,\r
+               OUT                     mlnx_fmr_handle_t* const        ph_fmr );\r
 \r
 typedef ib_api_status_t\r
-(*ib_pfn_map_phys_fmr_t)(\r
-       IN              const   ib_fmr_handle_t                         h_fmr,\r
-       IN              const   void* __ptr64                                   paddr_list,\r
+(*mlnx_pfn_map_phys_fmr_t)(\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr,\r
+       IN              const   uint64_t* const                         paddr_list,\r
        IN              const   int                                                     list_len,\r
-       IN      OUT             void** __ptr64 const                            p_vaddr,\r
-       OUT                     net32_t* const                                  p_lkey,\r
-       OUT                     net32_t* const                                  p_rkey);\r
+       IN      OUT                     uint64_t* const                         p_vaddr,\r
+               OUT                     net32_t* const                          p_lkey,\r
+               OUT                     net32_t* const                          p_rkey );\r
 \r
 typedef ib_api_status_t\r
-(*ib_pfn_unmap_fmr_t)(\r
-       IN              const   ib_fmr_handle_t                         h_fmr);\r
+(*mlnx_pfn_unmap_fmr_t)(\r
+       IN              const   mlnx_fmr_handle_t                       h_fmr );\r
 \r
 typedef ib_api_status_t\r
-(*ib_pfn_destroy_fmr_t)(\r
-       IN              ib_fmr_handle_t const                           h_fmr);\r
+(*mlnx_pfn_destroy_fmr_t)(\r
+       IN              mlnx_fmr_handle_t const                         h_fmr );\r
 \r
 typedef ib_api_status_t\r
 (*ib_pfn_create_mw_t)(\r
@@ -677,10 +677,10 @@ typedef struct _ib_al_ifc
        ib_pfn_close_al_t                       close_al;\r
        ib_pfn_get_err_str_t            get_err_str;\r
        ib_pfn_get_wc_status_str_t      get_wc_status_str;\r
-       ib_pfn_create_fmr_t             create_fmr;\r
-       ib_pfn_map_phys_fmr_t           map_phys_fmr;\r
-       ib_pfn_unmap_fmr_t              unmap_fmr;\r
-       ib_pfn_destroy_fmr_t            destroy_fmr;\r
+       mlnx_pfn_create_fmr_t           create_mlnx_fmr;\r
+       mlnx_pfn_map_phys_fmr_t         map_phys_mlnx_fmr;\r
+       mlnx_pfn_unmap_fmr_t            unmap_mlnx_fmr;\r
+       mlnx_pfn_destroy_fmr_t          destroy_mlnx_fmr;\r
 \r
 }      ib_al_ifc_t;\r
 \r