/*\r
* Copyright (c) 2009-2010 Intel Corporation. All rights reserved.\r
+ * Copyright (c) 2010 Microsoft Corporation. All rights reserved.\r
*\r
* This software is available to you under the OpenIB.org BSD license\r
* below:\r
return NDConvertWVStatus(hr);\r
}\r
\r
+#ifdef _WIN64\r
+\r
+C_ASSERT(sizeof(WV_SGE) == sizeof(ND_SGE));\r
+C_ASSERT(FIELD_OFFSET(WV_SGE, pAddress) == FIELD_OFFSET(ND_SGE, Buffer));\r
+C_ASSERT(RTL_FIELD_SIZE(WV_SGE, pAddress) == RTL_FIELD_SIZE(ND_SGE, Buffer));\r
+C_ASSERT(FIELD_OFFSET(WV_SGE, Length) == FIELD_OFFSET(ND_SGE, BufferLength));\r
+C_ASSERT(RTL_FIELD_SIZE(WV_SGE, Length) == RTL_FIELD_SIZE(ND_SGE, BufferLength));\r
+C_ASSERT(FIELD_OFFSET(WV_SGE, Lkey) == FIELD_OFFSET(ND_SGE, MemoryRegionToken));\r
+C_ASSERT(RTL_FIELD_SIZE(WV_SGE, Lkey) == RTL_FIELD_SIZE(ND_SGE, MemoryRegionToken));\r
+\r
STDMETHODIMP CNDSharedReceiveQueue::\r
Receive(VOID* requestContext, const ND_SGE* pSge, DWORD nSge)\r
{\r
hr = m_pWvSrq->PostReceive((UINT64) (ULONG_PTR) requestContext, (WV_SGE *) pSge, nSge);\r
return NDConvertWVStatus(hr);\r
}\r
+\r
+#else\r
+\r
+STDMETHODIMP CNDSharedReceiveQueue::\r
+Receive(VOID* requestContext, const ND_SGE* pSge, DWORD nSge)\r
+{\r
+ WV_SGE sgl[4];\r
+ WV_SGE *sge;\r
+ DWORD i;\r
+ HRESULT hr;\r
+\r
+ if (nSge > _countof(sgl)) {\r
+ sge = new WV_SGE[nSge];\r
+ if (sge == NULL) {\r
+ return ND_NO_MEMORY;\r
+ }\r
+ } else {\r
+ sge = sgl;\r
+ }\r
+\r
+ for (i = 0; i < nSge; i++) {\r
+ sge->pAddress = pSge[i].Buffer;\r
+ sge->Length = pSge[i].BufferLength;\r
+ sge->Lkey = pSge[i].MemoryRegionToken;\r
+ }\r
+\r
+ hr = m_pWvSrq->PostReceive((UINT64) (ULONG_PTR) requestContext, sge, nSge);\r
+ if (nSge > _countof(sge_array)) {\r
+ delete[] sge;\r
+ }\r
+ return NDConvertWVStatus(hr);\r
+}\r
+\r
+#endif
\ No newline at end of file