The librdmacm uses the same devices that are usable with the libibverbs library.
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sat, 24 Jan 2009 19:53:32 +0000 (19:53 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sat, 24 Jan 2009 19:53:32 +0000 (19:53 +0000)
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@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1878 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/libibverbs/src/Sources
ulp/libibverbs/src/device.cpp
ulp/libibverbs/src/verbs.cpp

index 04980b2..aef0946 100644 (file)
@@ -14,7 +14,7 @@ DLLDEF = $(OBJ_PATH)\$O\ibv_exports.def
 !endif\r
 \r
 DLLENTRY = DllMain\r
-USE_NTDLL = 1\r
+USE_MSVCRT=1\r
 \r
 SOURCES = \\r
        ibverbs.rc              \\r
index 6b29b29..af63338 100644 (file)
@@ -58,6 +58,22 @@ struct verbs_context
        uint8_t                         event_port_index;\r
 };\r
 \r
+__declspec(dllexport)\r
+IWVProvider *ibv_get_winverbs(void)\r
+{\r
+       HRESULT hr;\r
+\r
+       if (prov == NULL) {\r
+               hr = WvGetObject(IID_IWVProvider, (LPVOID*) &prov);\r
+               if (FAILED(hr)) {\r
+                       return NULL;\r
+               }\r
+       }\r
+\r
+       prov->AddRef();\r
+       return prov;\r
+}\r
+\r
 __declspec(dllexport)\r
 struct ibv_device **ibv_get_device_list(int *num)\r
 {\r
index 9fab212..992637a 100644 (file)
@@ -391,6 +391,7 @@ static void ibv_comp_channel_remove_cq(struct ibv_comp_channel *channel,
        vchan->count--;\r
        vchan->cq[cq->channel_index] = vchan->cq[vchan->count];\r
        vchan->event[cq->channel_index] = vchan->event[vchan->count];\r
+       vchan->cq[cq->channel_index]->channel_index = cq->channel_index;\r
        LeaveCriticalSection(&vchan->lock);\r
 }\r
 \r
@@ -675,10 +676,6 @@ struct ibv_qp *ibv_create_qp(struct ibv_pd *pd,
        } else {\r
                qp->conn_handle->QueryInterface(IID_IWVQueuePair, (LPVOID *) &qp->handle);\r
        }\r
-       hr = ibv_query_qp(qp, &attr, (enum ibv_qp_attr_mask) 0xFFFFFFFF, qp_init_attr);\r
-       if (FAILED(hr)) {\r
-               goto err;\r
-       }\r
 \r
        qp->context = pd->context;\r
        qp->qp_context = qp_init_attr->qp_context;\r
@@ -689,6 +686,12 @@ struct ibv_qp *ibv_create_qp(struct ibv_pd *pd,
        qp->state = IBV_QPS_RESET;\r
        /* qp_num set by ibv_query_qp */\r
        qp->qp_type = qp_init_attr->qp_type;\r
+\r
+       hr = ibv_query_qp(qp, &attr, (enum ibv_qp_attr_mask) 0xFFFFFFFF, qp_init_attr);\r
+       if (FAILED(hr)) {\r
+               goto err;\r
+       }\r
+\r
        return qp;\r
 \r
 err:\r