The current uvp_get_interface() routine takes a structure as input.  Included 
in the structure
is a version number.  In the winverb branch, I added a new API to take the 
version as a
separate parameter, along with the size of the structure.

A better solution to supporting multiple interfaces is to define interfaces 
using GUIDs.
This not only allows different versions of the same interface (for example the 
UVP interface),
but also provides a mechanism that can be used to add new interfaces without 
affecting
existing ABIs or APIs.

One possible use for an extended API is XRC support.  (This is captured in the 
patch.)

Signed-off-by: Sean Hefty <[EMAIL PROTECTED]>
---
This patch is against the winverb branch.  It removes the uvp_get_interface_n 
call, and
instead modifies the uvp_get_interface routine directly.  This is possible 
because of the
transition to a 2.0 release.


Index: core/al/user/ual_ca.c
===================================================================
--- core/al/user/ual_ca.c       (revision 1128)
+++ core/al/user/ual_ca.c       (working copy)
@@ -65,7 +65,7 @@
        uintn_t                                         bytes_ret;
        cl_status_t                                     cl_status;
        void                                            *h_lib;
-       uvp_get_interface_n_t           pfn_uvp_ifc;
+       uvp_get_interface_t                     pfn_uvp_ifc;
 
        AL_ENTER( AL_DBG_CA );
 
@@ -116,8 +116,8 @@
                return IB_SUCCESS;
        }
 
-       pfn_uvp_ifc = (uvp_get_interface_n_t)
-                                  GetProcAddress( h_lib, "uvp_get_interface_n" 
);
+       pfn_uvp_ifc = (uvp_get_interface_t)
+                                  GetProcAddress( h_lib, "uvp_get_interface" );
        if( !pfn_uvp_ifc )
        {
 #if defined( _DEBUG_ )
@@ -132,7 +132,7 @@
        }
 
        /* Query the vendor-supported user-mode functions */
-       pfn_uvp_ifc( 2, &p_vca_intf->user_verbs, sizeof p_vca_intf->user_verbs 
);
+       pfn_uvp_ifc( IID_UVP, &p_vca_intf->user_verbs );
        p_vca_intf->h_uvp_lib = h_lib;
        AL_EXIT( AL_DBG_CA );
        return IB_SUCCESS;
Index: core/winverbs/user/wv_uverbs.cpp
===================================================================
--- core/winverbs/user/wv_uverbs.cpp    (revision 1127)
+++ core/winverbs/user/wv_uverbs.cpp    (working copy)
@@ -376,14 +376,18 @@
 
 HRESULT WvGetUserVerbs(HMODULE hLib, uvp_interface_t *pVerbs)
 {
-       uvp_get_interface_n_t   pfgetif;
+       uvp_get_interface_t     pfgetif;
+       ib_api_status_t         ib_status;
 
-       pfgetif = (uvp_get_interface_n_t)GetProcAddress(hLib, 
"uvp_get_interface_n");
+       pfgetif = (uvp_get_interface_t)GetProcAddress(hLib, 
"uvp_get_interface");
        if (pfgetif == NULL) {
                return GetLastError();
        }
 
-       pfgetif(3, pVerbs, sizeof uvp_interface_t);
+       ib_status = pfgetif(IID_UVP, pVerbs);
+       if (ib_status != IB_SUCCESS) {
+               return WV_NOT_SUPPORTED;
+       }
 
        // Provide default implementations
        if (pVerbs->pre_open_ca == NULL) {
Index: hw/mlx4/user/hca/mlx4.c
===================================================================
--- hw/mlx4/user/hca/mlx4.c     (revision 1141)
+++ hw/mlx4/user/hca/mlx4.c     (working copy)
@@ -180,18 +180,10 @@
        cl_free(context);
 }
 
-__get_interface (
-       IN              uint32_t                        version,
-    IN OUT     uvp_interface_t         *p_uvp )
+static void __get_uvp_interface(uvp_interface_t *p_uvp)
 {
        CL_ASSERT(p_uvp);
 
-       p_uvp->guid    = 0x12345678;
-
-
-       /*
-        * CA Management
-        */
        p_uvp->pre_open_ca              = mlx4_pre_open_ca;
        p_uvp->post_open_ca             = mlx4_post_open_ca;
        p_uvp->pre_query_ca             = mlx4_pre_query_ca;
@@ -201,19 +193,11 @@
        p_uvp->pre_close_ca             = NULL;
        p_uvp->post_close_ca    = mlx4_post_close_ca;
 
-
-       /*
-        * Protection Domain
-        */
        p_uvp->pre_allocate_pd          = mlx4_pre_alloc_pd;
        p_uvp->post_allocate_pd         = mlx4_post_alloc_pd;
        p_uvp->pre_deallocate_pd        = NULL;
        p_uvp->post_deallocate_pd       = mlx4_post_free_pd;
 
-
-       /*
-        * SRQ Management Verbs
-        */
        p_uvp->pre_create_srq   = mlx4_pre_create_srq;
        p_uvp->post_create_srq  = mlx4_post_create_srq;
        p_uvp->pre_query_srq    = NULL;
@@ -223,13 +207,8 @@
        p_uvp->pre_destroy_srq  = NULL;
        p_uvp->post_destroy_srq = mlx4_post_destroy_srq;
 
-
-       /*
-        * QP Management Verbs
-        */
        p_uvp->pre_create_qp    = mlx4_pre_create_qp;
-       if (version >=3)
-               p_uvp->wv_pre_create_qp = mlx4_wv_pre_create_qp;
+       p_uvp->wv_pre_create_qp = mlx4_wv_pre_create_qp;
        p_uvp->post_create_qp   = mlx4_post_create_qp;
        p_uvp->pre_modify_qp    = mlx4_pre_modify_qp;
        p_uvp->post_modify_qp   = mlx4_post_modify_qp;
@@ -237,15 +216,9 @@
        p_uvp->post_query_qp    = mlx4_post_query_qp;
        p_uvp->pre_destroy_qp   = mlx4_pre_destroy_qp;
        p_uvp->post_destroy_qp  = mlx4_post_destroy_qp;
-       if (version >= 2)
-       {
-               p_uvp->nd_modify_qp             = mlx4_nd_modify_qp;
-               p_uvp->nd_get_qp_state  = mlx4_nd_get_qp_state;
-       }
+       p_uvp->nd_modify_qp             = mlx4_nd_modify_qp;
+       p_uvp->nd_get_qp_state  = mlx4_nd_get_qp_state;
 
-       /*
-        * Completion Queue Management Verbs
-        */
        p_uvp->pre_create_cq    = mlx4_pre_create_cq;
        p_uvp->post_create_cq   = mlx4_post_create_cq;
        p_uvp->pre_query_cq             = mlx4_pre_query_cq;
@@ -255,10 +228,6 @@
        p_uvp->pre_destroy_cq   = NULL;
        p_uvp->post_destroy_cq  = mlx4_post_destroy_cq;
 
-
-       /*
-        * AV Management
-        */
        p_uvp->pre_create_av    = mlx4_pre_create_ah;
        p_uvp->post_create_av   = NULL;
        p_uvp->pre_query_av             = mlx4_pre_query_ah;
@@ -268,10 +237,6 @@
        p_uvp->pre_destroy_av   = mlx4_pre_destroy_ah;
        p_uvp->post_destroy_av  = NULL;
 
-
-       /*
-        * Memory Region / Window Management Verbs
-        */
        p_uvp->pre_create_mw    = NULL;
        p_uvp->post_create_mw   = NULL;
        p_uvp->pre_query_mw     = NULL;
@@ -279,98 +244,59 @@
        p_uvp->pre_destroy_mw   = NULL;
        p_uvp->post_destroy_mw  = NULL;
 
-
-       /*
-        * Multicast Support Verbs
-        */
        p_uvp->pre_attach_mcast         = NULL;
        p_uvp->post_attach_mcast        = NULL;
        p_uvp->pre_detach_mcast         = NULL;
        p_uvp->post_detach_mcast        = NULL;
 
-
-       /*
-        * OS bypass (send, receive, poll/notify cq)
-        */
-       p_uvp->post_send        = mlx4_post_send;
-       p_uvp->post_recv        = mlx4_post_recv;
+       p_uvp->post_send                = mlx4_post_send;
+       p_uvp->post_recv                = mlx4_post_recv;
        p_uvp->post_srq_recv    = mlx4_post_srq_recv;
-       p_uvp->poll_cq          = mlx4_poll_cq_list;
-       if (version >= 3)
-               p_uvp->poll_cq_array = mlx4_poll_cq_array;
-       p_uvp->rearm_cq         = mlx4_arm_cq;
-       p_uvp->rearm_n_cq       = NULL; /* __enable_ncomp_cq_notify: Not 
implemented */;
-       p_uvp->peek_cq          = NULL; /* __peek_cq: Not implemented */
-       p_uvp->bind_mw          = NULL; /* __bind_mw: Not implemented */
-
-#ifdef XRC_SUPPORT
-       /*
-        * XRC Management Verbs
-        */
-       p_uvp->pre_create_xrc_srq               = mlx4_pre_create_xrc_srq;
-       p_uvp->post_create_xrc_srq      = mlx4_post_create_xrc_srq;
-       p_uvp->pre_open_xrc_domain      = mlx4_pre_open_xrc_domain;
-       p_uvp->post_open_xrc_domain     = mlx4_post_open_xrc_domain;
-       p_uvp->pre_close_xrc_domain     = NULL;
-       p_uvp->post_close_xrc_domain    = mlx4_post_close_xrc_domain;
-       p_uvp->pre_create_xrc_rcv_qp    = NULL;
-       p_uvp->post_create_xrc_rcv_qp   = NULL;
-       p_uvp->pre_modify_xrc_rcv_qp    = NULL;
-       p_uvp->post_modify_xrc_rcv_qp   = NULL;
-       p_uvp->pre_query_xrc_rcv_qp     = NULL;
-       p_uvp->post_query_xrc_rcv_qp    = NULL;
-       p_uvp->pre_reg_xrc_rcv_qp       = NULL;
-       p_uvp->post_reg_xrc_rcv_qp      = NULL;
-       p_uvp->pre_unreg_xrc_rcv_qp     = NULL;
-       p_uvp->post_unreg_xrc_rcv_qp    = NULL;
-#endif
+       p_uvp->poll_cq                  = mlx4_poll_cq_list;
+       p_uvp->poll_cq_array    = mlx4_poll_cq_array;
+       p_uvp->rearm_cq                 = mlx4_arm_cq;
+       p_uvp->rearm_n_cq               = NULL;
+       p_uvp->peek_cq                  = NULL;
+       p_uvp->bind_mw                  = NULL;
 }
 
-__declspec(dllexport) ib_api_status_t
-uvp_get_interface_n (
-       IN              uint32_t                        version,
-    IN OUT     void *                          p_uvp_interface,
-       IN              size_t                          uvp_interface_size)
-{
-       ib_api_status_t status = IB_SUCCESS;
-       uvp_interface_t *p_uvp;
 
-       p_uvp = p_uvp_interface;
-
-       switch (version)
-       {
-       case 2:
-               if (uvp_interface_size < sizeof(uvp2_interface_t))
-               {
-                       status = IB_INSUFFICIENT_MEMORY;
-               }
-               break;
-       case 3:
-               if (uvp_interface_size < sizeof(uvp_interface_t))
-               {
-                       status = IB_INSUFFICIENT_MEMORY;
-               }
-               break;
-       default:
-               status = IB_UNSUPPORTED;
-               break;
-       }
-
-       if (status == IB_SUCCESS)
-       {
-               __get_interface(version, p_uvp);
-               p_uvp->version = version;
-       }
-
-       return status;
+/* TODO: expose XRC through new interface GUID */
+#ifdef XRC_SUPPORT
+static void __get_xrc_interface(uvp_xrc_interface_t *p_xrc)
+{
+       p_xrc->pre_create_xrc_srq               = mlx4_pre_create_xrc_srq;
+       p_xrc->post_create_xrc_srq              = mlx4_post_create_xrc_srq;
+       p_xrc->pre_open_xrc_domain              = mlx4_pre_open_xrc_domain;
+       p_xrc->post_open_xrc_domain             = mlx4_post_open_xrc_domain;
+       p_xrc->pre_close_xrc_domain             = NULL;
+       p_xrc->post_close_xrc_domain    = mlx4_post_close_xrc_domain;
+       p_xrc->pre_create_xrc_rcv_qp    = NULL;
+       p_xrc->post_create_xrc_rcv_qp   = NULL;
+       p_xrc->pre_modify_xrc_rcv_qp    = NULL;
+       p_xrc->post_modify_xrc_rcv_qp   = NULL;
+       p_xrc->pre_query_xrc_rcv_qp             = NULL;
+       p_xrc->post_query_xrc_rcv_qp    = NULL;
+       p_xrc->pre_reg_xrc_rcv_qp               = NULL;
+       p_xrc->post_reg_xrc_rcv_qp              = NULL;
+       p_xrc->pre_unreg_xrc_rcv_qp             = NULL;
+       p_xrc->post_unreg_xrc_rcv_qp    = NULL;
 }
+#endif
 
-// Deprecate - for version 2 support only
-__declspec(dllexport) ib_api_status_t
-uvp_get_interface (
-    IN OUT     uvp2_interface_t        *p_uvp )
-{
-       __get_interface(2, (uvp_interface_t *) p_uvp);
-       p_uvp->version = 101;
-       return IB_SUCCESS;
+__declspec(dllexport) ib_api_status_t
+uvp_get_interface (GUID iid, void* pifc)
+{
+       ib_api_status_t status = IB_SUCCESS;
+
+       if (IsEqualGUID(&iid, &IID_UVP))
+       {
+           __get_uvp_interface((uvp_interface_t *) pifc);
+       }
+       else
+       {
+               status = IB_UNSUPPORTED;
+       }
+
+       return status;
 }
Index: hw/mlx4/user/hca/mlx4.def
===================================================================
--- hw/mlx4/user/hca/mlx4.def   (revision 1141)
+++ hw/mlx4/user/hca/mlx4.def   (working copy)
@@ -4,9 +4,3 @@
 LIBRARY mlx4u.dll
 #endif
 
-#ifndef _WIN64
-EXPORTS
-uvp_get_interface
-uvp_get_interface_n
-#endif
-
Index: hw/mthca/user/mlnx_ual_av.c
===================================================================
--- hw/mthca/user/mlnx_ual_av.c (revision 1128)
+++ hw/mthca/user/mlnx_ual_av.c (working copy)
@@ -390,15 +390,10 @@
 
 void
 mlnx_get_av_interface (
-       IN              uint32_t                        version,
        IN OUT  uvp_interface_t         *p_uvp )
 {
        CL_ASSERT(p_uvp);
-       UNREFERENCED_PARAMETER(version);
 
-       /*
-        * Address Vector Management Verbs
-        */
        p_uvp->pre_create_av  = __pre_create_av;
        p_uvp->post_create_av = __post_create_av;
        p_uvp->pre_query_av   = __pre_query_av;
Index: hw/mthca/user/mlnx_ual_ca.c
===================================================================
--- hw/mthca/user/mlnx_ual_ca.c (revision 1128)
+++ hw/mthca/user/mlnx_ual_ca.c (working copy)
@@ -261,20 +261,13 @@
 
 void
 mlnx_get_ca_interface (
-       IN              uint32_t                        version,
        IN OUT  uvp_interface_t         *p_uvp )
 {
        CL_ASSERT(p_uvp);
 
-       UNREFERENCED_PARAMETER(version);
-
-       /*
-        * HCA Access Verbs
-        */
        p_uvp->pre_open_ca  = __pre_open_ca;
        p_uvp->post_open_ca = __post_open_ca;
 
-
        p_uvp->pre_query_ca  = __pre_query_ca;
        p_uvp->post_query_ca = __post_query_ca;
 
@@ -283,7 +276,6 @@
 
        p_uvp->pre_close_ca  = __pre_close_ca;
        p_uvp->post_close_ca = __post_close_ca;
-
 }
 
 
Index: hw/mthca/user/mlnx_ual_cq.c
===================================================================
--- hw/mthca/user/mlnx_ual_cq.c (revision 1128)
+++ hw/mthca/user/mlnx_ual_cq.c (working copy)
@@ -193,25 +193,20 @@
 
 void
 mlnx_get_cq_interface (
-       IN              uint32_t                        version,
        IN OUT  uvp_interface_t         *p_uvp )
 {
        UVP_ENTER(UVP_DBG_DEV);
 
        CL_ASSERT(p_uvp);
-       UNREFERENCED_PARAMETER(version);
 
-       /*
-        * Completion Queue Management Verbs
-        */
        p_uvp->pre_create_cq  = __pre_create_cq;
        p_uvp->post_create_cq = __post_create_cq;
 
        p_uvp->pre_query_cq  = __pre_query_cq;
        p_uvp->post_query_cq = NULL;
 
-       p_uvp->pre_resize_cq  = NULL; /* __pre_resize_cq: not supported in 
kernel */
-       p_uvp->post_resize_cq = NULL;   /* __post_resize_cq:not supported in 
kernel */ 
+       p_uvp->pre_resize_cq  = NULL;
+       p_uvp->post_resize_cq = NULL;
 
        p_uvp->pre_destroy_cq  = __pre_destroy_cq;
        p_uvp->post_destroy_cq = __post_destroy_cq;
Index: hw/mthca/user/mlnx_ual_main.c
===================================================================
--- hw/mthca/user/mlnx_ual_main.c       (revision 1127)
+++ hw/mthca/user/mlnx_ual_main.c       (working copy)
@@ -133,123 +133,32 @@
 #endif
 }
 
-static void
-__get_interface (
-       IN              uint32_t                        version,
-    IN OUT     uvp_interface_t         *p_uvp )
-{
-    UVP_ENTER(UVP_DBG_SHIM);
-
-    CL_ASSERT(p_uvp);
-    /*
-     * Version of the header file this interface export can handle
-     */
-    p_uvp->guid    = 0x12345678;
-
-    /*
-     * CA Management
-     */
-    mlnx_get_ca_interface (version, p_uvp);
-    
-    /*
-     * Protection Domain
-     */
-    mlnx_get_pd_interface (version, p_uvp);
-
-    /*
-     * SRQ Management Verbs
-     */
-    mlnx_get_srq_interface (version, p_uvp);
-
-    /*
-     * QP Management Verbs
-     */
-    mlnx_get_qp_interface (version, p_uvp);
-
-    /*
-     * Completion Queue Management Verbs
-     */
-    mlnx_get_cq_interface (version, p_uvp);
-
-    /*
-     * AV Management
-     */
-    mlnx_get_av_interface(version, p_uvp);
-
-    /*
-     * Memory Region / Window Management Verbs
-     */
-    mlnx_get_mrw_interface (version, p_uvp);
-
-    /*
-     * Multicast Support Verbs
-     */
-    mlnx_get_mcast_interface (version, p_uvp);
-
-    /*
-     * OS bypass (send, receive, poll/notify cq)
-     */
-    mlnx_get_osbypass_interface(version, p_uvp);
-
-    
-    /*
-     * Local MAD support, for HCA's that do not support
-     * Agents in the HW.
-     * ??? Do we need this for user-mode ???
-     */
-
-    UVP_EXIT(UVP_DBG_SHIM);
-}
-
 __declspec(dllexport) ib_api_status_t
-uvp_get_interface_n (
-       IN              const   uint32_t                                        
version,
-       IN      OUT                     void*                                   
        p_uvp_interface,
-       IN                              size_t                                  
        uvp_interface_size)
+uvp_get_interface (
+       IN              GUID    iid,
+       IN              void*   pifc)
 {
        ib_api_status_t status = IB_SUCCESS;
-       uvp_interface_t *p_uvp;
 
-       p_uvp = (uvp_interface_t *) p_uvp_interface;
-
     UVP_ENTER(UVP_DBG_SHIM);
 
-       switch (version)
+       if (IsEqualGUID(&iid, &IID_UVP))
        {
-       case 2:
-               if (uvp_interface_size < sizeof(uvp2_interface_t))
-               {
-                       status = IB_INSUFFICIENT_MEMORY;
-               }
-               break;
-       case 3:
-               if (uvp_interface_size < sizeof(uvp_interface_t))
-               {
-                       status = IB_INSUFFICIENT_MEMORY;
-               }
-               break;
-       default:
-               status = IB_UNSUPPORTED;
-               break;
+           mlnx_get_ca_interface((uvp_interface_t *) pifc);
+               mlnx_get_pd_interface((uvp_interface_t *) pifc);
+               mlnx_get_srq_interface((uvp_interface_t *) pifc);
+               mlnx_get_qp_interface((uvp_interface_t *) pifc);
+               mlnx_get_cq_interface((uvp_interface_t *) pifc);
+               mlnx_get_av_interface((uvp_interface_t *) pifc);
+               mlnx_get_mrw_interface((uvp_interface_t *) pifc);
+               mlnx_get_mcast_interface((uvp_interface_t *) pifc);
+               mlnx_get_osbypass_interface((uvp_interface_t *) pifc);
        }
-
-       if (status == IB_SUCCESS)
+       else
        {
-               __get_interface(version, p_uvp);
-               p_uvp->version = version;
+               status = IB_UNSUPPORTED;
        }
 
        UVP_EXIT(UVP_DBG_SHIM);
        return status;
 }
-
-// Deprecate - for version 2 support only
-__declspec(dllexport) ib_api_status_t
-uvp_get_interface (
-    IN OUT     uvp2_interface_t                *p_uvp )
-{
-       __get_interface(2, (uvp_interface_t *) p_uvp);
-       p_uvp->version = 101;
-       return IB_SUCCESS;
-}
-
Index: hw/mthca/user/mlnx_ual_main.h
===================================================================
--- hw/mthca/user/mlnx_ual_main.h       (revision 1127)
+++ hw/mthca/user/mlnx_ual_main.h       (working copy)
@@ -89,55 +89,46 @@
 /************* CA operations *************************/
 void  
 mlnx_get_ca_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* PD Management *************************/
 void  
 mlnx_get_pd_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* AV Management *************************/
 void
 mlnx_get_av_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* CQ Management *************************/
 void  
 mlnx_get_cq_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* SRQ Management *************************/
 void  
 mlnx_get_srq_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* QP Management *************************/
 void  
 mlnx_get_qp_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* MR/MW Management *************************/
 void  
 mlnx_get_mrw_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* MCAST Management *************************/
 void  
 mlnx_get_mcast_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 /************* OS BYPASS Management *************************/
 void  
 mlnx_get_osbypass_interface (
-       IN              uint32_t                                        version,
     IN OUT     uvp_interface_t                         *p_uvp );
 
 #endif
Index: hw/mthca/user/mlnx_ual_mcast.c
===================================================================
--- hw/mthca/user/mlnx_ual_mcast.c      (revision 1128)
+++ hw/mthca/user/mlnx_ual_mcast.c      (working copy)
@@ -101,17 +101,11 @@
 
 void
 mlnx_get_mcast_interface (
-       IN              uint32_t                        version,
        IN OUT  uvp_interface_t         *p_uvp )
 {
        UVP_ENTER(UVP_DBG_SHIM);
 
        CL_ASSERT(p_uvp);
-       UNREFERENCED_PARAMETER(version);
-
-       /*
-        * Multicast Support Verbs
-        */
        p_uvp->pre_attach_mcast  = NULL;
        p_uvp->post_attach_mcast = NULL;
        p_uvp->pre_detach_mcast  = NULL;
Index: hw/mthca/user/mlnx_ual_mrw.c
===================================================================
--- hw/mthca/user/mlnx_ual_mrw.c        (revision 1128)
+++ hw/mthca/user/mlnx_ual_mrw.c        (working copy)
@@ -194,40 +194,19 @@
 
 void
 mlnx_get_mrw_interface (
-       IN              uint32_t                        version,
     IN OUT     uvp_interface_t         *p_uvp )
 {
     UVP_ENTER(UVP_DBG_SHIM);
 
     CL_ASSERT(p_uvp);
-       UNREFERENCED_PARAMETER(version);
 
-    /*
-     * Memory Management Verbs
-     */
-//    p_uvp->pre_register_mr    = NULL;
-//    p_uvp->post_register_mr   = NULL;
-//    p_uvp->pre_query_mr       = NULL;
-//    p_uvp->post_query_mr      = NULL;
-//    p_uvp->pre_deregister_mr  = NULL;
-//    p_uvp->post_deregister_mr = NULL;
-//    p_uvp->pre_modify_mr      = NULL;
-//    p_uvp->post_modify_mr     = NULL;
-//    p_uvp->pre_register_smr   = NULL;
-//    p_uvp->post_register_smr  = NULL;
+       p_uvp->pre_create_mw    = NULL;
+       p_uvp->post_create_mw = NULL;
+       p_uvp->pre_query_mw     = NULL;
+       p_uvp->post_query_mw    = NULL;
+       p_uvp->pre_destroy_mw = NULL;
+       p_uvp->post_destroy_mw = NULL;
 
-    /*
-     * Memory Window Verbs
-     */
-       p_uvp->pre_create_mw    = NULL; // __pre_create_mw
-       p_uvp->post_create_mw = NULL;   // __post_create_mw
-       p_uvp->pre_query_mw     = NULL; // __pre_query_mw
-       p_uvp->post_query_mw    = NULL; // __post_query_mw
-       p_uvp->pre_destroy_mw = NULL;   // __pre_destroy_mw
-       p_uvp->post_destroy_mw = NULL;  // __post_destroy_mw
-
-    /* register_pmr is not supported in user-mode */
-
     UVP_EXIT(UVP_DBG_SHIM);
 }
 
Index: hw/mthca/user/mlnx_ual_osbypass.c
===================================================================
--- hw/mthca/user/mlnx_ual_osbypass.c   (revision 1128)
+++ hw/mthca/user/mlnx_ual_osbypass.c   (working copy)
@@ -236,36 +236,18 @@
 
 void
 mlnx_get_osbypass_interface (
-       IN              uint32_t                        version,
     IN OUT     uvp_interface_t         *p_uvp )
 {
-
     CL_ASSERT(p_uvp);
 
-    /*
-     * Work Request Processing Verbs
-     * Should the types be same as Verbs?
-     */
     p_uvp->post_send = __post_send;
     p_uvp->post_recv = __post_recv;
     p_uvp->post_srq_recv = __post_srq_recv;
-
-    /*
-     * Completion Processing and 
-     * Completion Notification Request Verbs.
-     * Should the types be same as Verbs?
-     */
     p_uvp->poll_cq  = __poll_cq;
     p_uvp->rearm_cq = __enable_cq_notify;
-    p_uvp->rearm_n_cq = NULL; /* __enable_ncomp_cq_notify: Not implemented */;
-    p_uvp->peek_cq  = NULL; /* __peek_cq: Not implemented */
-
-    /* Memory window bind */
-    p_uvp->bind_mw = NULL; /* __bind_mw: Not implemented */
-
-       if (version >= 3)
-       {
-               p_uvp->poll_cq_array = __poll_cq_array;
-       }
+    p_uvp->rearm_n_cq = NULL;
+    p_uvp->peek_cq  = NULL;
+    p_uvp->bind_mw = NULL;
+       p_uvp->poll_cq_array = __poll_cq_array;
 }
 
Index: hw/mthca/user/mlnx_ual_pd.c
===================================================================
--- hw/mthca/user/mlnx_ual_pd.c (revision 1128)
+++ hw/mthca/user/mlnx_ual_pd.c (working copy)
@@ -164,17 +164,12 @@
 
 void
 mlnx_get_pd_interface (
-       IN              uint32_t                        version,
        IN OUT  uvp_interface_t         *p_uvp )
 {
        UVP_ENTER(UVP_DBG_SHIM);
 
        CL_ASSERT(p_uvp);
-       UNREFERENCED_PARAMETER(version);
 
-       /*
-        * Protection Domain
-        */
        p_uvp->pre_allocate_pd    = __pre_allocate_pd;
        p_uvp->post_allocate_pd   = __post_allocate_pd;
        p_uvp->pre_deallocate_pd  = __pre_deallocate_pd;
Index: hw/mthca/user/mlnx_ual_qp.c
===================================================================
--- hw/mthca/user/mlnx_ual_qp.c (revision 1128)
+++ hw/mthca/user/mlnx_ual_qp.c (working copy)
@@ -362,16 +362,12 @@
 
 void
 mlnx_get_qp_interface (
-       IN              uint32_t                        version,
     IN OUT     uvp_interface_t         *p_uvp )
 {
     UVP_ENTER(UVP_DBG_SHIM);
 
     CL_ASSERT(p_uvp);
 
-    /*
-     * QP Management Verbs
-     */
     p_uvp->pre_create_qp   = __pre_create_qp;
     p_uvp->post_create_qp  = __post_create_qp;
 
@@ -384,17 +380,10 @@
     p_uvp->pre_destroy_qp  = __pre_destroy_qp;
     p_uvp->post_destroy_qp = __post_destroy_qp;
 
-       if (version >= 2)
-       {
-           p_uvp->nd_modify_qp   = __nd_modify_qp;
-               p_uvp->nd_get_qp_state = __nd_get_qp_state;
-       }
+    p_uvp->nd_modify_qp   = __nd_modify_qp;
+       p_uvp->nd_get_qp_state = __nd_get_qp_state;
+       p_uvp->wv_pre_create_qp = __wv_pre_create_qp;
 
-       if (version >= 3)
-       {
-               p_uvp->wv_pre_create_qp = __wv_pre_create_qp;
-       }
-
     UVP_EXIT(UVP_DBG_SHIM);
 }
 
Index: hw/mthca/user/mlnx_ual_srq.c
===================================================================
--- hw/mthca/user/mlnx_ual_srq.c        (revision 1128)
+++ hw/mthca/user/mlnx_ual_srq.c        (working copy)
@@ -1,274 +1,269 @@
-/*
- * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
- * Copyright (c) 2004-2005 Mellanox Technologies, Inc. All rights reserved. 
- *
- * This software is available to you under the OpenIB.org BSD license
- * below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id: mlnx_ual_srq.c 1611 2006-08-20 14:48:55Z leonid $
- */
-
-#include "mt_l2w.h"
-#include "mlnx_ual_main.h"
-#include "mlnx_uvp.h"
-#include "mx_abi.h"
-
-#if defined(EVENT_TRACING)
-#include "mlnx_ual_srq.tmh"
-#endif
-
-
-extern uint32_t        mlnx_dbg_lvl;
-
-static void __free_srq(struct mthca_srq *srq)
-{
-       /* srq may be NULL, when ioctl returned with some kind of error, e.g. 
IB_INVALID_PARAM */
-       if (!srq)
-               return;
-       
-       if (mthca_is_memfree(srq->ibv_srq.context)) {
-               mthca_free_db(to_mctx(srq->ibv_srq.context)->db_tab, 
MTHCA_DB_TYPE_SRQ,
-               srq->db_index);
-       }
-
-       if (srq->buf) {
-#ifdef NOT_USE_VIRTUAL_ALLOC   
-               cl_free(srq->buf);
-#else
-               VirtualFree( srq->buf, 0, MEM_RELEASE);
-#endif
-       }
-
-       if (srq->wrid) 
-               cl_free(srq->wrid);
-
-       cl_spinlock_destroy(&srq->lock);
-       cl_free (srq);
-}
-
-static ib_api_status_t  
-__pre_create_srq (
-       IN              const   ib_pd_handle_t FUNC_PTR64               
h_uvp_pd,// Fix me: if needed
-       IN              const   ib_srq_attr_t           *p_srq_attr,
-       IN OUT  ci_umv_buf_t                            *p_umv_buf,
-           OUT ib_srq_handle_t FUNC_PTR64                              
*ph_uvp_srq)
-{
-       struct mthca_srq *srq;
-       ib_api_status_t status = IB_SUCCESS;
-       size_t size = max( sizeof(struct ibv_create_srq), sizeof(struct 
ibv_create_srq_resp) );
-       mlnx_ual_pd_info_t *p_pd = (mlnx_ual_pd_info_t *)h_uvp_pd;
-       struct ibv_pd *ibv_pd = p_pd->ibv_pd;
-       struct ibv_create_srq *p_create_srq;
-       int err;
-
-       UNREFERENCED_PARAMETER(ph_uvp_srq);
-       
-       UVP_ENTER(UVP_DBG_SRQ);
-
-       CL_ASSERT(p_umv_buf);
-
-       /* Sanity check SRQ size before proceeding */
-       if (p_srq_attr->max_wr > 1 << 16 || p_srq_attr->max_sge > 64)
-       {
-               status = IB_INVALID_PARAMETER;
-               goto err_params;
-       }
-
-       if( !p_umv_buf->p_inout_buf )
-       {
-               p_umv_buf->p_inout_buf = cl_zalloc( size );
-               if( !p_umv_buf->p_inout_buf )
-               {
-                       status = IB_INSUFFICIENT_MEMORY;
-                       goto err_memory;
-               }
-       }
-       p_umv_buf->input_size = sizeof(struct ibv_create_srq);
-       p_umv_buf->output_size = sizeof(struct ibv_create_srq_resp);
-       p_umv_buf->command = TRUE;
-
-       /* allocate srq */
-       srq = cl_zalloc(sizeof *srq);
-       if (!srq)
-       {
-               status = IB_INSUFFICIENT_MEMORY;
-               goto err_alloc_srq;
-       }
-
-       /* init fields */
-       cl_spinlock_construct(&srq->lock);
-       if (cl_spinlock_init(&srq->lock))
-               goto err_lock;
-
-       srq->ibv_srq.pd = ibv_pd;
-       srq->ibv_srq.context                    = ibv_pd->context;
-       srq->max     = align_queue_size(ibv_pd->context, p_srq_attr->max_wr, 1);
-       srq->max_gs  = p_srq_attr->max_sge;
-       srq->counter = 0;
-
-       if (mthca_alloc_srq_buf(ibv_pd, (void*)p_srq_attr, srq))
-       {
-               status = IB_INSUFFICIENT_MEMORY;
-               goto err_alloc_buf;
-       }
-
-       // fill the parameters for ioctl
-       p_create_srq = (struct ibv_create_srq *)p_umv_buf->p_inout_buf;
-       p_create_srq->user_handle = (uint64_t)(ULONG_PTR)srq;
-       p_create_srq->mr.start = (uint64_t)(ULONG_PTR)srq->buf;
-       p_create_srq->mr.length = srq->buf_size;
-       p_create_srq->mr.hca_va = 0;
-       p_create_srq->mr.pd_handle       = p_pd->ibv_pd->handle;
-       p_create_srq->mr.pdn = to_mpd(p_pd->ibv_pd)->pdn;
-       p_create_srq->mr.access_flags = 0;      //local read
-
-       if (mthca_is_memfree(ibv_pd->context)) {
-               srq->db_index = mthca_alloc_db(to_mctx(ibv_pd->context)->db_tab,
-                       MTHCA_DB_TYPE_SRQ, &srq->db);
-               if (srq->db_index < 0)
-                       goto err_alloc_db;
-
-               p_create_srq->db_page  = db_align(srq->db);
-               p_create_srq->db_index = srq->db_index;
-       }
-
-       status = IB_SUCCESS;
-       goto end;
-
-err_alloc_db:
-#ifdef NOT_USE_VIRTUAL_ALLOC   
-               cl_free(srq->buf);
-#else
-               VirtualFree( srq->buf, 0, MEM_RELEASE);
-#endif
-       cl_free(srq->wrid);
-err_alloc_buf:
-       cl_spinlock_destroy(&srq->lock);
-err_lock:
-       cl_free(srq);
-err_alloc_srq:
-       cl_free(p_umv_buf->p_inout_buf);
-err_memory:
-err_params:
-end:
-       UVP_EXIT(UVP_DBG_SRQ);
-       return status;
-}
-
-
-static void
-__post_create_srq (
-       IN              const   ib_pd_handle_t FUNC_PTR64                       
        h_uvp_pd,
-       IN                              ib_api_status_t                         
ioctl_status,
-       IN      OUT                     ib_srq_handle_t FUNC_PTR64              
                *ph_uvp_srq,
-       IN                              ci_umv_buf_t                            
*p_umv_buf )
-{
-       int err;
-       struct mthca_srq *srq;
-       struct ibv_create_srq_resp *p_resp;
-       mlnx_ual_pd_info_t *p_pd = (mlnx_ual_pd_info_t *)h_uvp_pd;
-       struct ibv_pd *ibv_pd = p_pd->ibv_pd;
-       ib_api_status_t status = IB_SUCCESS;
-
-       UVP_ENTER(UVP_DBG_SRQ);
-
-       CL_ASSERT(p_umv_buf);
-       p_resp = (struct ibv_create_srq_resp *)p_umv_buf->p_inout_buf;
-       srq = (struct mthca_srq *)(ULONG_PTR)p_resp->user_handle;
-
-       if (IB_SUCCESS == ioctl_status) {
-
-               /* complete filling SRQ object */
-               srq->ibv_srq.handle                     = p_resp->srq_handle;
-               srq->srqn                                       = p_resp->srqn;
-               srq->max                                        = 
p_resp->max_wr;
-               srq->max_gs                                     = 
p_resp->max_sge;
-               srq->mr.handle = p_resp->mr.mr_handle;
-               srq->mr.lkey = p_resp->mr.lkey;
-               srq->mr.rkey = p_resp->mr.rkey;
-               srq->mr.pd = ibv_pd;
-               srq->mr.context = ibv_pd->context;
-
-               if (mthca_is_memfree(ibv_pd->context))
-                       mthca_set_db_qn(srq->db, MTHCA_DB_TYPE_SRQ, srq->srqn);
-               
-               *ph_uvp_srq = (ib_srq_handle_t VOID_PTR64)srq;
-       }
-       else
-               __free_srq(srq);
-
-       if (p_resp)
-               cl_free( p_resp );
-       UVP_EXIT(UVP_DBG_SRQ);
-       return;
-}
-
-static void
-__post_destroy_srq (
-       IN              const ib_srq_handle_t FUNC_PTR64                
h_uvp_srq,
-       IN              ib_api_status_t                 ioctl_status)
-{
-       int err;
-       struct mthca_srq *srq = (struct mthca_srq *) ((void*)h_uvp_srq);
-
-       UVP_ENTER(UVP_DBG_CQ);
-
-       CL_ASSERT(srq);
-
-       if (IB_SUCCESS == ioctl_status) 
-               __free_srq(srq);
-
-       UVP_EXIT(UVP_DBG_CQ);
-}
-
-void
-mlnx_get_srq_interface (
-       IN              uint32_t                        version,
-       IN OUT  uvp_interface_t         *p_uvp )
-{
-       UVP_ENTER(UVP_DBG_DEV);
-
-       CL_ASSERT(p_uvp);
-       UNREFERENCED_PARAMETER(version);
-
-       /*
-        * Completion Queue Management Verbs
-        */
-       p_uvp->pre_create_srq  = __pre_create_srq;
-       p_uvp->post_create_srq = __post_create_srq;
-
-       p_uvp->pre_query_srq  = NULL; /* __pre_query_srq; */
-       p_uvp->post_query_srq = NULL; /*__post_query_srq;*/
-
-       p_uvp->pre_modify_srq  = NULL; /* __modify_srq;*/
-       p_uvp->post_modify_srq = NULL; /*__post_modify_srq;*/
-
-       p_uvp->pre_destroy_srq  = NULL; /* __pre_destroy_srq; */
-       p_uvp->post_destroy_srq = __post_destroy_srq;
-
-       UVP_EXIT(UVP_DBG_DEV);
-}
-
-
+/*
+ * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.
+ * Copyright (c) 2004-2005 Mellanox Technologies, Inc. All rights reserved. 
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id: mlnx_ual_srq.c 1611 2006-08-20 14:48:55Z leonid $
+ */
+
+#include "mt_l2w.h"
+#include "mlnx_ual_main.h"
+#include "mlnx_uvp.h"
+#include "mx_abi.h"
+
+#if defined(EVENT_TRACING)
+#include "mlnx_ual_srq.tmh"
+#endif
+
+
+extern uint32_t        mlnx_dbg_lvl;
+
+static void __free_srq(struct mthca_srq *srq)
+{
+       /* srq may be NULL, when ioctl returned with some kind of error, e.g. 
IB_INVALID_PARAM */
+       if (!srq)
+               return;
+       
+       if (mthca_is_memfree(srq->ibv_srq.context)) {
+               mthca_free_db(to_mctx(srq->ibv_srq.context)->db_tab, 
MTHCA_DB_TYPE_SRQ,
+               srq->db_index);
+       }
+
+       if (srq->buf) {
+#ifdef NOT_USE_VIRTUAL_ALLOC   
+               cl_free(srq->buf);
+#else
+               VirtualFree( srq->buf, 0, MEM_RELEASE);
+#endif
+       }
+
+       if (srq->wrid) 
+               cl_free(srq->wrid);
+
+       cl_spinlock_destroy(&srq->lock);
+       cl_free (srq);
+}
+
+static ib_api_status_t  
+__pre_create_srq (
+       IN              const   ib_pd_handle_t FUNC_PTR64               
h_uvp_pd,// Fix me: if needed
+       IN              const   ib_srq_attr_t           *p_srq_attr,
+       IN OUT  ci_umv_buf_t                            *p_umv_buf,
+           OUT ib_srq_handle_t FUNC_PTR64                              
*ph_uvp_srq)
+{
+       struct mthca_srq *srq;
+       ib_api_status_t status = IB_SUCCESS;
+       size_t size = max( sizeof(struct ibv_create_srq), sizeof(struct 
ibv_create_srq_resp) );
+       mlnx_ual_pd_info_t *p_pd = (mlnx_ual_pd_info_t *)h_uvp_pd;
+       struct ibv_pd *ibv_pd = p_pd->ibv_pd;
+       struct ibv_create_srq *p_create_srq;
+       int err;
+
+       UNREFERENCED_PARAMETER(ph_uvp_srq);
+       
+       UVP_ENTER(UVP_DBG_SRQ);
+
+       CL_ASSERT(p_umv_buf);
+
+       /* Sanity check SRQ size before proceeding */
+       if (p_srq_attr->max_wr > 1 << 16 || p_srq_attr->max_sge > 64)
+       {
+               status = IB_INVALID_PARAMETER;
+               goto err_params;
+       }
+
+       if( !p_umv_buf->p_inout_buf )
+       {
+               p_umv_buf->p_inout_buf = cl_zalloc( size );
+               if( !p_umv_buf->p_inout_buf )
+               {
+                       status = IB_INSUFFICIENT_MEMORY;
+                       goto err_memory;
+               }
+       }
+       p_umv_buf->input_size = sizeof(struct ibv_create_srq);
+       p_umv_buf->output_size = sizeof(struct ibv_create_srq_resp);
+       p_umv_buf->command = TRUE;
+
+       /* allocate srq */
+       srq = cl_zalloc(sizeof *srq);
+       if (!srq)
+       {
+               status = IB_INSUFFICIENT_MEMORY;
+               goto err_alloc_srq;
+       }
+
+       /* init fields */
+       cl_spinlock_construct(&srq->lock);
+       if (cl_spinlock_init(&srq->lock))
+               goto err_lock;
+
+       srq->ibv_srq.pd = ibv_pd;
+       srq->ibv_srq.context                    = ibv_pd->context;
+       srq->max     = align_queue_size(ibv_pd->context, p_srq_attr->max_wr, 1);
+       srq->max_gs  = p_srq_attr->max_sge;
+       srq->counter = 0;
+
+       if (mthca_alloc_srq_buf(ibv_pd, (void*)p_srq_attr, srq))
+       {
+               status = IB_INSUFFICIENT_MEMORY;
+               goto err_alloc_buf;
+       }
+
+       // fill the parameters for ioctl
+       p_create_srq = (struct ibv_create_srq *)p_umv_buf->p_inout_buf;
+       p_create_srq->user_handle = (uint64_t)(ULONG_PTR)srq;
+       p_create_srq->mr.start = (uint64_t)(ULONG_PTR)srq->buf;
+       p_create_srq->mr.length = srq->buf_size;
+       p_create_srq->mr.hca_va = 0;
+       p_create_srq->mr.pd_handle       = p_pd->ibv_pd->handle;
+       p_create_srq->mr.pdn = to_mpd(p_pd->ibv_pd)->pdn;
+       p_create_srq->mr.access_flags = 0;      //local read
+
+       if (mthca_is_memfree(ibv_pd->context)) {
+               srq->db_index = mthca_alloc_db(to_mctx(ibv_pd->context)->db_tab,
+                       MTHCA_DB_TYPE_SRQ, &srq->db);
+               if (srq->db_index < 0)
+                       goto err_alloc_db;
+
+               p_create_srq->db_page  = db_align(srq->db);
+               p_create_srq->db_index = srq->db_index;
+       }
+
+       status = IB_SUCCESS;
+       goto end;
+
+err_alloc_db:
+#ifdef NOT_USE_VIRTUAL_ALLOC   
+               cl_free(srq->buf);
+#else
+               VirtualFree( srq->buf, 0, MEM_RELEASE);
+#endif
+       cl_free(srq->wrid);
+err_alloc_buf:
+       cl_spinlock_destroy(&srq->lock);
+err_lock:
+       cl_free(srq);
+err_alloc_srq:
+       cl_free(p_umv_buf->p_inout_buf);
+err_memory:
+err_params:
+end:
+       UVP_EXIT(UVP_DBG_SRQ);
+       return status;
+}
+
+
+static void
+__post_create_srq (
+       IN              const   ib_pd_handle_t FUNC_PTR64                       
        h_uvp_pd,
+       IN                              ib_api_status_t                         
ioctl_status,
+       IN      OUT                     ib_srq_handle_t FUNC_PTR64              
                *ph_uvp_srq,
+       IN                              ci_umv_buf_t                            
*p_umv_buf )
+{
+       int err;
+       struct mthca_srq *srq;
+       struct ibv_create_srq_resp *p_resp;
+       mlnx_ual_pd_info_t *p_pd = (mlnx_ual_pd_info_t *)h_uvp_pd;
+       struct ibv_pd *ibv_pd = p_pd->ibv_pd;
+       ib_api_status_t status = IB_SUCCESS;
+
+       UVP_ENTER(UVP_DBG_SRQ);
+
+       CL_ASSERT(p_umv_buf);
+       p_resp = (struct ibv_create_srq_resp *)p_umv_buf->p_inout_buf;
+       srq = (struct mthca_srq *)(ULONG_PTR)p_resp->user_handle;
+
+       if (IB_SUCCESS == ioctl_status) {
+
+               /* complete filling SRQ object */
+               srq->ibv_srq.handle                     = p_resp->srq_handle;
+               srq->srqn                                       = p_resp->srqn;
+               srq->max                                        = 
p_resp->max_wr;
+               srq->max_gs                                     = 
p_resp->max_sge;
+               srq->mr.handle = p_resp->mr.mr_handle;
+               srq->mr.lkey = p_resp->mr.lkey;
+               srq->mr.rkey = p_resp->mr.rkey;
+               srq->mr.pd = ibv_pd;
+               srq->mr.context = ibv_pd->context;
+
+               if (mthca_is_memfree(ibv_pd->context))
+                       mthca_set_db_qn(srq->db, MTHCA_DB_TYPE_SRQ, srq->srqn);
+               
+               *ph_uvp_srq = (ib_srq_handle_t VOID_PTR64)srq;
+       }
+       else
+               __free_srq(srq);
+
+       if (p_resp)
+               cl_free( p_resp );
+       UVP_EXIT(UVP_DBG_SRQ);
+       return;
+}
+
+static void
+__post_destroy_srq (
+       IN              const ib_srq_handle_t FUNC_PTR64                
h_uvp_srq,
+       IN              ib_api_status_t                 ioctl_status)
+{
+       int err;
+       struct mthca_srq *srq = (struct mthca_srq *) ((void*)h_uvp_srq);
+
+       UVP_ENTER(UVP_DBG_CQ);
+
+       CL_ASSERT(srq);
+
+       if (IB_SUCCESS == ioctl_status) 
+               __free_srq(srq);
+
+       UVP_EXIT(UVP_DBG_CQ);
+}
+
+void
+mlnx_get_srq_interface (
+       IN OUT  uvp_interface_t         *p_uvp )
+{
+       UVP_ENTER(UVP_DBG_DEV);
+
+       CL_ASSERT(p_uvp);
+
+       p_uvp->pre_create_srq  = __pre_create_srq;
+       p_uvp->post_create_srq = __post_create_srq;
+
+       p_uvp->pre_query_srq  = NULL;
+       p_uvp->post_query_srq = NULL;
+
+       p_uvp->pre_modify_srq  = NULL;
+       p_uvp->post_modify_srq = NULL;
+
+       p_uvp->pre_destroy_srq  = NULL;
+       p_uvp->post_destroy_srq = __post_destroy_srq;
+
+       UVP_EXIT(UVP_DBG_DEV);
+}
+
+
Index: hw/mthca/user/mlnx_uvp.def
===================================================================
--- hw/mthca/user/mlnx_uvp.def  (revision 1127)
+++ hw/mthca/user/mlnx_uvp.def  (working copy)
@@ -3,9 +3,3 @@
 #else
 LIBRARY mthcau.dll
 #endif
-
-#ifndef _WIN64
-EXPORTS
-uvp_get_interface
-uvp_get_interface_n
-#endif
Index: inc/user/iba/ib_uvp.h
===================================================================
--- inc/user/iba/ib_uvp.h       (revision 1128)
+++ inc/user/iba/ib_uvp.h       (working copy)
@@ -36,6 +36,7 @@
 #include <complib/cl_types.h>
 #include <iba/ib_types.h>
 #include <iba/ib_ci.h>
+#include <initguid.h>
 
 /****h* UAL_UVP_Interface/user-mode Verbs
 * NAME
@@ -3344,171 +3345,9 @@
 
 /********/
 
-/****s* user-mode Verbs/uvp_interface_t
-* NAME
-*      uvp_interface_t -- Interface holding supported Vendor APIs
-*
-* PURPOSE
-*      The following structure is supplied by a Vendor library
-*      providing verbs functionality.
-*
-* SOURCE
-*/
-typedef struct _uvp2_interface
-{
-       ib_net64_t                                      guid;
-       /*
-        * Version of the header file this interface export can handle
-        */
-       uint32_t                                        version;
-
-       /* Version 2.00 APIs */
-
-       /*
-        * HCA Access Verbs
-        */
-       uvp_pre_open_ca_t                       pre_open_ca;
-       uvp_post_open_ca_t                      post_open_ca;
-
-       uvp_pre_query_ca                        pre_query_ca;
-       uvp_post_query_ca_t                     post_query_ca;
-
-       uvp_pre_modify_ca                       pre_modify_ca;
-       uvp_post_modify_ca_t            post_modify_ca;
-
-       uvp_pre_close_ca_t                      pre_close_ca;
-       uvp_post_close_ca_t                     post_close_ca;
-
-       uvp_pre_ci_call                         pre_ci_call;
-       uvp_post_ci_call                        post_ci_call;
-
-
-       /*
-        * Protection Domain
-        */
-       uvp_pre_allocate_pd                     pre_allocate_pd;
-       uvp_post_allocate_pd_t          post_allocate_pd;
-       uvp_pre_deallocate_pd           pre_deallocate_pd;
-       uvp_post_deallocate_pd_t        post_deallocate_pd;
-
-       /*
-        * Address Vector Management Verbs
-        */
-
-       uvp_pre_create_av                       pre_create_av;
-       uvp_post_create_av_t            post_create_av;
-
-       uvp_pre_query_av                        pre_query_av;
-       uvp_post_query_av_t                     post_query_av;
-
-       uvp_pre_modify_av                       pre_modify_av;
-       uvp_post_modify_av_t            post_modify_av;
-       uvp_pre_destroy_av                      pre_destroy_av;
-       uvp_post_destroy_av_t           post_destroy_av;
-
-       /*
-        * SRQ Management Verbs
-        */
-       uvp_pre_create_srq              pre_create_srq;
-       uvp_post_create_srq_t           post_create_srq;
-
-       uvp_pre_modify_srq              pre_modify_srq;
-       uvp_post_modify_srq_t           post_modify_srq;
-
-       uvp_pre_query_srq               pre_query_srq;
-       uvp_post_query_srq_t            post_query_srq;
-
-       uvp_pre_destroy_srq             pre_destroy_srq;
-       uvp_post_destroy_srq_t          post_destroy_srq;
-
-
-       /*
-        * QP Management Verbs
-        */
-       uvp_pre_create_qp                       pre_create_qp;
-       uvp_post_create_qp_t            post_create_qp;
-
-       /* No support for create_spl_qp, UAL will return error */
-
-       uvp_pre_modify_qp                       pre_modify_qp;
-       uvp_post_modify_qp_t            post_modify_qp;
-
-       uvp_pre_query_qp                        pre_query_qp;
-       uvp_post_query_qp_t                     post_query_qp;
-
-       uvp_pre_destroy_qp                      pre_destroy_qp;
-       uvp_post_destroy_qp_t           post_destroy_qp;
-
-       /*
-        * Completion Queue Management Verbs
-        */
-       uvp_pre_create_cq                       pre_create_cq;
-       uvp_post_create_cq_t            post_create_cq;
-
-       uvp_pre_query_cq                        pre_query_cq;
-       uvp_post_query_cq_t                     post_query_cq;
-
-       uvp_pre_resize_cq                       pre_resize_cq;
-       uvp_post_resize_cq_t            post_resize_cq;
-
-       uvp_pre_destroy_cq                      pre_destroy_cq;
-       uvp_post_destroy_cq_t           post_destroy_cq;
-
-       /*
-        * Memory Window Verbs
-        */
-       uvp_pre_create_mw                       pre_create_mw;
-       uvp_post_create_mw_t            post_create_mw;
-       uvp_pre_query_mw                        pre_query_mw;
-       uvp_post_query_mw_t                     post_query_mw;
-       uvp_pre_destroy_mw                      pre_destroy_mw;
-       uvp_post_destroy_mw_t           post_destroy_mw;
-
-       /* No pre/post functions for bind */
-       uvp_bind_mw                                     bind_mw;
-
-       /*
-        * Work Request Processing Verbs
-        * Should the types be same as Verbs?
-        */
-       uvp_post_send                           post_send;
-       uvp_post_recv                           post_recv;
-       uvp_post_srq_recv                       post_srq_recv;
-
-       /*
-        * Completion Processing and
-        * Completion Notification Request Verbs.
-        * Should the types be same as Verbs?
-        */
-       uvp_peek_cq                                     peek_cq;
-       uvp_poll_cq                                     poll_cq;
-       uvp_rearm_cq                            rearm_cq;
-       uvp_rearm_n_cq                          rearm_n_cq;
-
-       /*
-        * Multicast Support Verbs
-        */
-       uvp_pre_attach_mcast            pre_attach_mcast;
-       uvp_post_attach_mcast           post_attach_mcast;
-       uvp_pre_detach_mcast            pre_detach_mcast;
-       uvp_post_detach_mcast           post_detach_mcast;
-
-       /*
-        * ND Support Verbs
-        */
-       uvp_nd_modify_qp_t                      nd_modify_qp;
-       uvp_nd_get_qp_state_t           nd_get_qp_state;
-
-} uvp2_interface_t;
-
 typedef struct _uvp_interface
 {
-       ib_net64_t                                      guid;
-       /*
-        * Version of the header file this interface export can handle
-        */
-       uint32_t                                        version;
-
+//     ib_net64_t                                      guid;
        uvp_pre_open_ca_t                       pre_open_ca;
        uvp_post_open_ca_t                      post_open_ca;
        uvp_pre_query_ca                        pre_query_ca;
@@ -3591,52 +3430,15 @@
        
 }      uvp_interface_t;
 
+// {A1F1EA66-4D17-4d04-B910-893F658241D0}
+DEFINE_GUID(IID_UVP, 
+0xa1f1ea66, 0x4d17, 0x4d04, 0xb9, 0x10, 0x89, 0x3f, 0x65, 0x82, 0x41, 0xd0);
+
 /********/
 
-/****f* user-mode Verbs/uvp_get_interface
-* NAME
-*      uvp_get_interface -- Get the Vendor's supported Verbs calls
-*
-* SYNOPSIS
-*/
 typedef ib_api_status_t
-(AL_API *uvp_get_interface_t)(
-       IN      OUT                     uvp2_interface_t*       const   p_uvp );
-/*
-* DESCRIPTION
-*      This routine is called by UAL to get the functions supported by
-*      a vendor's library. Upon discovering a new CA, UAL will look for
-*      the appropriate vendor library, load the library and query using
-*      this function to get the supported interfaces.
-*
-*      If the vendor does not support an interface function, it should be
-*      set to NULL in the interface structure returned.
-*
-* PARAMETERS
-*      p_uvp
-*              [in out] Pointer to the uvp2_interface_t structure that has the 
function
-*              vector to support verbs functionality.
-*
-* RETURN VALUE
-*      IB_SUCCESS
-*              The registration is successful.
-*      IB_INSUFFICIENT_MEMORY
-*              Insufficient memory to satisfy request
-*
-* PORTABILITY
-*      User mode
-*
-* SEE ALSO
-*      uvp_interface_t
-*
-********/
+(AL_API *uvp_get_interface_t)(GUID iid, void* pifc);
 
-typedef ib_api_status_t
-(AL_API *uvp_get_interface_n_t)(
-       IN              const   uint32_t                                        
version,
-       IN      OUT                     void*                                   
        p_uvp_interface,
-       IN                              size_t                                  
        uvp_interface_size);
-
 /********/
 
 #endif // __IB_UAL_UVP_H__


_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to