[ofw] [PATCH] OFED compat: convert return values to errno
Smith, Stan
stan.smith at intel.com
Wed Apr 14 12:51:34 PDT 2010
Sean,
Works fine to solve the building outside of the OFED-W src tree using Visual Studio 10 cmd window.
thanks,
stan.
>-----Original Message-----
>From: ofw-bounces at lists.openfabrics.org
>[mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Sean Hefty
>Sent: Wednesday, April 14, 2010 10:08 AM
>To: ofw at lists.openfabrics.org
>Subject: [ofw] [PATCH] OFED compat: convert return values to errno
>
>Convert libibverbs and librdmacm to use errno. Return values
>from winverbs and winsock are converted into errno values.
>
>To handle values undefined in the current WDK version of errno.h,
>add a new header file under the linux include directory with
>missing values.
>
>Signed-off-by: Sean Hefty <sean.hefty at intel.com>
>---
>This has been compiled tested only.
>
> trunk/inc/user/linux/_errno.h | 91 ++++++++++++
> trunk/tests/perftest/rdma_bw/SOURCES | 3
> trunk/tests/perftest/rdma_lat/SOURCES | 3
> trunk/tests/perftest/read_bw/SOURCES | 3
> trunk/tests/perftest/read_lat/SOURCES | 3
> trunk/tests/perftest/send_bw/SOURCES | 3
> trunk/tests/perftest/send_lat/SOURCES | 3
> trunk/tests/perftest/write_bw/SOURCES | 4 -
> trunk/tests/perftest/write_lat/SOURCES | 3
> trunk/ulp/dapl2/dapl/openib_cma/SOURCES | 2
> trunk/ulp/dapl2/dapl/openib_scm/SOURCES | 2
> trunk/ulp/dapl2/dapl/openib_ucm/SOURCES | 3
> trunk/ulp/libibumad/src/Sources | 3
> trunk/ulp/libibverbs/examples/asyncwatch/SOURCES | 3
> trunk/ulp/libibverbs/examples/rc_pingpong/SOURCES | 3
> trunk/ulp/libibverbs/examples/uc_pingpong/SOURCES | 3
> trunk/ulp/libibverbs/examples/ud_pingpong/SOURCES | 3
> trunk/ulp/libibverbs/include/infiniband/verbs.h | 17 +-
> trunk/ulp/libibverbs/src/ibv_exports.src | 1
> trunk/ulp/libibverbs/src/ibv_main.cpp | 2
> trunk/ulp/libibverbs/src/verbs.cpp | 66 ++++++--
> trunk/ulp/librdmacm/examples/cmatose/SOURCES | 3
> trunk/ulp/librdmacm/include/rdma/rdma_cma.h | 3
> trunk/ulp/librdmacm/src/Sources | 3
> trunk/ulp/librdmacm/src/cma.cpp | 165
>++++++++++++++-------
> trunk/ulp/librdmacm/src/cma_exports.src | 1
> 26 files changed, 293 insertions(+), 106 deletions(-)
> create mode 100755 trunk/inc/user/linux/_errno.h
>
>diff --git a/trunk/inc/user/linux/_errno.h
>b/trunk/inc/user/linux/_errno.h
>new file mode 100755
>index 0000000..c3e5959
>--- /dev/null
>+++ b/trunk/inc/user/linux/_errno.h
>@@ -0,0 +1,91 @@
>+/*
>+ * Copyright (c) 2009 Intel Corp, Inc. All rights reserved.
>+ *
>+ * This software is available to you under a choice of one of two
>+ * licenses. You may choose to be licensed under the terms of the GNU
>+ * General Public License (GPL) Version 2, available from the file
>+ * COPYING in the main directory of this source tree, or the
>+ * OpenIB.org BSD license below:
>+ *
>+ * Redistribution and use in source and binary forms, with or
>+ * without modification, are permitted provided that the following
>+ * conditions are met:
>+ *
>+ * - Redistributions of source code must retain the above
>+ * copyright notice, this list of conditions and the following
>+ * disclaimer.
>+ *
>+ * - Redistributions in binary form must reproduce the above
>+ * copyright notice, this list of conditions and the following
>+ * disclaimer in the documentation and/or other materials
>+ * provided with the distribution.
>+ *
>+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
>+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
>+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
>+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
>+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>+ * SOFTWARE.
>+ *
>+ */
>+
>+#ifndef __ERRNO_H_
>+#define __ERRNO_H_
>+
>+#include <errno.h>
>+
>+/* provide defines missing in older errno.h */
>+#ifndef EINVAL
>+#define EINVAL 22
>+#define ERANGE 34
>+#define EILSEQ 42
>+#define STRUNCATE 80
>+#endif
>+
>+#ifndef EADDRINUSE
>+#define EADDRINUSE 100
>+#define EADDRNOTAVAIL 101
>+#define EAFNOSUPPORT 102
>+#define EALREADY 103
>+#define EBADMSG 104
>+#define ECANCELED 105
>+#define ECONNABORTED 106
>+#define ECONNREFUSED 107
>+#define ECONNRESET 108
>+#define EDESTADDRREQ 109
>+#define EHOSTUNREACH 110
>+#define EIDRM 111
>+#define EINPROGRESS 112
>+#define EISCONN 113
>+#define ELOOP 114
>+#define EMSGSIZE 115
>+#define ENETDOWN 116
>+#define ENETRESET 117
>+#define ENETUNREACH 118
>+#define ENOBUFS 119
>+#define ENODATA 120
>+#define ENOLINK 121
>+#define ENOMSG 122
>+#define ENOPROTOOPT 123
>+#define ENOSR 124
>+#define ENOSTR 125
>+#define ENOTCONN 126
>+#define ENOTRECOVERABLE 127
>+#define ENOTSOCK 128
>+#define ENOTSUP 129
>+#define EOPNOTSUPP 130
>+#define EOTHER 131
>+#define EOVERFLOW 132
>+#define EOWNERDEAD 133
>+#define EPROTO 134
>+#define EPROTONOSUPPORT 135
>+#define EPROTOTYPE 136
>+#define ETIME 137
>+#define ETIMEDOUT 138
>+#define ETXTBSY 139
>+#define EWOULDBLOCK 140
>+#endif
>+
>+#endif /* __ERRNO_H_ */
>diff --git a/trunk/tests/perftest/rdma_bw/SOURCES
>b/trunk/tests/perftest/rdma_bw/SOURCES
>index f0bbf0e..1fedb20 100644
>--- a/trunk/tests/perftest/rdma_bw/SOURCES
>+++ b/trunk/tests/perftest/rdma_bw/SOURCES
>@@ -14,7 +14,8 @@ SOURCES = rdma_bw.rc rdma_bw.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
> ..\..\..\ulp\librdmacm\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/tests/perftest/rdma_lat/SOURCES
>b/trunk/tests/perftest/rdma_lat/SOURCES
>index c1e26ad..ab37d71 100644
>--- a/trunk/tests/perftest/rdma_lat/SOURCES
>+++ b/trunk/tests/perftest/rdma_lat/SOURCES
>@@ -14,7 +14,8 @@ SOURCES = rdma_lat.rc rdma_lat.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
> ..\..\..\ulp\librdmacm\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux;
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/tests/perftest/read_bw/SOURCES
>b/trunk/tests/perftest/read_bw/SOURCES
>index 0c28233..fbf699f 100644
>--- a/trunk/tests/perftest/read_bw/SOURCES
>+++ b/trunk/tests/perftest/read_bw/SOURCES
>@@ -13,7 +13,8 @@ USE_IOSTREAM = 1
> SOURCES = read_bw.rc read_bw.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux;
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/tests/perftest/read_lat/SOURCES
>b/trunk/tests/perftest/read_lat/SOURCES
>index 2aebbe0..c354d5a 100644
>--- a/trunk/tests/perftest/read_lat/SOURCES
>+++ b/trunk/tests/perftest/read_lat/SOURCES
>@@ -13,7 +13,8 @@ USE_IOSTREAM = 1
> SOURCES = read_lat.rc read_lat.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux;
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/tests/perftest/send_bw/SOURCES
>b/trunk/tests/perftest/send_bw/SOURCES
>index 907bcfb..382d17a 100644
>--- a/trunk/tests/perftest/send_bw/SOURCES
>+++ b/trunk/tests/perftest/send_bw/SOURCES
>@@ -13,7 +13,8 @@ USE_IOSTREAM = 1
> SOURCES = send_bw.rc send_bw.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux;
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/tests/perftest/send_lat/SOURCES
>b/trunk/tests/perftest/send_lat/SOURCES
>index e92f25b..92e2f54 100644
>--- a/trunk/tests/perftest/send_lat/SOURCES
>+++ b/trunk/tests/perftest/send_lat/SOURCES
>@@ -13,7 +13,8 @@ USE_IOSTREAM = 1
> SOURCES = send_lat.rc send_lat.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux;
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/tests/perftest/write_bw/SOURCES
>b/trunk/tests/perftest/write_bw/SOURCES
>index 4e7a5a1..8b7426d 100644
>--- a/trunk/tests/perftest/write_bw/SOURCES
>+++ b/trunk/tests/perftest/write_bw/SOURCES
>@@ -13,8 +13,8 @@ USE_IOSTREAM = 1
> SOURCES = write_bw.rc write_bw.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>-
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux;
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
> $(SDK_LIB_PATH)\advapi32.lib \
>diff --git a/trunk/tests/perftest/write_lat/SOURCES
>b/trunk/tests/perftest/write_lat/SOURCES
>index f869ff1..6e948e2 100644
>--- a/trunk/tests/perftest/write_lat/SOURCES
>+++ b/trunk/tests/perftest/write_lat/SOURCES
>@@ -13,7 +13,8 @@ USE_IOSTREAM = 1
> SOURCES = write_lat.rc write_lat.c ..\perftest.c
>
> INCLUDES = ..;..\..\..\ulp\libibverbs\include;\
>- ..\..\..\inc;..\..\..\inc\user;
>+ ..\..\..\inc;..\..\..\inc\user;\
>+ ..\..\..\inc\user\linux;
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/ulp/dapl2/dapl/openib_cma/SOURCES
>b/trunk/ulp/dapl2/dapl/openib_cma/SOURCES
>index d6b97a2..0c3764b 100644
>--- a/trunk/ulp/dapl2/dapl/openib_cma/SOURCES
>+++ b/trunk/ulp/dapl2/dapl/openib_cma/SOURCES
>@@ -25,7 +25,7 @@ SOURCES = \
> cm.c
>
> INCLUDES =
>..\include;..\openib_common;..\common;windows;..\..\dat\include;\
>- ..\..\dat\udat\windows;..\udapl\windows;\
>+
>..\..\dat\udat\windows;..\udapl\windows;..\..\..\..\inc\user\linux;\
>
>..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\libibverbs\include;\
> ..\..\..\librdmacm\include
>
>diff --git a/trunk/ulp/dapl2/dapl/openib_scm/SOURCES
>b/trunk/ulp/dapl2/dapl/openib_scm/SOURCES
>index 6e4ad30..2129e27 100644
>--- a/trunk/ulp/dapl2/dapl/openib_scm/SOURCES
>+++ b/trunk/ulp/dapl2/dapl/openib_scm/SOURCES
>@@ -25,7 +25,7 @@ SOURCES = \
> cm.c
>
> INCLUDES =
>..\include;..\openib_common\;..\common;windows;..\..\dat\include;\
>- ..\..\dat\udat\windows;..\udapl\windows;\
>+
>..\..\dat\udat\windows;..\udapl\windows;..\..\..\..\inc\user\linux;\
>
>..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\libibverbs\include
>
> DAPL_OPTS = -DEXPORT_DAPL_SYMBOLS -DDAT_EXTENSIONS -DSOCK_CM
>-DOPENIB -DCQ_WAIT_OBJECT
>diff --git a/trunk/ulp/dapl2/dapl/openib_ucm/SOURCES
>b/trunk/ulp/dapl2/dapl/openib_ucm/SOURCES
>index 7eecf48..a2b5dce 100644
>--- a/trunk/ulp/dapl2/dapl/openib_ucm/SOURCES
>+++ b/trunk/ulp/dapl2/dapl/openib_ucm/SOURCES
>@@ -21,7 +21,8 @@ SOURCES = udapl.rc ..\dapl_common_src.c
>..\dapl_udapl_src.c ..\openib_common.c \
>
> INCLUDES =
>..\include;..\openib_common\;..\common;windows;..\..\dat\include;\
> ..\..\dat\udat\windows;..\udapl\windows;\
>-
>..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\libibverbs\include
>+
>..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\libibverbs\include;\
>+ ..\..\..\..\inc\user\linux;
>
> DAPL_OPTS = -DEXPORT_DAPL_SYMBOLS -DDAT_EXTENSIONS -DOPENIB
>-DCQ_WAIT_OBJECT
>
>diff --git a/trunk/ulp/libibumad/src/Sources
>b/trunk/ulp/libibumad/src/Sources
>index 1d53cf2..971ca4c 100644
>--- a/trunk/ulp/libibumad/src/Sources
>+++ b/trunk/ulp/libibumad/src/Sources
>@@ -21,7 +21,8 @@ SOURCES = \
> ibum_main.cpp \
> umad.cpp
>
>-INCLUDES =
>..\include;..\..\libibverbs\include;..\..\..\inc;..\..\..\inc\user;
>+INCLUDES = ..\include;..\..\libibverbs\include;..\..\..\inc;\
>+ ..\..\..\inc\user;..\..\..\inc\user\linux;
>
> USER_C_FLAGS = $(USER_C_FLAGS) -DEXPORT_IBUM_SYMBOLS
>
>diff --git a/trunk/ulp/libibverbs/examples/asyncwatch/SOURCES
>b/trunk/ulp/libibverbs/examples/asyncwatch/SOURCES
>index f8c7c85..c62d745 100644
>--- a/trunk/ulp/libibverbs/examples/asyncwatch/SOURCES
>+++ b/trunk/ulp/libibverbs/examples/asyncwatch/SOURCES
>@@ -14,7 +14,8 @@ SOURCES = \
> asyncwatch.rc \
> asyncwatch.c
>
>-INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;
>+INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;\
>+ ..\..\..\..\inc\user\linux
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/ulp/libibverbs/examples/rc_pingpong/SOURCES
>b/trunk/ulp/libibverbs/examples/rc_pingpong/SOURCES
>index 8de70ed..e4d74d6 100644
>--- a/trunk/ulp/libibverbs/examples/rc_pingpong/SOURCES
>+++ b/trunk/ulp/libibverbs/examples/rc_pingpong/SOURCES
>@@ -14,7 +14,8 @@ SOURCES = \
> rc_pingpong.rc \
> rc_pingpong.c
>
>-INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;
>+INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;\
>+ ..\..\..\..\inc\user\linux
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/ulp/libibverbs/examples/uc_pingpong/SOURCES
>b/trunk/ulp/libibverbs/examples/uc_pingpong/SOURCES
>index c84ae84..463261f 100644
>--- a/trunk/ulp/libibverbs/examples/uc_pingpong/SOURCES
>+++ b/trunk/ulp/libibverbs/examples/uc_pingpong/SOURCES
>@@ -14,7 +14,8 @@ SOURCES = \
> uc_pingpong.rc \
> uc_pingpong.c
>
>-INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;
>+INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;\
>+ ..\..\..\..\inc\user\linux
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/ulp/libibverbs/examples/ud_pingpong/SOURCES
>b/trunk/ulp/libibverbs/examples/ud_pingpong/SOURCES
>index 5cdce28..b527794 100644
>--- a/trunk/ulp/libibverbs/examples/ud_pingpong/SOURCES
>+++ b/trunk/ulp/libibverbs/examples/ud_pingpong/SOURCES
>@@ -14,7 +14,8 @@ SOURCES = \
> ud_pingpong.rc \
> ud_pingpong.c
>
>-INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;
>+INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;\
>+ ..\..\..\..\inc\user\linux
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/ulp/libibverbs/include/infiniband/verbs.h
>b/trunk/ulp/libibverbs/include/infiniband/verbs.h
>index 780f938..25584e5 100644
>--- a/trunk/ulp/libibverbs/include/infiniband/verbs.h
>+++ b/trunk/ulp/libibverbs/include/infiniband/verbs.h
>@@ -37,7 +37,7 @@
>
> #include <windows.h>
> #include <rdma\winverbs.h>
>-#include <errno.h>
>+#include <_errno.h>
> #include <comp_channel.h>
>
> #ifdef __cplusplus
>@@ -53,18 +53,6 @@ typedef unsigned __int16 uint16_t;
> typedef unsigned __int32 uint32_t;
> typedef unsigned __int64 uint64_t;
>
>-#define EOVERFLOW WV_BUFFER_OVERFLOW
>-#define EISCONN WV_CONNECTION_ACTIVE
>-#define ECONNREFUSED WV_CONNECTION_REFUSED
>-#define ETIMEDOUT WV_TIMEOUT
>-#define ENETUNREACH WV_HOST_UNREACHABLE
>-#define EADDRINUSE WV_ADDRESS_ALREADY_EXISTS
>-#define EALREADY WV_IO_PENDING
>-#define EAFNOSUPPORT WV_INVALID_ADDRESS
>-#define EWOULDBLOCK WV_DEVICE_BUSY
>-
>-#define ECONNRESET WSAECONNRESET
>-
> union ibv_gid
> {
> uint8_t raw[16];
>@@ -1136,6 +1124,9 @@ int ibvw_get_windata(struct ibvw_windata
>*windata, int version);
> __declspec(dllexport)
> void ibvw_release_windata(struct ibvw_windata *windata, int version);
>
>+__declspec(dllexport)
>+int ibvw_wv_errno(HRESULT hr);
>+
> #ifdef __cplusplus
> }
> #endif
>diff --git a/trunk/ulp/libibverbs/src/ibv_exports.src
>b/trunk/ulp/libibverbs/src/ibv_exports.src
>index 67707a5..48fc8bc 100644
>--- a/trunk/ulp/libibverbs/src/ibv_exports.src
>+++ b/trunk/ulp/libibverbs/src/ibv_exports.src
>@@ -53,4 +53,5 @@ ibv_port_state_str
> ibv_event_type_str
> ibvw_get_windata
> ibvw_release_windata
>+ibvw_wv_errno
> #endif
>diff --git a/trunk/ulp/libibverbs/src/ibv_main.cpp
>b/trunk/ulp/libibverbs/src/ibv_main.cpp
>index 76216e0..c6f4b73 100644
>--- a/trunk/ulp/libibverbs/src/ibv_main.cpp
>+++ b/trunk/ulp/libibverbs/src/ibv_main.cpp
>@@ -28,6 +28,8 @@
> */
>
> #include <windows.h>
>+#include <rdma/wvstatus.h>
>+#include <_errno.h>
>
> extern CRITICAL_SECTION lock;
> HANDLE heap;
>diff --git a/trunk/ulp/libibverbs/src/verbs.cpp
>b/trunk/ulp/libibverbs/src/verbs.cpp
>index 849f8ae..8aa407d 100644
>--- a/trunk/ulp/libibverbs/src/verbs.cpp
>+++ b/trunk/ulp/libibverbs/src/verbs.cpp
>@@ -83,7 +83,7 @@ static int ibv_find_gid_index(struct
>ibv_context *context, uint8_t port_num,
> ret = ibv_query_gid(context, port_num, i++, &sgid);
> } while (!ret && memcmp(&sgid, gid, sizeof *gid));
>
>- return ret ? ret : i - 1;
>+ return ret ? -1 : i - 1;
> }
>
> static void ibv_convert_ah_attr(struct ibv_context *context,
>@@ -140,7 +140,7 @@ int ibv_query_device(struct ibv_context *context,
>
> hr = context->cmd_if->Query(&attr);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> sprintf(device_attr->fw_ver, "0x%I64x", attr.FwVersion);
>@@ -208,7 +208,7 @@ int ibv_query_port(struct ibv_context
>*context, uint8_t port_num,
>
> hr = context->cmd_if->QueryPort(port_num, &attr);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> port_attr->state = (enum ibv_port_state) attr.State;
>@@ -238,14 +238,14 @@ __declspec(dllexport)
> int ibv_query_gid(struct ibv_context *context, uint8_t port_num,
> int index, union ibv_gid *gid)
> {
>- return context->cmd_if->QueryGid(port_num, index,
>(WV_GID *) gid);
>+ return
>ibvw_wv_errno(context->cmd_if->QueryGid(port_num, index,
>(WV_GID *) gid));
> }
>
> __declspec(dllexport)
> int ibv_query_pkey(struct ibv_context *context, uint8_t port_num,
> int index, uint16_t *pkey)
> {
>- return context->cmd_if->QueryPkey(port_num, (UINT16)
>index, pkey);
>+ return
>ibvw_wv_errno(context->cmd_if->QueryPkey(port_num, (UINT16)
>index, pkey));
> }
>
> __declspec(dllexport)
>@@ -311,7 +311,7 @@ int ibv_dereg_mr(struct ibv_mr *mr)
> if (SUCCEEDED(hr)) {
> delete mr;
> }
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> __declspec(dllexport)
>@@ -386,7 +386,7 @@ int ibv_resize_cq(struct ibv_cq *cq, int cqe)
> if (SUCCEEDED(hr)) {
> cq->cqe = (int) entries;
> }
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> __declspec(dllexport)
>@@ -407,7 +407,7 @@ int ibv_req_notify_cq(struct ibv_cq *cq,
>int solicited_only)
> } else {
> hr = 0;
> }
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> __declspec(dllexport)
>@@ -506,7 +506,7 @@ int ibv_modify_srq(struct ibv_srq *srq,
> attr.srq_limit = srq_attr->srq_limit;
> }
>
>- return srq->handle->Modify(attr.max_wr, attr.srq_limit);
>+ return ibvw_wv_errno(srq->handle->Modify(attr.max_wr,
>attr.srq_limit));
> }
>
> __declspec(dllexport)
>@@ -522,7 +522,7 @@ int ibv_post_srq_recv(struct ibv_srq *srq,
>
> (WV_SGE *) (*bad_recv_wr)->sg_list,
>
> (*bad_recv_wr)->num_sge);
> }
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> __declspec(dllexport)
>@@ -533,7 +533,7 @@ int ibv_query_srq(struct ibv_srq *srq,
>struct ibv_srq_attr *srq_attr)
>
> hr = srq->handle->Query(&max_wr, &max_sge, &srq_limit);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> srq_attr->max_wr = (uint32_t) max_wr;
>@@ -626,7 +626,7 @@ int ibv_query_qp(struct ibv_qp *qp, struct
>ibv_qp_attr *attr,
>
> hr = qp->handle->Query(&wv_attr);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> /* ibv_qp exposes qp_num. Save qp_num from query. */
>@@ -725,7 +725,7 @@ int ibv_modify_qp(struct ibv_qp *qp,
>struct ibv_qp_attr *attr,
> qp->state = attr->qp_state;
> }
>
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> __declspec(dllexport)
>@@ -737,7 +737,7 @@ int ibv_post_send(struct ibv_qp *qp,
>struct ibv_send_wr *wr,
> struct ibv_ah *ah;
>
> if ((qp->qp_type == IBV_QPT_UD) && (wr->next != NULL))
>- return WV_NOT_SUPPORTED;
>+ return ibvw_wv_errno(WV_NOT_SUPPORTED);
>
> for (cur_wr = wr; cur_wr != NULL; cur_wr = cur_wr->next) {
> if (qp->qp_type == IBV_QPT_UD) {
>@@ -778,7 +778,7 @@ int ibv_post_send(struct ibv_qp *qp,
>struct ibv_send_wr *wr,
> }
> }
>
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> __declspec(dllexport)
>@@ -791,7 +791,7 @@ int ibv_post_recv(struct ibv_qp *qp,
>struct ibv_recv_wr *wr,
> hr = qp->handle->PostReceive((*bad_wr)->wr_id,
>(WV_SGE *) (*bad_wr)->sg_list,
>
> (*bad_wr)->num_sge);
> }
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> __declspec(dllexport)
>@@ -890,11 +890,41 @@ int ibv_destroy_ah(struct ibv_ah *ah)
> __declspec(dllexport)
> int ibv_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
>uint16_t lid)
> {
>- return qp->ud_handle->AttachMulticast((WV_GID *) gid,
>lid, NULL);
>+ return
>ibvw_wv_errno(qp->ud_handle->AttachMulticast((WV_GID *) gid,
>lid, NULL));
> }
>
> __declspec(dllexport)
> int ibv_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid,
>uint16_t lid)
> {
>- return qp->ud_handle->DetachMulticast((WV_GID *) gid,
>lid, NULL);
>+ return
>ibvw_wv_errno(qp->ud_handle->DetachMulticast((WV_GID *) gid,
>lid, NULL));
>+}
>+
>+__declspec(dllexport)
>+int ibvw_wv_errno(HRESULT hr)
>+{
>+ switch (hr) {
>+ case WV_SUCCESS: return 0;
>+ case WV_PENDING:
>_set_errno(EINPROGRESS); break;
>+ case WV_IO_PENDING:
>_set_errno(EINPROGRESS); break;
>+ case WV_TIMEOUT:
>_set_errno(ETIMEDOUT); break;
>+ case WV_BUFFER_OVERFLOW: _set_errno(EOVERFLOW); break;
>+ case WV_DEVICE_BUSY: _set_errno(EBUSY); break;
>+ case WV_ACCESS_VIOLATION: _set_errno(EACCES); break;
>+ case WV_INVALID_HANDLE: _set_errno(EINVAL); break;
>+ case WV_INVALID_PARAMETER: _set_errno(EINVAL); break;
>+ case WV_NO_MEMORY:
>_set_errno(ENOMEM); break;
>+ case WV_INSUFFICIENT_RESOURCES: _set_errno(ENOSPC); break;
>+ case WV_IO_TIMEOUT:
>_set_errno(ETIMEDOUT); break;
>+ case WV_NOT_SUPPORTED: _set_errno(ENOSYS); break;
>+ case WV_CANCELLED:
>_set_errno(ECANCELED); break;
>+ case WV_INVALID_ADDRESS:
>_set_errno(EADDRNOTAVAIL); break;
>+ case WV_ADDRESS_ALREADY_EXISTS: _set_errno(EADDRINUSE); break;
>+ case WV_CONNECTION_REFUSED: _set_errno(ECONNREFUSED); break;
>+ case WV_CONNECTION_INVALID: _set_errno(ENOTCONN); break;
>+ case WV_CONNECTION_ACTIVE: _set_errno(EISCONN); break;
>+ case WV_HOST_UNREACHABLE: _set_errno(ENETUNREACH); break;
>+ case WV_CONNECTION_ABORTED: _set_errno(ECONNABORTED); break;
>+ case WV_UNKNOWN_ERROR: _set_errno(EIO); break;
>+ }
>+ return -1;
> }
>diff --git a/trunk/ulp/librdmacm/examples/cmatose/SOURCES
>b/trunk/ulp/librdmacm/examples/cmatose/SOURCES
>index cfe59ff..396635f 100644
>--- a/trunk/ulp/librdmacm/examples/cmatose/SOURCES
>+++ b/trunk/ulp/librdmacm/examples/cmatose/SOURCES
>@@ -12,7 +12,8 @@ USE_IOSTREAM = 1
>
> SOURCES = cmatose.c
>
>-INCLUDES =
>..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\
libibverbs\include;
>+INCLUDES = ..;..\..\include;..\..\..\..\inc;..\..\..\..\inc\user;\
>+
>..\..\..\libibverbs\include;..\..\..\..\inc\user\linux;
>
> TARGETLIBS = \
> $(SDK_LIB_PATH)\kernel32.lib \
>diff --git a/trunk/ulp/librdmacm/include/rdma/rdma_cma.h
>b/trunk/ulp/librdmacm/include/rdma/rdma_cma.h
>index 7b9a6e0..0fd481c 100644
>--- a/trunk/ulp/librdmacm/include/rdma/rdma_cma.h
>+++ b/trunk/ulp/librdmacm/include/rdma/rdma_cma.h
>@@ -626,6 +626,9 @@ int rdma_set_option(struct rdma_cm_id *id,
>int level, int optname,
> __declspec(dllexport)
> int rdma_migrate_id(struct rdma_cm_id *id, struct
>rdma_event_channel *channel);
>
>+__declspec(dllexport)
>+int rdmaw_wsa_errno(int wsa_err);
>+
> #ifdef __cplusplus
> }
> #endif
>diff --git a/trunk/ulp/librdmacm/src/Sources
>b/trunk/ulp/librdmacm/src/Sources
>index 3a77169..6a8418a 100644
>--- a/trunk/ulp/librdmacm/src/Sources
>+++ b/trunk/ulp/librdmacm/src/Sources
>@@ -21,7 +21,8 @@ SOURCES = \
> cma_main.cpp \
> cma.cpp
>
>-INCLUDES =
>..\include;..\..\..\inc;..\..\..\inc\user;..\..\libibverbs\include
>+INCLUDES =
>..\include;..\..\..\inc;..\..\..\inc\user;..\..\libibverbs\include;\
>+ ..\..\..\inc\user\linux;
>
> USER_C_FLAGS = $(USER_C_FLAGS) -DEXPORT_CMA_SYMBOLS
>
>diff --git a/trunk/ulp/librdmacm/src/cma.cpp
>b/trunk/ulp/librdmacm/src/cma.cpp
>index 40e7411..53bf25f 100644
>--- a/trunk/ulp/librdmacm/src/cma.cpp
>+++ b/trunk/ulp/librdmacm/src/cma.cpp
>@@ -244,15 +244,16 @@ int rdma_create_id(struct
>rdma_event_channel *channel,
> {
> struct cma_id_private *id_priv;
> HRESULT hr;
>+ int ret;
>
>- hr = ucma_acquire();
>- if (hr) {
>- return hr;
>+ ret = ucma_acquire();
>+ if (ret) {
>+ return ret;
> }
>
> id_priv = new struct cma_id_private;
> if (id_priv == NULL) {
>- hr = ENOMEM;
>+ ret = ENOMEM;
> goto err1;
> }
>
>@@ -269,6 +270,7 @@ int rdma_create_id(struct
>rdma_event_channel *channel,
> hr =
>windata.prov->CreateDatagramEndpoint(&id_priv->id.ep.datagram);
> }
> if (FAILED(hr)) {
>+ ret = ibvw_wv_errno(hr);
> goto err2;
> }
>
>@@ -364,11 +366,12 @@ static int ucma_query_connect(struct
>rdma_cm_id *id, struct rdma_conn_param *par
> struct cma_id_private *id_priv;
> WV_CONNECT_ATTRIBUTES attr;
> HRESULT hr;
>+ int ret;
>
> id_priv = CONTAINING_RECORD(id, struct cma_id_private, id);
> hr = id->ep.connect->Query(&attr);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> RtlCopyMemory(&id->route.addr.src_addr, &attr.LocalAddress,
>@@ -388,9 +391,9 @@ static int ucma_query_connect(struct
>rdma_cm_id *id, struct rdma_conn_param *par
> }
>
> if (id_priv->cma_dev == NULL && attr.Device.DeviceGuid != 0) {
>- hr = ucma_get_device(id_priv, attr.Device.DeviceGuid);
>- if (FAILED(hr)) {
>- return hr;
>+ ret = ucma_get_device(id_priv, attr.Device.DeviceGuid);
>+ if (ret) {
>+ return ret;
> }
>
> id->route.addr.addr.ibaddr.pkey = attr.Device.Pkey;
>@@ -405,6 +408,7 @@ static int ucma_query_datagram(struct
>rdma_cm_id *id, struct rdma_ud_param *para
> struct cma_id_private *id_priv;
> WV_DATAGRAM_ATTRIBUTES attr;
> HRESULT hr;
>+ int ret;
>
> id_priv = CONTAINING_RECORD(id, struct cma_id_private, id);
> hr = id->ep.datagram->Query(&attr);
>@@ -427,9 +431,9 @@ static int ucma_query_datagram(struct
>rdma_cm_id *id, struct rdma_ud_param *para
> }
>
> if (id_priv->cma_dev == NULL && attr.Device.DeviceGuid != 0) {
>- hr = ucma_get_device(id_priv, attr.Device.DeviceGuid);
>- if (FAILED(hr))
>- return hr;
>+ ret = ucma_get_device(id_priv, attr.Device.DeviceGuid);
>+ if (ret)
>+ return ret;
> id->route.addr.addr.ibaddr.pkey = attr.Device.Pkey;
> id_priv->id.port_num = attr.Device.PortNumber;
> }
>@@ -441,24 +445,29 @@ int rdma_bind_addr(struct rdma_cm_id
>*id, struct sockaddr *addr)
> {
> struct cma_id_private *id_priv;
> HRESULT hr;
>+ int ret;
>
> if (id->ps == RDMA_PS_TCP) {
> hr = id->ep.connect->BindAddress(addr);
> if (SUCCEEDED(hr)) {
>- hr = ucma_query_connect(id, NULL);
>+ ret = ucma_query_connect(id, NULL);
>+ } else {
>+ ret = ibvw_wv_errno(hr);
> }
> } else {
> hr = id->ep.datagram->BindAddress(addr);
> if (SUCCEEDED(hr)) {
>- hr = ucma_query_datagram(id, NULL);
>+ ret = ucma_query_datagram(id, NULL);
>+ } else {
>+ ret = ibvw_wv_errno(hr);
> }
> }
>
>- if (SUCCEEDED(hr)) {
>+ if (!ret) {
> id_priv = CONTAINING_RECORD(id, struct
>cma_id_private, id);
> id_priv->state = cma_addr_bind;
> }
>- return hr;
>+ return ret;
> }
>
> __declspec(dllexport)
>@@ -470,6 +479,7 @@ int rdma_resolve_addr(struct rdma_cm_id
>*id, struct sockaddr *src_addr,
> SOCKET s;
> DWORD size;
> HRESULT hr;
>+ int ret;
>
> id_priv = CONTAINING_RECORD(id, struct cma_id_private, id);
> if (id_priv->state == cma_idle) {
>@@ -480,21 +490,21 @@ int rdma_resolve_addr(struct rdma_cm_id
>*id, struct sockaddr *src_addr,
> s = socket(dst_addr->sa_family,
>SOCK_DGRAM, IPPROTO_UDP);
> }
> if (s == INVALID_SOCKET) {
>- return WSAGetLastError();
>+ return
>rdmaw_wsa_errno(WSAGetLastError());
> }
>
> hr = WSAIoctl(s,
>SIO_ROUTING_INTERFACE_QUERY, dst_addr, ucma_addrlen(dst_addr),
> &addr, sizeof
>addr, &size, NULL, NULL);
> closesocket(s);
> if (FAILED(hr)) {
>- return WSAGetLastError();
>+ return
>rdmaw_wsa_errno(WSAGetLastError());
> }
> src_addr = &addr.Sa;
> }
>
>- hr = rdma_bind_addr(id, src_addr);
>- if (FAILED(hr)) {
>- return hr;
>+ ret = rdma_bind_addr(id, src_addr);
>+ if (ret) {
>+ return ret;
> }
> }
>
>@@ -516,14 +526,14 @@ int rdma_resolve_route(struct rdma_cm_id
>*id, int timeout_ms)
> hr = IBAT::ResolvePath(&id->route.addr.src_addr,
>&id->route.addr.dst_addr,
> &path, timeout_ms);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> hr = (id->ps == RDMA_PS_TCP) ?
> id->ep.connect->Modify(WV_EP_OPTION_ROUTE,
>&path, sizeof path) :
> id->ep.datagram->Modify(WV_EP_OPTION_ROUTE,
>&path, sizeof path);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> id_priv = CONTAINING_RECORD(id, struct cma_id_private, id);
>@@ -547,7 +557,7 @@ static int ucma_modify_qp_init(struct
>cma_id_private *id_priv, struct ibv_qp *qp
>
> id_priv->id.route.addr.addr.ibaddr.pkey,
>
> &index);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> qp_attr.pkey_index = index;
>@@ -638,11 +648,12 @@ int rdma_connect(struct rdma_cm_id *id,
>struct rdma_conn_param *conn_param)
> struct cma_id_private *id_priv;
> WV_CONNECT_PARAM attr;
> HRESULT hr;
>+ int ret;
>
> id_priv = CONTAINING_RECORD(id, struct cma_id_private, id);
>- hr = ucma_valid_param(id_priv, conn_param);
>- if (FAILED(hr)) {
>- return hr;
>+ ret = ucma_valid_param(id_priv, conn_param);
>+ if (ret) {
>+ return ret;
> }
>
> RtlZeroMemory(&attr, sizeof attr);
>@@ -663,7 +674,7 @@ int rdma_connect(struct rdma_cm_id *id,
>struct rdma_conn_param *conn_param)
> id_priv->refcnt--;
> id->comp_entry.Busy = 0;
> id_priv->state = cma_route_resolve;
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> return 0;
>@@ -673,17 +684,18 @@ static int ucma_get_request(struct
>cma_id_private *listen, int index)
> {
> struct cma_id_private *id_priv = NULL;
> HRESULT hr;
>+ int ret;
>
> EnterCriticalSection(&lock);
> if (listen->state != cma_listening) {
>- hr = WV_INVALID_PARAMETER;
>+ ret = ibvw_wv_errno(WV_INVALID_PARAMETER);
> goto err1;
> }
>
> InterlockedIncrement(&listen->refcnt);
>- hr = rdma_create_id(listen->id.channel,
>&listen->req_list[index],
>+ ret = rdma_create_id(listen->id.channel,
>&listen->req_list[index],
> listen, listen->id.ps);
>- if (FAILED(hr)) {
>+ if (ret) {
> goto err2;
> }
>
>@@ -701,6 +713,7 @@ static int ucma_get_request(struct
>cma_id_private *listen, int index)
>
> &id_priv->id.comp_entry.Overlap);
> }
> if (FAILED(hr) && hr != WV_IO_PENDING) {
>+ ret = ibvw_wv_errno(hr);
> id_priv->id.comp_entry.Busy = 0;
> id_priv->refcnt--;
> goto err2;
>@@ -716,7 +729,7 @@ err1:
> if (id_priv != NULL) {
> rdma_destroy_id(&id_priv->id);
> }
>- return hr;
>+ return ret;
> }
>
> __declspec(dllexport)
>@@ -724,7 +737,7 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
> {
> struct cma_id_private *id_priv, *req_id;
> HRESULT hr;
>- int i;
>+ int i, ret;
>
> if (backlog <= 0) {
> backlog = CMA_DEFAULT_BACKLOG;
>@@ -743,13 +756,13 @@ int rdma_listen(struct rdma_cm_id *id,
>int backlog)
> hr = (id->ps == RDMA_PS_TCP) ?
> id->ep.connect->Listen(backlog) :
>id->ep.datagram->Listen(backlog);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> for (i = 0; i < backlog; i++) {
>- hr = ucma_get_request(id_priv, i);
>- if (FAILED(hr)) {
>- return hr;
>+ ret = ucma_get_request(id_priv, i);
>+ if (ret) {
>+ return ret;
> }
> }
>
>@@ -762,11 +775,12 @@ int rdma_accept(struct rdma_cm_id *id,
>struct rdma_conn_param *conn_param)
> struct cma_id_private *id_priv;
> WV_CONNECT_PARAM attr;
> HRESULT hr;
>+ int ret;
>
> id_priv = CONTAINING_RECORD(id, struct cma_id_private, id);
>- hr = ucma_valid_param(id_priv, conn_param);
>- if (FAILED(hr)) {
>- return hr;
>+ ret = ucma_valid_param(id_priv, conn_param);
>+ if (ret) {
>+ return ret;
> }
>
> RtlZeroMemory(&attr, sizeof attr);
>@@ -787,7 +801,7 @@ int rdma_accept(struct rdma_cm_id *id,
>struct rdma_conn_param *conn_param)
> id_priv->refcnt--;
> id->comp_entry.Busy = 0;
> id_priv->state = cma_disconnected;
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> return 0;
>@@ -804,7 +818,7 @@ int rdma_reject(struct rdma_cm_id *id,
>const void *private_data,
> id_priv->state = cma_disconnected;
> hr = id->ep.connect->Reject(private_data, private_data_len);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
> return 0;
> }
>@@ -829,7 +843,7 @@ int rdma_disconnect(struct rdma_cm_id *id)
> }
> hr = id->ep.connect->Disconnect(NULL);
> if (FAILED(hr)) {
>- return hr;
>+ return ibvw_wv_errno(hr);
> }
>
> return 0;
>@@ -861,12 +875,12 @@ static int ucma_process_conn_req(struct
>cma_event *event)
>
> ucma_get_request(listen, id_priv->index);
>
>- if (SUCCEEDED(event->event.status)) {
>+ if (!event->event.status) {
> event->event.status = ucma_query_connect(&id_priv->id,
>
> &event->event.param.conn);
> }
>
>- if (SUCCEEDED(event->event.status)) {
>+ if (!event->event.status) {
> event->event.event = RDMA_CM_EVENT_CONNECT_REQUEST;
> id_priv->state = cma_passive_connect;
> event->event.listen_id = &listen->id;
>@@ -885,7 +899,7 @@ static int ucma_process_conn_resp(struct
>cma_event *event)
> WV_CONNECT_PARAM attr;
> HRESULT hr;
>
>- if (FAILED(event->event.status)) {
>+ if (event->event.status) {
> goto err;
> }
>
>@@ -902,7 +916,7 @@ static int ucma_process_conn_resp(struct
>cma_event *event)
> goto err;
> }
>
>- return WV_IO_PENDING;
>+ return EINPROGRESS;
>
> err:
> event->event.event = (event->event.status == WV_REJECTED) ?
>@@ -916,12 +930,12 @@ static void
>ucma_process_establish(struct cma_event *event)
> {
> struct cma_id_private *id_priv = event->id_priv;
>
>- if (SUCCEEDED(event->event.status)) {
>+ if (!event->event.status) {
> event->event.status = ucma_query_connect(&id_priv->id,
>
> &event->event.param.conn);
> }
>
>- if (SUCCEEDED(event->event.status)) {
>+ if (!event->event.status) {
> event->event.event = RDMA_CM_EVENT_ESTABLISHED;
>
> id_priv->state = cma_connected;
>@@ -938,7 +952,7 @@ static int ucma_process_event(struct
>cma_event *event)
> {
> struct cma_id_private *listen, *id_priv;
> WV_CONNECT_ATTRIBUTES attr;
>- HRESULT hr = 0;
>+ int ret = 0;
>
> id_priv = event->id_priv;
>
>@@ -948,7 +962,7 @@ static int ucma_process_event(struct
>cma_event *event)
> listen = (struct cma_id_private *) id_priv->id.context;
> if (listen->state != cma_listening) {
> InterlockedDecrement(&id_priv->refcnt);
>- hr = WV_CANCELLED;
>+ ret = ECANCELED;
> break;
> }
>
>@@ -962,7 +976,7 @@ static int ucma_process_event(struct
>cma_event *event)
> event->event.event = RDMA_CM_EVENT_ROUTE_RESOLVED;
> break;
> case cma_active_connect:
>- hr = ucma_process_conn_resp(event);
>+ ret = ucma_process_conn_resp(event);
> break;
> case cma_accepting:
> ucma_process_establish(event);
>@@ -977,11 +991,11 @@ static int ucma_process_event(struct
>cma_event *event)
> break;
> default:
> InterlockedDecrement(&id_priv->refcnt);
>- hr = WV_CANCELLED;
>+ ret = ECANCELED;
> }
> LeaveCriticalSection(&lock);
>
>- return hr;
>+ return ret;
> }
>
> __declspec(dllexport)
>@@ -1028,13 +1042,15 @@ __declspec(dllexport)
> int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
> void *context)
> {
>- return WV_NOT_SUPPORTED;
>+ _set_errno(ENOSYS);
>+ return -1;
> }
>
> __declspec(dllexport)
> int rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)
> {
>- return WV_NOT_SUPPORTED;
>+ _set_errno(ENOSYS);
>+ return -1;
> }
>
> __declspec(dllexport)
>@@ -1082,7 +1098,8 @@ __declspec(dllexport)
> int rdma_set_option(struct rdma_cm_id *id, int level, int optname,
> void *optval, size_t optlen)
> {
>- return WV_NOT_SUPPORTED;
>+ _set_errno(ENOSYS);
>+ return -1;
> }
>
> __declspec(dllexport)
>@@ -1091,3 +1108,39 @@ int rdma_migrate_id(struct rdma_cm_id
>*id, struct rdma_event_channel *channel)
> id->channel = channel;
> return 0;
> }
>+
>+__declspec(dllexport)
>+int rdmaw_wsa_errno(int wsa_err)
>+{
>+ switch (wsa_err) {
>+ case 0: return 0;
>+ case WSAEWOULDBLOCK: _set_errno(EWOULDBLOCK); break;
>+ case WSAEINPROGRESS: _set_errno(EINPROGRESS); break;
>+ case WSAEALREADY: _set_errno(EALREADY); break;
>+ case WSAENOTSOCK: _set_errno(ENOTSOCK); break;
>+ case WSAEDESTADDRREQ: _set_errno(EDESTADDRREQ); break;
>+ case WSAEMSGSIZE: _set_errno(EMSGSIZE); break;
>+ case WSAEPROTOTYPE: _set_errno(EPROTOTYPE); break;
>+ case WSAENOPROTOOPT: _set_errno(ENOPROTOOPT); break;
>+ case WSAEPROTONOSUPPORT:_set_errno(EPROTONOSUPPORT); break;
>+ case WSAEOPNOTSUPP: _set_errno(EOPNOTSUPP); break;
>+ case WSAEAFNOSUPPORT: _set_errno(EAFNOSUPPORT); break;
>+ case WSAEADDRINUSE: _set_errno(EADDRINUSE); break;
>+ case WSAEADDRNOTAVAIL: _set_errno(EADDRNOTAVAIL); break;
>+ case WSAENETDOWN: _set_errno(ENETDOWN); break;
>+ case WSAENETUNREACH: _set_errno(ENETUNREACH); break;
>+ case WSAENETRESET: _set_errno(ENETRESET); break;
>+ case WSAECONNABORTED: _set_errno(ECONNABORTED); break;
>+ case WSAECONNRESET: _set_errno(ECONNRESET); break;
>+ case WSAENOBUFS: _set_errno(ENOBUFS); break;
>+ case WSAEISCONN: _set_errno(EISCONN); break;
>+ case WSAENOTCONN: _set_errno(ENOTCONN); break;
>+ case WSAETIMEDOUT: _set_errno(ETIMEDOUT); break;
>+ case WSAECONNREFUSED: _set_errno(ECONNREFUSED); break;
>+ case WSAELOOP: _set_errno(ELOOP); break;
>+ case WSAENAMETOOLONG: _set_errno(ENAMETOOLONG); break;
>+ case WSAEHOSTUNREACH: _set_errno(EHOSTUNREACH); break;
>+ case WSAENOTEMPTY: _set_errno(ENOTEMPTY); break;
>+ }
>+ return -1;
>+}
>diff --git a/trunk/ulp/librdmacm/src/cma_exports.src
>b/trunk/ulp/librdmacm/src/cma_exports.src
>index 853173b..a8fe8f3 100644
>--- a/trunk/ulp/librdmacm/src/cma_exports.src
>+++ b/trunk/ulp/librdmacm/src/cma_exports.src
>@@ -30,4 +30,5 @@ rdma_free_devices
> rdma_event_str
> rdma_set_option
> rdma_migrate_id
>+rdmaw_wsa_errno
> #endif
>
>
>_______________________________________________
>ofw mailing list
>ofw at lists.openfabrics.org
>http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
>
More information about the ofw
mailing list