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