[ofw] [PATCH] winverbs/nd: map completion status to ND values

Sean Hefty sean.hefty at intel.com
Wed Jan 13 09:51:41 PST 2010


Define work completion status values for winverbs and
have the winverbs ND provider convert to ND status values.

MS-MPI requires ND_CANCELED for all flushed work requests.

Note that this does not change the winverbs ABI.  It merely
provides definition for the values that are returned.  For ease
of maintanence, update libibverbs to reference the winverbs status
values.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
This patch is for WinOF 2.2 once committed to the trunk.  I will
continue to test this patch with the other 4, plus one in the works,
through the rest of the week.

 trunk/inc/user/rdma/winverbs.h                  |   21 ++++++++++-
 trunk/ulp/libibverbs/include/infiniband/verbs.h |   45 ++++++++++++-----------
 trunk/ulp/netdirect/user/nd_cq.cpp              |   30 +++++++++++++++
 trunk/ulp/netdirect/user/nd_cq.h                |    1 +
 4 files changed, 73 insertions(+), 24 deletions(-)

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





More information about the ofw mailing list