[ofw] [PATCH] netdirect: implement rest of NDConnector calls

Sean Hefty sean.hefty at intel.com
Wed Jun 10 11:59:47 PDT 2009


Add initial implementations for NDConnector Connect, CompleteConnect,
Accept, and Disconnect.  This is compile tested only and "optimizes for
performance".  (I.e. doesn't provide any error checking on the input
parameters.)

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
The winverbs ND provider is still in need of implementations for
SendAndInvalidate, Bind, and Invalidate.

Index: user/nd_adapter.cpp
===================================================================
--- user/nd_adapter.cpp	(revision 2100)
+++ user/nd_adapter.cpp	(working copy)
@@ -126,7 +126,7 @@
 STDMETHODIMP CNDAdapter::
 CancelOverlappedRequests(void)
 {
-	// TODO: add CancelOverlappedRequests to IWVProtectionDomain for MR
+	m_pWvPd->CancelOverlappedRequests();
 	return ND_SUCCESS;
 }
 
Index: user/nd_connect.cpp
===================================================================
--- user/nd_connect.cpp	(revision 2100)
+++ user/nd_connect.cpp	(working copy)
@@ -116,15 +116,35 @@
 		const void* pPrivateData, SIZE_T PrivateDataLength,
 		OVERLAPPED* pOverlapped)
 {
-	// TODO
-	return ND_NOT_SUPPORTED;
+	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)
 {
-	// TODO
-	return ND_NOT_SUPPORTED;
+	WV_CONNECT_PARAM	attr;
+
+	RtlZeroMemory(&attr, sizeof attr);
+	return m_pWvConnEp->Accept(NULL, &attr, pOverlapped);
 }
 
 STDMETHODIMP CNDConnector::
@@ -132,8 +152,17 @@
 	   const void* pPrivateData, SIZE_T PrivateDataLength,
 	   OVERLAPPED* pOverlapped)
 {
-	// TODO
-	return ND_NOT_SUPPORTED;
+	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::
@@ -226,6 +255,5 @@
 STDMETHODIMP CNDConnector::
 Disconnect(OVERLAPPED* pOverlapped)
 {
-	// TODO
-	return ND_NOT_SUPPORTED;
+	return m_pWvConnEp->Disconnect(pOverlapped);
 }
Index: user/nd_ep.cpp
===================================================================
--- user/nd_ep.cpp	(revision 2100)
+++ user/nd_ep.cpp	(working copy)
@@ -58,6 +58,8 @@
 
 	m_pInboundCq->AddRef();
 	m_pOutboundCq->AddRef();
+	m_InitiatorDepth = OutboundReadLimit;
+	m_ResponderResources = InboundReadLimit;
 
 	RtlZeroMemory(&create, sizeof create);
 	create.pSendCq = pOutboundCq->m_pWvCq;
Index: user/nd_ep.h
===================================================================
--- user/nd_ep.h	(revision 2100)
+++ user/nd_ep.h	(working copy)
@@ -108,11 +108,14 @@
 		return hr;
 	}
 
+	IWVConnectQueuePair	*m_pWvQp;
+	SIZE_T				m_InitiatorDepth;
+	SIZE_T				m_ResponderResources;
+
 protected:
 	CNDConnector		*m_pConnector;
 	CNDCompletionQueue	*m_pInboundCq;
 	CNDCompletionQueue	*m_pOutboundCq;
-	IWVConnectQueuePair	*m_pWvQp;
 
 	STDMETHODIMP Init(CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,
 					  SIZE_T nInboundEntries, SIZE_T nOutboundEntries,





More information about the ofw mailing list