Hefty, Sean wrote on Tue, 27 Jul 2010 at 00:57:52
>
>The SRQ receive code assumes that ND_SGE can map
>to a WV_SGE.  This is only true for 64-bit platforms.
>A 32-bit library must convert ND_SGE to WV_SGE.  The
>ND_SGE size varies based on the build; WV_SGE is a fixed
>size for all platforms.
>
>Signed-off-by: Sean Hefty <[email protected]>
>---
> trunk/ulp/netdirect2/user/nd_srq.cpp |   44 ++++++++++++++++++++++++++++++++++
> 1 files changed, 44 insertions(+), 0 deletions(-)
>
>diff --git a/trunk/ulp/netdirect2/user/nd_srq.cpp 
>b/trunk/ulp/netdirect2/user/nd_srq.cpp
>index 7499617..0703aa9 100644
>--- a/trunk/ulp/netdirect2/user/nd_srq.cpp
>+++ b/trunk/ulp/netdirect2/user/nd_srq.cpp
>@@ -123,6 +123,16 @@ Notify(OVERLAPPED* pOverlapped)
>       return NDConvertWVStatus(hr);
> }
> 
>+#ifdef _WIN64
>+
>+C_ASSERT(sizeof(WV_SGE) == sizeof(ND_SGE));
>+C_ASSERT(FIELD_OFFSET(WV_SGE, pAddress)   == FIELD_OFFSET(ND_SGE, Buffer));
>+C_ASSERT(RTL_FIELD_SIZE(WV_SGE, pAddress) == RTL_FIELD_SIZE(ND_SGE, Buffer));
>+C_ASSERT(FIELD_OFFSET(WV_SGE, Length)     == FIELD_OFFSET(ND_SGE, 
>BufferLength));
>+C_ASSERT(RTL_FIELD_SIZE(WV_SGE, Length)   == RTL_FIELD_SIZE(ND_SGE, 
>BufferLength));
>+C_ASSERT(FIELD_OFFSET(WV_SGE, Lkey)       == FIELD_OFFSET(ND_SGE, 
>MemoryRegionToken));
>+C_ASSERT(RTL_FIELD_SIZE(WV_SGE, Lkey)     == RTL_FIELD_SIZE(ND_SGE, 
>MemoryRegionToken));
>+

If you're going to copy-paste code that I contributed, please also copy-paste 
the copyright update at the top of the file.

> STDMETHODIMP CNDSharedReceiveQueue::
> Receive(VOID* requestContext, const ND_SGE* pSge, DWORD nSge)
> {
>@@ -131,3 +141,37 @@ Receive(VOID* requestContext, const ND_SGE* pSge, DWORD 
>nSge)
>       hr = m_pWvSrq->PostReceive((UINT64) (ULONG_PTR) requestContext, (WV_SGE 
> *) pSge, nSge);
>       return NDConvertWVStatus(hr);
> }
>+
>+#else
>+
>+STDMETHODIMP CNDSharedReceiveQueue::
>+Receive(VOID* requestContext, const ND_SGE* pSge, DWORD nSge)
>+{
>+      WV_SGE sge_array[4];
>+      WV_SGE *sge;
>+      DWORD i;
>+      HRESULT hr;
>+
>+      if (nSge > _countof(sge_array)) {
>+              sge = new WV_SGE[nSge];
>+              if (pShadowSge == NULL) {

pShadowSge doesn't exist in this context.

>+                      return ND_NO_MEMORY;
>+              }
>+      } else {
>+              sge = sge_array;
>+      }
>+
>+      for (i = 0; i < nSge; i++) {
>+              sge->pAddress = pSge[i].Buffer;
>+              sge->Length = pSge[i].BufferLength;
>+              sge->Lkey = pSge[i].MemoryRegionToken;
>+      }
>+
>+      hr = m_pWvSrq->PostReceive((UINT64) (ULONG_PTR) requestContext, sge, 
>nSge);
>+      if (nSge > _countof(sge_array)) {
>+              delete[] sge;
>+      }
>+      return NDConvertWVStatus(hr);
>+}
>+
>+#endif
>\ No newline at end of file
>
>
>_______________________________________________
>ofw mailing list
>[email protected]
>http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
>
>
_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to