[ofw] [PATCH 6/7] libibverbs: update library to support librdmacm compat. library

Sean Hefty sean.hefty at intel.com
Fri Jan 16 14:54:22 PST 2009


The librdmacm uses the same devices that are usable with the libibverbs library.
Provide a method in libibverbs that allows librdmacm to use the same winverbs
provider as libibverbs.

Include fixes discovered testing the librdmacm port:

When a CQ is removed, its position in the completion channel is replaced by
the CQ at the end of the list, but the CQ that moves is not updated to
reflect its new location.

When a QP is created, we need to save the user's initial values before
querying for the QPN.  Otherwise, the query call tries to access invalid data.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk/ulp/libibverbs/src/device.cpp
branches\winverbs/ulp/libibverbs/src/device.cpp
--- trunk/ulp/libibverbs/src/device.cpp	2008-07-18 15:10:58.520531400 -0700
+++ branches\winverbs/ulp/libibverbs/src/device.cpp	2008-11-26 23:45:19.234375000 -0800
@@ -59,6 +59,22 @@ struct verbs_context
 };
 
 __declspec(dllexport)
+IWVProvider *ibv_get_winverbs(void)
+{
+	HRESULT hr;
+
+	if (prov == NULL) {
+		hr = WvGetObject(IID_IWVProvider, (LPVOID*) &prov);
+		if (FAILED(hr)) {
+			return NULL;
+		}
+	}
+
+	prov->AddRef();
+	return prov;
+}
+
+__declspec(dllexport)
 struct ibv_device **ibv_get_device_list(int *num)
 {
 	WV_DEVICE_ATTRIBUTES attr;
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk/ulp/libibverbs/src/Sources branches\winverbs/ulp/libibverbs/src/Sources
--- trunk/ulp/libibverbs/src/Sources	2008-06-29 00:36:25.140625000 -0700
+++ branches\winverbs/ulp/libibverbs/src/Sources	2008-12-08 14:03:31.059784600 -0800
@@ -14,7 +14,7 @@ DLLDEF = $(OBJ_PATH)\$O\ibv_exports.def
 !endif
 
 DLLENTRY = DllMain
-USE_NTDLL = 1
+USE_MSVCRT=1
 
 SOURCES = \
 	ibverbs.rc		\
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk/ulp/libibverbs/src/verbs.cpp branches\winverbs/ulp/libibverbs/src/verbs.cpp
--- trunk/ulp/libibverbs/src/verbs.cpp	2008-07-18 14:01:21.257485600 -0700
+++ branches\winverbs/ulp/libibverbs/src/verbs.cpp	2009-01-14 12:33:55.139175800 -0800
@@ -391,6 +391,7 @@ static void ibv_comp_channel_remove_cq(s
 	vchan->count--;
 	vchan->cq[cq->channel_index] = vchan->cq[vchan->count];
 	vchan->event[cq->channel_index] = vchan->event[vchan->count];
+	vchan->cq[cq->channel_index]->channel_index = cq->channel_index;
 	LeaveCriticalSection(&vchan->lock);
 }
 
@@ -675,10 +676,6 @@ struct ibv_qp *ibv_create_qp(struct ibv_
 	} else {
 		qp->conn_handle->QueryInterface(IID_IWVQueuePair, (LPVOID *) &qp->handle);
 	}
-	hr = ibv_query_qp(qp, &attr, (enum ibv_qp_attr_mask) 0xFFFFFFFF, qp_init_attr);
-	if (FAILED(hr)) {
-		goto err;
-	}
 
 	qp->context = pd->context;
 	qp->qp_context = qp_init_attr->qp_context;
@@ -689,6 +686,12 @@ struct ibv_qp *ibv_create_qp(struct ibv_
 	qp->state = IBV_QPS_RESET;
 	/* qp_num set by ibv_query_qp */
 	qp->qp_type = qp_init_attr->qp_type;
+
+	hr = ibv_query_qp(qp, &attr, (enum ibv_qp_attr_mask) 0xFFFFFFFF, qp_init_attr);
+	if (FAILED(hr)) {
+		goto err;
+	}
+
 	return qp;
 
 err:





More information about the ofw mailing list