From 8ca34e5716dc6afab703f29f70292303179908bb Mon Sep 17 00:00:00 2001 From: shefty Date: Thu, 3 Dec 2009 20:32:45 +0000 Subject: [PATCH] winverbs/ND: fix calculating RDMA read/write address 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 git-svn-id: svn://openib.tc.cornell.edu/gen1@2619 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/ulp/netdirect/user/nd_ep.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/trunk/ulp/netdirect/user/nd_ep.cpp b/trunk/ulp/netdirect/user/nd_ep.cpp index 7b04fbea..d0fe6ea3 100644 --- a/trunk/ulp/netdirect/user/nd_ep.cpp +++ b/trunk/ulp/netdirect/user/nd_ep.cpp @@ -273,14 +273,15 @@ 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]; + 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 @@ 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]; + 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); } -- 2.46.0