[ofw] [PATCH 4/9 v2] uvp/interface: add support for reporting QP context in WCs

Sean Hefty sean.hefty at intel.com
Fri Jun 27 09:40:08 PDT 2008


Extend the uvp_interface to include support for reporting the QP context in
work completions.  The required changes are to allow specifying a qp_context
in the pre_create_qp() IOCTL call, and reporting the qp_context through the
work completion structure.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
changes from v1:

Removed UNREFERENCED_PARAMETER(ph_uvp_qp) from __pre_create_qp, since it is
now referenced.

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 20:27:56.776000000 -0700
+++ branches\winverbs/hw/mlx4/user/hca/mlx4.c	2008-06-03 20:32:17.213500000 -0700
@@ -227,11 +227,8 @@ uvp_get_interface (
 	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;
+	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;
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk/hw/mlx4/user/hca/verbs.c
branches\winverbs/hw/mlx4/user/hca/verbs.c
--- trunk/hw/mlx4/user/hca/verbs.c	2008-06-03 20:27:56.744750000 -0700
+++ branches\winverbs/hw/mlx4/user/hca/verbs.c	2008-06-03 20:32:17.197875000 -0700
@@ -852,6 +852,25 @@ end:
 }
 
 ib_api_status_t
+mlx4_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 )
+{
+	struct mlx4_qp *qp;
+	ib_api_status_t	status;
+
+	status = mlx4_pre_create_qp(h_uvp_pd, &p_create_attr->qp_create,
+								p_umv_buf, ph_uvp_qp);
+	if (status == IB_SUCCESS) {
+		qp = (struct mlx4_qp *) *ph_uvp_qp;
+		qp->ibv_qp.qp_context = p_create_attr->context;
+	}
+	return status;
+}
+
+ib_api_status_t
 mlx4_post_create_qp (
 	IN		const	ib_pd_handle_t			h_uvp_pd,
 	IN				ib_api_status_t 			ioctl_status,
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk/hw/mlx4/user/hca/verbs.h
branches\winverbs/hw/mlx4/user/hca/verbs.h
--- trunk/hw/mlx4/user/hca/verbs.h	2008-06-03 20:27:56.807250000 -0700
+++ branches\winverbs/hw/mlx4/user/hca/verbs.h	2008-06-03 20:32:17.229125000 -0700
@@ -184,6 +184,7 @@ struct ibv_srq {
 
 struct ibv_qp {
 	struct ibv_context     *context;
+	void				   *qp_context;
 	struct ibv_pd	       *pd;
 	struct ibv_cq	       *send_cq;
 	struct ibv_cq	       *recv_cq;
@@ -327,6 +328,13 @@ mlx4_pre_create_qp (
 		OUT			ib_qp_handle_t			*ph_uvp_qp );
 
 ib_api_status_t
+mlx4_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 );
+
+ib_api_status_t
 mlx4_post_create_qp (
 	IN		const	ib_pd_handle_t			h_uvp_pd,
 	IN				ib_api_status_t 			ioctl_status,
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk/hw/mthca/user/mlnx_ual_qp.c
branches\winverbs/hw/mthca/user/mlnx_ual_qp.c
--- trunk/hw/mthca/user/mlnx_ual_qp.c	2008-06-03 20:27:56.838500000 -0700
+++ branches\winverbs/hw/mthca/user/mlnx_ual_qp.c	2008-06-03 20:32:17.244750000 -0700
@@ -93,8 +93,6 @@ __pre_create_qp (
 	size_t size = max( sizeof(struct ibv_create_qp), sizeof(struct ibv_create_qp_resp) );
 	struct ibv_pd *ibv_pd = h_uvp_pd->ibv_pd;
 
-	UNREFERENCED_PARAMETER(ph_uvp_qp);
-		
 	UVP_ENTER(UVP_DBG_QP);
 
 	CL_ASSERT(p_umv_buf);
@@ -138,6 +138,7 @@ __pre_create_qp (
 		goto err_alloc_qp;
 	}
 
+	*ph_uvp_qp = (ib_qp_handle_t) ibv_qp;
 	goto end;
 		
 err_alloc_qp:
@@ -149,6 +150,25 @@ end:
 }
 
 static ib_api_status_t
+__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)
+{
+	struct ibv_qp *qp;
+	ib_api_status_t status;
+
+	status = __pre_create_qp(h_uvp_pd, &p_create_attr->qp_create,
+							 p_umv_buf, ph_uvp_qp);
+	if (status == IB_SUCCESS) {
+		qp = (struct ibv_qp *) *ph_uvp_qp;
+		qp->qp_context = p_create_attr->context;
+	}
+	return status;
+}
+
+static ib_api_status_t
 __post_create_qp (
 	IN		const ib_pd_handle_t FUNC_PTR64				h_uvp_pd,
 	IN				ib_api_status_t 			ioctl_status,
@@ -178,8 +198,6 @@ __post_create_qp (
 			status = errno_to_iberr(err);
 			goto err_create_cq;
 		}
-
-		*ph_uvp_qp = (ib_qp_handle_t VOID_PTR64)ibv_qp;
 	}
 	goto end;
 	
@@ -363,8 +381,10 @@ mlnx_get_qp_interface (
     p_uvp->post_query_qp   = __post_query_qp;
     p_uvp->pre_destroy_qp  = __pre_destroy_qp;
     p_uvp->post_destroy_qp = __post_destroy_qp;
+
     p_uvp->nd_modify_qp   = __nd_modify_qp;
-    p_uvp->nd_get_qp_state = __nd_get_qp_state;
+	p_uvp->nd_get_qp_state = __nd_get_qp_state;
+	p_uvp->wv_pre_create_qp = __wv_pre_create_qp;
 
     UVP_EXIT(UVP_DBG_SHIM);
 }
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk/hw/mthca/user/mlnx_uvp_verbs.h
branches\winverbs/hw/mthca/user/mlnx_uvp_verbs.h
--- trunk/hw/mthca/user/mlnx_uvp_verbs.h	2008-06-03 22:03:07.885375000 -0700
+++ branches\winverbs/hw/mthca/user/mlnx_uvp_verbs.h	2008-06-10 13:57:57.638049900 -0700
@@ -420,6 +420,7 @@ struct ibv_qp {
 	enum ibv_qp_state       state;
 	ib_qp_type_t	qp_type;
 	struct ibv_context     *context;
+	void					*qp_context;
 };
 
 struct ibv_cq {
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 20:27:56.916625000 -0700
+++ branches\winverbs/inc/user/iba/ib_uvp.h	2008-06-03 20:32:17.260375000 -0700
@@ -1581,6 +1581,24 @@ typedef ib_api_status_t
 *
 ********/
 
+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
@@ -3435,7 +3453,8 @@ typedef struct _uvp_interface
 	 */
 	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;
+
 } uvp_interface_t;
 
 /********/





More information about the ofw mailing list