Winverbs fixes based on testing the DAPL openib_scm provider, which uses the libibverbs compatibility library.
Simplify endpoint connect locking and code structure so it's clear when the user's request is completed. Add const to TranslateAddress to avoid a compiler warning when building the ND provider. Renumber CQ notification types to align with underlying code. Take the RemoteAddress in a send work request in host order, to align with the UVP. (This will be revisited, but is required for RDMA over winverbs to work for now.) Signed-off-by: Sean Hefty <[email protected]> --- diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\winverbs/kernel/wv_ep.c branches\winverbs\core\winverbs/kernel/wv_ep.c --- trunk\core\winverbs/kernel/wv_ep.c 2009-03-10 14:59:38.662275100 -0700 +++ branches\winverbs\core\winverbs/kernel/wv_ep.c 2009-04-01 15:51:01.289540300 -0700 @@ -501,25 +501,26 @@ void WvEpConnect(WV_PROVIDER *pProvider, WdfObjectAcquireLock(ep->Queue); if (ep->State != WvEpRouteResolved) { status = STATUS_NOT_SUPPORTED; - goto release; + goto unlock; } status = IbCmInterface.CM.create_id(WvEpIbCmHandler, ep, &ep->pIbCmId); if (!NT_SUCCESS(status)) { - goto release; + goto unlock; } ep->State = WvEpActiveConnect; - status = WdfRequestForwardToIoQueue(Request, ep->Queue); + status = IbCmInterface.CM.send_req(ep->pIbCmId, &req); if (NT_SUCCESS(status)) { - status = IbCmInterface.CM.send_req(ep->pIbCmId, &req); + status = WdfRequestForwardToIoQueue(Request, ep->Queue); } if (!NT_SUCCESS(status)) { ep->State = WvEpDisconnected; } -release: +unlock: WdfObjectReleaseLock(ep->Queue); +release: WvEpRelease(ep); complete: if (!NT_SUCCESS(status)) { @@ -618,9 +619,7 @@ static NTSTATUS WvEpAcceptActive(WDFREQU pEndpoint->State = WvEpConnected; status = IbCmInterface.CM.send_rtu(pEndpoint->pIbCmId, pAttr->Param.Data, pAttr->Param.DataLength); - if (NT_SUCCESS(status)) { - WdfRequestComplete(Request, STATUS_SUCCESS); - } else { + if (!NT_SUCCESS(status)) { pEndpoint->State = WvEpDisconnected; } @@ -722,6 +721,10 @@ void WvEpAccept(WV_PROVIDER *pProvider, break; case WvEpPassiveConnect: status = WvEpAcceptPassive(Request, out, outlen, ep, pattr); + if (NT_SUCCESS(status)) { + WvEpRelease(ep); + return; + } break; default: status = STATUS_NOT_SUPPORTED; @@ -730,9 +733,7 @@ void WvEpAccept(WV_PROVIDER *pProvider, WvEpRelease(ep); complete: - if (!NT_SUCCESS(status)) { - WdfRequestComplete(Request, status); - } + WdfRequestComplete(Request, status); } void WvEpReject(WV_PROVIDER *pProvider, WDFREQUEST Request) @@ -831,6 +832,11 @@ void WvEpDisconnectNotify(WV_PROVIDER *p case WvEpConnected: case WvEpActiveDisconnect: status = WdfRequestForwardToIoQueue(Request, ep->Queue); + if (NT_SUCCESS(status)) { + WdfObjectReleaseLock(ep->Queue); + WvEpRelease(ep); + return; + } break; case WvEpPassiveDisconnect: case WvEpDisconnected: @@ -844,9 +850,7 @@ void WvEpDisconnectNotify(WV_PROVIDER *p WvEpRelease(ep); complete: - if (!NT_SUCCESS(status)) { - WdfRequestComplete(Request, status); - } + WdfRequestComplete(Request, status); } static NTSTATUS WvEpIbListenHandler(iba_cm_id *pId, iba_cm_event *pEvent) @@ -864,6 +868,7 @@ static NTSTATUS WvEpIbListenHandler(iba_ goto release; } + ASSERT(!IsListEmpty(&listen->Entry)); ep = CONTAINING_RECORD(RemoveHeadList(&listen->Entry), WV_ENDPOINT, Entry); ep->pIbCmId = pId; pId->callback = WvEpIbCmHandler; diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\winverbs/user/wv_provider.cpp branches\winverbs\core\winverbs/user/wv_provider.cpp --- trunk\core\winverbs/user/wv_provider.cpp 2008-12-01 13:05:16.214438800 -0800 +++ branches\winverbs\core\winverbs/user/wv_provider.cpp 2009-03-26 23:56:20.950000000 -0700 @@ -134,7 +134,7 @@ out: } STDMETHODIMP CWVProvider:: -TranslateAddress(SOCKADDR* pAddress, WV_DEVICE_ADDRESS* pDeviceAddress) +TranslateAddress(const SOCKADDR* pAddress, WV_DEVICE_ADDRESS* pDeviceAddress) { HANDLE hIbat; IOCTL_IBAT_IP_TO_PORT_IN addr; diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\winverbs/user/wv_provider.h branches\winverbs\core\winverbs/user/wv_provider.h --- trunk\core\winverbs/user/wv_provider.h 2008-12-01 13:04:01.212232800 -0800 +++ branches\winverbs\core\winverbs/user/wv_provider.h 2009-03-26 23:56:20.309375000 -0700 @@ -49,7 +49,7 @@ public: STDMETHODIMP_(HANDLE) GetFileHandle(); STDMETHODIMP QueryDeviceList(NET64* pGuidList, SIZE_T* pBufferSize); STDMETHODIMP QueryDevice(NET64 Guid, WV_DEVICE_ATTRIBUTES* pAttributes); - STDMETHODIMP TranslateAddress(SOCKADDR* pAddress, + STDMETHODIMP TranslateAddress(const SOCKADDR* pAddress, WV_DEVICE_ADDRESS* pDeviceAddress); STDMETHODIMP OpenDevice(NET64 Guid, IWVDevice** ppDevice); diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\winverbs/wv_ioctl.h branches\winverbs\core\winverbs/wv_ioctl.h --- trunk\core\winverbs/wv_ioctl.h 2009-01-07 14:32:56.497700600 -0800 +++ branches\winverbs\core\winverbs/wv_ioctl.h 2009-03-27 03:04:48.793750000 -0700 @@ -502,8 +502,8 @@ typedef struct _WV_IO_AH_CREATE } WV_IO_AH_CREATE; #define WV_CQ_ERROR 0 -#define WV_CQ_SOLICITED 1 -#define WV_CQ_NEXT_COMPLETION 2 +#define WV_CQ_NEXT_COMPLETION 1 +#define WV_CQ_SOLICITED 2 typedef struct _WV_IO_SRQ_ATTRIBUTES { Only in branches\winverbs\inc\kernel\rdma: _ntstatus_.h diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\inc\user\rdma/winverbs.h branches\winverbs\inc\user\rdma/winverbs.h --- trunk\inc\user\rdma/winverbs.h 2009-02-11 20:04:22.551035000 -0800 +++ branches\winverbs\inc\user\rdma/winverbs.h 2009-03-27 03:05:27.028125000 -0700 @@ -176,8 +176,8 @@ typedef struct _WV_DEVICE_ADDRESS typedef enum _WV_CQ_NOTIFY_TYPE { WvCqError, - WvCqSolicited, - WvCqNextCompletion + WvCqNextCompletion, + WvCqSolicited } WV_CQ_NOTIFY_TYPE; @@ -291,14 +291,14 @@ typedef struct _WV_SEND_REQUEST { struct { - NET64 RemoteAddress; + UINT64 RemoteAddress; NET32 Rkey; } Rdma; struct { - NET64 RemoteAddress; + UINT64 RemoteAddress; NET32 Rkey; NET64 Compare; NET64 Exchange; @@ -307,7 +307,7 @@ typedef struct _WV_SEND_REQUEST struct { - NET64 RemoteAddress; + UINT64 RemoteAddress; NET32 Rkey; NET64 Add; UINT64 Reserved; @@ -1487,7 +1487,7 @@ DECLARE_INTERFACE_(IWVProvider, IUnknown STDMETHOD(TranslateAddress)( THIS_ - __in SOCKADDR* pAddress, + __in const SOCKADDR* pAddress, __out WV_DEVICE_ADDRESS* pDeviceAddress ) PURE; _______________________________________________ ofw mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
