[ofw] [PATCH] winverbs/ND: fix calculating RDMA read/write address

Sean Hefty sean.hefty at intel.com
Wed Dec 2 12:31:58 PST 2009


The RDMA address should be base + offset, in network byte order.  Rather
than trying to convert the offset into network byte order, then add that
to the base, which is already in network byte order, we need to convert
the base to host order, add the offset, then convert the results back.

This allows the winverbs ND provider to pass the ndmw test.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Index: nd_ep.cpp
===================================================================
--- nd_ep.cpp	(revision 2342)
+++ nd_ep.cpp	(working copy)
@@ -273,14 +273,15 @@
 	 const ND_MW_DESCRIPTOR* pRemoteMwDescriptor, ULONGLONG Offset, DWORD
Flags)
 {
 	WV_SGE sgl[ND_MAX_SGE];
+	UINT64 addr;
 	DWORD opts;
 	HRESULT hr;
 
 	pResult->BytesTransferred = ConvertSgl(pSgl, nSge, sgl);
 	opts = ConvertSendFlags(Flags) | (pSgl[0].hMr ? 0 : WV_SEND_INLINE);
+	addr = ntohll(pRemoteMwDescriptor->Base) + Offset;
 	hr = m_pWvQp->Read((UINT64) pResult, sgl, nSge, opts,
-					   pRemoteMwDescriptor->Base +
htonll(Offset),
-					   pRemoteMwDescriptor->Token);
+					   htonll(addr),
pRemoteMwDescriptor->Token);
 	return NDConvertWVStatus(hr);
 }
 
@@ -289,13 +290,14 @@
 	  const ND_MW_DESCRIPTOR* pRemoteMwDescriptor, ULONGLONG Offset, DWORD
Flags)
 {
 	WV_SGE sgl[ND_MAX_SGE];
+	UINT64 addr;
 	DWORD opts;
 	HRESULT hr;
 
 	pResult->BytesTransferred = ConvertSgl(pSgl, nSge, sgl);
 	opts = ConvertSendFlags(Flags) | (pSgl && pSgl[0].hMr ? 0 :
WV_SEND_INLINE);
+	addr = ntohll(pRemoteMwDescriptor->Base) + Offset;
 	hr = m_pWvQp->Write((UINT64) pResult, sgl, nSge, opts, 0,
-						pRemoteMwDescriptor->Base +
htonll(Offset),
-						pRemoteMwDescriptor->Token);
+						htonll(addr),
pRemoteMwDescriptor->Token);
 	return NDConvertWVStatus(hr);
 }




More information about the ofw mailing list