[ofw] [RFC] [PATCH] winverbs\uvp: add uvp_get_interface_n
Sean Hefty
sean.hefty at intel.com
Tue Mar 18 14:03:51 PDT 2008
Here's a quick attempt at adding support for multiple interface
versions to the UVP.
I've also defined a handful of function calls that will go into the
uvp v3 interface. These are mostly wrappers to the existing pre/post
calls, or minor modifications to existing functions. The purpose
for adding each call is as follows:
pre_create_qp - allows setting the qp_context
query_cq - single call in place of pre/post combo
poll_cq_array - returns an array of completion structures with qp_context
create_av - single call in place of pre/post combo
destroy_av - single call in place of pre/post combo
Comments?
- Sean
Index: core/al/user/ual_ca.c
===================================================================
--- core/al/user/ual_ca.c (revision 960)
+++ 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_t pfn_uvp_ifc;
+ uvp_get_interface_n_t pfn_uvp_ifc;
AL_ENTER( AL_DBG_CA );
@@ -116,7 +116,8 @@
return IB_SUCCESS;
}
- pfn_uvp_ifc = al_get_uvp_ifc_pfn( h_lib );
+ pfn_uvp_ifc = (uvp_get_interface_n_t)
+ GetProcAddress( h_lib, "uvp_get_interface_n" );
if( !pfn_uvp_ifc )
{
#if defined( _DEBUG_ )
@@ -131,7 +132,7 @@
}
/* Query the vendor-supported user-mode functions */
- pfn_uvp_ifc( &p_vca_intf->user_verbs );
+ pfn_uvp_ifc( 3, &p_vca_intf->user_verbs, sizeof p_vca_intf->user_verbs );
p_vca_intf->h_uvp_lib = h_lib;
AL_EXIT( AL_DBG_CA );
return IB_SUCCESS;
Index: core/al/user/ual_support.h
===================================================================
--- core/al/user/ual_support.h (revision 960)
+++ core/al/user/ual_support.h (working copy)
@@ -80,14 +80,6 @@
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,
Index: hw/mthca/user/mlnx_ual_main.c
===================================================================
--- hw/mthca/user/mlnx_ual_main.c (revision 960)
+++ hw/mthca/user/mlnx_ual_main.c (working copy)
@@ -133,8 +133,8 @@
#endif
}
-__declspec(dllexport) ib_api_status_t
-uvp_get_interface (
+static void
+_get_v2_interfaces (
IN OUT uvp_interface_t *p_uvp )
{
UVP_ENTER(UVP_DBG_SHIM);
@@ -143,7 +143,6 @@
/*
* Version of the header file this interface export can handle
*/
- p_uvp->version = 0x101;
p_uvp->guid = 0x12345678;
/*
@@ -199,6 +198,75 @@
*/
UVP_EXIT(UVP_DBG_SHIM);
- return IB_SUCCESS;
}
+static void
+_get_v3_interfaces (
+ IN OUT uvp_interface_t *p_uvp )
+{
+ UVP_ENTER(UVP_DBG_SHIM);
+
+ _get_v2_interfaces(p_uvp);
+ // TODO: set uvp3 specific interfaces
+ //p_uvp3->pre_create_qp = ;
+ //p_uvp3->query_cq = ;
+ //p_uvp3->poll_cq_array = ;
+ //p_uvp3->create_av = ;
+ //p_uvp3->destroy_av = ;
+
+ 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)
+{
+ ib_api_status_t stat = IB_SUCCESS;
+ uvp_interface_t *p_uvp;
+
+ p_uvp = (uvp_interface_t *) p_uvp_interface;
+
+ UVP_ENTER(UVP_DBG_SHIM);
+
+ switch (version)
+ {
+ case 2:
+ if (uvp_interface_size < sizeof(uvp2_interface_t))
+ {
+ stat = IB_INSUFFICIENT_MEMORY;
+ break;
+ }
+ _get_v2_interfaces(p_uvp);
+ break;
+ case 3:
+ if (uvp_interface_size < sizeof(uvp_interface_t))
+ {
+ stat = IB_INSUFFICIENT_MEMORY;
+ break;
+ }
+ _get_v3_interfaces(p_uvp);
+ break;
+ default:
+ stat = IB_UNSUPPORTED;
+ break;
+ }
+
+ if (stat == IB_SUCCESS)
+ {
+ p_uvp->version = version;
+ }
+
+ UVP_EXIT(UVP_DBG_SHIM);
+ return stat;
+}
+
+// Deprecate - for version 2 support only
+__declspec(dllexport) ib_api_status_t
+uvp_get_interface (
+ IN OUT uvp2_interface_t *p_uvp )
+{
+ return uvp_get_interface_n(2, (void *) p_uvp, sizeof(uvp2_interface_t));
+}
+
Index: hw/mthca/user/mlnx_uvp.def
===================================================================
--- hw/mthca/user/mlnx_uvp.def (revision 960)
+++ hw/mthca/user/mlnx_uvp.def (working copy)
@@ -7,4 +7,5 @@
#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 960)
+++ inc/user/iba/ib_uvp.h (working copy)
@@ -871,6 +871,12 @@
*
********/
+typedef ib_api_status_t
+(AL_API *uvp_create_av) (
+ IN const ib_pd_handle_t h_uvp_pd,
+ IN const ib_av_attr_t *p_addr_vector,
+ OUT ib_av_handle_t *ph_uvp_av);
+
/********/
/****f* user-mode Verbs/uvp_pre_query_av
@@ -1133,6 +1139,10 @@
*
********/
+typedef ib_api_status_t
+(AL_API *uvp_destroy_av) (
+ IN const ib_av_handle_t h_uvp_av );
+
/********/
/****f* user-mode Verbs/uvp_pre_create_srq
@@ -1581,6 +1591,24 @@
*
********/
+typedef struct _uvp_qp_create
+{
+ ib_qp_create_t qp_create;
+
+ void *context;
+ uint32_t max_inline_send;
+ uint32_t initiator_depth;
+ uint32_t responder_resources;
+
+} uvp_qp_create_t;
+
+typedef ib_api_status_t
+(AL_API *uvp_wv_pre_create_qp) (
+ IN const ib_pd_handle_t h_uvp_pd,
+ IN const uvp_qp_create_t *p_create_attr,
+ IN OUT ci_umv_buf_t *p_umv_buf,
+ OUT ib_qp_handle_t *ph_uvp_qp);
+
/********/
/****f* user-mode Verbs/uvp_post_create_qp_t
@@ -2305,6 +2333,11 @@
*
********/
+typedef ib_api_status_t
+(AL_API *uvp_query_cq) (
+ IN const ib_cq_handle_t h_uvp_cq,
+ IN OUT uint32_t* const p_size );
+
/********/
/****f* user-mode Verbs/uvp_pre_destroy_cq
@@ -2992,6 +3025,51 @@
/********/
+/*
+ * Define uvp_wc_t so that we can cast directly to ib_wc_t.
+ */
+typedef struct _uvp_wc
+{
+ void* qp_context;
+ /* If pointer size is 32-bits, then compiler will pad before uint64_t */
+ uint64_t wr_id;
+ ib_wc_type_t wc_type;
+
+ uint32_t length;
+ ib_wc_status_t status;
+ uint64_t vendor_specific;
+
+ union _uvp_wc_recv
+ {
+ struct _uvp_wc_conn
+ {
+ ib_recv_opt_t recv_opt;
+ ib_net32_t immediate_data;
+
+ } conn;
+
+ struct _uvp_wc_ud
+ {
+ ib_recv_opt_t recv_opt;
+ ib_net32_t immediate_data;
+ ib_net32_t remote_qp;
+ uint16_t pkey_index;
+ ib_net16_t remote_lid;
+ uint8_t remote_sl;
+ uint8_t path_bits;
+
+ } ud;
+ } recv;
+} uvp_wc_t;
+
+typedef int
+(AL_API *uvp_poll_cq_array) (
+ IN const void* h_cq,
+ IN const int num_entries,
+ IN OUT uvp_wc_t* const wcs);
+
+/********/
+
/****f* user-mode Verbs/uvp_rearm_cq
* NAME
* uvp_rearm_cq -- Invoke the Completion handler, on next entry added.
@@ -3291,7 +3369,7 @@
*
* SOURCE
*/
-typedef struct _uvp_interface
+typedef struct _uvp2_interface
{
ib_net64_t guid;
/*
@@ -3430,13 +3508,167 @@
uvp_pre_detach_mcast pre_detach_mcast;
uvp_post_detach_mcast post_detach_mcast;
+ // TODO: see if these should go into uvp_interface3
/*
* 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;
+
+ /*
+ * 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;
+
+ // Version 3 interfaces
+ uvp_wv_pre_create_qp wv_pre_create_qp;
+
+ uvp_query_cq query_cq;
+ uvp_poll_cq_array poll_cq_array;
+ uvp_create_av create_av;
+ uvp_destroy_av destroy_av;
-} uvp_interface_t;
+} uvp_interface_t;
/********/
@@ -3448,7 +3680,7 @@
*/
typedef ib_api_status_t
(AL_API *uvp_get_interface_t)(
- IN OUT uvp_interface_t* const p_uvp );
+ IN OUT uvp2_interface_t* const p_uvp );
/*
* DESCRIPTION
* This routine is called by UAL to get the functions supported by
@@ -3461,7 +3693,7 @@
*
* PARAMETERS
* p_uvp
-* [in out] Pointer to the uvp_interface_t structure that has the function
+* [in out] Pointer to the uvp2_interface_t structure that has the function
* vector to support verbs functionality.
*
* RETURN VALUE
@@ -3478,6 +3710,12 @@
*
********/
+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__
More information about the ofw
mailing list