xref: /illumos-gate/usr/src/uts/common/sys/ib/ibtl/ibtl_status.h (revision ef2504f26d1ea5859db9838255bb63f488f1b050)
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_IBMF_TIMEOUT		= 10,	/* IBMF call returned with */
102 						/* TIMEOUT error code. */
103 	IBT_INSUFF_DATA			= 11,	/* Requested number of */
104 						/* paths/records are not */
105 						/* available. */
106 	IBT_NO_HCAS_AVAILABLE		= 12,	/* No HCAs have attached. */
107 	IBT_PATH_RECORDS_NOT_FOUND	= 13,	/* Path records not found. */
108 	IBT_SERVICE_RECORDS_NOT_FOUND	= 14,	/* Service records not found. */
109 	IBT_MCG_RECORDS_NOT_FOUND	= 15,	/* MCG records not found. */
110 	IBT_PATH_PKT_LT_TOO_HIGH	= 16,	/* Path's packet life time */
111 						/* is too high. */
112 	IBT_CM_SERVICE_BUSY		= 17,	/* Service still has bindings */
113 	IBT_STATIC_RATE_INVALID		= 18,	/* Invalid Static Rate */
114 	IBT_SGID_INVALID		= 19,	/* Invalid SGID or SGID index */
115 	IBT_NODE_RECORDS_NOT_FOUND	= 20,	/* NODEInfo records not found */
116 	IBT_GIDS_NOT_FOUND		= 21,	/* Companion GIDs not found */
117 	IBT_INCONSISTENT_AR		= 22,	/* Address Record contradicts */
118 						/* an existing Address Record */
119 	IBT_AR_NOT_REGISTERED		= 23,	/* Address Record is not */
120 						/* currently registered */
121 	IBT_MULTIPLE_AR			= 24,	/* Multiple records exist for */
122 						/* what should be a unique */
123 						/* query result. One of the */
124 						/* records was returned. */
125 	IBT_DEST_IP_GID_NOT_FOUND	= 25,	/* No IP to GID Mapping */
126 	IBT_SRC_IP_NOT_FOUND		= 26,	/* SRC IP Endpoint not found */
127 
128 	/*
129 	 * Resource Errors
130 	 */
131 	IBT_INSUFF_RESOURCE		= 100,	/* Not enough resources */
132 	IBT_HCA_CQ_EXCEEDED		= 101,	/* CQ capacity requested */
133 						/* exceeds HCA capability */
134 	IBT_HCA_WR_EXCEEDED		= 102,	/* Requested WRs exceed limit */
135 	IBT_HCA_SGL_EXCEEDED		= 103,	/* Requested SGL entries */
136 						/* exceed HCA max limit */
137 	IBT_ERR_OPAQUE1			= 104,
138 	IBT_HCA_MCG_CHAN_EXCEEDED	= 105,	/* Requested Channel exceeds */
139 						/* HCA multicast groups */
140 						/* channel limit */
141 	IBT_HCA_IN_USE			= 106,	/* HCA already open (in use) */
142 	IBT_HCA_RESOURCES_NOT_FREED	= 107,	/* HCA resources still in use */
143 	IBT_HCA_BUSY_DETACHING		= 108,	/* HCA detach in progress */
144 	IBT_HCA_BUSY_CLOSING		= 109,	/* This client is in the */
145 						/* process of closing this */
146 						/* HCA */
147 
148 	/*
149 	 * Host Channel Adapter (HCA) Attribute Errors.
150 	 */
151 	IBT_HCA_INVALID			= 200,	/* Invalid HCA GUID */
152 	IBT_HCA_HDL_INVALID		= 201,	/* Invalid HCA Handle */
153 	IBT_HCA_PORT_MTU_EXCEEDED	= 202,	/* MTU of HCA port exceeded */
154 	IBT_HCA_PORT_INVALID		= 203,	/* Invalid HCA physical port */
155 	IBT_HCA_CNTR_INVALID		= 204,	/* Invalid Counter Specified */
156 	IBT_HCA_CNTR_VAL_INVALID	= 205,	/* Invalid Counter value */
157 	IBT_HCA_PORT_NOT_ACTIVE		= 206,	/* Port is down */
158 	IBT_HCA_SRQ_NOT_SUPPORTED	= 207,	/* Shared Receive Queue */
159 						/* not supported */
160 	IBT_HCA_RESIZE_SRQ_NOT_SUPPORTED = 208,	/* SRQ Resize not supported */
161 	IBT_HCA_PAGE_MODE		= 209,	/* Not opened in page mode */
162 	IBT_HCA_BLOCK_MODE		= 210,	/* HCA does not support Block */
163 						/* mode or Not opened in */
164 						/* Block mode */
165 	IBT_HCA_BMM_NOT_SUPPORTED	= 211,	/* Base Memory Management */
166 						/* Extensions not supported */
167 	IBT_HCA_BQM_NOT_SUPPORTED	= 212,	/* Base Queue Management */
168 						/* Extensions not supported */
169 	IBT_HCA_ZBVA_NOT_SUPPORTED	= 213,	/* Zero Based Virtual */
170 						/* Addresses not supported */
171 	IBT_HCA_MR_MPB_SZ_NOT_SUPPORTED	= 214,	/* Multiple physical buffer */
172 						/* sizes per MR not supported */
173 	IBT_HCA_TYPE_2_MW_NOT_SUPPORTED	= 215,
174 
175 	IBT_HCA_LIF_NOT_SUPPORTED	= 216,	/* Local Invalidate Fencing */
176 						/* not supported */
177 	IBT_HCA_FMR_NOT_SUPPORTED	= 217,	/* Fast Memory Registration */
178 						/* not supported */
179 	/*
180 	 * Address errors
181 	 */
182 	IBT_UD_DEST_HDL_INVALID		= 300,	/* Invalid Address Handle */
183 
184 	/*
185 	 * Channel Errors
186 	 */
187 	IBT_CHAN_HDL_INVALID		= 400,	/* Invalid channel Handle */
188 	IBT_CHAN_ATTR_RO		= 401,	/* Cannot Change channel */
189 						/* Attribute */
190 	IBT_CHAN_STATE_INVALID		= 402,	/* Invalid channel State */
191 	IBT_CHAN_SRV_TYPE_INVALID	= 403,	/* Invalid channel Service */
192 						/* Type */
193 	IBT_CHAN_IN_USE			= 404,	/* SMI/GSI channel in use */
194 	IBT_CHAN_ATOMICS_NOT_SUPPORTED	= 405,	/* Atomics not supported */
195 	IBT_ERR_OPAQUE2			= 406,
196 	IBT_ERR_OPAQUE3			= 407,
197 	IBT_CHAN_OP_TYPE_INVALID 	= 408,	/* Invalid Operation Type */
198 	IBT_CHAN_SGL_FORMAT_INVALID	= 409,	/* Invalid SG List format */
199 	IBT_CHAN_SGL_LEN_INVALID 	= 410,	/* Invalid SG List length */
200 	IBT_CHAN_APM_STATE_INVALID	= 411,	/* Invalid Path Migration */
201 						/* State */
202 	IBT_CHAN_SPECIAL_TYPE_INVALID	= 412,	/* Invalid Special channel */
203 	IBT_CHAN_SZ_INSUFFICIENT	= 413,	/* The Size of the WQ is too */
204 						/* small, there are more */
205 						/* outstanding entries than */
206 						/* than the requested size. */
207 	IBT_CHAN_FULL			= 414,	/* Too many WRs posted */
208 	IBT_CHAN_SRQ			= 415,	/* Handle used on a channel */
209 						/* that is associated with an */
210 						/* SRQ */
211 	IBT_CHAN_TYPE_2A_MW_BOUND	= 416,	/* Channel still has a type */
212 						/* 2A memory window bound */
213 	IBT_CHAN_WQE_SZ_INSUFF		= 417,	/* inline-data/LSO too large */
214 
215 	/*
216 	 * Completion Queue (CQ) errors
217 	 */
218 	IBT_CQ_HDL_INVALID		= 500,	/* Invalid CQ Handle */
219 	IBT_CQ_SZ_INSUFFICIENT		= 501,  /* The Size of the CQ is too */
220 						/* small, there are more */
221 						/* outstanding completions */
222 						/* than the requested size. */
223 	IBT_CQ_BUSY			= 502,	/* WQ(s) Still Reference CQ */
224 	IBT_CQ_EMPTY			= 503,	/* Completion Queue Empty */
225 	IBT_CQ_NOTIFY_TYPE_INVALID	= 504,	/* Invalid notification type */
226 	IBT_CQ_INVALID_PRIORITY		= 505,	/* Invalid CQ Priority */
227 
228 	/*
229 	 * Reserved for future use.
230 	 */
231 	IBT_ERR_OPAQUE4			= 600,
232 	IBT_ERR_OPAQUE5			= 601,
233 	IBT_ERR_OPAQUE6			= 602,
234 	IBT_ERR_OPAQUE7			= 700,
235 	IBT_ERR_OPAQUE8			= 701,
236 	IBT_ERR_OPAQUE9 		= 702,
237 	IBT_ERR_OPAQUE10		= 703,
238 
239 	/*
240 	 * Memory operation errors
241 	 */
242 	IBT_MR_VA_INVALID		= 800,	/* Invalid Virtual Address */
243 	IBT_MR_LEN_INVALID		= 801,	/* Invalid Memory Length */
244 	IBT_MR_PHYSBUF_INVALID 		= 802,	/* Invalid Physical Buffer */
245 						/* List */
246 	IBT_MR_OFFSET_INVALID		= 803,	/* Invalid Memory Offset */
247 	IBT_MR_LKEY_INVALID		= 804,	/* Invalid Memory L_KEY */
248 	IBT_MR_RKEY_INVALID		= 805,	/* Invalid Memory R_KEY */
249 	IBT_MR_HDL_INVALID 		= 806,	/* Invalid Memory Region */
250 						/* Handle */
251 	IBT_MR_ACCESS_REQ_INVALID 	= 807,	/* Invalid Access Control */
252 						/* Specifier */
253 	IBT_MR_IN_USE			= 808,	/* Mem region in Use */
254 	IBT_MW_HDL_INVALID 		= 809,	/* Invalid Memory Window */
255 						/* Handle */
256 	IBT_MW_TYPE_INVALID		= 810,
257 	IBT_MA_HDL_INVALID		= 811,  /* Invalid Memory Area Hdl */
258 	IBT_SGL_TOO_SMALL		= 812,
259 	IBT_MI_HDL_INVALID		= 813,
260 
261 	/*
262 	 * Multicast errors
263 	 */
264 	IBT_MC_OPAQUE			= 900,	/* Invalid MLID */
265 	IBT_MC_MGID_INVALID		= 901,	/* Invalid MGID */
266 	IBT_MC_GROUP_INVALID		= 902,	/* Invalid MC Group */
267 
268 	/*
269 	 * Partition table errors.
270 	 */
271 	IBT_PKEY_IX_ILLEGAL		= 1000,	/* P_Key index Out of range */
272 	IBT_PKEY_IX_INVALID		= 1001,	/* P_Key index specifies */
273 						/* invalid entry in table */
274 	/*
275 	 * Protection Domain errors
276 	 */
277 	IBT_PD_HDL_INVALID		= 1100,	/* Invalid protection domain */
278 	IBT_PD_IN_USE			= 1101,	/* Protection Domain in Use */
279 	IBT_MEM_ALLOC_HDL_INVALID	= 1102,	/* Invalid MEM handle */
280 
281 	/*
282 	 * Shared Receive Queue errors
283 	 */
284 	IBT_SRQ_HDL_INVALID		= 1200,	/* Invalid SRQ Handle */
285 	IBT_SRQ_ERROR_STATE		= 1201, /* SRQ in Error State */
286 	IBT_SRQ_LIMIT_EXCEEDED		= 1202, /* SRQ Limit exceeds max SRQ */
287 						/* size */
288 	IBT_SRQ_SZ_INSUFFICIENT		= 1203,	/* The Size of the WQ is too */
289 						/* small, there are more */
290 						/* outstanding entries than */
291 	IBT_SRQ_IN_USE			= 1204,	/* SRQ Still has QPs */
292 						/* associated with it */
293 	/*
294 	 * FMR Errors
295 	 */
296 	IBT_FMR_POOL_HDL_INVALID	= 1300,	/* Invalid FMR Pool handle */
297 	IBT_FMR_POOL_IN_USE		= 1301,	/* FMR Pool in use. */
298 	IBT_PBL_TOO_SMALL		= 1302
299 } ibt_status_t;
300 
301 /*
302  * Work Request Completion Return Status.
303  *
304  * Refer InfiniBand Architecture Release Volume 1:
305  * Section 11.6.2 Completion Return Status.
306  *
307  * NOTE: this was converted from an enum to a uint8_t to save space.
308  */
309 typedef uint8_t ibt_wc_status_t;
310 #define	IBT_WC_SUCCESS			0	/* WR Completed Successfully */
311 #define	IBT_WC_LOCAL_LEN_ERR		10	/* Data in WR posted to local */
312 						/* queue too big */
313 #define	IBT_WC_LOCAL_CHAN_OP_ERR	11	/* Internal consistency error */
314 #define	IBT_WC_LOCAL_PROTECT_ERR	13	/* Memory Region violation */
315 						/* for posted WR */
316 #define	IBT_WC_WR_FLUSHED_ERR		14	/* WR was in process when the */
317 						/* chan went to error state */
318 #define	IBT_WC_MEM_WIN_BIND_ERR		15	/* Consumer had insufficient */
319 						/* access rights */
320 
321 	/*
322 	 * Errors that are only reported for Reliable Queue Pairs.
323 	 */
324 #define	IBT_WC_BAD_RESPONSE_ERR		20	/* An unexpected transport */
325 						/* layer opcode was returned */
326 						/* by the responder */
327 #define	IBT_WC_LOCAL_ACCESS_ERR		21	/* A protection error */
328 						/* occurred on a local data */
329 						/* buffer during the */
330 						/* processing of a RDMA Write */
331 						/* with Immediate Data */
332 						/* operation sent from the */
333 						/* remote node */
334 						/* data buffer */
335 #define	IBT_WC_REMOTE_INVALID_REQ_ERR	22	/* Responder detected invalid */
336 						/* message on the channel */
337 #define	IBT_WC_REMOTE_ACCESS_ERR	23	/* Protection Error on remote */
338 						/* data buffer */
339 #define	IBT_WC_REMOTE_OP_ERR		24	/* Operation could not be */
340 						/* completed by the responder */
341 #define	IBT_WC_TRANS_TIMEOUT_ERR	25	/* Local transport retry */
342 						/* counter exceeded */
343 #define	IBT_WC_RNR_NAK_TIMEOUT_ERR	26	/* RNR NAK retry counter */
344 						/* exceeded */
345 #ifdef	__cplusplus
346 }
347 #endif
348 
349 #endif /* _SYS_IB_IBTL_IBTL_STATUS_H */
350