[ofw] [PATCH 2/2] ulp/netdirect: add winverbs network direct provider
Sean Hefty
sean.hefty at intel.com
Thu Jul 2 15:38:40 PDT 2009
Initial implementation of WV ND provider.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Index: dirs
===================================================================
--- dirs (revision 0)
+++ dirs (revision 0)
@@ -0,0 +1 @@
+DIRS = user
Index: user/makefile
===================================================================
--- user/makefile (revision 0)
+++ user/makefile (revision 0)
@@ -0,0 +1,14 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
+# file to this component. This file merely indirects to the real make file
+# that is shared by all the driver components of the OpenIB Windows project.
+#
+
+!IFNDEF ND_SDK_PATH
+!MESSAGE Skipping wvndprov.dll build: ND_SD_PATH not set.
+DDK_BLOCK_ON_X86 = 1
+DDK_BLOCK_ON_AMD64 = 1
+DDK_BLOCK_ON_IA64 = 1
+!ENDIF
+
+!INCLUDE ..\..\..\inc\openib.def
Index: user/nd_adapter.cpp
===================================================================
--- user/nd_adapter.cpp (revision 0)
+++ user/nd_adapter.cpp (revision 0)
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_adapter.h"
+#include "nd_cq.h"
+#include "nd_listen.h"
+#include "nd_connect.h"
+#include "nd_mw.h"
+#include "nd_ep.h"
+
+
+CNDAdapter::CNDAdapter(CNDProvider *pProvider)
+{
+ pProvider->AddRef();
+ m_pProvider = pProvider;
+ m_pWvProvider = NULL;
+ m_pWvDevice = NULL;
+ m_pWvPd = NULL;
+ DListInit(&m_MrList);
+ InitializeCriticalSection(&m_Lock);
+}
+
+STDMETHODIMP CNDAdapter::
+Init(const struct sockaddr *pAddress, SIZE_T AddressLength)
+{
+ HRESULT hr;
+
+ hr = WvGetObject(IID_IWVProvider, (LPVOID *) &m_pWvProvider);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ hr = m_pWvProvider->TranslateAddress(pAddress, &m_DevAddress);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ hr = m_pWvProvider->OpenDevice(m_DevAddress.DeviceGuid, &m_pWvDevice);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ hr = m_pWvDevice->AllocateProtectionDomain(&m_pWvPd);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ RtlCopyMemory(&m_Address, pAddress, AddressLength);
+ return ND_SUCCESS;
+}
+
+CNDAdapter::~CNDAdapter(void)
+{
+ ND_MR *mr;
+
+ while (!DListEmpty(&m_MrList)) {
+ mr = CONTAINING_RECORD(m_MrList.Next, ND_MR, Entry);
+ DListRemove(&mr->Entry);
+ m_pWvPd->DeregisterMemory(mr->Keys.Lkey, NULL);
+ delete mr;
+ }
+
+ if (m_pWvPd != NULL) {
+ m_pWvPd->Release();
+ }
+ if (m_pWvDevice != NULL) {
+ m_pWvDevice->Release();
+ }
+ if (m_pWvProvider != NULL) {
+ m_pWvProvider->Release();
+ }
+ m_pProvider->Release();
+}
+
+STDMETHODIMP CNDAdapter::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_INDAdapter) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDAdapter::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDAdapter::
+Release(void)
+{
+ return CNDBase::Release();
+}
+
+STDMETHODIMP CNDAdapter::
+CancelOverlappedRequests(void)
+{
+ m_pWvPd->CancelOverlappedRequests();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP CNDAdapter::
+GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait)
+{
+ DLIST_ENTRY *entry;
+ ND_MR *mr;
+ HRESULT hr;
+
+ ::GetOverlappedResult(GetFileHandle(), pOverlapped,
+ (LPDWORD) pNumberOfBytesTransferred, bWait);
+ hr = (HRESULT) pOverlapped->Internal;
+
+ if (FAILED(hr)) {
+ EnterCriticalSection(&m_Lock);
+ for (entry = m_MrList.Next; entry != &m_MrList; entry = entry->Next) {
+ mr = CONTAINING_RECORD(entry, ND_MR, Entry);
+ if (mr->Context == pOverlapped) {
+ DListRemove(entry);
+ delete mr;
+ break;
+ }
+ }
+ LeaveCriticalSection(&m_Lock);
+ }
+
+ return hr;
+}
+
+STDMETHODIMP_(HANDLE) CNDAdapter::
+GetFileHandle(void)
+{
+ return m_pWvProvider->GetFileHandle();
+}
+
+STDMETHODIMP CNDAdapter::
+Query(DWORD VersionRequested, ND_ADAPTER_INFO* pInfo, SIZE_T* pBufferSize)
+{
+ WV_DEVICE_ATTRIBUTES attr;
+ HRESULT hr;
+
+ if (VersionRequested != 1) {
+ return ND_NOT_SUPPORTED;
+ }
+
+ if (*pBufferSize < sizeof(ND_ADAPTER_INFO)) {
+ hr = ND_BUFFER_OVERFLOW;
+ goto out;
+ }
+
+ hr = m_pWvDevice->Query(&attr);
+ if (FAILED(hr)) {
+ goto out;
+ }
+
+ pInfo->VendorId = attr.VendorId;
+ pInfo->DeviceId = attr.VendorPartId;
+ pInfo->MaxInboundSge = min(attr.MaxSge, ND_MAX_SGE);
+ pInfo->MaxInboundRequests = attr.MaxQpWr;
+ pInfo->MaxInboundLength = 1 << 31;
+ pInfo->MaxOutboundSge = min(attr.MaxSge, ND_MAX_SGE);
+ pInfo->MaxOutboundRequests = attr.MaxQpWr;
+ pInfo->MaxOutboundLength = 1 << 31;
+ pInfo->MaxInlineData = attr.MaxInlineSend;
+ pInfo->MaxInboundReadLimit = attr.MaxQpResponderResources;
+ pInfo->MaxOutboundReadLimit = attr.MaxQpInitiatorDepth;
+ pInfo->MaxCqEntries = attr.MaxCqEntries;
+ pInfo->MaxRegistrationSize = attr.MaxMrSize;
+ pInfo->MaxWindowSize = attr.MaxMrSize;
+ pInfo->LargeRequestThreshold = 0;
+ pInfo->MaxCallerData = ND_PRIVATE_DATA_SIZE;
+ pInfo->MaxCalleeData = ND_PRIVATE_DATA_SIZE;
+
+out:
+ *pBufferSize = sizeof(ND_ADAPTER_INFO);
+ return hr;
+}
+
+STDMETHODIMP CNDAdapter::
+Control(DWORD IoControlCode, const void* pInBuffer, SIZE_T InBufferSize,
+ void* pOutBuffer, SIZE_T OutBufferSize, SIZE_T* pBytesReturned,
+ OVERLAPPED* pOverlapped)
+{
+ return DeviceIoControl(GetFileHandle(), IoControlCode,
+ (LPVOID) pInBuffer, (DWORD) InBufferSize,
+ pOutBuffer, (DWORD) OutBufferSize,
+ (LPDWORD) pBytesReturned, pOverlapped) ?
+ ND_SUCCESS : HRESULT_FROM_WIN32(GetLastError());
+}
+
+STDMETHODIMP CNDAdapter::
+CreateCompletionQueue(SIZE_T nEntries, INDCompletionQueue** ppCq)
+{
+ return CNDCompletionQueue::CreateInstance(this, nEntries, ppCq);
+}
+
+STDMETHODIMP CNDAdapter::
+RegisterMemory(const void* pBuffer, SIZE_T BufferSize,
+ OVERLAPPED* pOverlapped, ND_MR_HANDLE* phMr)
+{
+ ND_MR *mr;
+ HRESULT hr;
+ DWORD flags;
+
+ mr = new ND_MR;
+ if (mr == NULL) {
+ return ND_NO_MEMORY;
+ }
+
+ mr->Context = pOverlapped;
+ EnterCriticalSection(&m_Lock);
+ DListInsertHead(&mr->Entry, &m_MrList);
+ LeaveCriticalSection(&m_Lock);
+
+ // TODO: restrict access when MWs are implemented
+ flags = WV_ACCESS_REMOTE_READ | WV_ACCESS_REMOTE_WRITE |
+ WV_ACCESS_REMOTE_ATOMIC | WV_ACCESS_LOCAL_WRITE | WV_ACCESS_MW_BIND;
+ hr = m_pWvPd->RegisterMemory(pBuffer, BufferSize, flags, pOverlapped, &mr->Keys);
+ if (FAILED(hr)) {
+ CleanupMr(mr);
+ } else {
+ *phMr = (ND_MR_HANDLE) mr;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CNDAdapter::
+DeregisterMemory(ND_MR_HANDLE hMr, OVERLAPPED* pOverlapped)
+{
+ ND_MR *mr;
+ HRESULT hr;
+
+ mr = (ND_MR *) hMr;
+ hr = m_pWvPd->DeregisterMemory(mr->Keys.Lkey, pOverlapped);
+ if (SUCCEEDED(hr) || hr == WV_IO_PENDING) {
+ CleanupMr(mr);
+ }
+ return hr;
+}
+
+void CNDAdapter::
+CleanupMr(ND_MR *pMr)
+{
+ EnterCriticalSection(&m_Lock);
+ DListRemove(&pMr->Entry);
+ LeaveCriticalSection(&m_Lock);
+ delete pMr;
+}
+
+STDMETHODIMP CNDAdapter::
+CreateMemoryWindow(ND_RESULT* pInvalidateResult, INDMemoryWindow** ppMw)
+{
+ // TODO: do something with pInvalidateResult
+ return CNDMemoryWindow::CreateInstance(this, ppMw);
+}
+
+STDMETHODIMP CNDAdapter::
+CreateConnector(INDConnector** ppConnector)
+{
+ return CNDConnector::CreateInstance(this, ppConnector);
+}
+
+STDMETHODIMP CNDAdapter::
+Listen(SIZE_T Backlog, INT Protocol, USHORT Port,
+ USHORT* pAssignedPort, INDListen** ppListen)
+{
+ return CNDListen::CreateInstance(this, Backlog, Protocol, Port,
+ pAssignedPort, ppListen);
+}
Index: user/nd_adapter.h
===================================================================
--- user/nd_adapter.h (revision 0)
+++ user/nd_adapter.h (revision 0)
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_ADAPTER_H_
+#define _ND_ADAPTER_H_
+
+#include <ndspi.h>
+#include "nd_base.h"
+#include "nd_provider.h"
+#include <dlist.h>
+
+
+typedef struct _ND_MR
+{
+ DLIST_ENTRY Entry;
+ WV_MEMORY_KEYS Keys;
+ void *Context;
+
+} ND_MR;
+
+
+class CNDAdapter : public INDAdapter, public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // INDOverlapped methods
+ STDMETHODIMP CancelOverlappedRequests();
+ STDMETHODIMP GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait);
+
+ // INDDevice methods
+ STDMETHODIMP_(HANDLE) GetFileHandle();
+ STDMETHODIMP Query(DWORD VersionRequested, ND_ADAPTER_INFO* pInfo,
+ SIZE_T* pBufferSize);
+ STDMETHODIMP Control(DWORD IoControlCode,
+ const void* pInBuffer, SIZE_T InBufferSize,
+ void* pOutBuffer, SIZE_T OutBufferSize,
+ SIZE_T* pBytesReturned, OVERLAPPED* pOverlapped);
+ STDMETHODIMP CreateCompletionQueue(SIZE_T nEntries, INDCompletionQueue** ppCq);
+ STDMETHODIMP RegisterMemory(const void* pBuffer, SIZE_T BufferSize,
+ OVERLAPPED* pOverlapped, ND_MR_HANDLE* phMr);
+ STDMETHODIMP DeregisterMemory(ND_MR_HANDLE hMr, OVERLAPPED* pOverlapped);
+ STDMETHODIMP CreateMemoryWindow(ND_RESULT* pInvalidateResult,
+ INDMemoryWindow** ppMw);
+ STDMETHODIMP CreateConnector(INDConnector** ppConnector);
+ STDMETHODIMP Listen(SIZE_T Backlog, INT Protocol, USHORT Port,
+ USHORT* pAssignedPort, INDListen** ppListen);
+
+ CNDAdapter(CNDProvider *pProvider);
+ ~CNDAdapter();
+ void Delete() {delete this;}
+ static STDMETHODIMP
+ CreateInstance(CNDProvider *pProvider, const struct sockaddr *pAddress,
+ SIZE_T AddressLength, INDAdapter** ppAdapter)
+ {
+ HRESULT hr;
+ CNDAdapter *adapter;
+
+ adapter = new CNDAdapter(pProvider);
+ if (adapter == NULL) {
+ hr = ND_NO_MEMORY;
+ goto err1;
+ }
+
+ hr = adapter->Init(pAddress, AddressLength);
+ if (FAILED(hr)) {
+ goto err2;
+ }
+
+ *ppAdapter = adapter;
+ return ND_SUCCESS;
+
+ err2:
+ adapter->Release();
+ err1:
+ *ppAdapter = NULL;
+ return hr;
+ }
+
+ IWVProvider *m_pWvProvider;
+ IWVDevice *m_pWvDevice;
+ IWVProtectionDomain *m_pWvPd;
+ SOCKADDR_STORAGE m_Address;
+ WV_DEVICE_ADDRESS m_DevAddress;
+
+protected:
+ CNDProvider *m_pProvider;
+ DLIST_ENTRY m_MrList;
+ CRITICAL_SECTION m_Lock;
+
+ STDMETHODIMP Init(const struct sockaddr *pAddress, SIZE_T AddressLength);
+ void CleanupMr(ND_MR *pMr);
+};
+
+#endif // _ND_ADAPTER_H_
Index: user/nd_base.cpp
===================================================================
--- user/nd_base.cpp (revision 0)
+++ user/nd_base.cpp (revision 0)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_base.h"
+
+CNDBase::CNDBase()
+{
+ m_nRef = 1;
+}
+
+STDMETHODIMP_(ULONG) CNDBase::
+AddRef(void)
+{
+ return InterlockedIncrement(&m_nRef);
+}
+
+STDMETHODIMP_(ULONG) CNDBase::
+Release(void)
+{
+ ULONG ref;
+
+ ref = (ULONG) InterlockedDecrement(&m_nRef);
+ if (ref == 0) {
+ Delete();
+ }
+ return ref;
+}
Index: user/nd_base.h
===================================================================
--- user/nd_base.h (revision 0)
+++ user/nd_base.h (revision 0)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_BASE_H_
+#define _ND_BASE_H_
+
+#include <windows.h>
+#include <rdma\winverbs.h>
+
+class CNDBase
+{
+public:
+ CNDBase();
+ ~CNDBase() {};
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ virtual void Delete() {};
+
+ volatile LONG m_nRef;
+
+protected:
+};
+
+__inline void* __cdecl operator new(size_t size)
+{
+ return HeapAlloc(GetProcessHeap(), 0, size);
+}
+
+__inline void __cdecl operator delete(void *pObj)
+{
+ HeapFree(GetProcessHeap(), 0, pObj);
+}
+
+#endif // _ND_BASE_H_
Index: user/nd_connect.cpp
===================================================================
--- user/nd_connect.cpp (revision 0)
+++ user/nd_connect.cpp (revision 0)
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_connect.h"
+#include "nd_ep.h"
+
+
+CNDConnector::CNDConnector(CNDAdapter *pAdapter)
+{
+ pAdapter->AddRef();
+ m_pAdapter = pAdapter;
+ m_pWvConnEp = NULL;
+}
+
+STDMETHODIMP CNDConnector::
+Init(void)
+{
+ return m_pAdapter->m_pWvProvider->CreateConnectEndpoint(&m_pWvConnEp);
+}
+
+CNDConnector::~CNDConnector()
+{
+ if (m_pWvConnEp != NULL) {
+ m_pWvConnEp->Release();
+ }
+ m_pAdapter->Release();
+}
+
+STDMETHODIMP CNDConnector::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_INDConnector) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDConnector::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDConnector::
+Release(void)
+{
+ return CNDBase::Release();
+}
+
+STDMETHODIMP CNDConnector::
+CancelOverlappedRequests(void)
+{
+ return m_pWvConnEp->CancelOverlappedRequests();
+}
+
+STDMETHODIMP CNDConnector::
+GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait)
+{
+ return m_pWvConnEp->GetOverlappedResult(pOverlapped,
+ (DWORD *) pNumberOfBytesTransferred,
+ bWait);
+}
+
+STDMETHODIMP CNDConnector::
+CreateEndpoint(INDCompletionQueue* pInboundCq, INDCompletionQueue* pOutboundCq,
+ SIZE_T nInboundEntries, SIZE_T nOutboundEntries,
+ SIZE_T nInboundSge, SIZE_T nOutboundSge,
+ SIZE_T InboundReadLimit, SIZE_T OutboundReadLimit,
+ SIZE_T* pMaxInlineData, INDEndpoint** ppEndpoint)
+{
+ CNDCompletionQueue *incq = (CNDCompletionQueue *) pInboundCq;
+ CNDCompletionQueue *outcq = (CNDCompletionQueue *) pOutboundCq;
+
+ return CNDEndpoint::CreateInstance(this, incq, outcq,
+ nInboundEntries, nOutboundEntries,
+ nInboundSge, nOutboundSge,
+ InboundReadLimit, OutboundReadLimit,
+ pMaxInlineData, ppEndpoint);
+}
+
+STDMETHODIMP CNDConnector::
+Connect(INDEndpoint* pEndpoint,
+ const struct sockaddr* pAddress, SIZE_T AddressLength,
+ INT Protocol, USHORT LocalPort,
+ const void* pPrivateData, SIZE_T PrivateDataLength,
+ OVERLAPPED* pOverlapped)
+{
+ CNDEndpoint *ep = (CNDEndpoint *) pEndpoint;
+ WV_SOCKADDR addr;
+ WV_CONNECT_PARAM attr;
+
+ RtlCopyMemory(&addr, pAddress, AddressLength);
+ if (addr.Sa.sa_family == AF_INET) {
+ addr.Sin.sin_port = LocalPort;
+ } else {
+ addr.Sin6.sin6_port = LocalPort;
+ }
+
+ RtlZeroMemory(&attr, sizeof attr);
+ if ((attr.DataLength = PrivateDataLength)) {
+ RtlCopyMemory(attr.Data, pPrivateData, PrivateDataLength);
+ }
+ attr.ResponderResources = ep->m_ResponderResources;
+ attr.InitiatorDepth = ep->m_InitiatorDepth;
+ attr.RetryCount = 7;
+
+ return m_pWvConnEp->Connect(ep->m_pWvQp, &addr.Sa, &attr, pOverlapped);
+}
+
+STDMETHODIMP CNDConnector::
+CompleteConnect(OVERLAPPED* pOverlapped)
+{
+ WV_CONNECT_PARAM attr;
+
+ RtlZeroMemory(&attr, sizeof attr);
+ return m_pWvConnEp->Accept(NULL, &attr, pOverlapped);
+}
+
+STDMETHODIMP CNDConnector::
+Accept(INDEndpoint* pEndpoint,
+ const void* pPrivateData, SIZE_T PrivateDataLength,
+ OVERLAPPED* pOverlapped)
+{
+ CNDEndpoint *ep = (CNDEndpoint *) pEndpoint;
+ WV_CONNECT_PARAM attr;
+
+ RtlZeroMemory(&attr, sizeof attr);
+ if ((attr.DataLength = PrivateDataLength)) {
+ RtlCopyMemory(attr.Data, pPrivateData, PrivateDataLength);
+ }
+ attr.ResponderResources = ep->m_ResponderResources;
+ attr.InitiatorDepth = ep->m_InitiatorDepth;
+
+ return m_pWvConnEp->Accept(ep->m_pWvQp, &attr, pOverlapped);
+}
+
+STDMETHODIMP CNDConnector::
+Reject(const void* pPrivateData, SIZE_T PrivateDataLength)
+{
+ return m_pWvConnEp->Reject(pPrivateData, PrivateDataLength);
+}
+
+STDMETHODIMP CNDConnector::
+GetConnectionData(SIZE_T* pInboundReadLimit, SIZE_T* pOutboundReadLimit,
+ void* pPrivateData, SIZE_T* pPrivateDataLength)
+{
+ WV_CONNECT_ATTRIBUTES attr;
+ HRESULT hr;
+
+ if (pPrivateDataLength && *pPrivateDataLength < ND_PRIVATE_DATA_SIZE) {
+ *pPrivateDataLength = ND_PRIVATE_DATA_SIZE;
+ return ND_BUFFER_OVERFLOW;
+ }
+
+ hr = m_pWvConnEp->Query(&attr);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ *pInboundReadLimit = attr.Param.ResponderResources;
+ *pOutboundReadLimit = attr.Param.InitiatorDepth;
+ if (pPrivateDataLength) {
+ RtlCopyMemory(pPrivateData, attr.Param.Data, ND_PRIVATE_DATA_SIZE);
+ *pPrivateDataLength = ND_PRIVATE_DATA_SIZE;
+ }
+ return ND_SUCCESS;
+}
+
+static SIZE_T GetAddressSize(WV_SOCKADDR *addr)
+{
+ return (addr->Sa.sa_family == AF_INET) ? sizeof(addr->Sin) : sizeof(addr->Sin6);
+}
+
+STDMETHODIMP CNDConnector::
+GetLocalAddress(struct sockaddr* pAddress, SIZE_T* pAddressLength)
+{
+ WV_CONNECT_ATTRIBUTES attr;
+ HRESULT hr;
+
+ hr = m_pWvConnEp->Query(&attr);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ if (*pAddressLength < GetAddressSize(&attr.LocalAddress)) {
+ hr = ND_BUFFER_OVERFLOW;
+ goto out;
+ }
+
+ RtlCopyMemory(pAddress, &attr.LocalAddress, GetAddressSize(&attr.LocalAddress));
+out:
+ *pAddressLength = GetAddressSize(&attr.LocalAddress);
+ return hr;
+}
+
+STDMETHODIMP CNDConnector::
+GetPeerAddress(struct sockaddr* pAddress, SIZE_T* pAddressLength)
+{
+ WV_CONNECT_ATTRIBUTES attr;
+ HRESULT hr;
+
+ hr = m_pWvConnEp->Query(&attr);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ if (*pAddressLength < GetAddressSize(&attr.PeerAddress)) {
+ hr = ND_BUFFER_OVERFLOW;
+ goto out;
+ }
+
+ RtlCopyMemory(pAddress, &attr.PeerAddress, GetAddressSize(&attr.PeerAddress));
+out:
+ *pAddressLength = GetAddressSize(&attr.PeerAddress);
+ return hr;
+}
+
+STDMETHODIMP CNDConnector::
+NotifyDisconnect(OVERLAPPED* pOverlapped)
+{
+ return m_pWvConnEp->NotifyDisconnect(pOverlapped);
+}
+
+STDMETHODIMP CNDConnector::
+Disconnect(OVERLAPPED* pOverlapped)
+{
+ return m_pWvConnEp->Disconnect(pOverlapped);
+}
Index: user/nd_connect.h
===================================================================
--- user/nd_connect.h (revision 0)
+++ user/nd_connect.h (revision 0)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_CONNECTOR_H_
+#define _ND_CONNECTOR_H_
+
+#include <initguid.h>
+#include <ndspi.h>
+#include "nd_base.h"
+#include "nd_adapter.h"
+
+
+#define ND_PRIVATE_DATA_SIZE 56
+
+
+class CNDConnector : public INDConnector, public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // INDOverlapped methods
+ STDMETHODIMP CancelOverlappedRequests();
+ STDMETHODIMP GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait);
+
+ // INDConnector methods
+ STDMETHODIMP CreateEndpoint(INDCompletionQueue* pInboundCq,
+ INDCompletionQueue* pOutboundCq,
+ SIZE_T nInboundEntries, SIZE_T nOutboundEntries,
+ SIZE_T nInboundSge, SIZE_T nOutboundSge,
+ SIZE_T InboundReadLimit, SIZE_T OutboundReadLimit,
+ SIZE_T* pMaxInlineData, INDEndpoint** ppEndpoint);
+ STDMETHODIMP Connect(INDEndpoint* pEndpoint,
+ const struct sockaddr* pAddress, SIZE_T AddressLength,
+ INT Protocol, USHORT LocalPort,
+ const void* pPrivateData, SIZE_T PrivateDataLength,
+ OVERLAPPED* pOverlapped);
+ STDMETHODIMP CompleteConnect(OVERLAPPED* pOverlapped);
+ STDMETHODIMP Accept(INDEndpoint* pEndpoint,
+ const void* pPrivateData, SIZE_T PrivateDataLength,
+ OVERLAPPED* pOverlapped);
+ STDMETHODIMP Reject(const void* pPrivateData, SIZE_T PrivateDataLength);
+ STDMETHODIMP GetConnectionData(SIZE_T* pInboundReadLimit,
+ SIZE_T* pOutboundReadLimit,
+ void* pPrivateData, SIZE_T* pPrivateDataLength);
+ STDMETHODIMP GetLocalAddress(struct sockaddr* pAddress, SIZE_T* pAddressLength);
+ STDMETHODIMP GetPeerAddress(struct sockaddr* pAddress, SIZE_T* pAddressLength);
+ STDMETHODIMP NotifyDisconnect(OVERLAPPED* pOverlapped);
+ STDMETHODIMP Disconnect(OVERLAPPED* pOverlapped);
+
+ CNDConnector(CNDAdapter *pAdapter);
+ ~CNDConnector();
+ void Delete() {delete this;}
+ static STDMETHODIMP
+ CreateInstance(CNDAdapter *pAdapter, INDConnector** ppConnector)
+ {
+ HRESULT hr;
+ CNDConnector *conn;
+
+ conn = new CNDConnector(pAdapter);
+ if (conn == NULL) {
+ hr = ND_NO_MEMORY;
+ goto err1;
+ }
+
+ hr = conn->Init();
+ if (FAILED(hr)) {
+ goto err2;
+ }
+
+ *ppConnector = conn;
+ return ND_SUCCESS;
+
+ err2:
+ conn->Release();
+ err1:
+ *ppConnector = NULL;
+ return hr;
+ }
+
+ IWVConnectEndpoint *m_pWvConnEp;
+ CNDAdapter *m_pAdapter;
+
+protected:
+ STDMETHODIMP Init();
+};
+
+#endif // _ND_CONNECTOR_H_
Index: user/nd_cq.cpp
===================================================================
--- user/nd_cq.cpp (revision 0)
+++ user/nd_cq.cpp (revision 0)
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_cq.h"
+
+CNDCompletionQueue::CNDCompletionQueue(CNDAdapter *pAdapter)
+{
+ pAdapter->AddRef();
+ m_pAdapter = pAdapter;
+ m_pWvCq = NULL;
+}
+
+STDMETHODIMP CNDCompletionQueue::
+Init(SIZE_T nEntries)
+{
+ return m_pAdapter->m_pWvDevice->CreateCompletionQueue(&nEntries, &m_pWvCq);
+}
+
+CNDCompletionQueue::~CNDCompletionQueue()
+{
+ if (m_pWvCq != NULL) {
+ m_pWvCq->Release();
+ }
+ m_pAdapter->Release();
+}
+
+STDMETHODIMP CNDCompletionQueue::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_INDCompletionQueue) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDCompletionQueue::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDCompletionQueue::
+Release(void)
+{
+ return CNDBase::Release();
+}
+
+STDMETHODIMP CNDCompletionQueue::
+CancelOverlappedRequests(void)
+{
+ return m_pWvCq->CancelOverlappedRequests();
+}
+
+STDMETHODIMP CNDCompletionQueue::
+GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait)
+{
+ return m_pWvCq->GetOverlappedResult(pOverlapped,
+ (DWORD *) pNumberOfBytesTransferred, bWait);
+}
+
+STDMETHODIMP CNDCompletionQueue::
+Resize(SIZE_T nEntries)
+{
+ return m_pWvCq->Resize(&nEntries);
+}
+
+STDMETHODIMP CNDCompletionQueue::
+Notify(DWORD Type, OVERLAPPED* pOverlapped)
+{
+ return m_pWvCq->Notify((WV_CQ_NOTIFY_TYPE) Type, pOverlapped);
+}
+
+STDMETHODIMP_(SIZE_T) CNDCompletionQueue::
+GetResults(ND_RESULT* pResults[], SIZE_T nResults)
+{
+ WV_COMPLETION comp[8];
+ SIZE_T cnt, total, i;
+
+ for (total = 0; nResults; nResults -= cnt) {
+ cnt = min(8, nResults);
+ cnt = m_pWvCq->Poll(comp, cnt);
+ if (cnt == 0) {
+ break;
+ }
+
+ for (i = 0; i < cnt; i++) {
+ pResults[total] = (ND_RESULT *) comp[i].WrId;
+ pResults[total]->Status = comp[i].Status;
+ pResults[total++]->BytesTransferred = comp[i].Length;
+ }
+ }
+ return total;
+}
Index: user/nd_cq.h
===================================================================
--- user/nd_cq.h (revision 0)
+++ user/nd_cq.h (revision 0)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_CQ_H_
+#define _ND_CQ_H_
+
+#include <initguid.h>
+#include <ndspi.h>
+#include "nd_base.h"
+#include "nd_adapter.h"
+
+class CNDCompletionQueue : public INDCompletionQueue, public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // INDOverlapped methods
+ STDMETHODIMP CancelOverlappedRequests();
+ STDMETHODIMP GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait);
+
+ // INDCompletionQueue methods
+ STDMETHODIMP Resize(SIZE_T nEntries);
+ STDMETHODIMP Notify(DWORD Type, OVERLAPPED* pOverlapped);
+ STDMETHODIMP_(SIZE_T) GetResults(ND_RESULT* pResults[], SIZE_T nResults);
+
+ CNDCompletionQueue(CNDAdapter *pAdapter);
+ ~CNDCompletionQueue();
+ void Delete() {delete this;}
+ static STDMETHODIMP
+ CreateInstance(CNDAdapter *pAdapter, SIZE_T nEntries, INDCompletionQueue** ppCq)
+ {
+ HRESULT hr;
+ CNDCompletionQueue *cq;
+
+ cq = new CNDCompletionQueue(pAdapter);
+ if (cq == NULL) {
+ hr = ND_NO_MEMORY;
+ goto err1;
+ }
+
+ hr = cq->Init(nEntries);
+ if (FAILED(hr)) {
+ goto err2;
+ }
+
+ *ppCq = cq;
+ return ND_SUCCESS;
+
+ err2:
+ cq->Release();
+ err1:
+ *ppCq = NULL;
+ return hr;
+ }
+
+ IWVCompletionQueue *m_pWvCq;
+
+protected:
+ CNDAdapter *m_pAdapter;
+ STDMETHODIMP Init(SIZE_T nEntries);
+};
+
+#endif // _ND_CQ_H_
Index: user/nd_ep.cpp
===================================================================
--- user/nd_ep.cpp (revision 0)
+++ user/nd_ep.cpp (revision 0)
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_ep.h"
+#include "nd_adapter.h"
+#include "nd_connect.h"
+#include "nd_cq.h"
+#include "nd_mw.h"
+#include <netinet/in.h>
+
+
+CNDEndpoint::CNDEndpoint(CNDConnector *pConnector)
+{
+ pConnector->AddRef();
+ m_pConnector = pConnector;
+ m_pWvQp = NULL;
+ m_pInboundCq = NULL;
+ m_pOutboundCq = NULL;
+}
+
+STDMETHODIMP CNDEndpoint::
+Init(CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,
+ SIZE_T nInboundEntries, SIZE_T nOutboundEntries,
+ SIZE_T nInboundSge, SIZE_T nOutboundSge,
+ SIZE_T InboundReadLimit, SIZE_T OutboundReadLimit,
+ SIZE_T* pMaxInlineData)
+{
+ WV_QP_CREATE create;
+ WV_QP_ATTRIBUTES attr;
+ WV_DEVICE_ADDRESS *addr;
+ DWORD opts;
+ HRESULT hr;
+
+ m_pInboundCq->AddRef();
+ m_pOutboundCq->AddRef();
+ m_InitiatorDepth = OutboundReadLimit;
+ m_ResponderResources = InboundReadLimit;
+
+ RtlZeroMemory(&create, sizeof create);
+ create.pSendCq = pOutboundCq->m_pWvCq;
+ create.pReceiveCq = pInboundCq->m_pWvCq;
+ create.Context = this;
+ create.SendDepth = nOutboundEntries;
+ create.SendSge = nOutboundSge;
+ create.ReceiveDepth = nInboundEntries;
+ create.ReceiveSge = nInboundSge;
+ create.InitiatorDepth = OutboundReadLimit;
+ create.ResponderResources = InboundReadLimit;
+ create.QpType = WvQpTypeRc;
+
+ hr = m_pConnector->m_pAdapter->m_pWvPd->CreateConnectQueuePair(&create, &m_pWvQp);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ opts = WV_QP_ATTR_STATE | WV_QP_ATTR_PORT_NUMBER | WV_QP_ATTR_PKEY_INDEX;
+ attr.QpState = WvQpStateInit;
+ addr = &m_pConnector->m_pAdapter->m_DevAddress;
+ attr.AddressVector.PortNumber = addr->PortNumber;
+ hr = m_pConnector->m_pAdapter->m_pWvDevice->FindPkey(addr->PortNumber, addr->Pkey,
+ &attr.PkeyIndex);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ hr = m_pWvQp->Modify(&attr, opts, NULL);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ *pMaxInlineData = 0;
+ return ND_SUCCESS;
+}
+
+CNDEndpoint::~CNDEndpoint()
+{
+ if (m_pWvQp != NULL) {
+ m_pWvQp->Release();
+ }
+ if (m_pInboundCq != NULL) {
+ m_pInboundCq->Release();
+ }
+ if (m_pOutboundCq != NULL) {
+ m_pOutboundCq->Release();
+ }
+ m_pConnector->Release();
+}
+
+STDMETHODIMP CNDEndpoint::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_INDEndpoint) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDEndpoint::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDEndpoint::
+Release(void)
+{
+ return CNDBase::Release();
+}
+
+STDMETHODIMP CNDEndpoint::
+Flush(void)
+{
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(void) CNDEndpoint::
+StartRequestBatch(void)
+{
+ // no-op
+}
+
+STDMETHODIMP_(void) CNDEndpoint::
+SubmitRequestBatch(void)
+{
+ // no-op
+}
+
+STDMETHODIMP_(void) CNDEndpoint::
+ConvertSgl(const ND_SGE* pSgl, SIZE_T nSge, WV_SGE* pWvSgl)
+{
+ SIZE_T i;
+
+ for (i = 0; i < nSge; i++) {
+ pWvSgl[i].pAddress = pSgl[i].pAddr;
+ pWvSgl[i].Length = (UINT32) pSgl[i].Length;
+ pWvSgl[i].Lkey = pSgl[i].hMr ? ((ND_MR *) pSgl[i].hMr)->Keys.Lkey : 0;
+ }
+}
+
+STDMETHODIMP_(DWORD) CNDEndpoint::
+ConvertSendFlags(DWORD Flags)
+{
+ DWORD opts = 0;
+
+ if (!(Flags & ND_OP_FLAG_SILENT_SUCCESS)) {
+ opts |= WV_SEND_SIGNALED;
+ }
+ if (Flags & ND_OP_FLAG_READ_FENCE) {
+ opts |= WV_SEND_FENCE;
+ }
+ if (Flags & ND_OP_FLAG_SEND_AND_SOLICIT_EVENT) {
+ opts |= WV_SEND_SOLICITED;
+ }
+ return opts;
+}
+
+STDMETHODIMP_(DWORD) CNDEndpoint::
+ConvertAccessFlags(DWORD Flags)
+{
+ DWORD opts = 0;
+
+ if (!(Flags & ND_OP_FLAG_ALLOW_READ)) {
+ opts |= WV_ACCESS_REMOTE_READ;
+ }
+ if (Flags & ND_OP_FLAG_ALLOW_WRITE) {
+ opts |= WV_ACCESS_REMOTE_WRITE;
+ }
+ return opts;
+}
+
+STDMETHODIMP CNDEndpoint::
+Send(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge, DWORD Flags)
+{
+ WV_SGE sgl[ND_MAX_SGE];
+ DWORD opts;
+
+ ConvertSgl(pSgl, nSge, sgl);
+ opts = ConvertSendFlags(Flags) | (pSgl[0].hMr ? 0 : WV_SEND_INLINE);
+ return m_pWvQp->Send((UINT64) pResult, sgl, nSge, opts, 0);
+}
+
+STDMETHODIMP CNDEndpoint::
+SendAndInvalidate(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
+ const ND_MW_DESCRIPTOR* pRemoteMwDescriptor, DWORD Flags)
+{
+ return Send(pResult, pSgl, nSge, Flags);
+}
+
+STDMETHODIMP CNDEndpoint::
+Receive(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge)
+{
+ WV_SGE sgl[ND_MAX_SGE];
+
+ ConvertSgl(pSgl, nSge, sgl);
+ return m_pWvQp->PostReceive((UINT64) pResult, sgl, nSge);
+}
+
+STDMETHODIMP CNDEndpoint::
+Bind(ND_RESULT* pResult, ND_MR_HANDLE hMr, INDMemoryWindow* pMw,
+ const void* pBuffer, SIZE_T BufferSize, DWORD Flags,
+ ND_MW_DESCRIPTOR* pMwDescriptor)
+{
+ CNDMemoryWindow *mw = (CNDMemoryWindow *) pMw;
+ ND_MR *mr = (ND_MR *) hMr;
+ WV_SGE sge;
+
+ pMwDescriptor->Base = htonll((UINT64) (ULONG_PTR) pBuffer);
+ pMwDescriptor->Length = htonll(BufferSize);
+ pMwDescriptor->Token = mr->Keys.Rkey;
+
+ RtlZeroMemory(&sge, sizeof sge);
+ return m_pWvQp->Write((UINT64) pResult, &sge, 1, ConvertSendFlags(Flags),
+ 0, NULL, 0);
+}
+
+STDMETHODIMP CNDEndpoint::
+Invalidate(ND_RESULT* pResult, INDMemoryWindow* pMw, DWORD Flags)
+{
+ WV_SGE sge;
+
+ RtlZeroMemory(&sge, sizeof sge);
+ return m_pWvQp->Write((UINT64) pResult, &sge, 1, ConvertSendFlags(Flags),
+ 0, NULL, 0);
+}
+
+STDMETHODIMP CNDEndpoint::
+Read(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
+ const ND_MW_DESCRIPTOR* pRemoteMwDescriptor, ULONGLONG Offset, DWORD Flags)
+{
+ WV_SGE sgl[ND_MAX_SGE];
+ DWORD opts;
+
+ ConvertSgl(pSgl, nSge, sgl);
+ opts = ConvertSendFlags(Flags) | (pSgl[0].hMr ? 0 : WV_SEND_INLINE);
+ return m_pWvQp->Read((UINT64) pResult, sgl, nSge, opts,
+ pRemoteMwDescriptor->Base + htonll(Offset),
+ pRemoteMwDescriptor->Token);
+}
+
+STDMETHODIMP CNDEndpoint::
+Write(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
+ const ND_MW_DESCRIPTOR* pRemoteMwDescriptor, ULONGLONG Offset, DWORD Flags)
+{
+ WV_SGE sgl[ND_MAX_SGE];
+ DWORD opts;
+
+ ConvertSgl(pSgl, nSge, sgl);
+ opts = ConvertSendFlags(Flags) | (pSgl[0].hMr ? 0 : WV_SEND_INLINE);
+ return m_pWvQp->Write((UINT64) pResult, sgl, nSge, opts, 0,
+ pRemoteMwDescriptor->Base + htonll(Offset),
+ pRemoteMwDescriptor->Token);
+}
Index: user/nd_ep.h
===================================================================
--- user/nd_ep.h (revision 0)
+++ user/nd_ep.h (revision 0)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_ENDPOINT_H_
+#define _ND_ENDPOINT_H_
+
+#include <initguid.h>
+#include <ndspi.h>
+#include "nd_base.h"
+#include "nd_connect.h"
+#include "nd_cq.h"
+#include "nd_adapter.h"
+
+
+#define ND_MAX_SGE 8
+
+
+class CNDEndpoint : public INDEndpoint, public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // INDEndpoint methods
+ STDMETHODIMP Flush();
+ STDMETHODIMP_(void) StartRequestBatch();
+ STDMETHODIMP_(void) SubmitRequestBatch();
+ STDMETHODIMP Send(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge, DWORD Flags);
+ STDMETHODIMP SendAndInvalidate(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
+ const ND_MW_DESCRIPTOR* pRemoteMwDescriptor,
+ DWORD Flags);
+ STDMETHODIMP Receive(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge);
+ STDMETHODIMP Bind(ND_RESULT* pResult, ND_MR_HANDLE hMr, INDMemoryWindow* pMw,
+ const void* pBuffer, SIZE_T BufferSize, DWORD Flags,
+ ND_MW_DESCRIPTOR* pMwDescriptor);
+ STDMETHODIMP Invalidate(ND_RESULT* pResult, INDMemoryWindow* pMw, DWORD Flags);
+ STDMETHODIMP Read(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
+ const ND_MW_DESCRIPTOR* pRemoteMwDescriptor,
+ ULONGLONG Offset, DWORD Flags);
+ STDMETHODIMP Write(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
+ const ND_MW_DESCRIPTOR* pRemoteMwDescriptor,
+ ULONGLONG Offset, DWORD Flags);
+
+ CNDEndpoint(CNDConnector *pConnector);
+ ~CNDEndpoint();
+ void Delete() {delete this;}
+ static STDMETHODIMP
+ CreateInstance(CNDConnector *pConnector,
+ CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,
+ SIZE_T nInboundEntries, SIZE_T nOutboundEntries,
+ SIZE_T nInboundSge, SIZE_T nOutboundSge,
+ SIZE_T InboundReadLimit, SIZE_T OutboundReadLimit,
+ SIZE_T* pMaxInlineData, INDEndpoint** ppEndpoint)
+ {
+ HRESULT hr;
+ CNDEndpoint *ep;
+
+ ep = new CNDEndpoint(pConnector);
+ if (ep == NULL) {
+ hr = ND_NO_MEMORY;
+ goto err1;
+ }
+
+ hr = ep->Init(pInboundCq, pOutboundCq, nInboundEntries, nOutboundEntries,
+ nInboundSge, nOutboundSge, InboundReadLimit, OutboundReadLimit,
+ pMaxInlineData);
+ if (FAILED(hr)) {
+ goto err2;
+ }
+
+ *ppEndpoint = ep;
+ return ND_SUCCESS;
+
+ err2:
+ ep->Release();
+ err1:
+ *ppEndpoint = NULL;
+ return hr;
+ }
+
+ IWVConnectQueuePair *m_pWvQp;
+ SIZE_T m_InitiatorDepth;
+ SIZE_T m_ResponderResources;
+
+protected:
+ CNDConnector *m_pConnector;
+ CNDCompletionQueue *m_pInboundCq;
+ CNDCompletionQueue *m_pOutboundCq;
+
+ STDMETHODIMP Init(CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,
+ SIZE_T nInboundEntries, SIZE_T nOutboundEntries,
+ SIZE_T nInboundSge, SIZE_T nOutboundSge,
+ SIZE_T InboundReadLimit, SIZE_T OutboundReadLimit,
+ SIZE_T* pMaxInlineData);
+ STDMETHODIMP_(void) ConvertSgl(const ND_SGE* pSgl, SIZE_T nSge, WV_SGE *pWvSgl);
+ STDMETHODIMP_(DWORD) ConvertSendFlags(DWORD Flags);
+ STDMETHODIMP_(DWORD) ConvertAccessFlags(DWORD Flags);
+};
+
+#endif // _ND_ENDPOINT_H_
Index: user/nd_export.def
===================================================================
--- user/nd_export.def (revision 0)
+++ user/nd_export.def (revision 0)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+LIBRARY WVNDPROV.DLL
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ WSPStartup
Index: user/nd_exports.src
===================================================================
--- user/nd_exports.src (revision 0)
+++ user/nd_exports.src (revision 0)
@@ -0,0 +1,12 @@
+#if DBG
+LIBRARY wvndprov.dll
+#else
+LIBRARY wvndprov.dll
+#endif
+
+#ifndef _WIN64
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ WSPStartup
+#endif
Index: user/nd_listen.cpp
===================================================================
--- user/nd_listen.cpp (revision 0)
+++ user/nd_listen.cpp (revision 0)
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_listen.h"
+#include "nd_adapter.h"
+#include "nd_connect.h"
+
+
+CNDListen::CNDListen(CNDAdapter *pAdapter)
+{
+ pAdapter->AddRef();
+ m_pAdapter = pAdapter;
+ m_pWvConnEp = NULL;
+}
+
+STDMETHODIMP CNDListen::
+Init(SIZE_T Backlog, INT Protocol, USHORT *pPort)
+{
+ WV_CONNECT_ATTRIBUTES attr;
+ WV_SOCKADDR addr;
+ HRESULT hr;
+
+ if (Protocol != 6) {
+ return ND_NOT_SUPPORTED;
+ }
+
+ hr = m_pAdapter->m_pWvProvider->CreateConnectEndpoint(&m_pWvConnEp);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ if (m_pAdapter->m_Address.ss_family == AF_INET) {
+ RtlCopyMemory(&addr.Sin, &m_pAdapter->m_Address, sizeof(addr.Sin));
+ addr.Sin.sin_port = *pPort;
+ } else {
+ RtlCopyMemory(&addr.Sin6, &m_pAdapter->m_Address, sizeof(addr.Sin6));
+ addr.Sin6.sin6_port = *pPort;
+ }
+
+ hr = m_pWvConnEp->BindAddress(&addr.Sa);
+ if (FAILED(hr)) {
+ goto err;
+ }
+
+ hr = m_pWvConnEp->Listen(Backlog);
+ if (FAILED(hr)) {
+ goto err;
+ }
+
+ if (*pPort == 0) {
+ hr = m_pWvConnEp->Query(&attr);
+ if (FAILED(hr)) {
+ goto err;
+ }
+ *pPort = (addr.Sa.sa_family == AF_INET) ?
+ attr.LocalAddress.Sin.sin_port : attr.LocalAddress.Sin6.sin6_port;
+ }
+
+ return ND_SUCCESS;
+err:
+ m_pWvConnEp->Release();
+ return hr;
+}
+
+CNDListen::~CNDListen()
+{
+ if (m_pWvConnEp != NULL) {
+ m_pWvConnEp->Release();
+ }
+ m_pAdapter->Release();
+}
+
+STDMETHODIMP CNDListen::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_INDListen) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDListen::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDListen::
+Release(void)
+{
+ return CNDBase::Release();
+}
+
+STDMETHODIMP CNDListen::
+CancelOverlappedRequests(void)
+{
+ return m_pWvConnEp->CancelOverlappedRequests();
+}
+
+STDMETHODIMP CNDListen::
+GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait)
+{
+ return m_pWvConnEp->GetOverlappedResult(pOverlapped,
+ (DWORD *) pNumberOfBytesTransferred,
+ bWait);
+}
+
+STDMETHODIMP CNDListen::
+GetConnectionRequest(INDConnector* pConnector, OVERLAPPED* pOverlapped)
+{
+ CNDConnector *conn = (CNDConnector *) pConnector;
+
+ return m_pWvConnEp->GetRequest(conn->m_pWvConnEp, pOverlapped);
+}
Index: user/nd_listen.h
===================================================================
--- user/nd_listen.h (revision 0)
+++ user/nd_listen.h (revision 0)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_LISTEN_H_
+#define _ND_LISTEN_H_
+
+#include <initguid.h>
+#include <ndspi.h>
+#include "nd_base.h"
+#include "nd_adapter.h"
+
+class CNDListen : public INDListen, public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // INDOverlapped methods
+ STDMETHODIMP CancelOverlappedRequests();
+ STDMETHODIMP GetOverlappedResult(OVERLAPPED *pOverlapped,
+ SIZE_T *pNumberOfBytesTransferred, BOOL bWait);
+
+ // INDListen methods
+ STDMETHODIMP GetConnectionRequest(INDConnector* pConnector,
+ OVERLAPPED* pOverlapped);
+
+ CNDListen(CNDAdapter *pAdapter);
+ ~CNDListen();
+ void Delete() {delete this;}
+ static STDMETHODIMP
+ CreateInstance(CNDAdapter *pAdapter, SIZE_T Backlog, INT Protocol, USHORT Port,
+ USHORT* pAssignedPort, INDListen** ppListen)
+ {
+ HRESULT hr;
+ CNDListen *listener;
+
+ listener = new CNDListen(pAdapter);
+ if (listener == NULL) {
+ hr = ND_NO_MEMORY;
+ goto err1;
+ }
+
+ hr = listener->Init(Backlog, Protocol, &Port);
+ if (FAILED(hr)) {
+ goto err2;
+ }
+
+ if (pAssignedPort) {
+ *pAssignedPort = Port;
+ }
+ *ppListen = listener;
+ return ND_SUCCESS;
+
+ err2:
+ listener->Release();
+ err1:
+ *ppListen = NULL;
+ return hr;
+ }
+
+protected:
+ CNDAdapter *m_pAdapter;
+ IWVConnectEndpoint *m_pWvConnEp;
+
+ STDMETHODIMP Init(SIZE_T Backlog, INT Protocol, USHORT *pPort);
+};
+
+#endif // _ND_LISTEN_H_
Index: user/nd_main.cpp
===================================================================
--- user/nd_main.cpp (revision 0)
+++ user/nd_main.cpp (revision 0)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <windows.h>
+#include <ws2spi.h>
+#include <stdio.h>
+#include "nd_provider.h"
+
+
+extern "C" {
+
+extern BOOL APIENTRY
+_DllMainCRTStartupForGS(HINSTANCE h_module, DWORD ul_reason_for_call,
+ LPVOID lp_reserved);
+
+
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ case DLL_PROCESS_DETACH:
+ return _DllMainCRTStartupForGS(hInstance, dwReason, lpReserved);
+ default:
+ return TRUE;
+ }
+}
+
+STDAPI DllCanUnloadNow(void)
+{
+ return S_OK;
+}
+
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
+{
+ UNREFERENCED_PARAMETER(rclsid);
+
+ if (riid != IID_IClassFactory) {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppv = new CNDClassFactory();
+ if (*ppv == NULL) {
+ return E_OUTOFMEMORY;
+ }
+
+ return S_OK;
+}
+
+int /*WSPAPI*/ WSPStartup(WORD wVersionRequested, LPWSPDATA lpWSPData,
+ LPWSAPROTOCOL_INFOW lpProtocolInfo,
+ WSPUPCALLTABLE UpcallTable, LPWSPPROC_TABLE lpProcTable)
+{
+ UNREFERENCED_PARAMETER(wVersionRequested);
+ UNREFERENCED_PARAMETER(lpWSPData);
+ UNREFERENCED_PARAMETER(lpProtocolInfo);
+ UNREFERENCED_PARAMETER(UpcallTable);
+ UNREFERENCED_PARAMETER(lpProcTable);
+ return WSASYSNOTREADY;
+}
+
+} // extern "C"
\ No newline at end of file
Index: user/nd_main.h
===================================================================
--- user/nd_main.h (revision 0)
+++ user/nd_main.h (revision 0)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_MAIN_H_
+#define _ND_MAIN_H_
+
+#include <rdma\winverbs.h>
+
+#endif // _ND_MAIN_H_
Index: user/nd_mw.cpp
===================================================================
--- user/nd_mw.cpp (revision 0)
+++ user/nd_mw.cpp (revision 0)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_mw.h"
+
+CNDMemoryWindow::CNDMemoryWindow(CNDAdapter *pAdapter)
+{
+ pAdapter->AddRef();
+ m_pAdapter = pAdapter;
+ m_pWvMw = NULL;
+}
+
+STDMETHODIMP CNDMemoryWindow::
+Init(void)
+{
+ return m_pAdapter->m_pWvPd->AllocateMemoryWindow(&m_pWvMw);
+}
+
+CNDMemoryWindow::~CNDMemoryWindow()
+{
+ if (m_pWvMw != NULL) {
+ m_pWvMw->Release();
+ }
+ m_pAdapter->Release();
+}
+
+STDMETHODIMP CNDMemoryWindow::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_INDMemoryWindow) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDMemoryWindow::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDMemoryWindow::
+Release(void)
+{
+ return CNDBase::Release();
+}
Index: user/nd_mw.h
===================================================================
--- user/nd_mw.h (revision 0)
+++ user/nd_mw.h (revision 0)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_MW_H_
+#define _ND_MW_H_
+
+#include <initguid.h>
+#include <ndspi.h>
+#include "nd_base.h"
+#include "nd_adapter.h"
+
+class CNDMemoryWindow : public INDMemoryWindow , public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ CNDMemoryWindow(CNDAdapter *m_pAdapter);
+ ~CNDMemoryWindow();
+ void Delete() {delete this;}
+ static STDMETHODIMP
+ CreateInstance(CNDAdapter *pAdapter, INDMemoryWindow** ppMw)
+ {
+ HRESULT hr;
+ CNDMemoryWindow *mw;
+
+ mw = new CNDMemoryWindow(pAdapter);
+ if (mw == NULL) {
+ hr = ND_NO_MEMORY;
+ goto err1;
+ }
+
+ hr = mw->Init();
+ if (FAILED(hr)) {
+ goto err2;
+ }
+
+ *ppMw = mw;
+ return ND_SUCCESS;
+
+ err2:
+ mw->Release();
+ err1:
+ *ppMw = NULL;
+ return hr;
+ }
+
+ IWVMemoryWindow *m_pWvMw;
+protected:
+ CNDAdapter *m_pAdapter;
+
+ STDMETHODIMP Init();
+};
+
+#endif // _ND_MW_H_
Index: user/nd_provider.cpp
===================================================================
--- user/nd_provider.cpp (revision 0)
+++ user/nd_provider.cpp (revision 0)
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nd_provider.h"
+#include "nd_adapter.h"
+#include <ws2tcpip.h>
+
+STDMETHODIMP CNDProvider::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_INDProvider) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDProvider::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDProvider::
+Release(void)
+{
+ return CNDBase::Release();
+}
+
+STDMETHODIMP CNDProvider::
+QueryAddressList(SOCKET_ADDRESS_LIST* pAddressList, SIZE_T* pBufferSize)
+{
+ WV_DEVICE_ADDRESS devaddr;
+ IWVProvider *prov;
+ struct addrinfo *res, *ai;
+ HRESULT hr;
+ int cnt = 0;
+ size_t addrlen = 0, size;
+ UINT8 *offset;
+
+ hr = WvGetObject(IID_IWVProvider, (LPVOID *) &prov);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ hr = getaddrinfo("..localmachine", NULL, NULL, &res);
+ if (hr) {
+ goto release;
+ }
+
+ for (ai = res; ai; ai = ai->ai_next) {
+ ai->ai_flags = prov->TranslateAddress(ai->ai_addr, &devaddr);
+ if (SUCCEEDED(ai->ai_flags)) {
+ cnt++;
+ addrlen += ai->ai_addrlen;
+ }
+ }
+
+ if (cnt == 0) {
+ *pBufferSize = 0;
+ goto free;
+ }
+
+ size = sizeof(SOCKET_ADDRESS_LIST) + sizeof(SOCKET_ADDRESS) * (cnt - 1);
+ if (size + addrlen > *pBufferSize) {
+ *pBufferSize = size + addrlen;
+ hr = ND_BUFFER_OVERFLOW;
+ goto free;
+ }
+
+ pAddressList->iAddressCount = cnt;
+ offset = (UINT8 *) pAddressList + size;
+ for (cnt = 0, ai = res; ai; ai = ai->ai_next) {
+ if (SUCCEEDED(ai->ai_flags)) {
+ pAddressList->Address[cnt].iSockaddrLength = ai->ai_addrlen;
+ pAddressList->Address[cnt].lpSockaddr = (LPSOCKADDR) offset;
+ RtlCopyMemory(offset, ai->ai_addr, ai->ai_addrlen);
+ offset += ai->ai_addrlen;
+ }
+ }
+
+free:
+ freeaddrinfo(res);
+release:
+ prov->Release();
+ return hr;
+}
+
+STDMETHODIMP CNDProvider::
+OpenAdapter(const struct sockaddr* pAddress, SIZE_T AddressLength,
+ INDAdapter** ppAdapter)
+{
+ return CNDAdapter::CreateInstance(this, pAddress, AddressLength, ppAdapter);
+}
+
+
+//-------------------------
+// CNDClassFactory routines
+//-------------------------
+
+STDMETHODIMP CNDClassFactory::
+QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ if (riid != IID_IUnknown && riid != IID_IClassFactory) {
+ *ppvObj = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppvObj = this;
+ AddRef();
+ return ND_SUCCESS;
+}
+
+STDMETHODIMP_(ULONG) CNDClassFactory::
+AddRef(void)
+{
+ return CNDBase::AddRef();
+}
+
+STDMETHODIMP_(ULONG) CNDClassFactory::
+Release(void)
+{
+ return CNDBase::Release();
+}
+
+STDMETHODIMP CNDClassFactory::
+CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppObject)
+{
+ if (pUnkOuter != NULL) {
+ return CLASS_E_NOAGGREGATION;
+ }
+
+ if (riid != IID_INDProvider) {
+ *ppObject = NULL;
+ return E_NOINTERFACE;
+ }
+
+ *ppObject = new CNDProvider();
+ if (*ppObject == NULL) {
+ return E_OUTOFMEMORY;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CNDClassFactory::
+LockServer(BOOL fLock)
+{
+ UNREFERENCED_PARAMETER(fLock);
+ return S_OK;
+}
Index: user/nd_provider.h
===================================================================
--- user/nd_provider.h (revision 0)
+++ user/nd_provider.h (revision 0)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2009 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef _ND_PROVIDER_H_
+#define _ND_PROVIDER_H_
+
+#include <initguid.h>
+#include <ndspi.h>
+#include "nd_base.h"
+
+class CNDProvider : public INDProvider, public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // INDProvider methods
+ STDMETHODIMP QueryAddressList(SOCKET_ADDRESS_LIST* pAddressList,
+ SIZE_T* pBufferSize);
+ STDMETHODIMP OpenAdapter(const struct sockaddr* pAddress,
+ SIZE_T AddressLength, INDAdapter** ppAdapter);
+
+ CNDProvider() {};
+ ~CNDProvider() {};
+ void Delete() {delete this;}
+};
+
+
+class CNDClassFactory : public IClassFactory, public CNDBase
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // IClassFactory methods
+ STDMETHODIMP CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppObject);
+ STDMETHODIMP LockServer(BOOL fLock);
+
+ CNDClassFactory() {};
+ ~CNDClassFactory() {};
+ void Delete() {delete this;}
+};
+
+#endif // _ND_PROVIDER_H_
\ No newline at end of file
Index: user/netdirect.rc
===================================================================
--- user/netdirect.rc (revision 0)
+++ user/netdirect.rc (revision 0)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2008 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+
+#include <oib_ver.h>
+
+#define VER_FILETYPE VFT_DLL
+#define VER_FILESUBTYPE VFT2_UNKNOWN
+
+#ifdef _DEBUG_
+#define VER_FILEDESCRIPTION_STR "OpenFabrics Winverbs Network Direct Provider (Debug)"
+#define VER_INTERNALNAME_STR "wvndprovd.dll"
+#define VER_ORIGINALFILENAME_STR "wvndprovd.dll"
+#else
+#define VER_FILEDESCRIPTION_STR "OpenFabrics Winverbs Network Direct Provider"
+#define VER_INTERNALNAME_STR "wvndprov.dll"
+#define VER_ORIGINALFILENAME_STR "wvndprov.dll"
+#endif
+
+#include <common.ver>
Index: user/SOURCES
===================================================================
--- user/SOURCES (revision 0)
+++ user/SOURCES (revision 0)
@@ -0,0 +1,42 @@
+!if $(FREEBUILD)
+TARGETNAME = wvndprov
+!else
+TARGETNAME = wvndprovd
+!endif
+
+TARGETPATH = ..\..\..\bin\user\obj$(BUILD_ALT_DIR)
+TARGETTYPE = DYNLINK
+
+!if $(_NT_TOOLS_VERSION) == 0x700
+DLLDEF = $O\nd_exports.def
+!else
+DLLDEF = $(OBJ_PATH)\$O\nd_exports.def
+!endif
+
+DLLENTRY = DllMain
+USE_MSVCRT = 1
+
+SOURCES = \
+ nd_main.cpp \
+ nd_base.cpp \
+ nd_provider.cpp \
+ nd_adapter.cpp \
+ nd_listen.cpp \
+ nd_connect.cpp \
+ nd_ep.cpp \
+ nd_mw.cpp \
+ nd_cq.cpp
+
+INCLUDES = ..\..\..\inc;..\..\..\inc\user;\
+ ..\..\..\inc\user\linux;$(ND_SDK_PATH)\include;
+
+TARGETLIBS = \
+ $(SDK_LIB_PATH)\kernel32.lib \
+ $(SDK_LIB_PATH)\uuid.lib \
+ $(SDK_LIB_PATH)\ws2_32.lib \
+ $(SDK_LIB_PATH)\iphlpapi.lib \
+!if $(FREEBUILD)
+ $(TARGETPATH)\*\winverbs.lib
+!else
+ $(TARGETPATH)\*\winverbsd.lib
+!endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: netdirect.diff
Type: application/octet-stream
Size: 73647 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090702/84bba60a/attachment.obj>
More information about the ofw
mailing list