[ofw] [RFC] [PATCH] winverbs: convert ib_api_status to wvstatus

Smith, Stan stan.smith at intel.com
Wed Mar 5 10:05:24 PST 2008


Why are some many IBAL errors coalesced into a single WV error?
Example:
> -//	case IB_INVALID_QP_STATE:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_APM_STATE:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_PORT_STATE:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_STATE:			return
WV_INVALID_PARAMETER;

> -//	case IB_INVALID_GID:			return
WV_INVALID_ADDRESS;
> -//	case IB_INVALID_LID:			return
WV_INVALID_ADDRESS;
> -//	case IB_INVALID_GUID:			return
WV_INVALID_ADDRESS;

Seems useful debug info is lost?


Sean Hefty wrote:
> Enable code to convert from ib_api_status_t to HRESULT values.
> 
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
> Note that code was there in initial check-in, but commented out.  For
> the most part, converting the status is only necessary when reporting
> errors.  Compiled tested only.
> 
> Index: SOURCES
> ===================================================================
> --- SOURCES	(revision 971)
> +++ SOURCES	(working copy)
> @@ -27,8 +27,15 @@
> 
>  USER_C_FLAGS=$(USER_C_FLAGS) -DEXPORT_WV_SYMBOLS
> 
> -TARGETLIBS= \
> +TARGETLIBS=\
>  	$(SDK_LIB_PATH)\kernel32.lib	\
> -	$(SDK_LIB_PATH)\uuid.lib
> +	$(SDK_LIB_PATH)\uuid.lib		\
> +!if $(FREEBUILD)
> +	$(TARGETPATH)\*\complib.lib		\
> +	$(TARGETPATH)\*\ibal.lib
> +!else
> +	$(TARGETPATH)\*\complibd.lib	\
> +	$(TARGETPATH)\*\ibald.lib
> +!endif
> 
>  MSC_WARNING_LEVEL= /W4
> Index: wv_base.h
> ===================================================================
> --- wv_base.h	(revision 961)
> +++ wv_base.h	(working copy)
> @@ -32,9 +32,10 @@
>  #ifndef _WV_BASE_H_
>  #define _WV_BASE_H_
> 
> -#include "windows.h"
> -//#include "iba\ib_types.h"
> +#include <windows.h>
> 
> +#include <iba\ib_types.h>
> +
>  __inline void* __cdecl operator new(size_t size)
>  {
>  	return HeapAlloc(GetProcessHeap(), 0, size);
> @@ -45,6 +46,6 @@
>  	HeapFree(GetProcessHeap(), 0, pObj);
>  }
> 
> -//HRESULT ConvertIbalStatus(ib_api_status_t status);
> +HRESULT ConvertIbalStatus(ib_api_status_t status);
> 
>  #endif // _WV_BASE_H_
> \ No newline at end of file
> Index: wv_main.cpp
> ===================================================================
> --- wv_main.cpp	(revision 971)
> +++ wv_main.cpp	(working copy)
> @@ -72,63 +72,63 @@
>  	return hr;
>  }
> 
> -//HRESULT ConvertIbalStatus(ib_api_status_t status)
> -//{
> -//	switch (status)
> -//	{
> -//	case IB_SUCCESS:				return
WV_SUCCESS;
> -//	case IB_INSUFFICIENT_RESOURCES:	return
WV_INSUFFICIENT_RESOURCES;
> -//	case IB_INSUFFICIENT_MEMORY:	return WV_NO_MEMORY;
> -//	case IB_INVALID_PARAMETER:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_SETTING:		return
WV_INVALID_PARAMETER;
> -//	case IB_NOT_FOUND:				return
WV_INVALID_ADDRESS;
> -//	case IB_TIMEOUT:				return
WV_TIMEOUT;
> -//	case IB_CANCELED:				return
WV_CANCELLED;
> -//	case IB_INTERRUPTED:			return WV_CANCELLED;
> -//	case IB_INVALID_PERMISSION:		return
WV_ACCESS_VIOLATION;
> -//	case IB_UNSUPPORTED:			return WV_NOT_SUPPORTED;
> -//	case IB_OVERFLOW:				return
WV_BUFFER_OVERFLOW;
> -//	case IB_MAX_MCAST_QPS_REACHED:	return
WV_INSUFFICIENT_RESOURCES;
> -//	case IB_INVALID_QP_STATE:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_APM_STATE:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_PORT_STATE:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_STATE:			return
WV_INVALID_PARAMETER;
> -//	case IB_RESOURCE_BUSY:			return WV_DEVICE_BUSY;
> -//	case IB_INVALID_PKEY:			return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_LKEY:			return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_RKEY:			return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_MAX_WRS:		return
WV_INSUFFICIENT_RESOURCES;
> -//	case IB_INVALID_MAX_SGE:		return
WV_INSUFFICIENT_RESOURCES;
> -//	case IB_INVALID_CQ_SIZE:		return
WV_INSUFFICIENT_RESOURCES;
> -//	case IB_INVALID_SRQ_SIZE:		return
WV_INSUFFICIENT_RESOURCES;
> -//	case IB_INVALID_SERVICE_TYPE:	return WV_NOT_SUPPORTED;
> -//	case IB_INVALID_GID:			return
WV_INVALID_ADDRESS;
> -//	case IB_INVALID_LID:			return
WV_INVALID_ADDRESS;
> -//	case IB_INVALID_GUID:			return
WV_INVALID_ADDRESS;
> -//	case IB_INVALID_CA_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_AV_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_CQ_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_QP_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_SRQ_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_PD_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_MR_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_FMR_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_MW_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_MCAST_HANDLE:	return WV_INVALID_HANDLE;
> -//	case IB_INVALID_CALLBACK:		return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_AL_HANDLE:		return
WV_INVALID_HANDLE;
> -//	case IB_INVALID_HANDLE:			return
WV_INVALID_HANDLE;
> -//	case IB_ERROR:					return
WV_UNKNOWN_ERROR;
> -//	case IB_REMOTE_ERROR:			return
WV_REMOTE_OP_ERROR;
> -//	case IB_VERBS_PROCESSING_DONE:	return WV_SUCCESS;
> -//	case IB_INVALID_WR_TYPE:		return
WV_INVALID_PARAMETER;
> -//	case IB_QP_IN_TIMEWAIT:			return
WV_INVALID_PARAMETER;
> -//	case IB_EE_IN_TIMEWAIT:			return
WV_INVALID_PARAMETER;
> -//	case IB_INVALID_PORT:			return
WV_INVALID_ADDRESS;
> -//	case IB_NOT_DONE:				return
WV_PENDING;
> -//	case IB_INVALID_INDEX:			return
WV_INVALID_PARAMETER;
> -//	case IB_NO_MATCH:				return
WV_INVALID_PARAMETER;
> -//	case IB_PENDING:				return
WV_PENDING;
> -//	default:						return
WV_UNKNOWN_ERROR;
> -//	}
> -//}
> +HRESULT ConvertIbalStatus(ib_api_status_t status)
> +{
> +	switch (status)
> +	{
> +	case IB_SUCCESS:				return
WV_SUCCESS;
> +	case IB_INSUFFICIENT_RESOURCES:	return
WV_INSUFFICIENT_RESOURCES;
> +	case IB_INSUFFICIENT_MEMORY:	return WV_NO_MEMORY;
> +	case IB_INVALID_PARAMETER:		return
WV_INVALID_PARAMETER;
> +	case IB_INVALID_SETTING:		return
WV_INVALID_PARAMETER;
> +	case IB_NOT_FOUND:				return
WV_INVALID_ADDRESS;
> +	case IB_TIMEOUT:				return
WV_TIMEOUT;
> +	case IB_CANCELED:				return
WV_CANCELLED;
> +	case IB_INTERRUPTED:			return WV_CANCELLED;
> +	case IB_INVALID_PERMISSION:		return
WV_ACCESS_VIOLATION;
> +	case IB_UNSUPPORTED:			return WV_NOT_SUPPORTED;
> +	case IB_OVERFLOW:				return
WV_BUFFER_OVERFLOW;
> +	case IB_MAX_MCAST_QPS_REACHED:	return
WV_INSUFFICIENT_RESOURCES;
> +	case IB_INVALID_QP_STATE:		return
WV_INVALID_PARAMETER;
> +	case IB_INVALID_APM_STATE:		return
WV_INVALID_PARAMETER;
> +	case IB_INVALID_PORT_STATE:		return
WV_INVALID_PARAMETER;
> +	case IB_INVALID_STATE:			return
WV_INVALID_PARAMETER;
> +	case IB_RESOURCE_BUSY:			return WV_DEVICE_BUSY;
> +	case IB_INVALID_PKEY:			return
WV_INVALID_HANDLE;
> +	case IB_INVALID_LKEY:			return
WV_INVALID_HANDLE;
> +	case IB_INVALID_RKEY:			return
WV_INVALID_HANDLE;
> +	case IB_INVALID_MAX_WRS:		return
WV_INSUFFICIENT_RESOURCES;
> +	case IB_INVALID_MAX_SGE:		return
WV_INSUFFICIENT_RESOURCES;
> +	case IB_INVALID_CQ_SIZE:		return
WV_INSUFFICIENT_RESOURCES;
> +	case IB_INVALID_SRQ_SIZE:		return
WV_INSUFFICIENT_RESOURCES;
> +	case IB_INVALID_SERVICE_TYPE:	return WV_NOT_SUPPORTED;
> +	case IB_INVALID_GID:			return
WV_INVALID_ADDRESS;
> +	case IB_INVALID_LID:			return
WV_INVALID_ADDRESS;
> +	case IB_INVALID_GUID:			return
WV_INVALID_ADDRESS;
> +	case IB_INVALID_CA_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_AV_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_CQ_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_QP_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_SRQ_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_PD_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_MR_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_FMR_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_MW_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_MCAST_HANDLE:	return WV_INVALID_HANDLE;
> +	case IB_INVALID_CALLBACK:		return
WV_INVALID_PARAMETER;
> +	case IB_INVALID_AL_HANDLE:		return
WV_INVALID_HANDLE;
> +	case IB_INVALID_HANDLE:			return
WV_INVALID_HANDLE;
> +	case IB_ERROR:					return
WV_UNKNOWN_ERROR;
> +	case IB_REMOTE_ERROR:			return
WV_REMOTE_OP_ERROR;
> +	case IB_VERBS_PROCESSING_DONE:	return WV_SUCCESS;
> +	case IB_INVALID_WR_TYPE:		return
WV_INVALID_PARAMETER;
> +	case IB_QP_IN_TIMEWAIT:			return
WV_INVALID_PARAMETER;
> +	case IB_EE_IN_TIMEWAIT:			return
WV_INVALID_PARAMETER;
> +	case IB_INVALID_PORT:			return
WV_INVALID_ADDRESS;
> +	case IB_NOT_DONE:				return
WV_PENDING;
> +	case IB_INVALID_INDEX:			return
WV_INVALID_PARAMETER;
> +	case IB_NO_MATCH:				return
WV_INVALID_PARAMETER;
> +	case IB_PENDING:				return
WV_PENDING;
> +	default:						return
WV_UNKNOWN_ERROR;
> +	}
> +}
> 
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw




More information about the ofw mailing list