winverbs/nd: map completion status to ND values
authorLOCALS~1\Temp/report.7.tmp <LOCALS~1\Temp/report.7.tmp@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 13 Jan 2010 19:34:38 +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:38 +0000 (19:34 +0000)
Convert flushed completion status values

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

inc/user/rdma/winverbs.h
ulp/libibverbs/include/infiniband/verbs.h
ulp/netdirect/user/nd_cq.cpp
ulp/netdirect/user/nd_cq.h

index eb73b1b..12542a5 100644 (file)
@@ -194,6 +194,25 @@ typedef enum _WV_OPCODE
 \r
 }      WV_OPCODE;\r
 \r
 \r
 }      WV_OPCODE;\r
 \r
+typedef enum _WV_WC_STATUS\r
+{\r
+       WvWcSuccess,\r
+       WvWcLocalLengthError,\r
+       WvWcLocalOpError,\r
+       WvWcLocalProtectionError,\r
+       WvWcFlushed,\r
+       WvWcMwBindError,\r
+       WvWcRemoteAccessError,\r
+       WvWcRemoteOpError,\r
+       WvWcRnrRetryError,\r
+       WvWcTimeoutRetryError,\r
+       WvWcRemoteInvalidRequest,\r
+       WvWcBadResponse,\r
+       WvWcLocalAccessError,\r
+       WvWcError\r
+\r
+}      WV_WC_STATUS;\r
+\r
 // Completion flags\r
 #define WV_WC_IMMEDIATE                0x00000001\r
 // reserved                                    0x00000002\r
 // Completion flags\r
 #define WV_WC_IMMEDIATE                0x00000001\r
 // reserved                                    0x00000002\r
@@ -207,7 +226,7 @@ typedef struct _WV_COMPLETION
        WV_OPCODE               Opcode;\r
        UINT32                  Length;\r
        UINT64                  VendorCode;\r
        WV_OPCODE               Opcode;\r
        UINT32                  Length;\r
        UINT64                  VendorCode;\r
-       HRESULT                 Status;\r
+       WV_WC_STATUS    Status;\r
 \r
        // Receive completion data\r
        DWORD                   Flags;\r
 \r
        // Receive completion data\r
        DWORD                   Flags;\r
index b1e4489..780f938 100644 (file)
@@ -242,28 +242,29 @@ struct ibv_async_event
 \r
 enum ibv_wc_status\r
 {\r
 \r
 enum ibv_wc_status\r
 {\r
-       IBV_WC_SUCCESS,\r
-       IBV_WC_LOC_LEN_ERR,\r
-       IBV_WC_LOC_QP_OP_ERR,\r
-       IBV_WC_LOC_PROT_ERR,\r
-       IBV_WC_WR_FLUSH_ERR,\r
-       IBV_WC_MW_BIND_ERR,\r
-       IBV_WC_REM_ACCESS_ERR,\r
-       IBV_WC_REM_OP_ERR,\r
-       IBV_WC_RNR_RETRY_EXC_ERR,\r
-       IBV_WC_RESP_TIMEOUT_ERR,\r
-       IBV_WC_REM_INV_REQ_ERR,\r
-       IBV_WC_BAD_RESP_ERR,\r
-       IBV_WC_LOC_ACCESS_ERR,\r
-       IBV_WC_GENERAL_ERR,\r
-       IBV_WC_FATAL_ERR,\r
-       IBV_WC_RETRY_EXC_ERR,\r
-       IBV_WC_REM_ABORT_ERR,\r
-       IBV_WC_LOC_EEC_OP_ERR,\r
-       IBV_WC_LOC_RDD_VIOL_ERR,\r
-       IBV_WC_REM_INV_RD_REQ_ERR,\r
-       IBV_WC_INV_EECN_ERR,\r
-       IBV_WC_INV_EEC_STATE_ERR\r
+       IBV_WC_SUCCESS                          = WvWcSuccess,\r
+       IBV_WC_LOC_LEN_ERR                      = WvWcLocalLengthError,\r
+       IBV_WC_LOC_QP_OP_ERR            = WvWcLocalOpError,\r
+       IBV_WC_LOC_PROT_ERR                     = WvWcLocalProtectionError,\r
+       IBV_WC_WR_FLUSH_ERR                     = WvWcFlushed,\r
+       IBV_WC_MW_BIND_ERR                      = WvWcMwBindError,\r
+       IBV_WC_REM_ACCESS_ERR           = WvWcRemoteAccessError,\r
+       IBV_WC_REM_OP_ERR                       = WvWcRemoteOpError,\r
+       IBV_WC_RNR_RETRY_EXC_ERR        = WvWcRnrRetryError,\r
+       IBV_WC_RESP_TIMEOUT_ERR         = WvWcTimeoutRetryError,\r
+       IBV_WC_REM_INV_REQ_ERR          = WvWcRemoteInvalidRequest,\r
+       IBV_WC_BAD_RESP_ERR                     = WvWcBadResponse,\r
+       IBV_WC_LOC_ACCESS_ERR           = WvWcLocalAccessError,\r
+       IBV_WC_GENERAL_ERR                      = WvWcError,\r
+       IBV_WC_FATAL_ERR                        = WvWcError,\r
+       IBV_WC_RETRY_EXC_ERR            = WvWcError,\r
+       IBV_WC_REM_ABORT_ERR            = WvWcError,\r
+       IBV_WC_LOC_EEC_OP_ERR           = WvWcError,\r
+       IBV_WC_LOC_RDD_VIOL_ERR         = WvWcError,\r
+       IBV_WC_REM_INV_RD_REQ_ERR       = WvWcError,\r
+       IBV_WC_INV_EECN_ERR                     = WvWcError,\r
+       IBV_WC_INV_EEC_STATE_ERR        = WvWcError\r
+\r
 };\r
 \r
 __declspec(dllexport)\r
 };\r
 \r
 __declspec(dllexport)\r
index 28aabe5..07dabc2 100644 (file)
@@ -116,6 +116,34 @@ Notify(DWORD Type, OVERLAPPED* pOverlapped)
        return NDConvertWVStatus(hr);\r
 }\r
 \r
        return NDConvertWVStatus(hr);\r
 }\r
 \r
+STDMETHODIMP_(HRESULT) CNDCompletionQueue::\r
+ConvertStatus(WV_WC_STATUS Status)\r
+{\r
+       switch (Status) {\r
+       case WvWcSuccess:\r
+               return ND_SUCCESS;\r
+       case WvWcFlushed:\r
+               return ND_CANCELED;\r
+       case WvWcLocalLengthError:\r
+               return ND_LOCAL_LENGTH;\r
+       case WvWcRnrRetryError:\r
+       case WvWcTimeoutRetryError:\r
+               return ND_TIMEOUT;\r
+       case WvWcLocalAccessError:\r
+       case WvWcLocalOpError:\r
+       case WvWcLocalProtectionError:\r
+       case WvWcMwBindError:\r
+               return ND_ACCESS_VIOLATION;\r
+       case WvWcRemoteAccessError:\r
+       case WvWcRemoteOpError:\r
+       case WvWcRemoteInvalidRequest:\r
+       case WvWcBadResponse:\r
+               return ND_REMOTE_ERROR;\r
+       default:\r
+               return ND_INTERNAL_ERROR;\r
+       }\r
+}\r
+\r
 STDMETHODIMP_(SIZE_T) CNDCompletionQueue::\r
 GetResults(ND_RESULT* pResults[], SIZE_T nResults)\r
 {\r
 STDMETHODIMP_(SIZE_T) CNDCompletionQueue::\r
 GetResults(ND_RESULT* pResults[], SIZE_T nResults)\r
 {\r
@@ -134,7 +162,7 @@ GetResults(ND_RESULT* pResults[], SIZE_T nResults)
                        if (comp[i].Opcode & WvReceive) {\r
                                pResults[total]->BytesTransferred = comp[i].Length;\r
                        }\r
                        if (comp[i].Opcode & WvReceive) {\r
                                pResults[total]->BytesTransferred = comp[i].Length;\r
                        }\r
-                       pResults[total++]->Status = comp[i].Status;\r
+                       pResults[total++]->Status = ConvertStatus(comp[i].Status);\r
                }\r
        }\r
        return total;\r
                }\r
        }\r
        return total;\r
index ba1c91a..06c4d6c 100644 (file)
@@ -90,6 +90,7 @@ public:
 protected:\r
        CNDAdapter                      *m_pAdapter;\r
        STDMETHODIMP            Init(SIZE_T nEntries);\r
 protected:\r
        CNDAdapter                      *m_pAdapter;\r
        STDMETHODIMP            Init(SIZE_T nEntries);\r
+       STDMETHODIMP_(HRESULT) ConvertStatus(WV_WC_STATUS Status);\r
 };\r
 \r
 #endif // _ND_CQ_H_\r
 };\r
 \r
 #endif // _ND_CQ_H_\r