]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
winverbs/ND: fix calculating RDMA read/write address
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 3 Dec 2009 20:32:45 +0000 (20:32 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 3 Dec 2009 20:32:45 +0000 (20:32 +0000)
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@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@2619 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/ulp/netdirect/user/nd_ep.cpp

index 7b04fbea438b6307b1f3b30b7a283617b51d535c..d0fe6ea37f2ac7dc186ad8ae8c0158c83b38fce5 100644 (file)
@@ -273,14 +273,15 @@ Read(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
         const ND_MW_DESCRIPTOR* pRemoteMwDescriptor, ULONGLONG Offset, DWORD Flags)\r
 {\r
        WV_SGE sgl[ND_MAX_SGE];\r
+       UINT64 addr;\r
        DWORD opts;\r
        HRESULT hr;\r
 \r
        pResult->BytesTransferred = ConvertSgl(pSgl, nSge, sgl);\r
        opts = ConvertSendFlags(Flags) | (pSgl[0].hMr ? 0 : WV_SEND_INLINE);\r
+       addr = ntohll(pRemoteMwDescriptor->Base) + Offset;\r
        hr = m_pWvQp->Read((UINT64) pResult, sgl, nSge, opts,\r
-                                          pRemoteMwDescriptor->Base + htonll(Offset),\r
-                                          pRemoteMwDescriptor->Token);\r
+                                          htonll(addr), pRemoteMwDescriptor->Token);\r
        return NDConvertWVStatus(hr);\r
 }\r
 \r
@@ -289,13 +290,14 @@ Write(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
          const ND_MW_DESCRIPTOR* pRemoteMwDescriptor, ULONGLONG Offset, DWORD Flags)\r
 {\r
        WV_SGE sgl[ND_MAX_SGE];\r
+       UINT64 addr;\r
        DWORD opts;\r
        HRESULT hr;\r
 \r
        pResult->BytesTransferred = ConvertSgl(pSgl, nSge, sgl);\r
        opts = ConvertSendFlags(Flags) | (pSgl && pSgl[0].hMr ? 0 : WV_SEND_INLINE);\r
+       addr = ntohll(pRemoteMwDescriptor->Base) + Offset;\r
        hr = m_pWvQp->Write((UINT64) pResult, sgl, nSge, opts, 0,\r
-                                               pRemoteMwDescriptor->Base + htonll(Offset),\r
-                                               pRemoteMwDescriptor->Token);\r
+                                               htonll(addr), pRemoteMwDescriptor->Token);\r
        return NDConvertWVStatus(hr);\r
 }\r