xref: /illumos-gate/usr/src/uts/common/sys/ib/ibtl/ibtl_status.h (revision 4de2612967d06c4fdbf524a62556a1e8118a006f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_IB_IBTL_IBTL_STATUS_H
28 #define	_SYS_IB_IBTL_IBTL_STATUS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * ibtl_status.h
34  *
35  * Define global IBTL return codes.
36  */
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Mnemonics
44  *   APM   - Automatic Path Migration
45  *   APR   - Alternate Path Response
46  *   AH    - Address Handle
47  *   CI    - Channel Interface (HCA)
48  *   CQ    - Completion Queue
49  *   DLID  - Destination Local Id
50  *   DS    - Data Segment.
51  *   GSI   - General Service Interface
52  *   GUID  - Globally Unique Identifier
53  *   HCA   - Host Channel Adapter.
54  *   L_KEY - Local Key
55  *   LAP   - Load Alternative Path
56  *   MC    - Multicast
57  *   MCG   - Multicast Group
58  *   MR    - Memory Region
59  *   MW    - Memory Window
60  *   MTU   - Maximum Transfer Unit
61  *   NAK   - Negative Acknowledge
62  *   P_KEY - Partition Key
63  *   PD    - Protection Domain
64  *   PSN   - Packet Serial Number
65  *   QP    - Queue Pair
66  *   QPN   - Queue Pair Number
67  *   R_KEY - Remote Key
68  *   RC    - Reliable Connected
69  *   RDMA  - Remote DMA
70  *   RNR   - Receiver Not Ready
71  *   RQ    - Receive Work Queue
72  *   SGL   - Scatter/Gather List
73  *   SL    - Service Level
74  *   SMI   - Subnet Management Interface
75  *   SQ    - Send Work Queue
76  *   UC    - Unreliable Connected
77  *   UD    - Unreliable Datagram
78  *   VA    - Virtual Address
79  *   WR    - Work Request
80  *   WC    - Work Completion
81  *   WRC   - Work Request Completion
82  */
83 
84 /*
85  * IBTF Immediate status codes.
86  */
87 typedef enum ibt_status_e {
88 	/*
89 	 * Generic Status codes.
90 	 */
91 	IBT_SUCCESS			= 0,	/* Operation Successful */
92 	IBT_FAILURE			= 1,	/* Undefined IBTF Failure */
93 	IBT_NOT_SUPPORTED		= 2,	/* Feature not supported */
94 	IBT_ILLEGAL_OP			= 3,	/* Operation not supported */
95 	IBT_INVALID_PARAM		= 4,	/* Invalid argument specified */
96 	IBT_INSUFF_KERNEL_RESOURCE	= 5,	/* Not enough Kernel Resource */
97 	IBT_CM_FAILURE			= 6,	/* A call to CM returned */
98 						/* look into detailed error */
99 						/* code for actual failure */
100 	IBT_CM_SERVICE_EXISTS		= 7,	/* For the given parameters */
101 						/* serviceId already exists */
102 	IBT_APM_NOT_SUPPORTED		= 8,	/* Can not satisfy a request */
103 						/* for APM */
104 	IBT_INSUFF_DATA			= 11,	/* Requested number of */
105 						/* paths/records are not */
106 						/* available. */
107 	IBT_NO_HCAS_AVAILABLE		= 12,	/* No HCAs have attached. */
108 	IBT_PATH_RECORDS_NOT_FOUND	= 13,	/* Path records not found. */
109 	IBT_SERVICE_RECORDS_NOT_FOUND	= 14,	/* Service records not found. */
110 	IBT_MCG_RECORDS_NOT_FOUND	= 15,	/* MCG records not found. */
111 	IBT_PATH_PKT_LT_TOO_HIGH	= 16,	/* Path's packet life time */
112 						/* is too high. */
113 	IBT_CM_SERVICE_BUSY		= 17,	/* Service still has bindings */
114 	IBT_STATIC_RATE_INVALID		= 18,	/* Invalid Static Rate */
115 	IBT_SGID_INVALID		= 19,	/* Invalid SGID or SGID index */
116 	IBT_NODE_RECORDS_NOT_FOUND	= 20,	/* NODEInfo records not found */
117 	IBT_GIDS_NOT_FOUND		= 21,	/* Companion GIDs not found */
118 	IBT_INCONSISTENT_AR		= 22,	/* Address Record contradicts */
119 						/* an existing Address Record */
120 	IBT_AR_NOT_REGISTERED		= 23,	/* Address Record is not */
121 						/* currently registered */
122 	IBT_MULTIPLE_AR			= 24,	/* Multiple records exist for */
123 						/* what should be a unique */
124 						/* query result. One of the */
125 						/* records was returned. */
126 
127 	/*
128 	 * Resource Errors
129 	 */
130 	IBT_INSUFF_RESOURCE		= 100,	/* Not enough resources */
131 	IBT_HCA_CQ_EXCEEDED		= 101,	/* CQ capacity requested */
132 						/* exceeds HCA capability */
133 	IBT_HCA_WR_EXCEEDED		= 102,	/* Requested WRs exceed limit */
134 	IBT_HCA_SGL_EXCEEDED		= 103,	/* Requested SGL entries */
135 						/* exceed HCA max limit */
136 	IBT_ERR_OPAQUE1			= 104,
137 	IBT_HCA_MCG_CHAN_EXCEEDED	= 105,	/* Requested Channel exceeds */
138 						/* HCA multicast groups */
139 						/* channel limit */
140 	IBT_HCA_IN_USE			= 106,	/* HCA already open (in use) */
141 	IBT_HCA_RESOURCES_NOT_FREED	= 107,	/* HCA resources still in use */
142 	IBT_HCA_BUSY_DETACHING		= 108,	/* HCA detach in progress */
143 	IBT_HCA_BUSY_CLOSING		= 109,	/* This client is in the */
144 						/* process of closing this */
145 						/* HCA */
146 
147 	/*
148 	 * Host Channel Adapter (HCA) Attribute Errors.
149 	 */
150 	IBT_HCA_INVALID			= 200,	/* Invalid HCA GUID */
151 	IBT_HCA_HDL_INVALID		= 201,	/* Invalid HCA Handle */
152 	IBT_HCA_PORT_MTU_EXCEEDED	= 202,	/* MTU of HCA port exceeded */
153 	IBT_HCA_PORT_INVALID		= 203,	/* Invalid HCA physical port */
154 	IBT_HCA_CNTR_INVALID		= 204,	/* Invalid Counter Specified */
155 	IBT_HCA_CNTR_VAL_INVALID	= 205,	/* Invalid Counter value */
156 	IBT_HCA_PORT_NOT_ACTIVE		= 206,	/* Port is down */
157 	IBT_HCA_SRQ_NOT_SUPPORTED	= 207,	/* Shared Receive Queue */
158 	IBT_HCA_RESIZE_SRQ_NOT_SUPPORTED = 208,	/* Not supported */
159 	IBT_HCA_PAGE_MODE		= 209,	/* HCA operating in page mode */
160 	IBT_HCA_BLOCK_MODE		= 210,	/* HCA in block mode */
161 	IBT_HCA_BMM_NOT_SUPPORTED	= 211,	/* Base Memory Management */
162 						/* Extensions not supported */
163 	IBT_HCA_BQM_NOT_SUPPORTED	= 212,	/* Base Queue Management */
164 						/* Extensions not supported */
165 	IBT_HCA_ZBVA_NOT_SUPPORTED	= 213,	/* Zero Based Virtual */
166 						/* Addresses not supported */
167 	IBT_HCA_MR_MPB_SZ_NOT_SUPPORTED	= 214,	/* Multiple physical buffer */
168 						/* sizes per MR not supported */
169 	IBT_HCA_TYPE_2_MW_NOT_SUPPORTED	= 215,
170 
171 	IBT_HCA_LIF_NOT_SUPPORTED	= 216,	/* Local Invalidate Fencing */
172 						/* not supported */
173 	/*
174 	 * Address errors
175 	 */
176 	IBT_UD_DEST_HDL_INVALID		= 300,	/* Invalid Address Handle */
177 
178 	/*
179 	 * Channel Errors
180 	 */
181 	IBT_CHAN_HDL_INVALID		= 400,	/* Invalid channel Handle */
182 	IBT_CHAN_ATTR_RO		= 401,	/* Cannot Change channel */
183 						/* Attribute */
184 	IBT_CHAN_STATE_INVALID		= 402,	/* Invalid channel State */
185 	IBT_CHAN_SRV_TYPE_INVALID	= 403,	/* Invalid channel Service */
186 						/* Type */
187 	IBT_CHAN_IN_USE			= 404,	/* SMI/GSI channel in use */
188 	IBT_CHAN_ATOMICS_NOT_SUPPORTED	= 405,	/* Atomics not supported */
189 	IBT_ERR_OPAQUE2			= 406,
190 	IBT_ERR_OPAQUE3			= 407,
191 	IBT_CHAN_OP_TYPE_INVALID 	= 408,	/* Invalid Operation Type */
192 	IBT_CHAN_SGL_FORMAT_INVALID	= 409,	/* Invalid SG List format */
193 	IBT_CHAN_SGL_LEN_INVALID 	= 410,	/* Invalid SG List length */
194 	IBT_CHAN_APM_STATE_INVALID	= 411,	/* Invalid Path Migration */
195 						/* State */
196 	IBT_CHAN_SPECIAL_TYPE_INVALID	= 412,	/* Invalid Special channel */
197 	IBT_CHAN_SZ_INSUFFICIENT	= 413,	/* The Size of the WQ is too */
198 						/* small, there are more */
199 						/* outstanding entries than */
200 						/* than the requested size. */
201 	IBT_CHAN_FULL			= 414,	/* Too many WRs posted */
202 	IBT_CHAN_SRQ			= 415,	/* Handle used on a channel */
203 						/* that is associated with an */
204 						/* SRQ */
205 	IBT_CHAN_TYPE_2A_MW_BOUND	= 416,	/* Channel still has a type */
206 						/* 2A memory window bound */
207 
208 	/*
209 	 * Completion Queue (CQ) errors
210 	 */
211 	IBT_CQ_HDL_INVALID		= 500,	/* Invalid CQ Handle */
212 	IBT_CQ_SZ_INSUFFICIENT		= 501,  /* The Size of the CQ is too */
213 						/* small, there are more */
214 						/* outstanding completions */
215 						/* than the requested size. */
216 	IBT_CQ_BUSY			= 502,	/* WQ(s) Still Reference CQ */
217 	IBT_CQ_EMPTY			= 503,	/* Completion Queue Empty */
218 	IBT_CQ_NOTIFY_TYPE_INVALID	= 504,	/* Invalid notification type */
219 	IBT_CQ_INVALID_PRIORITY		= 505,	/* Invalid CQ Priority */
220 
221 	/*
222 	 * Reserved for future use.
223 	 */
224 	IBT_ERR_OPAQUE4			= 600,
225 	IBT_ERR_OPAQUE5			= 601,
226 	IBT_ERR_OPAQUE6			= 602,
227 	IBT_ERR_OPAQUE7			= 700,
228 	IBT_ERR_OPAQUE8			= 701,
229 	IBT_ERR_OPAQUE9 		= 702,
230 	IBT_ERR_OPAQUE10		= 703,
231 
232 	/*
233 	 * Memory operation errors
234 	 */
235 	IBT_MR_VA_INVALID		= 800,	/* Invalid Virtual Address */
236 	IBT_MR_LEN_INVALID		= 801,	/* Invalid Memory Length */
237 	IBT_MR_PHYSBUF_INVALID 		= 802,	/* Invalid Physical Buffer */
238 						/* List */
239 	IBT_MR_OFFSET_INVALID		= 803,	/* Invalid Memory Offset */
240 	IBT_MR_LKEY_INVALID		= 804,	/* Invalid Memory L_KEY */
241 	IBT_MR_RKEY_INVALID		= 805,	/* Invalid Memory R_KEY */
242 	IBT_MR_HDL_INVALID 		= 806,	/* Invalid Memory Region */
243 						/* Handle */
244 	IBT_MR_ACCESS_REQ_INVALID 	= 807,	/* Invalid Access Control */
245 						/* Specifier */
246 	IBT_MR_IN_USE			= 808,	/* Mem region in Use */
247 	IBT_MW_HDL_INVALID 		= 809,	/* Invalid Memory Window */
248 						/* Handle */
249 	IBT_MW_TYPE_INVALID		= 810,
250 
251 	/*
252 	 * Multicast errors
253 	 */
254 	IBT_MC_OPAQUE			= 900,	/* Invalid MLID */
255 	IBT_MC_MGID_INVALID		= 901,	/* Invalid MGID */
256 	IBT_MC_GROUP_INVALID		= 902,	/* Invalid MC Group */
257 
258 	/*
259 	 * Partition table errors.
260 	 */
261 	IBT_PKEY_IX_ILLEGAL		= 1000,	/* P_Key index Out of range */
262 	IBT_PKEY_IX_INVALID		= 1001,	/* P_Key index specifies */
263 						/* invalid entry in table */
264 	/*
265 	 * Protection Domain errors
266 	 */
267 	IBT_PD_HDL_INVALID		= 1100,	/* Invalid protection domain */
268 	IBT_PD_IN_USE			= 1101,	/* Protection Domain in Use */
269 
270 	/*
271 	 * Shared Receive Queue errors
272 	 */
273 	IBT_SRQ_HDL_INVALID		= 1200,	/* Invalid SRQ Handle */
274 	IBT_SRQ_ERROR_STATE		= 1201, /* SRQ in Error State */
275 	IBT_SRQ_LIMIT_EXCEEDED		= 1202, /* SRQ Limit exceeds max SRQ */
276 						/* size */
277 	IBT_SRQ_SZ_INSUFFICIENT		= 1203,	/* The Size of the WQ is too */
278 						/* small, there are more */
279 						/* outstanding entries than */
280 	IBT_SRQ_IN_USE			= 1204	/* SRQ Still has QPs */
281 						/* associated with it */
282 
283 } ibt_status_t;
284 
285 /*
286  * Work Request Completion Return Status.
287  *
288  * Refer InfiniBand Architecture Release Volume 1:
289  * Section 11.6.2 Completion Return Status.
290  *
291  * NOTE: this was converted from an enum to a uint8_t to save space.
292  */
293 typedef uint8_t ibt_wc_status_t;
294 #define	IBT_WC_SUCCESS			0	/* WR Completed Successfully */
295 #define	IBT_WC_LOCAL_LEN_ERR		10	/* Data in WR posted to local */
296 						/* queue too big */
297 #define	IBT_WC_LOCAL_CHAN_OP_ERR	11	/* Internal consistency error */
298 #define	IBT_WC_LOCAL_PROTECT_ERR	13	/* Memory Region violation */
299 						/* for posted WR */
300 #define	IBT_WC_WR_FLUSHED_ERR		14	/* WR was in process when the */
301 						/* chan went to error state */
302 #define	IBT_WC_MEM_WIN_BIND_ERR		15	/* Consumer had insufficient */
303 						/* access rights */
304 
305 	/*
306 	 * Errors that are only reported for Reliable Queue Pairs.
307 	 */
308 #define	IBT_WC_BAD_RESPONSE_ERR		20	/* An unexpected transport */
309 						/* layer opcode was returned */
310 						/* by the responder */
311 #define	IBT_WC_LOCAL_ACCESS_ERR		21	/* A protection error */
312 						/* occurred on a local data */
313 						/* buffer during the */
314 						/* processing of a RDMA Write */
315 						/* with Immediate Data */
316 						/* operation sent from the */
317 						/* remote node */
318 						/* data buffer */
319 #define	IBT_WC_REMOTE_INVALID_REQ_ERR	22	/* Responder detected invalid */
320 						/* message on the channel */
321 #define	IBT_WC_REMOTE_ACCESS_ERR	23	/* Protection Error on remote */
322 						/* data buffer */
323 #define	IBT_WC_REMOTE_OP_ERR		24	/* Operation could not be */
324 						/* completed by the responder */
325 #define	IBT_WC_TRANS_TIMEOUT_ERR	25	/* Local transport retry */
326 						/* counter exceeded */
327 #define	IBT_WC_RNR_NAK_TIMEOUT_ERR	26	/* RNR NAK retry counter */
328 						/* exceeded */
329 #ifdef	__cplusplus
330 }
331 #endif
332 
333 #endif /* _SYS_IB_IBTL_IBTL_STATUS_H */
334