[IBAL] Add documentation for ib_grh_t, fix wr_type string array to
[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_SERVICE_TYPE",\r
74         "IB_INVALID_GID",\r
75         "IB_INVALID_LID",\r
76         "IB_INVALID_GUID",\r
77         "IB_INVALID_CA_HANDLE",\r
78         "IB_INVALID_AV_HANDLE",\r
79         "IB_INVALID_CQ_HANDLE",\r
80         "IB_INVALID_QP_HANDLE",\r
81         "IB_INVALID_PD_HANDLE",\r
82         "IB_INVALID_MR_HANDLE",\r
83         "IB_INVALID_MW_HANDLE",\r
84         "IB_INVALID_MCAST_HANDLE",\r
85         "IB_INVALID_CALLBACK",\r
86         "IB_INVALID_AL_HANDLE",\r
87         "IB_INVALID_HANDLE",\r
88         "IB_ERROR",\r
89         "IB_REMOTE_ERROR",                                              /* Infiniband Access Layer */\r
90         "IB_VERBS_PROCESSING_DONE",\r
91         "IB_INVALID_WR_TYPE",\r
92         "IB_QP_IN_TIMEWAIT",\r
93         "IB_EE_IN_TIMEWAIT",\r
94         "IB_INVALID_PORT",\r
95         "IB_NOT_DONE",\r
96         "IB_INVALID_INDEX",\r
97         "IB_NO_MATCH",\r
98         "IB_PENDING",\r
99         "IB_UNKNOWN_ERROR"\r
100 };\r
101 \r
102 \r
103 const char*\r
104 ib_get_err_str(\r
105         IN                              ib_api_status_t                         status )\r
106 {\r
107         if( status > IB_UNKNOWN_ERROR )\r
108                 status = IB_UNKNOWN_ERROR;\r
109         return( __ib_error_str[status] );\r
110 }\r
111 \r
112 \r
113 /* ib_async_event_t values above converted to text for easier printing. */\r
114 static const char* const __ib_async_event_str[] =\r
115 {\r
116         "IB_AE_DUMMY",          /*place holder*/\r
117         "IB_AE_SQ_ERROR",\r
118         "IB_AE_SQ_DRAINED",\r
119         "IB_AE_RQ_ERROR",\r
120         "IB_AE_CQ_ERROR",\r
121         "IB_AE_QP_FATAL",\r
122         "IB_AE_QP_COMM",\r
123         "IB_AE_QP_APM",\r
124         "IB_AE_LOCAL_FATAL",\r
125         "IB_AE_PKEY_TRAP",\r
126         "IB_AE_QKEY_TRAP",\r
127         "IB_AE_MKEY_TRAP",\r
128         "IB_AE_PORT_TRAP",\r
129         "IB_AE_SYSIMG_GUID_TRAP",\r
130         "IB_AE_BUF_OVERRUN",\r
131         "IB_AE_LINK_INTEGRITY",\r
132         "IB_AE_FLOW_CTRL_ERROR",\r
133         "IB_AE_BKEY_TRAP",\r
134         "IB_AE_QP_APM_ERROR",\r
135         "IB_AE_WQ_REQ_ERROR",\r
136         "IB_AE_WQ_ACCESS_ERROR",\r
137         "IB_AE_PORT_ACTIVE",            /* ACTIVE STATE */\r
138         "IB_AE_PORT_DOWN",                      /* INIT", ARMED", DOWN */\r
139         "IB_AE_UNKNOWN"\r
140 };\r
141 \r
142 \r
143 const char*\r
144 ib_get_async_event_str(\r
145         IN                              ib_async_event_t                        event )\r
146 {\r
147         if( event > IB_AE_UNKNOWN )\r
148                 event = IB_AE_UNKNOWN;\r
149         return( __ib_async_event_str[event] );\r
150 }\r
151 \r
152 \r
153 static const char* const __ib_wc_status_str[] =\r
154 {\r
155         "IB_WCS_SUCCESS",\r
156         "IB_WCS_LOCAL_LEN_ERR",\r
157         "IB_WCS_LOCAL_OP_ERR",\r
158         "IB_WCS_LOCAL_PROTECTION_ERR",\r
159         "IB_WCS_WR_FLUSHED_ERR",\r
160         "IB_WCS_MEM_WINDOW_BIND_ERR",\r
161         "IB_WCS_REM_ACCESS_ERR",\r
162         "IB_WCS_REM_OP_ERR",\r
163         "IB_WCS_RNR_RETRY_ERR",\r
164         "IB_WCS_TIMEOUT_RETRY_ERR",\r
165         "IB_WCS_REM_INVALID_REQ_ERR",\r
166         "IB_WCS_UNMATCHED_RESPONSE",                    /* InfiniBand Access Layer */\r
167         "IB_WCS_CANCELED",                                              /* InfiniBand Access Layer */\r
168         "IB_WCS_UNKNOWN"\r
169 };\r
170 \r
171 \r
172 const char*\r
173 ib_get_wc_status_str(\r
174         IN                              ib_wc_status_t                          wc_status )\r
175 {\r
176         if( wc_status > IB_WCS_UNKNOWN )\r
177                 wc_status = IB_WCS_UNKNOWN;\r
178         return( __ib_wc_status_str[wc_status] );\r
179 }\r
180 \r
181 \r
182 static const char* const __ib_wc_type_str[] =\r
183 {\r
184         "IB_WC_SEND",\r
185         "IB_WC_RDMA_WRITE",\r
186         "IB_WC_RECV",\r
187         "IB_WC_RDMA_READ",\r
188         "IB_WC_MW_BIND",\r
189         "IB_WC_FETCH_ADD",\r
190         "IB_WC_COMPARE_SWAP",\r
191         "IB_WC_RECV_RDMA_WRITE"\r
192         "IB_WC_UNKNOWN"\r
193 };\r
194 \r
195 \r
196 const char*\r
197 ib_get_wc_type_str(\r
198         IN                              ib_wc_type_t                            wc_type )\r
199 {\r
200         if( wc_type > IB_WC_UNKNOWN )\r
201                 wc_type = IB_WC_UNKNOWN;\r
202         return( __ib_wc_type_str[wc_type] );\r
203 }\r
204 \r
205 \r
206 static const char* const __ib_wr_type_str[] =\r
207 {\r
208         "WR_DUMMY",             /*place holder*/\r
209         "WR_SEND",\r
210         "WR_RDMA_WRITE",\r
211         "WR_RDMA_READ",\r
212         "WR_COMPARE_SWAP",\r
213         "WR_FETCH_ADD",\r
214         "WR_UNKNOWN"\r
215 };\r
216 \r
217 \r
218 const char* \r
219 ib_get_wr_type_str(\r
220         IN                              uint8_t                                         wr_type )\r
221 {\r
222         if( wr_type > WR_UNKNOWN )\r
223                 wr_type = WR_UNKNOWN;\r
224         return( __ib_wr_type_str[wr_type] );\r
225 }\r
226 \r