winverbs/netdirect: add support for inline sends
authorLOCALS~1\Temp/report.7.tmp <LOCALS~1\Temp/report.7.tmp@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 13 Jan 2010 19:34:27 +0000 (19:34 +0000)
committerLOCALS~1\Temp/report.7.tmp <LOCALS~1\Temp/report.7.tmp@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 13 Jan 2010 19:34:27 +0000 (19:34 +0000)
By default, use inline sends, and allow user to limit
inline send size through an environment variable.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2664 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/netdirect/user/nd_ep.cpp
ulp/netdirect/user/nd_ep.h

index d0fe6ea..7060b20 100644 (file)
@@ -44,6 +44,16 @@ CNDEndpoint::CNDEndpoint(CNDConnector *pConnector)
        m_pOutboundCq = NULL;\r
 }\r
 \r
+STDMETHODIMP_(void) CNDEndpoint::\r
+InitMaxInline(void)\r
+{\r
+       TCHAR val[16];\r
+       DWORD ret;\r
+\r
+       ret = GetEnvironmentVariable("IBNDPROV_MAX_INLINE_SIZE", val, 16);\r
+       m_MaxInlineSend = (ret > 0 && ret <= 16) ? (SIZE_T) strtoul(val, NULL, 16) : 160;\r
+}\r
+\r
 STDMETHODIMP CNDEndpoint::\r
 Init(CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,\r
         SIZE_T nInboundEntries, SIZE_T nOutboundEntries,\r
@@ -63,6 +73,7 @@ Init(CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,
        m_pOutboundCq->AddRef();\r
        m_InitiatorDepth = OutboundReadLimit;\r
        m_ResponderResources = InboundReadLimit;\r
+       InitMaxInline();\r
 \r
        RtlZeroMemory(&create, sizeof create);\r
        create.pSendCq = pOutboundCq->m_pWvCq;\r
@@ -74,6 +85,7 @@ Init(CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,
        create.ReceiveSge = nInboundSge;\r
        create.InitiatorDepth = OutboundReadLimit;\r
        create.ResponderResources = InboundReadLimit;\r
+       create.MaxInlineSend = m_MaxInlineSend;\r
        create.QpType = WvQpTypeRc;\r
        \r
        hr = m_pConnector->m_pAdapter->m_pWvPd->CreateConnectQueuePair(&create, &m_pWvQp);\r
@@ -97,7 +109,7 @@ Init(CNDCompletionQueue* pInboundCq, CNDCompletionQueue* pOutboundCq,
        }\r
 \r
        if (pMaxInlineData) {\r
-               *pMaxInlineData = 0;\r
+               *pMaxInlineData = m_MaxInlineSend;\r
        }\r
        return ND_SUCCESS;\r
 }\r
@@ -212,7 +224,8 @@ Send(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge, DWORD Flags)
        HRESULT hr;\r
 \r
        pResult->BytesTransferred = ConvertSgl(pSgl, nSge, sgl);\r
-       opts = ConvertSendFlags(Flags) | (pSgl && pSgl[0].hMr ? 0 : WV_SEND_INLINE);\r
+       opts = ConvertSendFlags(Flags) |\r
+                  (pResult->BytesTransferred <= m_MaxInlineSend ? WV_SEND_INLINE : 0);\r
        hr = m_pWvQp->Send((UINT64) pResult, sgl, nSge, opts, 0);\r
        return NDConvertWVStatus(hr);\r
 }\r
@@ -278,7 +291,8 @@ Read(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
        HRESULT hr;\r
 \r
        pResult->BytesTransferred = ConvertSgl(pSgl, nSge, sgl);\r
-       opts = ConvertSendFlags(Flags) | (pSgl[0].hMr ? 0 : WV_SEND_INLINE);\r
+       opts = ConvertSendFlags(Flags) |\r
+                  (pResult->BytesTransferred ? 0 : WV_SEND_INLINE);\r
        addr = ntohll(pRemoteMwDescriptor->Base) + Offset;\r
        hr = m_pWvQp->Read((UINT64) pResult, sgl, nSge, opts,\r
                                           htonll(addr), pRemoteMwDescriptor->Token);\r
@@ -295,7 +309,8 @@ Write(ND_RESULT* pResult, const ND_SGE* pSgl, SIZE_T nSge,
        HRESULT hr;\r
 \r
        pResult->BytesTransferred = ConvertSgl(pSgl, nSge, sgl);\r
-       opts = ConvertSendFlags(Flags) | (pSgl && pSgl[0].hMr ? 0 : WV_SEND_INLINE);\r
+       opts = ConvertSendFlags(Flags) |\r
+                  (pResult->BytesTransferred <= m_MaxInlineSend ? WV_SEND_INLINE : 0);\r
        addr = ntohll(pRemoteMwDescriptor->Base) + Offset;\r
        hr = m_pWvQp->Write((UINT64) pResult, sgl, nSge, opts, 0,\r
                                                htonll(addr), pRemoteMwDescriptor->Token);\r
index a49c43e..78fac3f 100644 (file)
@@ -111,6 +111,7 @@ public:
        IWVConnectQueuePair     *m_pWvQp;\r
        SIZE_T                          m_InitiatorDepth;\r
        SIZE_T                          m_ResponderResources;\r
+       SIZE_T                          m_MaxInlineSend;\r
 \r
 protected:\r
        CNDConnector            *m_pConnector;\r
@@ -122,6 +123,7 @@ protected:
                                          SIZE_T nInboundSge, SIZE_T nOutboundSge,\r
                                          SIZE_T InboundReadLimit, SIZE_T OutboundReadLimit,\r
                                          SIZE_T* pMaxInlineData);\r
+       STDMETHODIMP_(void) InitMaxInline();\r
        STDMETHODIMP_(SIZE_T) ConvertSgl(const ND_SGE* pSgl, SIZE_T nSge, WV_SGE *pWvSgl);\r
        STDMETHODIMP_(DWORD) ConvertSendFlags(DWORD Flags);\r
        STDMETHODIMP_(DWORD) ConvertAccessFlags(DWORD Flags);\r