5740dffaefa15cedae0516007b35665ed9717cf4
[mirror/winof/.git] / core / al / ib_statustext.c
1 /*\r
2  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.\r
3  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
4  *\r
5  * This software is available to you under the OpenIB.org BSD license\r
6  * below:\r
7  *\r
8  *     Redistribution and use in source and binary forms, with or\r
9  *     without modification, are permitted provided that the following\r
10  *     conditions are met:\r
11  *\r
12  *      - Redistributions of source code must retain the above\r
13  *        copyright notice, this list of conditions and the following\r
14  *        disclaimer.\r
15  *\r
16  *      - Redistributions in binary form must reproduce the above\r
17  *        copyright notice, this list of conditions and the following\r
18  *        disclaimer in the documentation and/or other materials\r
19  *        provided with the distribution.\r
20  *\r
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
24  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
25  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
26  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
27  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
28  * SOFTWARE.\r
29  *\r
30  * $Id$\r
31  */\r
32 \r
33 \r
34 /*\r
35  * Abstract:\r
36  *      Defines string to decode ib_api_status_t return values.\r
37  *\r
38  * Environment:\r
39  *      All\r
40  */\r
41 \r
42 \r
43 #include <iba/ib_types.h>\r
44 \r
45 \r
46 /* ib_api_status_t values above converted to text for easier printing. */\r
47 static const char* const __ib_error_str[] =\r
48 {\r
49         "IB_SUCCESS",\r
50         "IB_INSUFFICIENT_RESOURCES",\r
51         "IB_INSUFFICIENT_MEMORY",\r
52         "IB_INVALID_PARAMETER",\r
53         "IB_INVALID_SETTING",\r
54         "IB_NOT_FOUND",\r
55         "IB_TIMEOUT",\r
56         "IB_CANCELED",\r
57         "IB_INTERRUPTED",\r
58         "IB_INVALID_PERMISSION",\r
59         "IB_UNSUPPORTED",\r
60         "IB_OVERFLOW",\r
61         "IB_MAX_MCAST_QPS_REACHED",\r
62         "IB_INVALID_QP_STATE",\r
63         "IB_INVALID_APM_STATE",\r
64         "IB_INVALID_PORT_STATE",\r
65         "IB_INVALID_STATE",\r
66         "IB_RESOURCE_BUSY",\r
67         "IB_INVALID_PKEY",\r
68         "IB_INVALID_LKEY",\r
69         "IB_INVALID_RKEY",\r
70         "IB_INVALID_MAX_WRS",\r
71         "IB_INVALID_MAX_SGE",\r
72         "IB_INVALID_CQ_SIZE",\r
73         "IB_INVALID_SRQ_SIZE",\r
74         "IB_INVALID_SERVICE_TYPE",\r
75         "IB_INVALID_GID",\r
76         "IB_INVALID_LID",\r
77         "IB_INVALID_GUID",\r
78         "IB_INVALID_CA_HANDLE",\r
79         "IB_INVALID_AV_HANDLE",\r
80         "IB_INVALID_CQ_HANDLE",\r
81         "IB_INVALID_QP_HANDLE",\r
82         "IB_INVALID_SRQ_HANDLE",\r
83         "IB_INVALID_PD_HANDLE",\r
84         "IB_INVALID_MR_HANDLE",\r
85         "IB_INVALID_FMR_HANDLE",\r
86         "IB_INVALID_MW_HANDLE",\r
87         "IB_INVALID_MCAST_HANDLE",\r
88         "IB_INVALID_CALLBACK",\r
89         "IB_INVALID_AL_HANDLE",\r
90         "IB_INVALID_HANDLE",\r
91         "IB_ERROR",\r
92         "IB_REMOTE_ERROR",\r
93         "IB_VERBS_PROCESSING_DONE",\r
94         "IB_INVALID_WR_TYPE",\r
95         "IB_QP_IN_TIMEWAIT",\r
96         "IB_EE_IN_TIMEWAIT",\r
97         "IB_INVALID_PORT",\r
98         "IB_NOT_DONE",\r
99         "IB_INVALID_INDEX",\r
100         "IB_NO_MATCH",\r
101         "IB_PENDING",\r
102         "IB_UNKNOWN_ERROR"\r
103 };\r
104 \r
105 \r
106 const char*\r
107 ib_get_err_str(\r
108         IN                              ib_api_status_t                         status )\r
109 {\r
110         if( status > IB_UNKNOWN_ERROR )\r
111                 status = IB_UNKNOWN_ERROR;\r
112         return( __ib_error_str[status] );\r
113 }\r
114 \r
115 \r
116 /* ib_async_event_t values above converted to text for easier printing. */\r
117 static const char* const __ib_async_event_str[] =\r
118 {\r
119         "IB_AE_DUMMY",          /*place holder*/\r
120         "IB_AE_SQ_ERROR",\r
121         "IB_AE_SQ_DRAINED",\r
122         "IB_AE_RQ_ERROR",\r
123         "IB_AE_CQ_ERROR",\r
124         "IB_AE_QP_FATAL",\r
125         "IB_AE_QP_COMM",\r
126         "IB_AE_QP_APM",\r
127         "IB_AE_LOCAL_FATAL",\r
128         "IB_AE_PKEY_TRAP",\r
129         "IB_AE_QKEY_TRAP",\r
130         "IB_AE_MKEY_TRAP",\r
131         "IB_AE_PORT_TRAP",\r
132         "IB_AE_SYSIMG_GUID_TRAP",\r
133         "IB_AE_BUF_OVERRUN",\r
134         "IB_AE_LINK_INTEGRITY",\r
135         "IB_AE_FLOW_CTRL_ERROR",\r
136         "IB_AE_BKEY_TRAP",\r
137         "IB_AE_QP_APM_ERROR",\r
138         "IB_AE_WQ_REQ_ERROR",\r
139         "IB_AE_WQ_ACCESS_ERROR",\r
140         "IB_AE_PORT_ACTIVE",            /* ACTIVE STATE */\r
141         "IB_AE_PORT_DOWN",                      /* INIT", ARMED", DOWN */\r
142         "IB_AE_UNKNOWN"\r
143 };\r
144 \r
145 \r
146 const char*\r
147 ib_get_async_event_str(\r
148         IN                              ib_async_event_t                        event )\r
149 {\r
150         if( event > IB_AE_UNKNOWN )\r
151                 event = IB_AE_UNKNOWN;\r
152         return( __ib_async_event_str[event] );\r
153 }\r
154 \r
155 \r
156 static const char* const __ib_wc_status_str[] =\r
157 {\r
158         "IB_WCS_SUCCESS",\r
159         "IB_WCS_LOCAL_LEN_ERR",\r
160         "IB_WCS_LOCAL_OP_ERR",\r
161         "IB_WCS_LOCAL_PROTECTION_ERR",\r
162         "IB_WCS_WR_FLUSHED_ERR",\r
163         "IB_WCS_MEM_WINDOW_BIND_ERR",\r
164         "IB_WCS_REM_ACCESS_ERR",\r
165         "IB_WCS_REM_OP_ERR",\r
166         "IB_WCS_RNR_RETRY_ERR",\r
167         "IB_WCS_TIMEOUT_RETRY_ERR",\r
168         "IB_WCS_REM_INVALID_REQ_ERR",\r
169         "IB_WCS_BAD_RESP_ERR",\r
170         "IB_WCS_LOCAL_ACCESS_ERR",\r
171         "IB_WCS_GENERAL_ERR",\r
172         "IB_WCS_UNMATCHED_RESPONSE",                    /* InfiniBand Access Layer */\r
173         "IB_WCS_CANCELED",                                              /* InfiniBand Access Layer */\r
174         "IB_WCS_UNKNOWN"\r
175 };\r
176 \r
177 \r
178 const char*\r
179 ib_get_wc_status_str(\r
180         IN                              ib_wc_status_t                          wc_status )\r
181 {\r
182         if( wc_status > IB_WCS_UNKNOWN )\r
183                 wc_status = IB_WCS_UNKNOWN;\r
184         return( __ib_wc_status_str[wc_status] );\r
185 }\r
186 \r
187 \r
188 static const char* const __ib_wc_type_str[] =\r
189 {\r
190         "IB_WC_SEND",\r
191         "IB_WC_RDMA_WRITE",\r
192         "IB_WC_RECV",\r
193         "IB_WC_RDMA_READ",\r
194         "IB_WC_MW_BIND",\r
195         "IB_WC_FETCH_ADD",\r
196         "IB_WC_COMPARE_SWAP",\r
197         "IB_WC_RECV_RDMA_WRITE"\r
198         "IB_WC_UNKNOWN"\r
199 };\r
200 \r
201 \r
202 const char*\r
203 ib_get_wc_type_str(\r
204         IN                              ib_wc_type_t                            wc_type )\r
205 {\r
206         if( wc_type > IB_WC_UNKNOWN )\r
207                 wc_type = IB_WC_UNKNOWN;\r
208         return( __ib_wc_type_str[wc_type] );\r
209 }\r
210 \r
211 \r
212 static const char* const __ib_wr_type_str[] =\r
213 {\r
214         "WR_DUMMY",             /*place holder*/\r
215         "WR_SEND",\r
216         "WR_RDMA_WRITE",\r
217         "WR_RDMA_READ",\r
218         "WR_COMPARE_SWAP",\r
219         "WR_FETCH_ADD",\r
220         "WR_UNKNOWN"\r
221 };\r
222 \r
223 \r
224 const char* \r
225 ib_get_wr_type_str(\r
226         IN                              uint8_t                                         wr_type )\r
227 {\r
228         if( wr_type > WR_UNKNOWN )\r
229                 wr_type = WR_UNKNOWN;\r
230         return( __ib_wr_type_str[wr_type] );\r
231 }\r
232 \r
233 static const char* const __ib_qp_type_str[] =\r
234 {\r
235         "IB_QPT_RELIABLE_CONN"\r
236         "IB_QPT_UNRELIABLE_CONN",\r
237         "IB_QPT_UNKNOWN",\r
238         "IB_QPT_UNRELIABLE_DGRM",\r
239         "IB_QPT_QP0",\r
240         "IB_QPT_QP1",\r
241         "IB_QPT_RAW_IPV6",\r
242         "IB_QPT_RAW_ETHER",\r
243         "IB_QPT_MAD",\r
244         "IB_QPT_QP0_ALIAS",\r
245         "IB_QPT_QP1_ALIAS",\r
246         "IB_QPT_UNKNOWN"\r
247
248 };\r
249 \r
250 \r
251 const char* \r
252 ib_get_qp_type_str(\r
253         IN                              uint8_t                                         qp_type )\r
254 {\r
255         if( qp_type > IB_QPT_UNKNOWN )\r
256                 qp_type = IB_QPT_UNKNOWN;\r
257         return( __ib_qp_type_str[qp_type] );\r
258 }\r
259 \r
260 \r