[ofw] proposed UVP change to support CQ polling

Sean Hefty sean.hefty at intel.com
Fri Mar 14 09:40:30 PDT 2008


>If the intention in:
>Poll(WV_COMPLETION* pCompletions[], SIZE_T Entries)
>Was to have the called function allocate the memory than I guess that
>your change is welcomed.

Poll was never intended to allocate memory.  I want to replace the
array of pointers to WV_COMPLETIONS with just the array of WV_COMPLETIONS,
to avoid the indirection.  The caller is still responsible for allocating
the memory.

The WV change is really separate from that suggested for the UVP.  The
change to the UVP is to return the qp_context information to the work
completion.  The patch below (RFC & compile tested only) shows what the
general changes would look like.  I don't _think_ this touches any accessible
code paths.

- Sean
---
Index: winverbs/hw/mthca/user/mlnx_ual_osbypass.c
===================================================================
--- winverbs/hw/mthca/user/mlnx_ual_osbypass.c	(revision 960)
+++ winverbs/hw/mthca/user/mlnx_ual_osbypass.c	(working copy)
@@ -176,6 +176,25 @@
 }
 
 
+static int
+__poll_cq_array (
+	IN		const	void*						h_cq,
+	IN		const	int							num_entries,
+	IN	OUT			uvp_wc_t*	const			wc )
+{
+	int ne;
+	struct mthca_cq *cq = (struct mthca_cq *) h_cq;
+
+	UVP_ENTER(UVP_DBG_CQ);
+	CL_ASSERT (cq);
+
+	ne = cq->ibv_cq.context->ops.poll_cq(&cq->ibv_cq, num_entries, wc);
+
+	UVP_EXIT(UVP_DBG_CQ);
+	return ne;
+}
+
+
 static ib_api_status_t
 __enable_cq_notify (
 	IN		const	void*		__ptr64			h_cq,
@@ -236,6 +255,7 @@
      * Should the types be same as Verbs?
      */
     p_uvp->poll_cq  = __poll_cq;
+	p_uvp->poll_cq_array = __poll_cq_array;
     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 */
Index: winverbs/hw/mthca/user/mlnx_uvp.h
===================================================================
--- winverbs/hw/mthca/user/mlnx_uvp.h	(revision 960)
+++ winverbs/hw/mthca/user/mlnx_uvp.h	(working copy)
@@ -277,7 +277,7 @@
 struct ibv_cq *mthca_create_cq_post(struct ibv_context *context, 
 				 struct ibv_create_cq_resp *resp);
 int mthca_destroy_cq(struct ibv_cq *cq);
-int mthca_poll_cq(struct ibv_cq *cq, int ne, struct _ib_wc *wc);
+int mthca_poll_cq(struct ibv_cq *cq, int ne, struct _uvp_wc *wc);
 int mthca_poll_cq_list(struct ibv_cq *ibcq, 
 	struct _ib_wc** const pp_free_wclist,
 	struct _ib_wc** const pp_done_wclist );
Index: winverbs/hw/mthca/user/mlnx_uvp_cq.c
===================================================================
--- winverbs/hw/mthca/user/mlnx_uvp_cq.c	(revision 960)
+++ winverbs/hw/mthca/user/mlnx_uvp_cq.c	(working copy)
@@ -37,6 +37,7 @@
 #include <opcode.h>
 #include "mlnx_uvp.h"
 #include "mlnx_uvp_doorbell.h"
+#include <iba\ib_uvp.h>
 
 #if defined(EVENT_TRACING)
 #include "mlnx_uvp_cq.tmh"
@@ -442,7 +443,7 @@
 	return err;
 }
 
-int mthca_poll_cq(struct ibv_cq *ibcq, int num_entries, struct _ib_wc *entry)
+int mthca_poll_cq(struct ibv_cq *ibcq, int num_entries, struct _uvp_wc *entry)
 {
 	struct mthca_cq *cq = to_mcq(ibcq);
 	struct mthca_qp *qp = NULL;
@@ -453,9 +454,10 @@
 	cl_spinlock_acquire(&cq->lock);
 
 	for (npolled = 0; npolled < num_entries; ++npolled) {
-		err = mthca_poll_one(cq, &qp, &freed, entry + npolled);
+		err = mthca_poll_one(cq, &qp, &freed, &entry[npolled].wc);
 		if (err)
 			break;
+		entry[npolled].qp_context = qp->ibv_qp.context;
 	}
 
 	if (freed) {
Index: winverbs/hw/mthca/user/mlnx_uvp_verbs.h
===================================================================
--- winverbs/hw/mthca/user/mlnx_uvp_verbs.h	(revision 960)
+++ winverbs/hw/mthca/user/mlnx_uvp_verbs.h	(working copy)
@@ -446,7 +446,7 @@
 			       struct ibv_create_cq *req);
 	struct ibv_cq * (*create_cq_post)(struct ibv_context *context, 
 			       struct ibv_create_cq_resp *resp);
-	int			(*poll_cq)(struct ibv_cq *cq, int num_entries, struct _ib_wc *wc);
+	int			(*poll_cq)(struct ibv_cq *cq, int num_entries, struct _uvp_wc *wc);
 	int 			(*poll_cq_list)( struct ibv_cq *ibcq, 
 		struct _ib_wc** const 			pp_free_wclist,
 		struct _ib_wc** const 			pp_done_wclist );
Index: winverbs/inc/user/iba/ib_uvp.h
===================================================================
--- winverbs/inc/user/iba/ib_uvp.h	(revision 960)
+++ winverbs/inc/user/iba/ib_uvp.h	(working copy)
@@ -2992,6 +2992,20 @@
 
 /********/
 
+typedef struct _uvp_wc
+{
+	ib_wc_t	wc;
+	void*	qp_context;
+}	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			wc );
+
+/********/
+
 /****f* user-mode Verbs/uvp_rearm_cq
 * NAME
 *	uvp_rearm_cq -- Invoke the Completion handler, on next entry added.
@@ -3435,6 +3449,8 @@
 	 */
 	uvp_nd_modify_qp_t			nd_modify_qp;
 	uvp_nd_get_qp_state_t		nd_get_qp_state;
+
+	uvp_poll_cq_array			poll_cq_array;
 	
 } uvp_interface_t;
 





More information about the ofw mailing list