xref: /illumos-gate/usr/src/uts/common/sys/ib/ibtl/ibtl_types.h (revision 7c478bd95313f5f23a4c958a745db2134aa0324)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_IB_IBTL_IBTL_TYPES_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_IB_IBTL_IBTL_TYPES_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  * ibtl_types.h
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * All common IBTL defined types. These are common data types
36*7c478bd9Sstevel@tonic-gate  * that are shared by the IBTI and IBCI interfaces, it is only included
37*7c478bd9Sstevel@tonic-gate  * by ibti.h and ibci.h
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
41*7c478bd9Sstevel@tonic-gate #include <sys/ib/ib_types.h>
42*7c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_status.h>
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
45*7c478bd9Sstevel@tonic-gate extern "C" {
46*7c478bd9Sstevel@tonic-gate #endif
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate /*
49*7c478bd9Sstevel@tonic-gate  * Define Internal IBTL handles
50*7c478bd9Sstevel@tonic-gate  */
51*7c478bd9Sstevel@tonic-gate typedef	struct	ibtl_clnt_s	*ibt_clnt_hdl_t;    /* ibt_attach() */
52*7c478bd9Sstevel@tonic-gate typedef	struct	ibtl_hca_s	*ibt_hca_hdl_t;	    /* ibt_open_hca() */
53*7c478bd9Sstevel@tonic-gate typedef	struct	ibtl_channel_s	*ibt_channel_hdl_t; /* alloc_rc|ud_channel() */
54*7c478bd9Sstevel@tonic-gate typedef	struct	ibtl_srq_s	*ibt_srq_hdl_t;	    /* ibt_alloc_srq() */
55*7c478bd9Sstevel@tonic-gate typedef	struct	ibtl_cq_s	*ibt_cq_hdl_t;	    /* ibt_alloc_cq() */
56*7c478bd9Sstevel@tonic-gate typedef	struct	ibcm_svc_info_s	*ibt_srv_hdl_t;	    /* ibt_register_service() */
57*7c478bd9Sstevel@tonic-gate typedef	struct	ibcm_svc_bind_s	*ibt_sbind_hdl_t;   /* ibt_bind_service() */
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate typedef	struct	ibc_ma_s	*ibt_ma_hdl_t;	    /* ibt_map_mem_area() */
60*7c478bd9Sstevel@tonic-gate typedef	struct	ibc_pd_s	*ibt_pd_hdl_t;	    /* ibt_alloc_pd() */
61*7c478bd9Sstevel@tonic-gate typedef	struct	ibc_sched_s	*ibt_sched_hdl_t;   /* ibt_alloc_cq_sched() */
62*7c478bd9Sstevel@tonic-gate typedef	struct	ibc_mr_s	*ibt_mr_hdl_t;	    /* ibt_register_mr() */
63*7c478bd9Sstevel@tonic-gate typedef	struct	ibc_mw_s	*ibt_mw_hdl_t;	    /* ibt_alloc_mw() */
64*7c478bd9Sstevel@tonic-gate typedef	struct	ibt_ud_dest_s	*ibt_ud_dest_hdl_t; /* UD dest handle */
65*7c478bd9Sstevel@tonic-gate typedef	struct	ibc_ah_s	*ibt_ah_hdl_t;	    /* ibt_alloc_ah() */
66*7c478bd9Sstevel@tonic-gate typedef struct	ibtl_eec_s	*ibt_eec_hdl_t;
67*7c478bd9Sstevel@tonic-gate typedef	struct	ibt_rd_dest_s	*ibt_rd_dest_hdl_t;	/* Reserved for */
68*7c478bd9Sstevel@tonic-gate 							/* Future use */
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate /*
71*7c478bd9Sstevel@tonic-gate  * Some General Types.
72*7c478bd9Sstevel@tonic-gate  */
73*7c478bd9Sstevel@tonic-gate typedef uint32_t	ibt_lkey_t;		/* L_Key */
74*7c478bd9Sstevel@tonic-gate typedef uint32_t	ibt_rkey_t;		/* R_Key */
75*7c478bd9Sstevel@tonic-gate typedef uint64_t	ibt_wrid_t;		/* Client assigned WR ID */
76*7c478bd9Sstevel@tonic-gate typedef uint32_t	ibt_immed_t;		/* WR Immediate Data */
77*7c478bd9Sstevel@tonic-gate typedef uint64_t	ibt_atom_arg_t;		/* WR Atomic Operation arg */
78*7c478bd9Sstevel@tonic-gate typedef	uint_t		ibt_cq_handler_id_t;	/* Event handler ID */
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate  * IBT selector type, used when looking up/requesting either an
82*7c478bd9Sstevel@tonic-gate  * MTU, Pkt lifetime, or Static rate.
83*7c478bd9Sstevel@tonic-gate  * The interpretation of IBT_BEST depends on the attribute being selected.
84*7c478bd9Sstevel@tonic-gate  */
85*7c478bd9Sstevel@tonic-gate typedef enum ibt_selector_e {
86*7c478bd9Sstevel@tonic-gate 	IBT_GT		= 0,	/* Greater than */
87*7c478bd9Sstevel@tonic-gate 	IBT_LT		= 1,	/* Less than */
88*7c478bd9Sstevel@tonic-gate 	IBT_EQU		= 2,	/* Equal to */
89*7c478bd9Sstevel@tonic-gate 	IBT_BEST	= 3	/* Best */
90*7c478bd9Sstevel@tonic-gate } ibt_selector_t;
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate /*
94*7c478bd9Sstevel@tonic-gate  * Static rate definitions.
95*7c478bd9Sstevel@tonic-gate  */
96*7c478bd9Sstevel@tonic-gate typedef enum ibt_srate_e {
97*7c478bd9Sstevel@tonic-gate 	IBT_SRATE_NOT_SPECIFIED	= 0,
98*7c478bd9Sstevel@tonic-gate 	IBT_SRATE_1X		= 2,
99*7c478bd9Sstevel@tonic-gate 	IBT_SRATE_4X		= 3,
100*7c478bd9Sstevel@tonic-gate 	IBT_SRATE_12X		= 4
101*7c478bd9Sstevel@tonic-gate } ibt_srate_t;
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate /*
104*7c478bd9Sstevel@tonic-gate  * Static rate request type.
105*7c478bd9Sstevel@tonic-gate  */
106*7c478bd9Sstevel@tonic-gate typedef struct ibt_srate_req_s {
107*7c478bd9Sstevel@tonic-gate 	ibt_srate_t	r_srate;	/* Requested srate */
108*7c478bd9Sstevel@tonic-gate 	ibt_selector_t	r_selector;	/* Qualifier for r_srate */
109*7c478bd9Sstevel@tonic-gate } ibt_srate_req_t;
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate /*
112*7c478bd9Sstevel@tonic-gate  * Packet Life Time Request Type.
113*7c478bd9Sstevel@tonic-gate  */
114*7c478bd9Sstevel@tonic-gate typedef struct ibt_pkt_lt_req_s {
115*7c478bd9Sstevel@tonic-gate 	clock_t		p_pkt_lt;	/* Requested Packet Life Time */
116*7c478bd9Sstevel@tonic-gate 	ibt_selector_t	p_selector;	/* Qualifier for p_pkt_lt */
117*7c478bd9Sstevel@tonic-gate } ibt_pkt_lt_req_t;
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate /*
120*7c478bd9Sstevel@tonic-gate  * Queue size struct.
121*7c478bd9Sstevel@tonic-gate  */
122*7c478bd9Sstevel@tonic-gate typedef struct ibt_queue_sizes_s {
123*7c478bd9Sstevel@tonic-gate 	uint_t	qs_sq;		/* SendQ size. */
124*7c478bd9Sstevel@tonic-gate 	uint_t	qs_rq;		/* RecvQ size. */
125*7c478bd9Sstevel@tonic-gate } ibt_queue_sizes_t;
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate /*
128*7c478bd9Sstevel@tonic-gate  * Channel sizes struct, used by functions that allocate/query RC or UD
129*7c478bd9Sstevel@tonic-gate  * channels.
130*7c478bd9Sstevel@tonic-gate  */
131*7c478bd9Sstevel@tonic-gate typedef struct ibt_chan_sizes_s {
132*7c478bd9Sstevel@tonic-gate 	uint_t	cs_sq;		/* SendQ size. */
133*7c478bd9Sstevel@tonic-gate 	uint_t	cs_rq;		/* ReceiveQ size. */
134*7c478bd9Sstevel@tonic-gate 	uint_t	cs_sq_sgl;	/* Max SGL elements in a SQ WR. */
135*7c478bd9Sstevel@tonic-gate 	uint_t	cs_rq_sgl;	/* Max SGL elements in a RQ Wr. */
136*7c478bd9Sstevel@tonic-gate } ibt_chan_sizes_t;
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate /*
139*7c478bd9Sstevel@tonic-gate  * Shared Queue size struct.
140*7c478bd9Sstevel@tonic-gate  */
141*7c478bd9Sstevel@tonic-gate typedef struct ibt_srq_sizes_s {
142*7c478bd9Sstevel@tonic-gate 	uint_t	srq_wr_sz;
143*7c478bd9Sstevel@tonic-gate 	uint_t	srq_sgl_sz;
144*7c478bd9Sstevel@tonic-gate } ibt_srq_sizes_t;
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate /*
147*7c478bd9Sstevel@tonic-gate  * SRQ Modify Flags
148*7c478bd9Sstevel@tonic-gate  */
149*7c478bd9Sstevel@tonic-gate typedef enum ibt_srq_modify_flags_e {
150*7c478bd9Sstevel@tonic-gate 	IBT_SRQ_SET_NOTHING		= 0,
151*7c478bd9Sstevel@tonic-gate 	IBT_SRQ_SET_SIZE		= (1 << 1),
152*7c478bd9Sstevel@tonic-gate 	IBT_SRQ_SET_LIMIT		= (1 << 2)
153*7c478bd9Sstevel@tonic-gate } ibt_srq_modify_flags_t;
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate /*
157*7c478bd9Sstevel@tonic-gate  * Execution flags, indicates if the function should block or not.
158*7c478bd9Sstevel@tonic-gate  * Note: in some cases, e.g., a NULL rc_cm_handler, IBT_NONBLOCKING
159*7c478bd9Sstevel@tonic-gate  * will not have an effect, and the thread will block.
160*7c478bd9Sstevel@tonic-gate  * IBT_NOCALLBACKS is valid for ibt_close_rc_channel only.
161*7c478bd9Sstevel@tonic-gate  */
162*7c478bd9Sstevel@tonic-gate typedef enum ibt_execution_mode_e {
163*7c478bd9Sstevel@tonic-gate 	IBT_BLOCKING	= 0,	/* Block */
164*7c478bd9Sstevel@tonic-gate 	IBT_NONBLOCKING	= 1,	/* Return as soon as possible */
165*7c478bd9Sstevel@tonic-gate 	IBT_NOCALLBACKS	= 2	/* cm_handler is not invoked after */
166*7c478bd9Sstevel@tonic-gate 				/* ibt_close_rc_channel returns */
167*7c478bd9Sstevel@tonic-gate } ibt_execution_mode_t;
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate /*
170*7c478bd9Sstevel@tonic-gate  * Memory window alloc flags
171*7c478bd9Sstevel@tonic-gate  */
172*7c478bd9Sstevel@tonic-gate typedef enum ibt_mw_flags_e {
173*7c478bd9Sstevel@tonic-gate 	IBT_MW_SLEEP		= 0,		/* Can block */
174*7c478bd9Sstevel@tonic-gate 	IBT_MW_NOSLEEP		= (1 << 0),	/* Can't block */
175*7c478bd9Sstevel@tonic-gate 	IBT_MW_USER_MAP		= (1 << 1),
176*7c478bd9Sstevel@tonic-gate 	IBT_MW_DEFER_ALLOC	= (1 << 2),
177*7c478bd9Sstevel@tonic-gate 	IBT_MW_TYPE_1		= (1 << 3),
178*7c478bd9Sstevel@tonic-gate 	IBT_MW_TYPE_2		= (1 << 4)
179*7c478bd9Sstevel@tonic-gate } ibt_mw_flags_t;
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate /*
182*7c478bd9Sstevel@tonic-gate  * PD alloc flags
183*7c478bd9Sstevel@tonic-gate  */
184*7c478bd9Sstevel@tonic-gate typedef enum ibt_pd_flags_e {
185*7c478bd9Sstevel@tonic-gate 	IBT_PD_NO_FLAGS		= 0,
186*7c478bd9Sstevel@tonic-gate 	IBT_PD_USER_MAP		= (1 << 0),
187*7c478bd9Sstevel@tonic-gate 	IBT_PD_DEFER_ALLOC	= (1 << 1)
188*7c478bd9Sstevel@tonic-gate } ibt_pd_flags_t;
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate /*
191*7c478bd9Sstevel@tonic-gate  * UD Dest alloc flags
192*7c478bd9Sstevel@tonic-gate  */
193*7c478bd9Sstevel@tonic-gate typedef enum ibt_ud_dest_flags_e {
194*7c478bd9Sstevel@tonic-gate 	IBT_UD_DEST_NO_FLAGS	= 0,
195*7c478bd9Sstevel@tonic-gate 	IBT_UD_DEST_USER_MAP	= (1 << 0),
196*7c478bd9Sstevel@tonic-gate 	IBT_UD_DEST_DEFER_ALLOC	= (1 << 1)
197*7c478bd9Sstevel@tonic-gate } ibt_ud_dest_flags_t;
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate /*
200*7c478bd9Sstevel@tonic-gate  * SRQ alloc flags
201*7c478bd9Sstevel@tonic-gate  */
202*7c478bd9Sstevel@tonic-gate typedef enum ibt_srq_flags_e {
203*7c478bd9Sstevel@tonic-gate 	IBT_SRQ_NO_FLAGS	= 0,
204*7c478bd9Sstevel@tonic-gate 	IBT_SRQ_USER_MAP	= (1 << 0),
205*7c478bd9Sstevel@tonic-gate 	IBT_SRQ_DEFER_ALLOC	= (1 << 1)
206*7c478bd9Sstevel@tonic-gate } ibt_srq_flags_t;
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate /*
209*7c478bd9Sstevel@tonic-gate  * L_Key alloc flags
210*7c478bd9Sstevel@tonic-gate  */
211*7c478bd9Sstevel@tonic-gate typedef enum ibt_lkey_flags_e {
212*7c478bd9Sstevel@tonic-gate 	IBT_KEY_NO_FLAGS	= 0,
213*7c478bd9Sstevel@tonic-gate 	IBT_KEY_REMOTE		= (1 << 0)
214*7c478bd9Sstevel@tonic-gate } ibt_lkey_flags_t;
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate /*
217*7c478bd9Sstevel@tonic-gate  *  RNR NAK retry counts.
218*7c478bd9Sstevel@tonic-gate  */
219*7c478bd9Sstevel@tonic-gate typedef enum ibt_rnr_retry_cnt_e {
220*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NO_RETRY	= 0x0,	/* Don't retry, fail on first timeout */
221*7c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_1		= 0x1,	/* Retry once */
222*7c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_2		= 0x2,	/* Retry twice */
223*7c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_3		= 0x3,	/* Retry three times */
224*7c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_4		= 0x4,	/* Retry four times */
225*7c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_5		= 0x5,	/* Retry five times */
226*7c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_6		= 0x6,	/* Retry six times */
227*7c478bd9Sstevel@tonic-gate 	IBT_RNR_INFINITE_RETRY	= 0x7	/* Retry forever */
228*7c478bd9Sstevel@tonic-gate } ibt_rnr_retry_cnt_t;
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate /*
231*7c478bd9Sstevel@tonic-gate  * Valid values for RNR NAK timer fields, part of a channel's context.
232*7c478bd9Sstevel@tonic-gate  */
233*7c478bd9Sstevel@tonic-gate typedef enum ibt_rnr_nak_time_e {
234*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_655ms	= 0x0,
235*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_10us	= 0x1,
236*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_20us	= 0x2,
237*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_30us	= 0x3,
238*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_40us	= 0x4,
239*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_60us	= 0x5,
240*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_80us	= 0x6,
241*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_120us	= 0x7,
242*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_160us	= 0x8,
243*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_240us	= 0x9,
244*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_320us	= 0xA,
245*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_480us	= 0xB,
246*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_640us	= 0xC,
247*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_960us	= 0xD,
248*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_1280us	= 0xE,
249*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_1920us	= 0xF,
250*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_2560us	= 0x10,
251*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_3840us	= 0x11,
252*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_5120us	= 0x12,
253*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_7680us	= 0x13,
254*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_10ms	= 0x14,
255*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_15ms	= 0x15,
256*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_20ms	= 0x16,
257*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_31ms	= 0x17,
258*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_41ms	= 0x18,
259*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_61ms	= 0x19,
260*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_82ms	= 0x1A,
261*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_123ms	= 0x1B,
262*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_164ms	= 0x1C,
263*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_246ms	= 0x1D,
264*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_328ms	= 0x1E,
265*7c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_492ms	= 0x1F
266*7c478bd9Sstevel@tonic-gate } ibt_rnr_nak_time_t;
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate /*
269*7c478bd9Sstevel@tonic-gate  * The definition of HCA capabilities etc as a bitfield.
270*7c478bd9Sstevel@tonic-gate  */
271*7c478bd9Sstevel@tonic-gate typedef enum ibt_hca_flags_e {
272*7c478bd9Sstevel@tonic-gate 	IBT_HCA_NO_FLAGS	= 0,
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate 	IBT_HCA_RD		= 1 << 0,
275*7c478bd9Sstevel@tonic-gate 	IBT_HCA_UD_MULTICAST	= 1 << 1,
276*7c478bd9Sstevel@tonic-gate 	IBT_HCA_RAW_MULTICAST	= 1 << 2,
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate 	IBT_HCA_ATOMICS_HCA	= 1 << 3,
279*7c478bd9Sstevel@tonic-gate 	IBT_HCA_ATOMICS_GLOBAL	= 1 << 4,
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate 	IBT_HCA_RESIZE_CHAN	= 1 << 5,	/* Is resize supported? */
282*7c478bd9Sstevel@tonic-gate 	IBT_HCA_AUTO_PATH_MIG	= 1 << 6,	/* Is APM supported? */
283*7c478bd9Sstevel@tonic-gate 	IBT_HCA_SQD_SQD_PORT	= 1 << 7,	/* Can change physical port */
284*7c478bd9Sstevel@tonic-gate 						/* on transit from SQD to SQD */
285*7c478bd9Sstevel@tonic-gate 	IBT_HCA_PKEY_CNTR	= 1 << 8,
286*7c478bd9Sstevel@tonic-gate 	IBT_HCA_QKEY_CNTR	= 1 << 9,
287*7c478bd9Sstevel@tonic-gate 	IBT_HCA_AH_PORT_CHECK	= 1 << 10,	/* HCA checks AH port match */
288*7c478bd9Sstevel@tonic-gate 						/* in UD WRs */
289*7c478bd9Sstevel@tonic-gate 	IBT_HCA_PORT_UP		= 1 << 11,	/* PortActive event supported */
290*7c478bd9Sstevel@tonic-gate 	IBT_HCA_INIT_TYPE	= 1 << 12,	/* InitType supported */
291*7c478bd9Sstevel@tonic-gate 	IBT_HCA_SI_GUID		= 1 << 13,	/* System Image GUID */
292*7c478bd9Sstevel@tonic-gate 						/* supported */
293*7c478bd9Sstevel@tonic-gate 	IBT_HCA_SHUTDOWN_PORT	= 1 << 14,	/* ShutdownPort supported */
294*7c478bd9Sstevel@tonic-gate 	IBT_HCA_RNR_NAK		= 1 << 15,	/* RNR-NAK supported for RC */
295*7c478bd9Sstevel@tonic-gate 	IBT_HCA_CURRENT_QP_STATE = 1 << 16,	/* Does modify_qp support */
296*7c478bd9Sstevel@tonic-gate 						/* checking of current state? */
297*7c478bd9Sstevel@tonic-gate 	IBT_HCA_SRQ 		= 1 << 17,	/* Shared Receive Queue */
298*7c478bd9Sstevel@tonic-gate 	IBT_HCA_RESIZE_SRQ	= 1 << 18,	/* Is resize SRQ supported? */
299*7c478bd9Sstevel@tonic-gate 	IBT_HCA_BASE_MEM_MGT	= 1 << 19,	/* Base memory mgt supported? */
300*7c478bd9Sstevel@tonic-gate 	IBT_HCA_MULT_PAGE_SZ_MR	= 1 << 20,	/* Support of multiple page */
301*7c478bd9Sstevel@tonic-gate 						/* sizes per memory region? */
302*7c478bd9Sstevel@tonic-gate 	IBT_HCA_BLOCK_LIST	= 1 << 21,	/* Block list physical buffer */
303*7c478bd9Sstevel@tonic-gate 						/* lists supported? */
304*7c478bd9Sstevel@tonic-gate 	IBT_HCA_ZERO_BASED_VA	= 1 << 22,	/* Zero Based Virtual */
305*7c478bd9Sstevel@tonic-gate 						/* Addresses supported? */
306*7c478bd9Sstevel@tonic-gate 	IBT_HCA_LOCAL_INVAL_FENCE = 1 << 23,	/* Local invalidate fencing? */
307*7c478bd9Sstevel@tonic-gate 	IBT_HCA_BASE_QUEUE_MGT	= 1 << 24,	/* Base Queue Mgt supported? */
308*7c478bd9Sstevel@tonic-gate 	IBT_HCA_CKSUM_FULL	= 1 << 25,	/* Checksum offload supported */
309*7c478bd9Sstevel@tonic-gate 	IBT_HCA_MEM_WIN_TYPE_2B	= 1 << 26,	/* Type 2B memory windows */
310*7c478bd9Sstevel@tonic-gate 	IBT_HCA_PHYS_BUF_BLOCK	= 1 << 27	/* Block mode phys buf lists */
311*7c478bd9Sstevel@tonic-gate } ibt_hca_flags_t;
312*7c478bd9Sstevel@tonic-gate 
313*7c478bd9Sstevel@tonic-gate /*
314*7c478bd9Sstevel@tonic-gate  * The definition of HCA page size capabilities as a bitfield
315*7c478bd9Sstevel@tonic-gate  */
316*7c478bd9Sstevel@tonic-gate typedef enum ibt_page_sizes_e {
317*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_4K		= 0x1 << 2,
318*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_8K		= 0x1 << 3,
319*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_16K		= 0x1 << 4,
320*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_32K		= 0x1 << 5,
321*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_64K		= 0x1 << 6,
322*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_128K		= 0x1 << 7,
323*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_256K		= 0x1 << 8,
324*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_512K		= 0x1 << 9,
325*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_1M		= 0x1 << 10,
326*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_2M		= 0x1 << 11,
327*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_4M		= 0x1 << 12,
328*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_8M		= 0x1 << 13,
329*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_16M		= 0x1 << 14,
330*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_32M		= 0x1 << 15,
331*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_64M		= 0x1 << 16,
332*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_128M		= 0x1 << 17,
333*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_256M		= 0x1 << 18,
334*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_512M		= 0x1 << 19,
335*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_1G		= 0x1 << 20,
336*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_2G		= 0x1 << 21,
337*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_4G		= 0x1 << 22,
338*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_8G		= 0x1 << 23,
339*7c478bd9Sstevel@tonic-gate 	IBT_PAGE_16G		= 0x1 << 24
340*7c478bd9Sstevel@tonic-gate } ibt_page_sizes_t;
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate /*
343*7c478bd9Sstevel@tonic-gate  * Memory Window Type.
344*7c478bd9Sstevel@tonic-gate  */
345*7c478bd9Sstevel@tonic-gate typedef enum ibt_mem_win_type_e {
346*7c478bd9Sstevel@tonic-gate 	IBT_MEM_WIN_TYPE_NOT_DEFINED	= 0,
347*7c478bd9Sstevel@tonic-gate 	IBT_MEM_WIN_TYPE_1		= (1 << 0),
348*7c478bd9Sstevel@tonic-gate 	IBT_MEM_WIN_TYPE_2		= (1 << 1)
349*7c478bd9Sstevel@tonic-gate } ibt_mem_win_type_t;
350*7c478bd9Sstevel@tonic-gate 
351*7c478bd9Sstevel@tonic-gate /*
352*7c478bd9Sstevel@tonic-gate  * HCA attributes.
353*7c478bd9Sstevel@tonic-gate  * Contains all HCA static attributes.
354*7c478bd9Sstevel@tonic-gate  */
355*7c478bd9Sstevel@tonic-gate typedef struct ibt_hca_attr_s {
356*7c478bd9Sstevel@tonic-gate 	ibt_hca_flags_t	hca_flags;		/* HCA capabilities etc */
357*7c478bd9Sstevel@tonic-gate 
358*7c478bd9Sstevel@tonic-gate 	/* device/version inconsistency w/ NodeInfo and IOControllerProfile */
359*7c478bd9Sstevel@tonic-gate 	uint32_t	hca_vendor_id:24;	/* 24 bit Vendor ID */
360*7c478bd9Sstevel@tonic-gate 	uint16_t	hca_device_id;
361*7c478bd9Sstevel@tonic-gate 	uint32_t	hca_version_id;
362*7c478bd9Sstevel@tonic-gate 
363*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_chans;		/* Max Chans supported */
364*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_chan_sz;	/* Max outstanding WRs on any */
365*7c478bd9Sstevel@tonic-gate 						/* channel */
366*7c478bd9Sstevel@tonic-gate 
367*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_sgl;		/* Max SGL entries per WR */
368*7c478bd9Sstevel@tonic-gate 
369*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_cq;		/* Max num of CQs supported  */
370*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_cq_sz;		/* Max capacity of each CQ */
371*7c478bd9Sstevel@tonic-gate 
372*7c478bd9Sstevel@tonic-gate 	ibt_page_sizes_t	hca_page_sz;	/* Bit mask of page sizes */
373*7c478bd9Sstevel@tonic-gate 
374*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_memr;		/* Max num of HCA mem regions */
375*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	hca_max_memr_len;	/* Largest block, in bytes of */
376*7c478bd9Sstevel@tonic-gate 						/* mem that can be registered */
377*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_mem_win;	/* Max Memory windows in HCA */
378*7c478bd9Sstevel@tonic-gate 
379*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_rsc; 		/* Max Responder Resources of */
380*7c478bd9Sstevel@tonic-gate 						/* this HCA for RDMAR/Atomics */
381*7c478bd9Sstevel@tonic-gate 						/* with this HCA as target. */
382*7c478bd9Sstevel@tonic-gate 	uint8_t		hca_max_rdma_in_chan;	/* Max RDMAR/Atomics in per */
383*7c478bd9Sstevel@tonic-gate 						/* chan this HCA as target. */
384*7c478bd9Sstevel@tonic-gate 	uint8_t		hca_max_rdma_out_chan;	/* Max RDMA Reads/Atomics out */
385*7c478bd9Sstevel@tonic-gate 						/* per channel by this HCA */
386*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_ipv6_chan;	/* Max IPV6 channels in HCA */
387*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_ether_chan;	/* Max Ether channels in HCA */
388*7c478bd9Sstevel@tonic-gate 
389*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_mcg_chans;	/* Max number of channels */
390*7c478bd9Sstevel@tonic-gate 						/* that can join multicast */
391*7c478bd9Sstevel@tonic-gate 						/* groups */
392*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_mcg;		/* Max multicast groups */
393*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_chan_per_mcg;	/* Max number of channels per */
394*7c478bd9Sstevel@tonic-gate 						/* Multicast group in HCA */
395*7c478bd9Sstevel@tonic-gate 
396*7c478bd9Sstevel@tonic-gate 	uint16_t	hca_max_partitions;	/* Max partitions in HCA */
397*7c478bd9Sstevel@tonic-gate 	uint8_t		hca_nports;		/* Number of physical ports */
398*7c478bd9Sstevel@tonic-gate 	ib_guid_t	hca_node_guid;		/* Node GUID */
399*7c478bd9Sstevel@tonic-gate 
400*7c478bd9Sstevel@tonic-gate 	ib_time_t	hca_local_ack_delay;
401*7c478bd9Sstevel@tonic-gate 
402*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_port_sgid_tbl_sz;
403*7c478bd9Sstevel@tonic-gate 	uint16_t	hca_max_port_pkey_tbl_sz;
404*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_pd;		/* Max# of Protection Domains */
405*7c478bd9Sstevel@tonic-gate 	ib_guid_t	hca_si_guid;		/* Optional System Image GUID */
406*7c478bd9Sstevel@tonic-gate 	uint_t		hca_hca_max_ci_priv_sz;
407*7c478bd9Sstevel@tonic-gate 	uint_t		hca_chan_max_ci_priv_sz;
408*7c478bd9Sstevel@tonic-gate 	uint_t		hca_cq_max_ci_priv_sz;
409*7c478bd9Sstevel@tonic-gate 	uint_t		hca_pd_max_ci_priv_sz;
410*7c478bd9Sstevel@tonic-gate 	uint_t		hca_mr_max_ci_priv_sz;
411*7c478bd9Sstevel@tonic-gate 	uint_t		hca_mw_max_ci_priv_sz;
412*7c478bd9Sstevel@tonic-gate 	uint_t		hca_ud_dest_max_ci_priv_sz;
413*7c478bd9Sstevel@tonic-gate 	uint_t		hca_cq_sched_max_ci_priv_sz;
414*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_ud_dest;
415*7c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque2;
416*7c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque3;
417*7c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque4;
418*7c478bd9Sstevel@tonic-gate 	uint8_t		hca_opaque5;
419*7c478bd9Sstevel@tonic-gate 	uint8_t		hca_opaque6;
420*7c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque7;
421*7c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque8;
422*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_srqs;		/* Max SRQs supported */
423*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_srqs_sz;	/* Max outstanding WRs on any */
424*7c478bd9Sstevel@tonic-gate 						/* SRQ */
425*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_srq_sgl;	/* Max SGL entries per SRQ WR */
426*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_phys_buf_list_sz;
427*7c478bd9Sstevel@tonic-gate 	size_t		hca_block_sz_lo;	/* Range of block sizes */
428*7c478bd9Sstevel@tonic-gate 	size_t		hca_block_sz_hi;	/* supported by the HCA */
429*7c478bd9Sstevel@tonic-gate 	uint_t		hca_max_cq_handlers;
430*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t	hca_reserved_lkey;
431*7c478bd9Sstevel@tonic-gate } ibt_hca_attr_t;
432*7c478bd9Sstevel@tonic-gate 
433*7c478bd9Sstevel@tonic-gate /*
434*7c478bd9Sstevel@tonic-gate  * HCA Port link states.
435*7c478bd9Sstevel@tonic-gate  */
436*7c478bd9Sstevel@tonic-gate typedef enum ibt_port_state_e {
437*7c478bd9Sstevel@tonic-gate 	IBT_PORT_DOWN	= 1,
438*7c478bd9Sstevel@tonic-gate 	IBT_PORT_INIT,
439*7c478bd9Sstevel@tonic-gate 	IBT_PORT_ARM,
440*7c478bd9Sstevel@tonic-gate 	IBT_PORT_ACTIVE
441*7c478bd9Sstevel@tonic-gate } ibt_port_state_t;
442*7c478bd9Sstevel@tonic-gate 
443*7c478bd9Sstevel@tonic-gate /*
444*7c478bd9Sstevel@tonic-gate  * HCA Port capabilities as a bitfield.
445*7c478bd9Sstevel@tonic-gate  */
446*7c478bd9Sstevel@tonic-gate typedef enum ibt_port_caps_e {
447*7c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_NO_FLAGS		= 0,
448*7c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_SM			= 1 << 0,	/* SM port */
449*7c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_SM_DISABLED	= 1 << 1,
450*7c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_SNMP_TUNNEL	= 1 << 2,	/* SNMP Tunneling */
451*7c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_DM			= 1 << 3,	/* DM supported */
452*7c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_VENDOR		= 1 << 4	/* Vendor Class */
453*7c478bd9Sstevel@tonic-gate } ibt_port_caps_t;
454*7c478bd9Sstevel@tonic-gate 
455*7c478bd9Sstevel@tonic-gate 
456*7c478bd9Sstevel@tonic-gate /*
457*7c478bd9Sstevel@tonic-gate  * HCA port attributes structure definition. The number of ports per HCA
458*7c478bd9Sstevel@tonic-gate  * can be found from the "ibt_hca_attr_t" structure.
459*7c478bd9Sstevel@tonic-gate  *
460*7c478bd9Sstevel@tonic-gate  * p_pkey_tbl is a pointer to an array of ib_pkey_t, members are
461*7c478bd9Sstevel@tonic-gate  * accessed as:
462*7c478bd9Sstevel@tonic-gate  *		hca_portinfo->p_pkey_tbl[i]
463*7c478bd9Sstevel@tonic-gate  *
464*7c478bd9Sstevel@tonic-gate  * Where 0 <= i < hca_portinfo.p_pkey_tbl_sz
465*7c478bd9Sstevel@tonic-gate  *
466*7c478bd9Sstevel@tonic-gate  * Similarly p_sgid_tbl is a pointer to an array of ib_gid_t.
467*7c478bd9Sstevel@tonic-gate  *
468*7c478bd9Sstevel@tonic-gate  * The Query Port function - ibt_query_hca_ports() allocates the memory
469*7c478bd9Sstevel@tonic-gate  * required for the ibt_hca_portinfo_t struct as well as the memory
470*7c478bd9Sstevel@tonic-gate  * required for the SGID and P_Key tables. The memory is freed by calling
471*7c478bd9Sstevel@tonic-gate  * ibt_free_portinfo().
472*7c478bd9Sstevel@tonic-gate  */
473*7c478bd9Sstevel@tonic-gate typedef struct ibt_hca_portinfo_s {
474*7c478bd9Sstevel@tonic-gate 	ib_lid_t		p_opaque1;	/* Base LID of port */
475*7c478bd9Sstevel@tonic-gate 	ib_qkey_cntr_t		p_qkey_violations; /* Bad Q_Key cnt */
476*7c478bd9Sstevel@tonic-gate 	ib_pkey_cntr_t		p_pkey_violations; /* Optional bad P_Key cnt */
477*7c478bd9Sstevel@tonic-gate 	uint8_t			p_sm_sl:4;	/* SM Service level */
478*7c478bd9Sstevel@tonic-gate 	ib_lid_t		p_sm_lid;	/* SM LID */
479*7c478bd9Sstevel@tonic-gate 	ibt_port_state_t	p_linkstate;	/* Port state */
480*7c478bd9Sstevel@tonic-gate 	uint8_t			p_port_num;
481*7c478bd9Sstevel@tonic-gate 	ib_mtu_t		p_mtu;		/* Max transfer unit - pkt */
482*7c478bd9Sstevel@tonic-gate 	uint8_t			p_lmc:3;	/* Local mask control */
483*7c478bd9Sstevel@tonic-gate 	ib_gid_t		*p_sgid_tbl;	/* SGID Table */
484*7c478bd9Sstevel@tonic-gate 	uint_t			p_sgid_tbl_sz;	/* Size of SGID table */
485*7c478bd9Sstevel@tonic-gate 	uint16_t		p_pkey_tbl_sz;	/* Size of P_Key table */
486*7c478bd9Sstevel@tonic-gate 	uint16_t		p_def_pkey_ix;	/* default pkey index for TI */
487*7c478bd9Sstevel@tonic-gate 	ib_pkey_t		*p_pkey_tbl;	/* P_Key table */
488*7c478bd9Sstevel@tonic-gate 	uint8_t			p_max_vl;	/* Max num of virtual lanes */
489*7c478bd9Sstevel@tonic-gate 	uint8_t			p_init_type_reply; /* Optional InitTypeReply */
490*7c478bd9Sstevel@tonic-gate 	ib_time_t		p_subnet_timeout; /* Max Subnet Timeout */
491*7c478bd9Sstevel@tonic-gate 	ibt_port_caps_t		p_capabilities;	/* Port Capabilities */
492*7c478bd9Sstevel@tonic-gate 	uint32_t		p_msg_sz;	/* Max message size */
493*7c478bd9Sstevel@tonic-gate } ibt_hca_portinfo_t;
494*7c478bd9Sstevel@tonic-gate 
495*7c478bd9Sstevel@tonic-gate /*
496*7c478bd9Sstevel@tonic-gate  * Modify HCA port attributes flags, specifies which HCA port
497*7c478bd9Sstevel@tonic-gate  * attributes to modify.
498*7c478bd9Sstevel@tonic-gate  */
499*7c478bd9Sstevel@tonic-gate typedef enum ibt_port_modify_flags_e {
500*7c478bd9Sstevel@tonic-gate 	IBT_PORT_NO_FLAGS	= 0,
501*7c478bd9Sstevel@tonic-gate 
502*7c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_QKEY	= 1 << 0,	/* Reset Q_Key violation */
503*7c478bd9Sstevel@tonic-gate 						/* counter */
504*7c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_SM	= 1 << 1,	/* SM */
505*7c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_SM		= 1 << 2,
506*7c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_SNMP	= 1 << 3,	/* SNMP Tunneling */
507*7c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_SNMP	= 1 << 4,
508*7c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_DEVMGT	= 1 << 5,	/* Device Management */
509*7c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_DEVMGT	= 1 << 6,
510*7c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_VENDOR	= 1 << 7,	/* Vendor Class */
511*7c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_VENDOR	= 1 << 8,
512*7c478bd9Sstevel@tonic-gate 	IBT_PORT_SHUTDOWN	= 1 << 9,	/* Shut down the port */
513*7c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_INIT_TYPE	= 1 << 10	/* InitTypeReply value */
514*7c478bd9Sstevel@tonic-gate } ibt_port_modify_flags_t;
515*7c478bd9Sstevel@tonic-gate 
516*7c478bd9Sstevel@tonic-gate /*
517*7c478bd9Sstevel@tonic-gate  * Modify HCA port InitType bit definitions.
518*7c478bd9Sstevel@tonic-gate  */
519*7c478bd9Sstevel@tonic-gate #define	IBT_PINIT_NO_LOAD		0x1
520*7c478bd9Sstevel@tonic-gate #define	IBT_PINIT_PRESERVE_CONTENT	0x2
521*7c478bd9Sstevel@tonic-gate #define	IBT_PINIT_PRESERVE_PRESENCE	0x4
522*7c478bd9Sstevel@tonic-gate #define	IBT_PINIT_NO_RESUSCITATE	0x8
523*7c478bd9Sstevel@tonic-gate 
524*7c478bd9Sstevel@tonic-gate 
525*7c478bd9Sstevel@tonic-gate /*
526*7c478bd9Sstevel@tonic-gate  * Address vector definition.
527*7c478bd9Sstevel@tonic-gate  */
528*7c478bd9Sstevel@tonic-gate typedef struct ibt_adds_vect_s {
529*7c478bd9Sstevel@tonic-gate 	ib_gid_t	av_dgid;	/* IPV6 dest GID in GRH */
530*7c478bd9Sstevel@tonic-gate 	ib_gid_t	av_sgid;	/* SGID */
531*7c478bd9Sstevel@tonic-gate 	ibt_srate_t	av_srate;	/* Max static rate */
532*7c478bd9Sstevel@tonic-gate 	uint8_t		av_srvl:4;	/* Service level in LRH */
533*7c478bd9Sstevel@tonic-gate 	uint_t		av_flow:20;	/* 20 bit Flow Label */
534*7c478bd9Sstevel@tonic-gate 	uint8_t		av_tclass;	/* Traffic Class */
535*7c478bd9Sstevel@tonic-gate 	uint8_t		av_hop;		/* Hop Limit */
536*7c478bd9Sstevel@tonic-gate 	uint8_t		av_port_num;	/* Port number for UD */
537*7c478bd9Sstevel@tonic-gate 	boolean_t	av_opaque1;
538*7c478bd9Sstevel@tonic-gate 	ib_lid_t	av_opaque2;
539*7c478bd9Sstevel@tonic-gate 	ib_path_bits_t	av_opaque3;
540*7c478bd9Sstevel@tonic-gate 	uint32_t	av_opaque4;
541*7c478bd9Sstevel@tonic-gate } ibt_adds_vect_t;
542*7c478bd9Sstevel@tonic-gate 
543*7c478bd9Sstevel@tonic-gate typedef struct ibt_cep_path_s {
544*7c478bd9Sstevel@tonic-gate 	ibt_adds_vect_t	cep_adds_vect;		/* Address Vector */
545*7c478bd9Sstevel@tonic-gate 	uint16_t	cep_pkey_ix;		/* P_Key Index */
546*7c478bd9Sstevel@tonic-gate 	uint8_t		cep_hca_port_num;	/* Port number for connected */
547*7c478bd9Sstevel@tonic-gate 						/* channels.  A value of 0 */
548*7c478bd9Sstevel@tonic-gate 						/* indicates an invalid path */
549*7c478bd9Sstevel@tonic-gate 	ib_time_t	cep_cm_opaque1;
550*7c478bd9Sstevel@tonic-gate } ibt_cep_path_t;
551*7c478bd9Sstevel@tonic-gate 
552*7c478bd9Sstevel@tonic-gate /*
553*7c478bd9Sstevel@tonic-gate  * Channel Migration State.
554*7c478bd9Sstevel@tonic-gate  */
555*7c478bd9Sstevel@tonic-gate typedef enum ibt_cep_cmstate_e {
556*7c478bd9Sstevel@tonic-gate 	IBT_STATE_NOT_SUPPORTED	= 0,
557*7c478bd9Sstevel@tonic-gate 	IBT_STATE_MIGRATED	= 1,
558*7c478bd9Sstevel@tonic-gate 	IBT_STATE_REARMED	= 2,
559*7c478bd9Sstevel@tonic-gate 	IBT_STATE_ARMED		= 3
560*7c478bd9Sstevel@tonic-gate } ibt_cep_cmstate_t;
561*7c478bd9Sstevel@tonic-gate 
562*7c478bd9Sstevel@tonic-gate /*
563*7c478bd9Sstevel@tonic-gate  * Transport service type
564*7c478bd9Sstevel@tonic-gate  *
565*7c478bd9Sstevel@tonic-gate  * NOTE: this was converted from an enum to a uint8_t to save space.
566*7c478bd9Sstevel@tonic-gate  */
567*7c478bd9Sstevel@tonic-gate typedef uint8_t ibt_tran_srv_t;
568*7c478bd9Sstevel@tonic-gate 
569*7c478bd9Sstevel@tonic-gate #define	IBT_RC_SRV		0
570*7c478bd9Sstevel@tonic-gate #define	IBT_UC_SRV		1
571*7c478bd9Sstevel@tonic-gate #define	IBT_RD_SRV		2
572*7c478bd9Sstevel@tonic-gate #define	IBT_UD_SRV		3
573*7c478bd9Sstevel@tonic-gate #define	IBT_RAWIP_SRV		4
574*7c478bd9Sstevel@tonic-gate #define	IBT_RAWETHER_SRV	5
575*7c478bd9Sstevel@tonic-gate 
576*7c478bd9Sstevel@tonic-gate /*
577*7c478bd9Sstevel@tonic-gate  * Channel (QP/EEC) state definitions.
578*7c478bd9Sstevel@tonic-gate  */
579*7c478bd9Sstevel@tonic-gate typedef enum ibt_cep_state_e {
580*7c478bd9Sstevel@tonic-gate 	IBT_STATE_RESET	= 0,		/* Reset */
581*7c478bd9Sstevel@tonic-gate 	IBT_STATE_INIT,			/* Initialized */
582*7c478bd9Sstevel@tonic-gate 	IBT_STATE_RTR,			/* Ready to Receive */
583*7c478bd9Sstevel@tonic-gate 	IBT_STATE_RTS,			/* Ready to Send */
584*7c478bd9Sstevel@tonic-gate 	IBT_STATE_SQD,			/* Send Queue Drained */
585*7c478bd9Sstevel@tonic-gate 	IBT_STATE_SQE,			/* Send Queue Error */
586*7c478bd9Sstevel@tonic-gate 	IBT_STATE_ERROR,		/* Error */
587*7c478bd9Sstevel@tonic-gate 	IBT_STATE_SQDRAIN,		/* Send Queue Draining */
588*7c478bd9Sstevel@tonic-gate 	IBT_STATE_NUM			/* Number of states */
589*7c478bd9Sstevel@tonic-gate } ibt_cep_state_t;
590*7c478bd9Sstevel@tonic-gate 
591*7c478bd9Sstevel@tonic-gate 
592*7c478bd9Sstevel@tonic-gate /*
593*7c478bd9Sstevel@tonic-gate  * Channel Attribute flags.
594*7c478bd9Sstevel@tonic-gate  */
595*7c478bd9Sstevel@tonic-gate typedef enum ibt_attr_flags_e {
596*7c478bd9Sstevel@tonic-gate 	IBT_ALL_SIGNALED	= 0,	/* All sends signaled */
597*7c478bd9Sstevel@tonic-gate 	IBT_WR_SIGNALED		= 1,	/* Signaled on a WR basis */
598*7c478bd9Sstevel@tonic-gate 	IBT_FAST_REG_RES_LKEY	= (1 << 1)
599*7c478bd9Sstevel@tonic-gate } ibt_attr_flags_t;
600*7c478bd9Sstevel@tonic-gate 
601*7c478bd9Sstevel@tonic-gate /*
602*7c478bd9Sstevel@tonic-gate  * Channel End Point (CEP) Control Flags.
603*7c478bd9Sstevel@tonic-gate  */
604*7c478bd9Sstevel@tonic-gate typedef enum ibt_cep_flags_e {
605*7c478bd9Sstevel@tonic-gate 	IBT_CEP_NO_FLAGS	= 0,		/* Enable Nothing */
606*7c478bd9Sstevel@tonic-gate 	IBT_CEP_RDMA_RD		= (1 << 0),	/* Enable incoming RDMA RD's */
607*7c478bd9Sstevel@tonic-gate 						/* RC & RD only */
608*7c478bd9Sstevel@tonic-gate 	IBT_CEP_RDMA_WR		= (1 << 1),	/* Enable incoming RDMA WR's */
609*7c478bd9Sstevel@tonic-gate 						/* RC & RD only */
610*7c478bd9Sstevel@tonic-gate 	IBT_CEP_ATOMIC		= (1 << 2)	/* Enable incoming Atomics, */
611*7c478bd9Sstevel@tonic-gate 						/* RC & RD only */
612*7c478bd9Sstevel@tonic-gate } ibt_cep_flags_t;
613*7c478bd9Sstevel@tonic-gate 
614*7c478bd9Sstevel@tonic-gate /*
615*7c478bd9Sstevel@tonic-gate  * Channel Modify Flags
616*7c478bd9Sstevel@tonic-gate  *
617*7c478bd9Sstevel@tonic-gate  * These flags specify which attributes in either ibt_rc_chan_modify_attr_t or
618*7c478bd9Sstevel@tonic-gate  * ibt_ud_chan_modify_attr_t should be modified on an ibt_modify_rc_channel()
619*7c478bd9Sstevel@tonic-gate  * or ibt_modify_ud_channel() call.
620*7c478bd9Sstevel@tonic-gate  *
621*7c478bd9Sstevel@tonic-gate  *
622*7c478bd9Sstevel@tonic-gate  *	Flag			Comments
623*7c478bd9Sstevel@tonic-gate  *	----			--------
624*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_RDMA_R	Modify RDMA reads as indicated by the control
625*7c478bd9Sstevel@tonic-gate  *				ibt_cep_flags_t attribute (RC & RD only).
626*7c478bd9Sstevel@tonic-gate  *
627*7c478bd9Sstevel@tonic-gate  *				  IBT_CEP_RDMA_RD = 0 - Disable RDMA reads.
628*7c478bd9Sstevel@tonic-gate  *				  IBT_CEP_RDMA_RD = 1 - Enable RDMA reads.
629*7c478bd9Sstevel@tonic-gate  *
630*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_RDMA_W	Modify RDMA writes as indicated by the control
631*7c478bd9Sstevel@tonic-gate  *				ibt_cep_flags_t attribute (RC, UC & RD only).
632*7c478bd9Sstevel@tonic-gate  *
633*7c478bd9Sstevel@tonic-gate  *				  IBT_CEP_RDMA_WR = 0 - Disable RDMA writes.
634*7c478bd9Sstevel@tonic-gate  *				  IBT_CEP_RDMA_WR = 1 - Enable RDMA writes.
635*7c478bd9Sstevel@tonic-gate  *
636*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_ATOMIC	Modify atomic operations as indicated by the
637*7c478bd9Sstevel@tonic-gate  *				control ibt_cep_flags_t attribute
638*7c478bd9Sstevel@tonic-gate  *				(RC & RD only).
639*7c478bd9Sstevel@tonic-gate  *
640*7c478bd9Sstevel@tonic-gate  *				  IBT_CEP_ATOMIC = 0 - Disable atomics.
641*7c478bd9Sstevel@tonic-gate  *				  IBT_CEP_ATOMIC = 1 - Enable atomics.
642*7c478bd9Sstevel@tonic-gate  *
643*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_SQ_SIZE	Resize the maximum outstanding Work Requests
644*7c478bd9Sstevel@tonic-gate  *				on Send Queue.
645*7c478bd9Sstevel@tonic-gate  *
646*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_RQ_SIZE	Resize the maximum outstanding Work Requests
647*7c478bd9Sstevel@tonic-gate  *				on Receive Queue.
648*7c478bd9Sstevel@tonic-gate  *
649*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_ALT_PATH 	Modify Alternate Path Address Vector and HCA
650*7c478bd9Sstevel@tonic-gate  *				Port number (RC & UC only).
651*7c478bd9Sstevel@tonic-gate  *
652*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_ADDS_VECT	Modify Primary Path Address Vector information.
653*7c478bd9Sstevel@tonic-gate  *				(RC & UC Only).
654*7c478bd9Sstevel@tonic-gate  *
655*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_PORT	Modify Primary physical Port (RC, UC & UD only).
656*7c478bd9Sstevel@tonic-gate  *
657*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_RETRY	Modify Retry Count (RC only). This limits the
658*7c478bd9Sstevel@tonic-gate  *				number of times a requester can retry a request
659*7c478bd9Sstevel@tonic-gate  *				due to a Local ACK timeout or NAK-Sequence
660*7c478bd9Sstevel@tonic-gate  *				Error.
661*7c478bd9Sstevel@tonic-gate  *
662*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_RNR_NAK_RETRY	Modify RNR Retry Count (RC only). The
663*7c478bd9Sstevel@tonic-gate  *					RNR NAK retry counter limits the number
664*7c478bd9Sstevel@tonic-gate  *					of times a requester can retry a request
665*7c478bd9Sstevel@tonic-gate  *					that was RNR NAK'ed.
666*7c478bd9Sstevel@tonic-gate  *
667*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_MIN_RNR_NAK	Minimum RNR NAK timer field value
668*7c478bd9Sstevel@tonic-gate  *				(RC & RD only).
669*7c478bd9Sstevel@tonic-gate  *
670*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_QKEY	Modify Q_Key (UD & RD only).
671*7c478bd9Sstevel@tonic-gate  *
672*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_RDMARA_OUT	Modify Initiator depth, Number of outstanding
673*7c478bd9Sstevel@tonic-gate  *				RDMA Read/atomic operations at destination
674*7c478bd9Sstevel@tonic-gate  *				(RC Only).
675*7c478bd9Sstevel@tonic-gate  *
676*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_RDMARA_IN	Modify Responder Resources, Number of local
677*7c478bd9Sstevel@tonic-gate  *				RDMA Read/ atomic responder resources (RC Only).
678*7c478bd9Sstevel@tonic-gate  *
679*7c478bd9Sstevel@tonic-gate  *	IBT_CEP_SET_SQD_EVENT	Cause the SQD async event (only for RTS => SQD).
680*7c478bd9Sstevel@tonic-gate  *
681*7c478bd9Sstevel@tonic-gate  */
682*7c478bd9Sstevel@tonic-gate typedef enum ibt_cep_modify_flags_e {
683*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_NOTHING		= 0,
684*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_SQ_SIZE		= (1 << 1),
685*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RQ_SIZE		= (1 << 2),
686*7c478bd9Sstevel@tonic-gate 
687*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMA_R		= (1 << 3),
688*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMA_W		= (1 << 4),
689*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_ATOMIC		= (1 << 5),
690*7c478bd9Sstevel@tonic-gate 
691*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_ALT_PATH		= (1 << 6),	/* Alternate Path */
692*7c478bd9Sstevel@tonic-gate 
693*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_ADDS_VECT		= (1 << 7),
694*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_PORT		= (1 << 8),
695*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE5		= (1 << 9),
696*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RETRY		= (1 << 10),
697*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RNR_NAK_RETRY 	= (1 << 11),
698*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_MIN_RNR_NAK		= (1 << 12),
699*7c478bd9Sstevel@tonic-gate 
700*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_QKEY		= (1 << 13),
701*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMARA_OUT		= (1 << 14),
702*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMARA_IN		= (1 << 15),
703*7c478bd9Sstevel@tonic-gate 
704*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE1		= (1 << 16),
705*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE2		= (1 << 17),
706*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE3		= (1 << 18),
707*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE4		= (1 << 19),
708*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_SQD_EVENT		= (1 << 20),
709*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE6		= (1 << 21),
710*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE7		= (1 << 22),
711*7c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE8		= (1 << 23)
712*7c478bd9Sstevel@tonic-gate } ibt_cep_modify_flags_t;
713*7c478bd9Sstevel@tonic-gate 
714*7c478bd9Sstevel@tonic-gate /*
715*7c478bd9Sstevel@tonic-gate  * CQ notify types.
716*7c478bd9Sstevel@tonic-gate  */
717*7c478bd9Sstevel@tonic-gate typedef enum ibt_cq_notify_flags_e {
718*7c478bd9Sstevel@tonic-gate 	IBT_NEXT_COMPLETION	= 1,
719*7c478bd9Sstevel@tonic-gate 	IBT_NEXT_SOLICITED	= 2
720*7c478bd9Sstevel@tonic-gate } ibt_cq_notify_flags_t;
721*7c478bd9Sstevel@tonic-gate 
722*7c478bd9Sstevel@tonic-gate /*
723*7c478bd9Sstevel@tonic-gate  * CQ types shared across TI and CI.
724*7c478bd9Sstevel@tonic-gate  */
725*7c478bd9Sstevel@tonic-gate typedef enum ibt_cq_flags_e {
726*7c478bd9Sstevel@tonic-gate 	IBT_CQ_NO_FLAGS			= 0,
727*7c478bd9Sstevel@tonic-gate 	IBT_CQ_HANDLER_IN_THREAD	= 1 << 0,	/* A thread calls the */
728*7c478bd9Sstevel@tonic-gate 							/* CQ handler */
729*7c478bd9Sstevel@tonic-gate 	IBT_CQ_USER_MAP			= 1 << 1,
730*7c478bd9Sstevel@tonic-gate 	IBT_CQ_DEFER_ALLOC		= 1 << 2
731*7c478bd9Sstevel@tonic-gate } ibt_cq_flags_t;
732*7c478bd9Sstevel@tonic-gate 
733*7c478bd9Sstevel@tonic-gate /*
734*7c478bd9Sstevel@tonic-gate  * CQ types shared across TI and CI.
735*7c478bd9Sstevel@tonic-gate  */
736*7c478bd9Sstevel@tonic-gate typedef enum ibt_cq_sched_flags_e {
737*7c478bd9Sstevel@tonic-gate 	IBT_CQS_NO_FLAGS	= 0,
738*7c478bd9Sstevel@tonic-gate 	IBT_CQS_WARM_CACHE	= 1 << 0, /* run on same CPU */
739*7c478bd9Sstevel@tonic-gate 	IBT_CQS_AFFINITY	= 1 << 1,
740*7c478bd9Sstevel@tonic-gate 	IBT_CQS_SCHED_GROUP	= 1 << 2,
741*7c478bd9Sstevel@tonic-gate 	IBT_CQS_USER_MAP	= 1 << 3,
742*7c478bd9Sstevel@tonic-gate 	IBT_CQS_DEFER_ALLOC	= 1 << 4
743*7c478bd9Sstevel@tonic-gate } ibt_cq_sched_flags_t;
744*7c478bd9Sstevel@tonic-gate 
745*7c478bd9Sstevel@tonic-gate /*
746*7c478bd9Sstevel@tonic-gate  * Attributes when creating a Completion Queue.
747*7c478bd9Sstevel@tonic-gate  *
748*7c478bd9Sstevel@tonic-gate  * Note:
749*7c478bd9Sstevel@tonic-gate  *	The IBT_CQ_HANDLER_IN_THREAD cq_flags bit should be ignored by the CI.
750*7c478bd9Sstevel@tonic-gate  */
751*7c478bd9Sstevel@tonic-gate typedef struct ibt_cq_attr_s {
752*7c478bd9Sstevel@tonic-gate 	uint_t			cq_size;
753*7c478bd9Sstevel@tonic-gate 	ibt_sched_hdl_t		cq_sched;	/* 0 = no hint, */
754*7c478bd9Sstevel@tonic-gate 						/* other = cq_sched value */
755*7c478bd9Sstevel@tonic-gate 	ibt_cq_flags_t		cq_flags;
756*7c478bd9Sstevel@tonic-gate } ibt_cq_attr_t;
757*7c478bd9Sstevel@tonic-gate 
758*7c478bd9Sstevel@tonic-gate /*
759*7c478bd9Sstevel@tonic-gate  * Memory Management
760*7c478bd9Sstevel@tonic-gate  */
761*7c478bd9Sstevel@tonic-gate 
762*7c478bd9Sstevel@tonic-gate /* Memory management flags */
763*7c478bd9Sstevel@tonic-gate typedef enum ibt_mr_flags_e {
764*7c478bd9Sstevel@tonic-gate 	IBT_MR_SLEEP			= 0,
765*7c478bd9Sstevel@tonic-gate 	IBT_MR_NOSLEEP			= (1 << 1),
766*7c478bd9Sstevel@tonic-gate 	IBT_MR_NONCOHERENT		= (1 << 2),
767*7c478bd9Sstevel@tonic-gate 	IBT_MR_PHYS_IOVA		= (1 << 3),  /* ibt_(re)register_buf */
768*7c478bd9Sstevel@tonic-gate 
769*7c478bd9Sstevel@tonic-gate 	/* Access control flags */
770*7c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_WINDOW_BIND	= (1 << 4),
771*7c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_LOCAL_WRITE	= (1 << 5),
772*7c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_REMOTE_READ	= (1 << 6),
773*7c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_REMOTE_WRITE	= (1 << 7),
774*7c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_REMOTE_ATOMIC	= (1 << 8),
775*7c478bd9Sstevel@tonic-gate 
776*7c478bd9Sstevel@tonic-gate 	/* Reregister flags */
777*7c478bd9Sstevel@tonic-gate 	IBT_MR_CHANGE_TRANSLATION	= (1 << 9),
778*7c478bd9Sstevel@tonic-gate 	IBT_MR_CHANGE_ACCESS		= (1 << 10),
779*7c478bd9Sstevel@tonic-gate 	IBT_MR_CHANGE_PD		= (1 << 11),
780*7c478bd9Sstevel@tonic-gate 
781*7c478bd9Sstevel@tonic-gate 	/* Additional registration flags */
782*7c478bd9Sstevel@tonic-gate 	IBT_MR_ZBVA			= (1 << 12),
783*7c478bd9Sstevel@tonic-gate 
784*7c478bd9Sstevel@tonic-gate 	/* Additional physical registration flags */
785*7c478bd9Sstevel@tonic-gate 	IBT_MR_CONSUMER_KEY		= (1 << 13)	/* Consumer owns key */
786*7c478bd9Sstevel@tonic-gate 							/* portion of keys */
787*7c478bd9Sstevel@tonic-gate } ibt_mr_flags_t;
788*7c478bd9Sstevel@tonic-gate 
789*7c478bd9Sstevel@tonic-gate 
790*7c478bd9Sstevel@tonic-gate /* Memory Region attribute flags */
791*7c478bd9Sstevel@tonic-gate typedef enum ibt_mr_attr_flags_e {
792*7c478bd9Sstevel@tonic-gate 	/* Access control flags */
793*7c478bd9Sstevel@tonic-gate 	IBT_MR_WINDOW_BIND		= (1 << 0),
794*7c478bd9Sstevel@tonic-gate 	IBT_MR_LOCAL_WRITE		= (1 << 1),
795*7c478bd9Sstevel@tonic-gate 	IBT_MR_REMOTE_READ		= (1 << 2),
796*7c478bd9Sstevel@tonic-gate 	IBT_MR_REMOTE_WRITE		= (1 << 3),
797*7c478bd9Sstevel@tonic-gate 	IBT_MR_REMOTE_ATOMIC		= (1 << 4),
798*7c478bd9Sstevel@tonic-gate 	IBT_MR_ZERO_BASED_VA		= (1 << 5),
799*7c478bd9Sstevel@tonic-gate 	IBT_MR_CONSUMER_OWNED_KEY	= (1 << 6),
800*7c478bd9Sstevel@tonic-gate 	IBT_MR_SHARED			= (1 << 7)
801*7c478bd9Sstevel@tonic-gate } ibt_mr_attr_flags_t;
802*7c478bd9Sstevel@tonic-gate 
803*7c478bd9Sstevel@tonic-gate /* Memory region physical descriptor. */
804*7c478bd9Sstevel@tonic-gate typedef struct ibt_phys_buf_s {
805*7c478bd9Sstevel@tonic-gate 	union {
806*7c478bd9Sstevel@tonic-gate 		uint64_t	_p_ll;		/* 64 bit DMA address */
807*7c478bd9Sstevel@tonic-gate 		uint32_t	_p_la[2];	/* 2 x 32 bit address */
808*7c478bd9Sstevel@tonic-gate 	} _phys_buf;
809*7c478bd9Sstevel@tonic-gate 	size_t	p_size;
810*7c478bd9Sstevel@tonic-gate } ibt_phys_buf_t;
811*7c478bd9Sstevel@tonic-gate 
812*7c478bd9Sstevel@tonic-gate #define	p_laddr		_phys_buf._p_ll
813*7c478bd9Sstevel@tonic-gate #ifdef	_LONG_LONG_HTOL
814*7c478bd9Sstevel@tonic-gate #define	p_notused	_phys_buf._p_la[0]
815*7c478bd9Sstevel@tonic-gate #define	p_addr		_phys_buf._p_la[1]
816*7c478bd9Sstevel@tonic-gate #else
817*7c478bd9Sstevel@tonic-gate #define	p_addr		_phys_buf._p_la[0]
818*7c478bd9Sstevel@tonic-gate #define	p_notused	_phys_buf._p_la[1]
819*7c478bd9Sstevel@tonic-gate #endif
820*7c478bd9Sstevel@tonic-gate 
821*7c478bd9Sstevel@tonic-gate 
822*7c478bd9Sstevel@tonic-gate /* Memory region descriptor. */
823*7c478bd9Sstevel@tonic-gate typedef struct ibt_mr_desc_s {
824*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	md_vaddr;	/* IB virtual adds of memory */
825*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t	md_lkey;
826*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t	md_rkey;
827*7c478bd9Sstevel@tonic-gate 	boolean_t	md_sync_required;
828*7c478bd9Sstevel@tonic-gate } ibt_mr_desc_t;
829*7c478bd9Sstevel@tonic-gate 
830*7c478bd9Sstevel@tonic-gate /* Physical Memory region descriptor. */
831*7c478bd9Sstevel@tonic-gate typedef struct ibt_pmr_desc_s {
832*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pmd_iova;	/* Returned I/O Virtual Address */
833*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t	pmd_lkey;
834*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t	pmd_rkey;
835*7c478bd9Sstevel@tonic-gate 	uint_t 		pmd_phys_buf_list_sz;	/* Allocated Phys buf sz */
836*7c478bd9Sstevel@tonic-gate 	boolean_t	pmd_sync_required;
837*7c478bd9Sstevel@tonic-gate } ibt_pmr_desc_t;
838*7c478bd9Sstevel@tonic-gate 
839*7c478bd9Sstevel@tonic-gate /* Memory region protection bounds. */
840*7c478bd9Sstevel@tonic-gate typedef struct ibt_mr_prot_bounds_s {
841*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pb_addr;	/* Beginning address */
842*7c478bd9Sstevel@tonic-gate 	size_t		pb_len;		/* Length of protected region */
843*7c478bd9Sstevel@tonic-gate } ibt_mr_prot_bounds_t;
844*7c478bd9Sstevel@tonic-gate 
845*7c478bd9Sstevel@tonic-gate /* Memory Region (Re)Register attributes */
846*7c478bd9Sstevel@tonic-gate typedef struct ibt_mr_attr_s {
847*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	mr_vaddr;	/* Virtual address to register */
848*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	mr_len;		/* Length of region to register */
849*7c478bd9Sstevel@tonic-gate 	struct as	*mr_as;		/* A pointer to an address space */
850*7c478bd9Sstevel@tonic-gate 					/* structure. This parameter should */
851*7c478bd9Sstevel@tonic-gate 					/* be set to NULL, which implies */
852*7c478bd9Sstevel@tonic-gate 					/* kernel address space. */
853*7c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t	mr_flags;
854*7c478bd9Sstevel@tonic-gate } ibt_mr_attr_t;
855*7c478bd9Sstevel@tonic-gate 
856*7c478bd9Sstevel@tonic-gate /* Physical Memory Region (Re)Register */
857*7c478bd9Sstevel@tonic-gate typedef struct ibt_pmr_attr_s {
858*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pmr_iova;	/* I/O virtual address requested by */
859*7c478bd9Sstevel@tonic-gate 					/* client for the first byte of the */
860*7c478bd9Sstevel@tonic-gate 					/* region */
861*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_len;	/* Length of region to register */
862*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_offset;	/* Offset of the regions starting */
863*7c478bd9Sstevel@tonic-gate 					/* IOVA within the 1st physical */
864*7c478bd9Sstevel@tonic-gate 					/* buffer */
865*7c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t	pmr_flags;
866*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t	pmr_lkey;	/* Reregister only */
867*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t	pmr_rkey;	/* Reregister only */
868*7c478bd9Sstevel@tonic-gate 	uint8_t		pmr_key;	/* Key to use on new Lkey & Rkey */
869*7c478bd9Sstevel@tonic-gate 	uint_t		pmr_num_buf;	/* Num of entries in the mr_buf_list */
870*7c478bd9Sstevel@tonic-gate 	ibt_phys_buf_t	*pmr_buf_list;	/* List of physical buffers accessed */
871*7c478bd9Sstevel@tonic-gate 					/* as an array */
872*7c478bd9Sstevel@tonic-gate } ibt_pmr_attr_t;
873*7c478bd9Sstevel@tonic-gate 
874*7c478bd9Sstevel@tonic-gate 
875*7c478bd9Sstevel@tonic-gate /*
876*7c478bd9Sstevel@tonic-gate  * Memory Region (Re)Register attributes - used by ibt_register_shared_mr(),
877*7c478bd9Sstevel@tonic-gate  * ibt_register_buf() and ibt_reregister_buf().
878*7c478bd9Sstevel@tonic-gate  */
879*7c478bd9Sstevel@tonic-gate typedef struct ibt_smr_attr_s {
880*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t		mr_vaddr;
881*7c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t		mr_flags;
882*7c478bd9Sstevel@tonic-gate 	uint8_t			mr_key;		/* Only for physical */
883*7c478bd9Sstevel@tonic-gate 						/* ibt_(Re)register_buf() */
884*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t		mr_lkey;	/* Only for physical */
885*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t		mr_rkey;	/* ibt_Reregister_buf() */
886*7c478bd9Sstevel@tonic-gate } ibt_smr_attr_t;
887*7c478bd9Sstevel@tonic-gate 
888*7c478bd9Sstevel@tonic-gate /*
889*7c478bd9Sstevel@tonic-gate  * key states.
890*7c478bd9Sstevel@tonic-gate  */
891*7c478bd9Sstevel@tonic-gate typedef enum ibt_key_state_e {
892*7c478bd9Sstevel@tonic-gate 	IBT_KEY_INVALID	= 0,
893*7c478bd9Sstevel@tonic-gate 	IBT_KEY_FREE,
894*7c478bd9Sstevel@tonic-gate 	IBT_KEY_VALID
895*7c478bd9Sstevel@tonic-gate } ibt_key_state_t;
896*7c478bd9Sstevel@tonic-gate 
897*7c478bd9Sstevel@tonic-gate /* Memory region query attributes */
898*7c478bd9Sstevel@tonic-gate typedef struct ibt_mr_query_attr_s {
899*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t		mr_lkey;
900*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t		mr_rkey;
901*7c478bd9Sstevel@tonic-gate 	ibt_mr_prot_bounds_t	mr_lbounds;	/* Actual local CI protection */
902*7c478bd9Sstevel@tonic-gate 						/* bounds */
903*7c478bd9Sstevel@tonic-gate 	ibt_mr_prot_bounds_t	mr_rbounds;	/* Actual remote CI */
904*7c478bd9Sstevel@tonic-gate 						/* protection bounds */
905*7c478bd9Sstevel@tonic-gate 	ibt_mr_attr_flags_t	mr_attr_flags;	/* Access rights etc. */
906*7c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		mr_pd;		/* Protection domain */
907*7c478bd9Sstevel@tonic-gate 	boolean_t		mr_sync_required;
908*7c478bd9Sstevel@tonic-gate 	ibt_key_state_t		mr_lkey_state;
909*7c478bd9Sstevel@tonic-gate 	uint_t			mr_phys_buf_list_sz;
910*7c478bd9Sstevel@tonic-gate } ibt_mr_query_attr_t;
911*7c478bd9Sstevel@tonic-gate 
912*7c478bd9Sstevel@tonic-gate /* Memory window query attributes */
913*7c478bd9Sstevel@tonic-gate typedef struct ibt_mw_query_attr_s {
914*7c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		mw_pd;
915*7c478bd9Sstevel@tonic-gate 	ibt_mem_win_type_t	mw_type;
916*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t		mw_rkey;
917*7c478bd9Sstevel@tonic-gate 	ibt_key_state_t		mw_state;
918*7c478bd9Sstevel@tonic-gate } ibt_mw_query_attr_t;
919*7c478bd9Sstevel@tonic-gate 
920*7c478bd9Sstevel@tonic-gate 
921*7c478bd9Sstevel@tonic-gate #define	IBT_SYNC_READ	0x1	/* Make memory changes visible to incoming */
922*7c478bd9Sstevel@tonic-gate 				/* RDMA reads */
923*7c478bd9Sstevel@tonic-gate 
924*7c478bd9Sstevel@tonic-gate #define	IBT_SYNC_WRITE	0x2	/* Make the affects of an incoming RDMA write */
925*7c478bd9Sstevel@tonic-gate 				/* visible to the consumer */
926*7c478bd9Sstevel@tonic-gate 
927*7c478bd9Sstevel@tonic-gate /* Memory region sync args */
928*7c478bd9Sstevel@tonic-gate typedef struct ibt_mr_sync_s {
929*7c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	ms_handle;
930*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	ms_vaddr;
931*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	ms_len;
932*7c478bd9Sstevel@tonic-gate 	uint32_t	ms_flags;	/* IBT_SYNC_READ or  IBT_SYNC_WRITE */
933*7c478bd9Sstevel@tonic-gate } ibt_mr_sync_t;
934*7c478bd9Sstevel@tonic-gate 
935*7c478bd9Sstevel@tonic-gate /*
936*7c478bd9Sstevel@tonic-gate  * Flags for Virtual Address to HCA Physical Address translation.
937*7c478bd9Sstevel@tonic-gate  */
938*7c478bd9Sstevel@tonic-gate typedef enum ibt_va_flags_e {
939*7c478bd9Sstevel@tonic-gate 	IBT_VA_NO_FLAGS		= 0
940*7c478bd9Sstevel@tonic-gate } ibt_va_flags_t;
941*7c478bd9Sstevel@tonic-gate 
942*7c478bd9Sstevel@tonic-gate 
943*7c478bd9Sstevel@tonic-gate /*  Address Translation parameters */
944*7c478bd9Sstevel@tonic-gate typedef struct ibt_va_attr_s {
945*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	va_vaddr;	/* Virtual address to register */
946*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	va_len;		/* Length of region to register */
947*7c478bd9Sstevel@tonic-gate 	struct as	*va_as;		/* A pointer to an address space */
948*7c478bd9Sstevel@tonic-gate 					/* structure. */
949*7c478bd9Sstevel@tonic-gate 	ibt_va_flags_t	va_flags;
950*7c478bd9Sstevel@tonic-gate } ibt_va_attr_t;
951*7c478bd9Sstevel@tonic-gate 
952*7c478bd9Sstevel@tonic-gate /*
953*7c478bd9Sstevel@tonic-gate  * WORK REQUEST AND WORK REQUEST COMPLETION DEFINITIONS.
954*7c478bd9Sstevel@tonic-gate  */
955*7c478bd9Sstevel@tonic-gate 
956*7c478bd9Sstevel@tonic-gate /*
957*7c478bd9Sstevel@tonic-gate  * Work Request and Work Request Completion types - These types are used
958*7c478bd9Sstevel@tonic-gate  *   to indicate the type of work requests posted to a work queue
959*7c478bd9Sstevel@tonic-gate  *   or the type of completion received.  Immediate Data is indicated via
960*7c478bd9Sstevel@tonic-gate  *   ibt_wr_flags_t or ibt_wc_flags_t.
961*7c478bd9Sstevel@tonic-gate  *
962*7c478bd9Sstevel@tonic-gate  *   IBT_WRC_RECV and IBT_WRC_RECV_RDMAWI are only used as opcodes in the
963*7c478bd9Sstevel@tonic-gate  *   work completions.
964*7c478bd9Sstevel@tonic-gate  *
965*7c478bd9Sstevel@tonic-gate  * NOTE: this was converted from an enum to a uint8_t to save space.
966*7c478bd9Sstevel@tonic-gate  */
967*7c478bd9Sstevel@tonic-gate typedef uint8_t ibt_wrc_opcode_t;
968*7c478bd9Sstevel@tonic-gate 
969*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_SEND		1	/* Send */
970*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_RDMAR		2	/* RDMA Read */
971*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_RDMAW		3	/* RDMA Write */
972*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_CSWAP		4	/* Compare & Swap Atomic */
973*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_FADD		5	/* Fetch & Add Atomic */
974*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_BIND		6	/* Bind Memory Window */
975*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_RECV		7	/* Receive */
976*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_RECV_RDMAWI	8	/* Received RDMA Write w/ Immediate */
977*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_FAST_REG_PMR	9	/* Fast Register Physical mem region */
978*7c478bd9Sstevel@tonic-gate #define	IBT_WRC_LOCAL_INVALIDATE 10
979*7c478bd9Sstevel@tonic-gate 
980*7c478bd9Sstevel@tonic-gate 
981*7c478bd9Sstevel@tonic-gate /*
982*7c478bd9Sstevel@tonic-gate  * Work Request Completion flags - These flags indicate what type
983*7c478bd9Sstevel@tonic-gate  *   of data is present in the Work Request Completion structure
984*7c478bd9Sstevel@tonic-gate  *
985*7c478bd9Sstevel@tonic-gate  *   IBT_WC_GRH_PRESENT 	- indicates that a Global Route Header was
986*7c478bd9Sstevel@tonic-gate  *				  received and inserted into the first 40
987*7c478bd9Sstevel@tonic-gate  *				  bytes of the buffer pointed to by the recv
988*7c478bd9Sstevel@tonic-gate  *				  SGL.
989*7c478bd9Sstevel@tonic-gate  *
990*7c478bd9Sstevel@tonic-gate  *   IBT_WC_IMMED_DATA_PRESENT	- indicates that the received request
991*7c478bd9Sstevel@tonic-gate  *				  contained immediate data.
992*7c478bd9Sstevel@tonic-gate  */
993*7c478bd9Sstevel@tonic-gate typedef uint8_t ibt_wc_flags_t;
994*7c478bd9Sstevel@tonic-gate 
995*7c478bd9Sstevel@tonic-gate #define	IBT_WC_NO_FLAGS			0
996*7c478bd9Sstevel@tonic-gate #define	IBT_WC_GRH_PRESENT		(1 << 0)
997*7c478bd9Sstevel@tonic-gate #define	IBT_WC_IMMED_DATA_PRESENT	(1 << 1)
998*7c478bd9Sstevel@tonic-gate #define	IBT_WC_RKEY_INVALIDATED		(1 << 2)
999*7c478bd9Sstevel@tonic-gate #define	IBT_WC_CKSUM_OK			(1 << 3)
1000*7c478bd9Sstevel@tonic-gate 
1001*7c478bd9Sstevel@tonic-gate 
1002*7c478bd9Sstevel@tonic-gate /*
1003*7c478bd9Sstevel@tonic-gate  * Work Request Completion - This structure encapsulates the information
1004*7c478bd9Sstevel@tonic-gate  *   necessary to define a work request completion.
1005*7c478bd9Sstevel@tonic-gate  *
1006*7c478bd9Sstevel@tonic-gate  *   wc_id 		- contains the work request ID of the completing WR.
1007*7c478bd9Sstevel@tonic-gate  *   wc_bytes_xfer 	- indicates the number of bytes transferred in the
1008*7c478bd9Sstevel@tonic-gate  *			  request.
1009*7c478bd9Sstevel@tonic-gate  *   wc_flags 		- Work Request Completion Flags, see ibt_wc_flags_t
1010*7c478bd9Sstevel@tonic-gate  *   wc_immed_data 	- Immediate Data.
1011*7c478bd9Sstevel@tonic-gate  *   wc_freed_rc	- indicates the freed resource count. Always valid
1012*7c478bd9Sstevel@tonic-gate  *			  regardless of the wc_status.
1013*7c478bd9Sstevel@tonic-gate  *   wc_type 		- indicates the type of WR completion
1014*7c478bd9Sstevel@tonic-gate  *			  (see ibt_wrc_opcode_t above).
1015*7c478bd9Sstevel@tonic-gate  *   wc_status		- indicates request completion status.
1016*7c478bd9Sstevel@tonic-gate  *   wc_sl		- Service Lane
1017*7c478bd9Sstevel@tonic-gate  *   wc_ethertype	- Ethertype, RawEther only.
1018*7c478bd9Sstevel@tonic-gate  */
1019*7c478bd9Sstevel@tonic-gate typedef struct ibt_wc_s {
1020*7c478bd9Sstevel@tonic-gate 	ibt_wrid_t		wc_id;		/* Work Request Id */
1021*7c478bd9Sstevel@tonic-gate 	uint64_t		wc_fma_ena;	/* fault management err data */
1022*7c478bd9Sstevel@tonic-gate 	ib_msglen_t		wc_bytes_xfer;	/* Number of Bytes */
1023*7c478bd9Sstevel@tonic-gate 						/* Transferred */
1024*7c478bd9Sstevel@tonic-gate 	ibt_wc_flags_t		wc_flags;	/* WR Completion Flags */
1025*7c478bd9Sstevel@tonic-gate 	ibt_wrc_opcode_t	wc_type;	/* Operation Type */
1026*7c478bd9Sstevel@tonic-gate 	uint16_t		wc_cksum;	/* payload checksum */
1027*7c478bd9Sstevel@tonic-gate 	ibt_immed_t		wc_immed_data;	/* Immediate Data */
1028*7c478bd9Sstevel@tonic-gate 	uint32_t		wc_freed_rc;	/* Freed Resource Count */
1029*7c478bd9Sstevel@tonic-gate 	ibt_wc_status_t		wc_status;	/* Completion Status */
1030*7c478bd9Sstevel@tonic-gate 	uint8_t			wc_sl:4;	/* Remote SL */
1031*7c478bd9Sstevel@tonic-gate 	uint16_t		wc_ethertype;	/* Ethertype Field - RE */
1032*7c478bd9Sstevel@tonic-gate 	ib_lid_t		wc_opaque1;
1033*7c478bd9Sstevel@tonic-gate 	uint16_t		wc_opaque2;
1034*7c478bd9Sstevel@tonic-gate 	ib_qpn_t		wc_qpn;		/* Source QPN Datagram only */
1035*7c478bd9Sstevel@tonic-gate 	ib_eecn_t		wc_opaque3;
1036*7c478bd9Sstevel@tonic-gate 	ib_qpn_t		wc_local_qpn;
1037*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t		wc_rkey;
1038*7c478bd9Sstevel@tonic-gate 	ib_path_bits_t		wc_opaque4;
1039*7c478bd9Sstevel@tonic-gate } ibt_wc_t;
1040*7c478bd9Sstevel@tonic-gate 
1041*7c478bd9Sstevel@tonic-gate 
1042*7c478bd9Sstevel@tonic-gate /*
1043*7c478bd9Sstevel@tonic-gate  * WR Flags. Common for both RC and UD
1044*7c478bd9Sstevel@tonic-gate  *
1045*7c478bd9Sstevel@tonic-gate  * NOTE: this was converted from an enum to a uint8_t to save space.
1046*7c478bd9Sstevel@tonic-gate  */
1047*7c478bd9Sstevel@tonic-gate typedef uint8_t ibt_wr_flags_t;
1048*7c478bd9Sstevel@tonic-gate 
1049*7c478bd9Sstevel@tonic-gate #define	IBT_WR_NO_FLAGS		0
1050*7c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_IMMED	(1 << 0)	/* Immediate Data Indicator */
1051*7c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_SIGNAL	(1 << 1)	/* Signaled, if set */
1052*7c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_FENCE	(1 << 2)	/* Fence Indicator */
1053*7c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_SOLICIT	(1 << 3)	/* Solicited Event Indicator */
1054*7c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_REMOTE_INVAL	(1 << 4) /* Remote Invalidate */
1055*7c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_CKSUM	(1 << 5)	/* Checksum offload Indicator */
1056*7c478bd9Sstevel@tonic-gate 
1057*7c478bd9Sstevel@tonic-gate /*
1058*7c478bd9Sstevel@tonic-gate  * Access control flags for Bind Memory Window operation,
1059*7c478bd9Sstevel@tonic-gate  * applicable for RC/UC/RD only.
1060*7c478bd9Sstevel@tonic-gate  *
1061*7c478bd9Sstevel@tonic-gate  * If IBT_WR_BIND_WRITE or IBT_WR_BIND_ATOMIC is desired then
1062*7c478bd9Sstevel@tonic-gate  * it is required that Memory Region should have Local Write Access.
1063*7c478bd9Sstevel@tonic-gate  */
1064*7c478bd9Sstevel@tonic-gate typedef enum ibt_bind_flags_e {
1065*7c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_READ	= (1 << 0),	/* enable remote read */
1066*7c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_WRITE	= (1 << 1),	/* enable remote write */
1067*7c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_ATOMIC	= (1 << 2),	/* enable remote atomics */
1068*7c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_ZBVA	= (1 << 3)	/* Zero Based Virtual Address */
1069*7c478bd9Sstevel@tonic-gate } ibt_bind_flags_t;
1070*7c478bd9Sstevel@tonic-gate 
1071*7c478bd9Sstevel@tonic-gate /*
1072*7c478bd9Sstevel@tonic-gate  * Data Segment for scatter-gather list
1073*7c478bd9Sstevel@tonic-gate  *
1074*7c478bd9Sstevel@tonic-gate  * SGL consists of an array of data segments and the length of the SGL.
1075*7c478bd9Sstevel@tonic-gate  */
1076*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_ds_s {
1077*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	ds_va;		/* Virtual Address */
1078*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t	ds_key;		/* L_Key */
1079*7c478bd9Sstevel@tonic-gate 	ib_msglen_t	ds_len;		/* Length of DS */
1080*7c478bd9Sstevel@tonic-gate } ibt_wr_ds_t;
1081*7c478bd9Sstevel@tonic-gate 
1082*7c478bd9Sstevel@tonic-gate /*
1083*7c478bd9Sstevel@tonic-gate  * Bind Memory Window WR
1084*7c478bd9Sstevel@tonic-gate  *
1085*7c478bd9Sstevel@tonic-gate  * WR ID from ibt_send_wr_t applies here too, SWG_0038 errata.
1086*7c478bd9Sstevel@tonic-gate  */
1087*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_bind_s {
1088*7c478bd9Sstevel@tonic-gate 	ibt_bind_flags_t	bind_flags;
1089*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t		bind_rkey;		/* Mem Window's R_key */
1090*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t		bind_lkey;		/* Mem Region's L_Key */
1091*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t		bind_rkey_out;		/* OUT: new R_Key */
1092*7c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t		bind_ibt_mr_hdl;	/* Mem Region handle */
1093*7c478bd9Sstevel@tonic-gate 	ibt_mw_hdl_t		bind_ibt_mw_hdl;	/* Mem Window handle */
1094*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t		bind_va;		/* Virtual Address */
1095*7c478bd9Sstevel@tonic-gate 	ib_memlen_t		bind_len;		/* Length of Window */
1096*7c478bd9Sstevel@tonic-gate } ibt_wr_bind_t;
1097*7c478bd9Sstevel@tonic-gate 
1098*7c478bd9Sstevel@tonic-gate /*
1099*7c478bd9Sstevel@tonic-gate  * Atomic WR
1100*7c478bd9Sstevel@tonic-gate  *
1101*7c478bd9Sstevel@tonic-gate  * Operation type (compare & swap or fetch & add) in ibt_wrc_opcode_t.
1102*7c478bd9Sstevel@tonic-gate  *
1103*7c478bd9Sstevel@tonic-gate  * A copy of the original contents of the remote memory will be stored
1104*7c478bd9Sstevel@tonic-gate  * in the local data segment described by wr_sgl within ibt_send_wr_t,
1105*7c478bd9Sstevel@tonic-gate  * and wr_nds should be set to 1.
1106*7c478bd9Sstevel@tonic-gate  *
1107*7c478bd9Sstevel@tonic-gate  * Atomic operation operands:
1108*7c478bd9Sstevel@tonic-gate  *   Compare & Swap Operation:
1109*7c478bd9Sstevel@tonic-gate  *	atom_arg1 - Compare Operand
1110*7c478bd9Sstevel@tonic-gate  *	atom_arg2 - Swap Operand
1111*7c478bd9Sstevel@tonic-gate  *
1112*7c478bd9Sstevel@tonic-gate  *   Fetch & Add Operation:
1113*7c478bd9Sstevel@tonic-gate  *	atom_arg1 - Add Operand
1114*7c478bd9Sstevel@tonic-gate  *	atom_arg2 - ignored
1115*7c478bd9Sstevel@tonic-gate  */
1116*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_atomic_s {
1117*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	atom_raddr;	/* Remote address. */
1118*7c478bd9Sstevel@tonic-gate 	ibt_atom_arg_t	atom_arg1;	/* operand #1 */
1119*7c478bd9Sstevel@tonic-gate 	ibt_atom_arg_t	atom_arg2;	/* operand #2 */
1120*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t	atom_rkey;	/* R_Key. */
1121*7c478bd9Sstevel@tonic-gate } ibt_wr_atomic_t;
1122*7c478bd9Sstevel@tonic-gate 
1123*7c478bd9Sstevel@tonic-gate /*
1124*7c478bd9Sstevel@tonic-gate  * RDMA WR
1125*7c478bd9Sstevel@tonic-gate  * Immediate Data indicator in ibt_wr_flags_t.
1126*7c478bd9Sstevel@tonic-gate  */
1127*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_rdma_s {
1128*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	rdma_raddr;	/* Remote address. */
1129*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t	rdma_rkey;	/* R_Key. */
1130*7c478bd9Sstevel@tonic-gate 	ibt_immed_t	rdma_immed;	/* Immediate Data */
1131*7c478bd9Sstevel@tonic-gate } ibt_wr_rdma_t;
1132*7c478bd9Sstevel@tonic-gate 
1133*7c478bd9Sstevel@tonic-gate /*
1134*7c478bd9Sstevel@tonic-gate  * Fast Register Physical Memory Region Work Request.
1135*7c478bd9Sstevel@tonic-gate  */
1136*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_reg_pmr_s {
1137*7c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pmr_iova;	/* I/O virtual address requested by */
1138*7c478bd9Sstevel@tonic-gate 					/* client for the first byte of the */
1139*7c478bd9Sstevel@tonic-gate 					/* region */
1140*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_len;	/* Length of region to register */
1141*7c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_offset;	/* Offset of the regions starting */
1142*7c478bd9Sstevel@tonic-gate 					/* IOVA within the 1st physical */
1143*7c478bd9Sstevel@tonic-gate 					/* buffer */
1144*7c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	pmr_mr_hdl;
1145*7c478bd9Sstevel@tonic-gate 	ibt_phys_buf_t	*pmr_buf_list;	/* List of physical buffers accessed */
1146*7c478bd9Sstevel@tonic-gate 					/* as an array */
1147*7c478bd9Sstevel@tonic-gate 	uint_t		pmr_num_buf;	/* Num of entries in the mr_buf_list */
1148*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t	pmr_lkey;
1149*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t	pmr_rkey;
1150*7c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t	pmr_flags;
1151*7c478bd9Sstevel@tonic-gate 	uint8_t		pmr_key;	/* Key to use on new Lkey & Rkey */
1152*7c478bd9Sstevel@tonic-gate } ibt_wr_reg_pmr_t;
1153*7c478bd9Sstevel@tonic-gate 
1154*7c478bd9Sstevel@tonic-gate /*
1155*7c478bd9Sstevel@tonic-gate  * Local Invalidate.
1156*7c478bd9Sstevel@tonic-gate  */
1157*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_li_s {
1158*7c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	li_mr_hdl;	/* Null for MW invalidates */
1159*7c478bd9Sstevel@tonic-gate 	ibt_mw_hdl_t	li_mw_hdl;	/* Null for MR invalidates */
1160*7c478bd9Sstevel@tonic-gate 	ibt_lkey_t	li_lkey;	/* Ignore for MW invalidates */
1161*7c478bd9Sstevel@tonic-gate 	ibt_rkey_t	li_rkey;
1162*7c478bd9Sstevel@tonic-gate } ibt_wr_li_t;
1163*7c478bd9Sstevel@tonic-gate 
1164*7c478bd9Sstevel@tonic-gate /*
1165*7c478bd9Sstevel@tonic-gate  * Reserved For Future Use.
1166*7c478bd9Sstevel@tonic-gate  * Raw IPv6 Send WR
1167*7c478bd9Sstevel@tonic-gate  */
1168*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_ripv6_s {
1169*7c478bd9Sstevel@tonic-gate 	ib_lid_t	rip_dlid;	/* DLID */
1170*7c478bd9Sstevel@tonic-gate 	ib_path_bits_t  rip_slid_bits;	/* SLID path bits, SWG_0033 errata */
1171*7c478bd9Sstevel@tonic-gate 	uint8_t		rip_sl:4;	/* SL */
1172*7c478bd9Sstevel@tonic-gate 	ibt_srate_t	rip_rate;	/* Max Static Rate, SWG_0007 errata */
1173*7c478bd9Sstevel@tonic-gate } ibt_wr_ripv6_t;
1174*7c478bd9Sstevel@tonic-gate 
1175*7c478bd9Sstevel@tonic-gate /*
1176*7c478bd9Sstevel@tonic-gate  * Reserved For Future Use.
1177*7c478bd9Sstevel@tonic-gate  * Raw Ethertype Send WR
1178*7c478bd9Sstevel@tonic-gate  */
1179*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_reth_s {
1180*7c478bd9Sstevel@tonic-gate 	ib_ethertype_t  reth_type;	/* Ethertype */
1181*7c478bd9Sstevel@tonic-gate 	ib_lid_t	reth_dlid;	/* DLID */
1182*7c478bd9Sstevel@tonic-gate 	ib_path_bits_t	reth_slid_bits;	/* SLID path bits, SWG_0033 errata */
1183*7c478bd9Sstevel@tonic-gate 	uint8_t		reth_sl:4;	/* SL */
1184*7c478bd9Sstevel@tonic-gate 	ibt_srate_t	reth_rate;	/* Max Static Rate, SWG_0007 errata */
1185*7c478bd9Sstevel@tonic-gate } ibt_wr_reth_t;
1186*7c478bd9Sstevel@tonic-gate 
1187*7c478bd9Sstevel@tonic-gate /*
1188*7c478bd9Sstevel@tonic-gate  * Reserved For future Use.
1189*7c478bd9Sstevel@tonic-gate  * RD Send WR, Operation type in ibt_wrc_opcode_t.
1190*7c478bd9Sstevel@tonic-gate  */
1191*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_rd_s {
1192*7c478bd9Sstevel@tonic-gate 	ibt_rd_dest_hdl_t	rdwr_dest_hdl;
1193*7c478bd9Sstevel@tonic-gate 	union {
1194*7c478bd9Sstevel@tonic-gate 	    ibt_immed_t		send_immed;	/* IBT_WRC_SEND */
1195*7c478bd9Sstevel@tonic-gate 	    ibt_wr_rdma_t	rdma;		/* IBT_WRC_RDMAR */
1196*7c478bd9Sstevel@tonic-gate 						/* IBT_WRC_RDMAW */
1197*7c478bd9Sstevel@tonic-gate 	    ibt_wr_li_t		*li;		/* IBT_WRC_LOCAL_INVALIDATE */
1198*7c478bd9Sstevel@tonic-gate 	    ibt_wr_atomic_t	*atomic;	/* IBT_WRC_FADD */
1199*7c478bd9Sstevel@tonic-gate 						/* IBT_WRC_CSWAP */
1200*7c478bd9Sstevel@tonic-gate 	    ibt_wr_bind_t	*bind;		/* IBT_WRC_BIND */
1201*7c478bd9Sstevel@tonic-gate 	    ibt_wr_reg_pmr_t	*reg_pmr;	/* IBT_WRC_FAST_REG_PMR */
1202*7c478bd9Sstevel@tonic-gate 	} rdwr;
1203*7c478bd9Sstevel@tonic-gate } ibt_wr_rd_t;
1204*7c478bd9Sstevel@tonic-gate 
1205*7c478bd9Sstevel@tonic-gate /*
1206*7c478bd9Sstevel@tonic-gate  * Reserved For Future Use.
1207*7c478bd9Sstevel@tonic-gate  * UC Send WR, Operation type in ibt_wrc_opcode_t, the only valid
1208*7c478bd9Sstevel@tonic-gate  * ones are:
1209*7c478bd9Sstevel@tonic-gate  *		IBT_WRC_SEND
1210*7c478bd9Sstevel@tonic-gate  *		IBT_WRC_RDMAW
1211*7c478bd9Sstevel@tonic-gate  *		IBT_WRC_BIND
1212*7c478bd9Sstevel@tonic-gate  */
1213*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_uc_s {
1214*7c478bd9Sstevel@tonic-gate 	union {
1215*7c478bd9Sstevel@tonic-gate 	    ibt_immed_t		send_immed;	/* IBT_WRC_SEND */
1216*7c478bd9Sstevel@tonic-gate 	    ibt_wr_rdma_t	rdma;		/* IBT_WRC_RDMAW */
1217*7c478bd9Sstevel@tonic-gate 	    ibt_wr_li_t		*li;		/* IBT_WRC_LOCAL_INVALIDATE */
1218*7c478bd9Sstevel@tonic-gate 	    ibt_wr_bind_t	*bind;		/* IBT_WRC_BIND */
1219*7c478bd9Sstevel@tonic-gate 	    ibt_wr_reg_pmr_t	*reg_pmr;	/* IBT_WRC_FAST_REG_PMR */
1220*7c478bd9Sstevel@tonic-gate 	} ucwr;
1221*7c478bd9Sstevel@tonic-gate } ibt_wr_uc_t;
1222*7c478bd9Sstevel@tonic-gate 
1223*7c478bd9Sstevel@tonic-gate /*
1224*7c478bd9Sstevel@tonic-gate  * RC Send WR, Operation type in ibt_wrc_opcode_t.
1225*7c478bd9Sstevel@tonic-gate  */
1226*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_rc_s {
1227*7c478bd9Sstevel@tonic-gate 	union {
1228*7c478bd9Sstevel@tonic-gate 	    ibt_immed_t		send_immed;	/* IBT_WRC_SEND w/ immediate */
1229*7c478bd9Sstevel@tonic-gate 	    ibt_rkey_t		send_inval;	/* IBT_WRC_SEND w/ invalidate */
1230*7c478bd9Sstevel@tonic-gate 	    ibt_wr_rdma_t	rdma;		/* IBT_WRC_RDMAR */
1231*7c478bd9Sstevel@tonic-gate 						/* IBT_WRC_RDMAW */
1232*7c478bd9Sstevel@tonic-gate 	    ibt_wr_li_t		*li;		/* IBT_WRC_LOCAL_INVALIDATE */
1233*7c478bd9Sstevel@tonic-gate 	    ibt_wr_atomic_t	*atomic;	/* IBT_WRC_CSWAP */
1234*7c478bd9Sstevel@tonic-gate 						/* IBT_WRC_FADD */
1235*7c478bd9Sstevel@tonic-gate 	    ibt_wr_bind_t	*bind;		/* IBT_WRC_BIND */
1236*7c478bd9Sstevel@tonic-gate 	    ibt_wr_reg_pmr_t	*reg_pmr;	/* IBT_WRC_FAST_REG_PMR */
1237*7c478bd9Sstevel@tonic-gate 	} rcwr;
1238*7c478bd9Sstevel@tonic-gate } ibt_wr_rc_t;
1239*7c478bd9Sstevel@tonic-gate 
1240*7c478bd9Sstevel@tonic-gate /*
1241*7c478bd9Sstevel@tonic-gate  * UD Send WR, the only valid Operation is IBT_WRC_SEND.
1242*7c478bd9Sstevel@tonic-gate  */
1243*7c478bd9Sstevel@tonic-gate typedef struct ibt_wr_ud_s {
1244*7c478bd9Sstevel@tonic-gate 	ibt_immed_t		udwr_immed;
1245*7c478bd9Sstevel@tonic-gate 	ibt_ud_dest_hdl_t	udwr_dest;
1246*7c478bd9Sstevel@tonic-gate } ibt_wr_ud_t;
1247*7c478bd9Sstevel@tonic-gate 
1248*7c478bd9Sstevel@tonic-gate /*
1249*7c478bd9Sstevel@tonic-gate  * Send Work Request (WR) attributes structure.
1250*7c478bd9Sstevel@tonic-gate  *
1251*7c478bd9Sstevel@tonic-gate  * Operation type in ibt_wrc_opcode_t.
1252*7c478bd9Sstevel@tonic-gate  * Immediate Data indicator in ibt_wr_flags_t.
1253*7c478bd9Sstevel@tonic-gate  */
1254*7c478bd9Sstevel@tonic-gate typedef struct ibt_send_wr_s {
1255*7c478bd9Sstevel@tonic-gate 	ibt_wrid_t		wr_id;		/* WR ID */
1256*7c478bd9Sstevel@tonic-gate 	ibt_wr_flags_t		wr_flags;	/* Work Request Flags. */
1257*7c478bd9Sstevel@tonic-gate 	ibt_tran_srv_t		wr_trans;	/* Transport Type. */
1258*7c478bd9Sstevel@tonic-gate 	ibt_wrc_opcode_t	wr_opcode;	/* Operation Type. */
1259*7c478bd9Sstevel@tonic-gate 	uint8_t			wr_rsvd;	/* maybe later */
1260*7c478bd9Sstevel@tonic-gate 	uint32_t		wr_nds;		/* Number of data segments */
1261*7c478bd9Sstevel@tonic-gate 						/* pointed to by wr_sgl */
1262*7c478bd9Sstevel@tonic-gate 	ibt_wr_ds_t		*wr_sgl;	/* SGL */
1263*7c478bd9Sstevel@tonic-gate 	union {
1264*7c478bd9Sstevel@tonic-gate 		ibt_wr_ud_t	ud;
1265*7c478bd9Sstevel@tonic-gate 		ibt_wr_rc_t	rc;
1266*7c478bd9Sstevel@tonic-gate 		ibt_wr_rd_t	rd;	/* Reserved For Future Use */
1267*7c478bd9Sstevel@tonic-gate 		ibt_wr_uc_t	uc;	/* Reserved For Future Use */
1268*7c478bd9Sstevel@tonic-gate 		ibt_wr_reth_t	reth;	/* Reserved For Future Use */
1269*7c478bd9Sstevel@tonic-gate 		ibt_wr_ripv6_t	ripv6;	/* Reserved For Future Use */
1270*7c478bd9Sstevel@tonic-gate 	} wr;				/* operation specific */
1271*7c478bd9Sstevel@tonic-gate } ibt_send_wr_t;
1272*7c478bd9Sstevel@tonic-gate 
1273*7c478bd9Sstevel@tonic-gate /*
1274*7c478bd9Sstevel@tonic-gate  * Receive Work Request (WR) attributes structure.
1275*7c478bd9Sstevel@tonic-gate  */
1276*7c478bd9Sstevel@tonic-gate typedef struct ibt_recv_wr_s {
1277*7c478bd9Sstevel@tonic-gate 	ibt_wrid_t		wr_id;		/* WR ID */
1278*7c478bd9Sstevel@tonic-gate 	uint32_t		wr_nds;		/* number of data segments */
1279*7c478bd9Sstevel@tonic-gate 						/* pointed to by wr_sgl */
1280*7c478bd9Sstevel@tonic-gate 	ibt_wr_ds_t		*wr_sgl;	/* SGL */
1281*7c478bd9Sstevel@tonic-gate } ibt_recv_wr_t;
1282*7c478bd9Sstevel@tonic-gate 
1283*7c478bd9Sstevel@tonic-gate 
1284*7c478bd9Sstevel@tonic-gate /*
1285*7c478bd9Sstevel@tonic-gate  * Asynchronous Events and Errors.
1286*7c478bd9Sstevel@tonic-gate  *
1287*7c478bd9Sstevel@tonic-gate  *  IBT_EVENT_PATH_MIGRATED	- Connection migrated to alternate path.
1288*7c478bd9Sstevel@tonic-gate  *  IBT_EVENT_SQD		- Send queue has drained.
1289*7c478bd9Sstevel@tonic-gate  *  IBT_EVENT_COM_EST		- First packet arrived on receive WQ while the
1290*7c478bd9Sstevel@tonic-gate  *				  QP is in RTR state (before receiving RTU).
1291*7c478bd9Sstevel@tonic-gate  *				  This event is not given to the client,
1292*7c478bd9Sstevel@tonic-gate  *				  but instead, is given to CM.
1293*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_CATASTROPHIC_CHAN	- Channel, or SRQ  (if channel is associated
1294*7c478bd9Sstevel@tonic-gate  *				  with an SRQ) error, prevents reporting of
1295*7c478bd9Sstevel@tonic-gate  *				  completions.
1296*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_INVALID_REQUEST_CHAN - Detection of a transport opcode violation
1297*7c478bd9Sstevel@tonic-gate  *				     at the responder.
1298*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_ACCESS_VIOLATION_CHAN - Detection of a request access violation
1299*7c478bd9Sstevel@tonic-gate  *				      at the responder.
1300*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_PATH_MIGRATE_REQ	- Incoming path migration req not accepted.
1301*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_CQ		- CQ protection error or CQ overrun.
1302*7c478bd9Sstevel@tonic-gate  *  IBT_EVENT_PORT_UP		- HCA port/link available.
1303*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_PORT_DOWN		- HCA port/link unavailable.
1304*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_LOCAL_CATASTROPHIC - HCA Local Catastrophic (all QPs in error).
1305*7c478bd9Sstevel@tonic-gate  *  IBT_EVENT_LIMIT_REACHED_SRQ - Shared Receive Queue Limit is reached. Number
1306*7c478bd9Sstevel@tonic-gate  *				  of SRQ WQEs is less than the SRQ limit.
1307*7c478bd9Sstevel@tonic-gate  *  IBT_EVENT_EMPTY_CHAN	- Channel in Error state associated with an
1308*7c478bd9Sstevel@tonic-gate  *				  SRQ is empty (last WQE reached).
1309*7c478bd9Sstevel@tonic-gate  *  IBT_ERROR_CATASTROPHIC_SRQ	- SRQ error, prevents reporting of
1310*7c478bd9Sstevel@tonic-gate  *                                completions.
1311*7c478bd9Sstevel@tonic-gate  *
1312*7c478bd9Sstevel@tonic-gate  * Here are codes that are not used in calls to ibc_async_handler, but
1313*7c478bd9Sstevel@tonic-gate  * are used by IBTL to inform IBT clients of a significant event.
1314*7c478bd9Sstevel@tonic-gate  *
1315*7c478bd9Sstevel@tonic-gate  *  IBT_HCA_ATTACH_EVENT	- New HCA available.
1316*7c478bd9Sstevel@tonic-gate  *  IBT_HCA_DETACH_EVENT	- HCA is requesting not to be used.
1317*7c478bd9Sstevel@tonic-gate  *
1318*7c478bd9Sstevel@tonic-gate  * ERRORs on a channel indicate that the channel has entered error state.
1319*7c478bd9Sstevel@tonic-gate  * EVENTs on a channel indicate that the channel has not changed state.
1320*7c478bd9Sstevel@tonic-gate  *
1321*7c478bd9Sstevel@tonic-gate  */
1322*7c478bd9Sstevel@tonic-gate typedef enum ibt_async_code_e {
1323*7c478bd9Sstevel@tonic-gate 	IBT_EVENT_PATH_MIGRATED			= 0x000001,
1324*7c478bd9Sstevel@tonic-gate 	IBT_EVENT_SQD				= 0x000002,
1325*7c478bd9Sstevel@tonic-gate 	IBT_EVENT_COM_EST			= 0x000004,
1326*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_CATASTROPHIC_CHAN		= 0x000008,
1327*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_INVALID_REQUEST_CHAN		= 0x000010,
1328*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_ACCESS_VIOLATION_CHAN		= 0x000020,
1329*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_PATH_MIGRATE_REQ		= 0x000040,
1330*7c478bd9Sstevel@tonic-gate 
1331*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_CQ				= 0x000080,
1332*7c478bd9Sstevel@tonic-gate 
1333*7c478bd9Sstevel@tonic-gate 	IBT_EVENT_PORT_UP			= 0x000100,
1334*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_PORT_DOWN			= 0x000200,
1335*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_LOCAL_CATASTROPHIC		= 0x000400,
1336*7c478bd9Sstevel@tonic-gate 
1337*7c478bd9Sstevel@tonic-gate 	IBT_HCA_ATTACH_EVENT			= 0x000800,
1338*7c478bd9Sstevel@tonic-gate 	IBT_HCA_DETACH_EVENT			= 0x001000,
1339*7c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE1			= 0x002000,
1340*7c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE2			= 0x004000,
1341*7c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE3			= 0x008000,
1342*7c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE4			= 0x010000,
1343*7c478bd9Sstevel@tonic-gate 	IBT_EVENT_LIMIT_REACHED_SRQ		= 0x020000,
1344*7c478bd9Sstevel@tonic-gate 	IBT_EVENT_EMPTY_CHAN			= 0x040000,
1345*7c478bd9Sstevel@tonic-gate 	IBT_ERROR_CATASTROPHIC_SRQ		= 0x080000
1346*7c478bd9Sstevel@tonic-gate } ibt_async_code_t;
1347*7c478bd9Sstevel@tonic-gate 
1348*7c478bd9Sstevel@tonic-gate 
1349*7c478bd9Sstevel@tonic-gate /*
1350*7c478bd9Sstevel@tonic-gate  * ibt_ci_data_in() and ibt_ci_data_out() flags.
1351*7c478bd9Sstevel@tonic-gate  */
1352*7c478bd9Sstevel@tonic-gate typedef enum ibt_ci_data_flags_e {
1353*7c478bd9Sstevel@tonic-gate 	IBT_CI_NO_FLAGS		= 0,
1354*7c478bd9Sstevel@tonic-gate 	IBT_CI_COMPLETE_ALLOC	= (1 << 0)
1355*7c478bd9Sstevel@tonic-gate } ibt_ci_data_flags_t;
1356*7c478bd9Sstevel@tonic-gate 
1357*7c478bd9Sstevel@tonic-gate /*
1358*7c478bd9Sstevel@tonic-gate  * Used by ibt_ci_data_in() and ibt_ci_data_out() identifies the type of handle
1359*7c478bd9Sstevel@tonic-gate  * mapping data is being obtained for.
1360*7c478bd9Sstevel@tonic-gate  */
1361*7c478bd9Sstevel@tonic-gate typedef enum ibt_object_type_e {
1362*7c478bd9Sstevel@tonic-gate 	IBT_HDL_HCA	=	1,
1363*7c478bd9Sstevel@tonic-gate 	IBT_HDL_CHANNEL,
1364*7c478bd9Sstevel@tonic-gate 	IBT_HDL_CQ,
1365*7c478bd9Sstevel@tonic-gate 	IBT_HDL_PD,
1366*7c478bd9Sstevel@tonic-gate 	IBT_HDL_MR,
1367*7c478bd9Sstevel@tonic-gate 	IBT_HDL_MW,
1368*7c478bd9Sstevel@tonic-gate 	IBT_HDL_UD_DEST,
1369*7c478bd9Sstevel@tonic-gate 	IBT_HDL_SCHED,
1370*7c478bd9Sstevel@tonic-gate 	IBT_HDL_OPAQUE1,
1371*7c478bd9Sstevel@tonic-gate 	IBT_HDL_OPAQUE2,
1372*7c478bd9Sstevel@tonic-gate 	IBT_HDL_SRQ
1373*7c478bd9Sstevel@tonic-gate } ibt_object_type_t;
1374*7c478bd9Sstevel@tonic-gate 
1375*7c478bd9Sstevel@tonic-gate /*
1376*7c478bd9Sstevel@tonic-gate  * Memory error handler data structures; code, and payload data.
1377*7c478bd9Sstevel@tonic-gate  */
1378*7c478bd9Sstevel@tonic-gate typedef enum ibt_mem_code_s {
1379*7c478bd9Sstevel@tonic-gate 	IBT_MEM_AREA	= 0x1,
1380*7c478bd9Sstevel@tonic-gate 	IBT_MEM_REGION	= 0x2
1381*7c478bd9Sstevel@tonic-gate } ibt_mem_code_t;
1382*7c478bd9Sstevel@tonic-gate 
1383*7c478bd9Sstevel@tonic-gate typedef struct ibt_mem_data_s {
1384*7c478bd9Sstevel@tonic-gate 	uint64_t	ev_fma_ena;	/* FMA Error data */
1385*7c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	ev_mr_hdl;	/* MR handle */
1386*7c478bd9Sstevel@tonic-gate 	ibt_ma_hdl_t	ev_ma_hdl;	/* MA handle */
1387*7c478bd9Sstevel@tonic-gate } ibt_mem_data_t;
1388*7c478bd9Sstevel@tonic-gate 
1389*7c478bd9Sstevel@tonic-gate /*
1390*7c478bd9Sstevel@tonic-gate  * Special case failure type.
1391*7c478bd9Sstevel@tonic-gate  */
1392*7c478bd9Sstevel@tonic-gate typedef enum ibt_failure_type_e {
1393*7c478bd9Sstevel@tonic-gate 	IBT_FAILURE_STANDARD	= 0,
1394*7c478bd9Sstevel@tonic-gate 	IBT_FAILURE_CI,
1395*7c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBMF,
1396*7c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBTL,
1397*7c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBCM,
1398*7c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBDM
1399*7c478bd9Sstevel@tonic-gate } ibt_failure_type_t;
1400*7c478bd9Sstevel@tonic-gate 
1401*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1402*7c478bd9Sstevel@tonic-gate }
1403*7c478bd9Sstevel@tonic-gate #endif
1404*7c478bd9Sstevel@tonic-gate 
1405*7c478bd9Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBTL_TYPES_H */
1406