[ofw] [PATCH 6/9] uvp: obtain desired interface by GUID
Reuven Amitai
reuven at mellanox.co.il
Sun Jun 29 10:26:54 PDT 2008
Hi,
I think that it will be more useful to adapt the description of the new
get_interface function
than remove it.
Thanks, Reuven.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/****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 GUID iid
IN OUT uvp_interface_t* const
pifc );
/*
* 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 an interface by GUID.
*
* If the vendor does not support an interface, it should returns
* IB_UNSUPPORTED
*
* If the vendor does not support an interface function, it should
be
* set to NULL in the interface structure returned.
*
* PARAMETERS
* pifc
* [in out] Pointer to the uvp_interface_t structure that
has the function
* vector to support verbs functionality.
* iid
* [in] GUID of the requested interface.
*
* RETURN VALUE
* IB_SUCCESS
* The registration is successful.
* IB_INSUFFICIENT_MEMORY
* Insufficient memory to satisfy request
* IB_UNSUPPORTED
* The Interface isn't supported by the vendor's library.
*
* PORTABILITY
* User mode
*
* SEE ALSO
* uvp_interface_t
*
********/
/********/
-----Original Message-----
From: ofw-bounces at lists.openfabrics.org
[mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Sean Hefty
Sent: Thursday, June 26, 2008 2:56 AM
To: Hefty, Sean; ofw at lists.openfabrics.org
Subject: [ofw] [PATCH 6/9] uvp: obtain desired interface by GUID
The current uvp_get_interface() routine takes a structure as input.
Included in the structure is a version number.
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.
This will make it easier to extend the existing interfaces in the
future.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:'
trunk/core/al/user/ual_ca.c branches\winverbs/core/al/user/ual_ca.c
--- trunk/core/al/user/ual_ca.c 2008-06-03 21:35:25.166625000 -0700
+++ branches\winverbs/core/al/user/ual_ca.c 2008-06-03
21:24:28.322875000 -0700
@@ -116,7 +116,8 @@ open_vendor_lib(
return IB_SUCCESS;
}
- pfn_uvp_ifc = al_get_uvp_ifc_pfn( h_lib );
+ pfn_uvp_ifc = (uvp_get_interface_t)
+ GetProcAddress( h_lib,
"uvp_get_interface" );
if( !pfn_uvp_ifc )
{
#if defined( _DEBUG_ )
@@ -131,7 +132,7 @@ open_vendor_lib(
}
/* Query the vendor-supported user-mode functions */
- pfn_uvp_ifc( &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;
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:'
trunk/core/al/user/ual_support.h
branches\winverbs/core/al/user/ual_support.h
--- trunk/core/al/user/ual_support.h 2008-06-03 21:35:25.182250000
-0700
+++ branches\winverbs/core/al/user/ual_support.h 2008-06-03
21:24:28.338500000 -0700
@@ -80,14 +80,6 @@ al_unload_uvp(
FreeLibrary( h_uvp_lib );
}
-static inline uvp_get_interface_t
-al_get_uvp_ifc_pfn(
- IN void
*h_uvp_lib )
-{
- return (uvp_get_interface_t)
- GetProcAddress( h_uvp_lib, "uvp_get_interface" );
-}
-
static inline void
al_uvp_lib_err(
IN uint32_t
dbg_lvl,
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:'
trunk/hw/mlx4/user/hca/mlx4.c branches\winverbs/hw/mlx4/user/hca/mlx4.c
--- trunk/hw/mlx4/user/hca/mlx4.c 2008-06-03 21:35:25.197875000
-0700
+++ branches\winverbs/hw/mlx4/user/hca/mlx4.c 2008-06-03
21:24:28.354125000 -0700
@@ -180,22 +180,8 @@ void mlx4_free_context(struct ibv_contex
cl_free(context);
}
-__declspec(dllexport) ib_api_status_t
-uvp_get_interface (
- IN OUT uvp_interface_t *p_uvp )
+static void __get_uvp_interface(uvp_interface_t *p_uvp)
{
- CL_ASSERT(p_uvp);
-
- /*
- * Version of the header file this interface export can handle
- */
- p_uvp->version = 0x101;
- 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;
@@ -298,30 +284,47 @@ uvp_get_interface (
p_uvp->rearm_n_cq = NULL;
p_uvp->peek_cq = NULL;
p_uvp->bind_mw = NULL;
+}
+/* TODO: define and expose XRC through new interface GUID */
#ifdef XRC_SUPPORT
+static void __get_xrc_interface(uvp_xrc_interface_t *p_xrc) {
/*
* 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_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->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->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
- 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;
+}
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:'
trunk/hw/mthca/user/mlnx_ual_main.c
branches\winverbs/hw/mthca/user/mlnx_ual_main.c
--- trunk/hw/mthca/user/mlnx_ual_main.c 2008-06-03 21:35:25.213500000
-0700
+++ branches\winverbs/hw/mthca/user/mlnx_ual_main.c 2008-06-03
21:24:28.369750000 -0700
@@ -135,70 +135,30 @@ uvp_init()
__declspec(dllexport) ib_api_status_t
uvp_get_interface (
- IN OUT uvp_interface_t *p_uvp )
+ IN GUID iid,
+ IN void* pifc)
{
+ ib_api_status_t status = IB_SUCCESS;
+
UVP_ENTER(UVP_DBG_SHIM);
- CL_ASSERT(p_uvp);
- /*
- * Version of the header file this interface export can handle
- */
- p_uvp->version = 0x101;
- p_uvp->guid = 0x12345678;
-
- /*
- * CA Management
- */
- mlnx_get_ca_interface (p_uvp);
-
- /*
- * Protection Domain
- */
- mlnx_get_pd_interface (p_uvp);
-
- /*
- * SRQ Management Verbs
- */
- mlnx_get_srq_interface (p_uvp);
-
- /*
- * QP Management Verbs
- */
- mlnx_get_qp_interface (p_uvp);
-
- /*
- * Completion Queue Management Verbs
- */
- mlnx_get_cq_interface (p_uvp);
-
- /*
- * AV Management
- */
- mlnx_get_av_interface(p_uvp);
-
- /*
- * Memory Region / Window Management Verbs
- */
- mlnx_get_mrw_interface (p_uvp);
-
- /*
- * Multicast Support Verbs
- */
- mlnx_get_mcast_interface (p_uvp);
-
- /*
- * OS bypass (send, receive, poll/notify cq)
- */
- mlnx_get_osbypass_interface(p_uvp);
-
-
- /*
- * Local MAD support, for HCA's that do not support
- * Agents in the HW.
- * ??? Do we need this for user-mode ???
- */
+ if (IsEqualGUID(&iid, &IID_UVP))
+ {
+ 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);
+ }
+ else
+ {
+ status = IB_UNSUPPORTED;
+ }
- UVP_EXIT(UVP_DBG_SHIM);
- return IB_SUCCESS;
+ UVP_EXIT(UVP_DBG_SHIM);
+ return status;
}
-
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:'
trunk/inc/user/iba/ib_uvp.h branches\winverbs/inc/user/iba/ib_uvp.h
--- trunk/inc/user/iba/ib_uvp.h 2008-06-03 21:35:25.229125000 -0700
+++ branches\winverbs/inc/user/iba/ib_uvp.h 2008-06-03
21:24:28.385375000 -0700
@@ -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
@@ -3342,121 +3343,61 @@ typedef void
/********/
-/********/
-
-/****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 _uvp_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_pre_create_srq pre_create_srq;
uvp_post_create_srq_t post_create_srq;
-
- uvp_pre_modify_srq pre_modify_srq;
+ uvp_pre_modify_srq pre_modify_srq;
uvp_post_modify_srq_t post_modify_srq;
-
- uvp_pre_query_srq pre_query_srq;
+ uvp_pre_query_srq pre_query_srq;
uvp_post_query_srq_t post_query_srq;
-
- uvp_pre_destroy_srq pre_destroy_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;
@@ -3464,38 +3405,21 @@ typedef struct _uvp_interface
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;
uvp_wv_pre_create_qp wv_pre_create_qp;
@@ -3503,46 +3427,11 @@ typedef struct _uvp_interface
} 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 uvp_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 uvp_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);
#endif // __IB_UAL_UVP_H__
_______________________________________________
ofw mailing list
ofw at lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
More information about the ofw
mailing list