xref: /illumos-gate/usr/src/uts/common/sys/ib/ibtl/ibtl_status.h (revision a07094369b21309434206d9b3601d162693466fc)
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 2005 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 						/* not supported */
159 	IBT_HCA_RESIZE_SRQ_NOT_SUPPORTED = 208,	/* SRQ Resize not supported */
160 	IBT_HCA_PAGE_MODE		= 209,	/* Not opened in page mode */
161 	IBT_HCA_BLOCK_MODE		= 210,	/* HCA does not support Block */
162 						/* mode or Not opened in */
163 						/* Block mode */
164 	IBT_HCA_BMM_NOT_SUPPORTED	= 211,	/* Base Memory Management */
165 						/* Extensions not supported */
166 	IBT_HCA_BQM_NOT_SUPPORTED	= 212,	/* Base Queue Management */
167 						/* Extensions not supported */
168 	IBT_HCA_ZBVA_NOT_SUPPORTED	= 213,	/* Zero Based Virtual */
169 						/* Addresses not supported */
170 	IBT_HCA_MR_MPB_SZ_NOT_SUPPORTED	= 214,	/* Multiple physical buffer */
171 						/* sizes per MR not supported */
172 	IBT_HCA_TYPE_2_MW_NOT_SUPPORTED	= 215,
173 
174 	IBT_HCA_LIF_NOT_SUPPORTED	= 216,	/* Local Invalidate Fencing */
175 						/* not supported */
176 	IBT_HCA_FMR_NOT_SUPPORTED	= 217,	/* Fast Memory Registration */
177 						/* not supported */
178 	/*
179 	 * Address errors
180 	 */
181 	IBT_UD_DEST_HDL_INVALID		= 300,	/* Invalid Address Handle */
182 
183 	/*
184 	 * Channel Errors
185 	 */
186 	IBT_CHAN_HDL_INVALID		= 400,	/* Invalid channel Handle */
187 	IBT_CHAN_ATTR_RO		= 401,	/* Cannot Change channel */
188 						/* Attribute */
189 	IBT_CHAN_STATE_INVALID		= 402,	/* Invalid channel State */
190 	IBT_CHAN_SRV_TYPE_INVALID	= 403,	/* Invalid channel Service */
191 						/* Type */
192 	IBT_CHAN_IN_USE			= 404,	/* SMI/GSI channel in use */
193 	IBT_CHAN_ATOMICS_NOT_SUPPORTED	= 405,	/* Atomics not supported */
194 	IBT_ERR_OPAQUE2			= 406,
195 	IBT_ERR_OPAQUE3			= 407,
196 	IBT_CHAN_OP_TYPE_INVALID 	= 408,	/* Invalid Operation Type */
197 	IBT_CHAN_SGL_FORMAT_INVALID	= 409,	/* Invalid SG List format */
198 	IBT_CHAN_SGL_LEN_INVALID 	= 410,	/* Invalid SG List length */
199 	IBT_CHAN_APM_STATE_INVALID	= 411,	/* Invalid Path Migration */
200 						/* State */
201 	IBT_CHAN_SPECIAL_TYPE_INVALID	= 412,	/* Invalid Special channel */
202 	IBT_CHAN_SZ_INSUFFICIENT	= 413,	/* The Size of the WQ is too */
203 						/* small, there are more */
204 						/* outstanding entries than */
205 						/* than the requested size. */
206 	IBT_CHAN_FULL			= 414,	/* Too many WRs posted */
207 	IBT_CHAN_SRQ			= 415,	/* Handle used on a channel */
208 						/* that is associated with an */
209 						/* SRQ */
210 	IBT_CHAN_TYPE_2A_MW_BOUND	= 416,	/* Channel still has a type */
211 						/* 2A memory window bound */
212 
213 	/*
214 	 * Completion Queue (CQ) errors
215 	 */
216 	IBT_CQ_HDL_INVALID		= 500,	/* Invalid CQ Handle */
217 	IBT_CQ_SZ_INSUFFICIENT		= 501,  /* The Size of the CQ is too */
218 						/* small, there are more */
219 						/* outstanding completions */
220 						/* than the requested size. */
221 	IBT_CQ_BUSY			= 502,	/* WQ(s) Still Reference CQ */
222 	IBT_CQ_EMPTY			= 503,	/* Completion Queue Empty */
223 	IBT_CQ_NOTIFY_TYPE_INVALID	= 504,	/* Invalid notification type */
224 	IBT_CQ_INVALID_PRIORITY		= 505,	/* Invalid CQ Priority */
225 
226 	/*
227 	 * Reserved for future use.
228 	 */
229 	IBT_ERR_OPAQUE4			= 600,
230 	IBT_ERR_OPAQUE5			= 601,
231 	IBT_ERR_OPAQUE6			= 602,
232 	IBT_ERR_OPAQUE7			= 700,
233 	IBT_ERR_OPAQUE8			= 701,
234 	IBT_ERR_OPAQUE9 		= 702,
235 	IBT_ERR_OPAQUE10		= 703,
236 
237 	/*
238 	 * Memory operation errors
239 	 */
240 	IBT_MR_VA_INVALID		= 800,	/* Invalid Virtual Address */
241 	IBT_MR_LEN_INVALID		= 801,	/* Invalid Memory Length */
242 	IBT_MR_PHYSBUF_INVALID 		= 802,	/* Invalid Physical Buffer */
243 						/* List */
244 	IBT_MR_OFFSET_INVALID		= 803,	/* Invalid Memory Offset */
245 	IBT_MR_LKEY_INVALID		= 804,	/* Invalid Memory L_KEY */
246 	IBT_MR_RKEY_INVALID		= 805,	/* Invalid Memory R_KEY */
247 	IBT_MR_HDL_INVALID 		= 806,	/* Invalid Memory Region */
248 						/* Handle */
249 	IBT_MR_ACCESS_REQ_INVALID 	= 807,	/* Invalid Access Control */
250 						/* Specifier */
251 	IBT_MR_IN_USE			= 808,	/* Mem region in Use */
252 	IBT_MW_HDL_INVALID 		= 809,	/* Invalid Memory Window */
253 						/* Handle */
254 	IBT_MW_TYPE_INVALID		= 810,
255 	IBT_MA_HDL_INVALID		= 811,  /* Invalid Memory Area Hdl */
256 
257 	/*
258 	 * Multicast errors
259 	 */
260 	IBT_MC_OPAQUE			= 900,	/* Invalid MLID */
261 	IBT_MC_MGID_INVALID		= 901,	/* Invalid MGID */
262 	IBT_MC_GROUP_INVALID		= 902,	/* Invalid MC Group */
263 
264 	/*
265 	 * Partition table errors.
266 	 */
267 	IBT_PKEY_IX_ILLEGAL		= 1000,	/* P_Key index Out of range */
268 	IBT_PKEY_IX_INVALID		= 1001,	/* P_Key index specifies */
269 						/* invalid entry in table */
270 	/*
271 	 * Protection Domain errors
272 	 */
273 	IBT_PD_HDL_INVALID		= 1100,	/* Invalid protection domain */
274 	IBT_PD_IN_USE			= 1101,	/* Protection Domain in Use */
275 
276 	/*
277 	 * Shared Receive Queue errors
278 	 */
279 	IBT_SRQ_HDL_INVALID		= 1200,	/* Invalid SRQ Handle */
280 	IBT_SRQ_ERROR_STATE		= 1201, /* SRQ in Error State */
281 	IBT_SRQ_LIMIT_EXCEEDED		= 1202, /* SRQ Limit exceeds max SRQ */
282 						/* size */
283 	IBT_SRQ_SZ_INSUFFICIENT		= 1203,	/* The Size of the WQ is too */
284 						/* small, there are more */
285 						/* outstanding entries than */
286 	IBT_SRQ_IN_USE			= 1204,	/* SRQ Still has QPs */
287 						/* associated with it */
288 	/*
289 	 * FMR Errors
290 	 */
291 	IBT_FMR_POOL_HDL_INVALID	= 1300,	/* Invalid FMR Pool handle */
292 	IBT_FMR_POOL_IN_USE		= 1301,	/* FMR Pool in use. */
293 	IBT_PBL_TOO_SMALL		= 1302
294 
295 } ibt_status_t;
296 
297 /*
298  * Work Request Completion Return Status.
299  *
300  * Refer InfiniBand Architecture Release Volume 1:
301  * Section 11.6.2 Completion Return Status.
302  *
303  * NOTE: this was converted from an enum to a uint8_t to save space.
304  */
305 typedef uint8_t ibt_wc_status_t;
306 #define	IBT_WC_SUCCESS			0	/* WR Completed Successfully */
307 #define	IBT_WC_LOCAL_LEN_ERR		10	/* Data in WR posted to local */
308 						/* queue too big */
309 #define	IBT_WC_LOCAL_CHAN_OP_ERR	11	/* Internal consistency error */
310 #define	IBT_WC_LOCAL_PROTECT_ERR	13	/* Memory Region violation */
311 						/* for posted WR */
312 #define	IBT_WC_WR_FLUSHED_ERR		14	/* WR was in process when the */
313 						/* chan went to error state */
314 #define	IBT_WC_MEM_WIN_BIND_ERR		15	/* Consumer had insufficient */
315 						/* access rights */
316 
317 	/*
318 	 * Errors that are only reported for Reliable Queue Pairs.
319 	 */
320 #define	IBT_WC_BAD_RESPONSE_ERR		20	/* An unexpected transport */
321 						/* layer opcode was returned */
322 						/* by the responder */
323 #define	IBT_WC_LOCAL_ACCESS_ERR		21	/* A protection error */
324 						/* occurred on a local data */
325 						/* buffer during the */
326 						/* processing of a RDMA Write */
327 						/* with Immediate Data */
328 						/* operation sent from the */
329 						/* remote node */
330 						/* data buffer */
331 #define	IBT_WC_REMOTE_INVALID_REQ_ERR	22	/* Responder detected invalid */
332 						/* message on the channel */
333 #define	IBT_WC_REMOTE_ACCESS_ERR	23	/* Protection Error on remote */
334 						/* data buffer */
335 #define	IBT_WC_REMOTE_OP_ERR		24	/* Operation could not be */
336 						/* completed by the responder */
337 #define	IBT_WC_TRANS_TIMEOUT_ERR	25	/* Local transport retry */
338 						/* counter exceeded */
339 #define	IBT_WC_RNR_NAK_TIMEOUT_ERR	26	/* RNR NAK retry counter */
340 						/* exceeded */
341 #ifdef	__cplusplus
342 }
343 #endif
344 
345 #endif /* _SYS_IB_IBTL_IBTL_STATUS_H */
346