From: shefty Date: Sat, 24 Jan 2009 19:53:32 +0000 (+0000) Subject: The librdmacm uses the same devices that are usable with the libibverbs library. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=bddad7e8274ffae7ea416998488863fa47bba037;p=~shefty%2Frdma-win.git 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 git-svn-id: svn://openib.tc.cornell.edu/gen1@1878 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/ulp/libibverbs/src/Sources b/trunk/ulp/libibverbs/src/Sources index 04980b26..aef09468 100644 --- a/trunk/ulp/libibverbs/src/Sources +++ b/trunk/ulp/libibverbs/src/Sources @@ -14,7 +14,7 @@ DLLDEF = $(OBJ_PATH)\$O\ibv_exports.def !endif DLLENTRY = DllMain -USE_NTDLL = 1 +USE_MSVCRT=1 SOURCES = \ ibverbs.rc \ diff --git a/trunk/ulp/libibverbs/src/device.cpp b/trunk/ulp/libibverbs/src/device.cpp index 6b29b295..af633386 100644 --- a/trunk/ulp/libibverbs/src/device.cpp +++ b/trunk/ulp/libibverbs/src/device.cpp @@ -58,6 +58,22 @@ struct verbs_context uint8_t event_port_index; }; +__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) { diff --git a/trunk/ulp/libibverbs/src/verbs.cpp b/trunk/ulp/libibverbs/src/verbs.cpp index 9fab212a..992637ac 100644 --- a/trunk/ulp/libibverbs/src/verbs.cpp +++ b/trunk/ulp/libibverbs/src/verbs.cpp @@ -391,6 +391,7 @@ static void ibv_comp_channel_remove_cq(struct ibv_comp_channel *channel, 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_pd *pd, } 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_pd *pd, 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: