xref: /titanic_50/usr/src/uts/common/sys/ib/ibtl/ibtl_ci_types.h (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_SYS_IB_IBTL_IBTL_CI_TYPES_H
26 #define	_SYS_IB_IBTL_IBTL_CI_TYPES_H
27 
28 /*
29  * ibtl_ci_types.h
30  * Definitions shared between the IBTL and CI interface.
31  */
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 typedef	struct ibc_cq_s		*ibt_opaque1_t;
38 typedef	struct ibc_srq_s	*ibt_opaque2_t;
39 typedef	struct ibc_rdd_s	*ibt_rdd_hdl_t;	/* ibt_alloc_eec() */
40 
41 
42 /*
43  * Channel Modify flags - ibt_cep_modify_flags_t
44  *
45  *    Note:
46  *	That the IBT_CEP_SET_RESET_INIT, IBT_CEP_SET_INIT_RTR
47  *	IBT_CEP_SET_RTR_RTS flags are mutually exclusive. However if one of the
48  *	optional attributes associated with these flags is to be modified then
49  *	the corresponding modify flag must also be specified. For example if
50  *	a client wishes to transit from the INIT to RTR state but additionally
51  *	they want to disable atomics, then the modify flags should be:
52  *
53  *	(IBT_CEP_SET_INIT_RTR | IBT_CEP_SET_ATOMIC)
54  *
55  *	And the following attributes specified:
56  *
57  *		- Number of responder resources for RDMA read/atomic ops.
58  *		- Primary Path Address Vector Information.
59  *		- Destination QPN.
60  *		- PSN for ReceiveQ.
61  *		- Minimum RNR NAK Timer field value.
62  *		- ibt_cep_flags_t set to IBT_CEP_ATOMIC
63  *
64  */
65 #define	IBT_CEP_SET_RESET_INIT		IBT_CEP_SET_OPAQUE1
66 #define	IBT_CEP_SET_INIT_RTR		IBT_CEP_SET_OPAQUE2
67 #define	IBT_CEP_SET_RTR_RTS		IBT_CEP_SET_OPAQUE3
68 
69 #define	IBT_CEP_SET_STATE		IBT_CEP_SET_OPAQUE4
70 #define	IBT_CEP_SET_MTU			IBT_CEP_SET_OPAQUE5
71 
72 #define	IBT_CEP_SET_TIMEOUT		IBT_CEP_SET_OPAQUE6
73 #define	IBT_CEP_SET_PKEY_IX		IBT_CEP_SET_OPAQUE7
74 #define	IBT_CEP_SET_MIG			IBT_CEP_SET_OPAQUE8
75 
76 /*
77  * ibt_async_code_t
78  */
79 #define	IBT_EVENT_PATH_MIGRATED_QP	IBT_EVENT_PATH_MIGRATED
80 #define	IBT_EVENT_COM_EST_QP		IBT_EVENT_COM_EST
81 #define	IBT_EVENT_COM_EST_EEC		IBT_ASYNC_OPAQUE2
82 #define	IBT_ERROR_CATASTROPHIC_QP	IBT_ERROR_CATASTROPHIC_CHAN
83 #define	IBT_ERROR_INVALID_REQUEST_QP	IBT_ERROR_INVALID_REQUEST_CHAN
84 #define	IBT_ERROR_ACCESS_VIOLATION_QP	IBT_ERROR_ACCESS_VIOLATION_CHAN
85 #define	IBT_ERROR_PATH_MIGRATE_REQ_QP	IBT_ERROR_PATH_MIGRATE_REQ
86 #define	IBT_EVENT_EMPTY_QP		IBT_EVENT_EMPTY_CHAN
87 
88 
89 /*
90  * ibt_adds_vect_t
91  */
92 #define	av_send_grh	av_opaque1	/* flag to specify if GRH is there */
93 #define	av_dlid		av_opaque2	/* destination LID, or router LID */
94 #define	av_src_path	av_opaque3	/* Source path bits */
95 #define	av_sgid_ix	av_opaque4
96 
97 /*
98  * ibt_wc_t
99  */
100 #define	wc_slid		wc_opaque1	/* source LID */
101 #define	wc_pkey_ix	wc_opaque2	/* The P_Key index, GSI only */
102 #define	wc_path_bits	wc_opaque4	/* DLID path bits, UD's, RawIPv6 & */
103 					/* RawEthr only */
104 
105 /*
106  * ibt_mcg_attr_t
107  */
108 #define	mc_mlid		mc_opaque1	/* Multicast LID */
109 
110 /*
111  * ibt_mcg_info_t
112  */
113 #define	mc_pkt_lt	mc_opaque2
114 
115 /*
116  * ibt_hca_flags_t
117  */
118 #define	IBT_HCA_RESIZE_QP	IBT_HCA_RESIZE_CHAN
119 
120 /*
121  * ibt_object_type_t
122  */
123 #define	IBT_HDL_QP	IBT_HDL_CHANNEL
124 #define	IBT_HDL_AH	IBT_HDL_UD_DEST
125 
126 /*
127  * ibt_hca_attr_t
128  */
129 #define	hca_max_ah	hca_max_ud_dest	/* Max address handles in HCA */
130 #define	hca_ah_max_ci_priv_sz	hca_ud_dest_max_ci_priv_sz
131 #define	hca_qp_max_ci_priv_sz	hca_chan_max_ci_priv_sz
132 #define	hca_max_qp	hca_max_chans	/* Max Channels supported by the HCA */
133 #define	hca_max_qp_sz	hca_max_chan_sz	/* Max outstanding WRs on any channel */
134 #define	hca_max_rdma_out_qp	hca_max_rdma_out_chan
135 #define	hca_max_rdma_in_qp	hca_max_rdma_in_chan
136 #define	hca_max_mcg_qps		hca_max_mcg_chans
137 #define	hca_max_qp_per_mcg	hca_max_chan_per_mcg
138 
139 /*
140  * ibt_hca_portinfo_t
141  */
142 #define	p_base_lid	p_opaque1	/* Base LID of the port */
143 
144 
145 /* Mapping of Verbs defined return status to channel specific. */
146 #define	IBT_QP_FULL			IBT_CHAN_FULL
147 #define	IBT_QP_HDL_INVALID		IBT_CHAN_HDL_INVALID
148 #define	IBT_QP_ATTR_RO			IBT_CHAN_ATTR_RO
149 #define	IBT_QP_STATE_INVALID		IBT_CHAN_STATE_INVALID
150 #define	IBT_QP_SRV_TYPE_INVALID		IBT_CHAN_SRV_TYPE_INVALID
151 #define	IBT_QP_IN_USE			IBT_CHAN_IN_USE
152 #define	IBT_QP_ATOMICS_NOT_SUPPORTED	IBT_CHAN_ATOMICS_NOT_SUPPORTED
153 #define	IBT_QP_OP_TYPE_INVALID		IBT_CHAN_OP_TYPE_INVALID
154 #define	IBT_QP_SGL_FORMAT_INVALID	IBT_CHAN_SGL_FORMAT_INVALID
155 #define	IBT_QP_SGL_LEN_INVALID		IBT_CHAN_SGL_LEN_INVALID
156 #define	IBT_QP_APM_STATE_INVALID	IBT_CHAN_APM_STATE_INVALID
157 #define	IBT_QP_SZ_INSUFFICIENT		IBT_CHAN_SZ_INSUFFICIENT
158 #define	IBT_QP_SPECIAL_TYPE_INVALID	IBT_CHAN_SPECIAL_TYPE_INVALID
159 #define	IBT_WC_LOCAL_QP_OP_ERR		IBT_WC_LOCAL_CHAN_OP_ERR
160 #define	IBT_AH_HDL_INVALID		IBT_UD_DEST_HDL_INVALID
161 #define	IBT_HCA_MCG_QP_EXCEEDED		IBT_HCA_MCG_CHAN_EXCEEDED
162 #define	IBT_MC_MLID_INVALID		IBT_MC_OPAQUE
163 #define	IBT_QP_SRQ			IBT_CHAN_SRQ
164 #define	IBT_QP_TYPE_2A_MW_BOUND		IBT_CHAN_TYPE_2A_MW_BOUND
165 #define	IBT_QP_WQE_SZ_INSUFF		IBT_CHAN_WQE_SZ_INSUFF
166 
167 
168 /*
169  * ibt_cep_path_t
170  */
171 #define	cep_timeout	cep_cm_opaque1	/* 6 bits of timeout exponent */
172 					/* Local ACK timeout for RC */
173 
174 /*
175  * Define an ibt UD Destination struct. This holds all the information
176  * needed to reach a UD destination.
177  *
178  * The ibt_ud_dest_s struct is known by the CI and IBTL.  This structure is
179  * referenced by the CI during UD work request processing.  It is defined here
180  * here so that IBTL does not need to do any data copying during ibt_post_send.
181  */
182 typedef struct ibt_ud_dest_s {
183 	ibt_ah_hdl_t		ud_ah;		/* Address handle */
184 	ib_qpn_t		ud_dst_qpn;	/* Destination QPN */
185 	ib_qkey_t		ud_qkey;	/* Q_Key */
186 
187 	/* The following fields are IBTL-only, i.e., opaque to the CI */
188 	struct ibtl_hca_s	*ud_dest_opaque1;
189 } ibt_ud_dest_t;
190 
191 /*
192  * Reserved For Future Use
193  * RD destination address info.
194  */
195 typedef struct ibt_rd_dest_s {
196 	ibt_ah_hdl_t	rd_ah;		/* Address handle */
197 	ib_eecn_t	rd_eecn;	/* Local EEC Number */
198 	ib_qpn_t	rd_dst_qpn;	/* Destination QP Number */
199 	ib_qkey_t	rd_dst_qkey;	/* The Q_Key for the destination QP */
200 } ibt_rd_dest_t;
201 
202 /*
203  * QP Type.
204  */
205 typedef enum ibt_qp_type_e {
206 	IBT_RC_RQP	= 0,
207 	IBT_RD_RQP	= 1,	/* Reserved For Future Use */
208 	IBT_UC_RQP	= 2,	/* Reserved For Future Use */
209 	IBT_UD_RQP	= 3
210 } ibt_qp_type_t;
211 
212 /*
213  * Special QP Type.
214  */
215 typedef enum ibt_sqp_type_e {
216 	IBT_SMI_SQP		= 0,
217 	IBT_GSI_SQP		= 1,
218 	IBT_RAWIP_SQP		= 2,	/* Reserved For Future Use */
219 	IBT_RAWETHER_SQP	= 3	/* Reserved For Future Use */
220 } ibt_sqp_type_t;
221 
222 /*
223  * QP alloc flags.
224  */
225 typedef enum ibt_qp_alloc_flags_e {
226 	IBT_QP_NO_FLAGS		= 0,
227 	IBT_QP_USER_MAP		= (1 << 0),
228 	IBT_QP_DEFER_ALLOC	= (1 << 1),
229 	IBT_QP_USES_SRQ		= (1 << 2),
230 	IBT_QP_USES_RSS		= (1 << 3),
231 
232 	/* FC variants of UD */
233 	IBT_QP_USES_RFCI	= (1 << 4),
234 	IBT_QP_USES_FCMD	= (1 << 5),
235 	IBT_QP_USES_FEXCH	= (1 << 6)
236 } ibt_qp_alloc_flags_t;
237 
238 /*
239  * QP Alloc Attributes definition.
240  *
241  * Contains the QP attributes that are required to create a QP.
242  */
243 typedef struct ibt_qp_alloc_attr_s {
244 	ibt_qp_alloc_flags_t	qp_alloc_flags;
245 	ibt_cq_hdl_t		qp_scq_hdl;	/* SQ CQ IBT Hdl */
246 	ibt_cq_hdl_t		qp_rcq_hdl;	/* RQ CQ IBT Hdl */
247 	ibt_rdd_hdl_t		qp_rdd_hdl;	/* Reserved */
248 	ibt_pd_hdl_t		qp_pd_hdl;	/* PD handle. */
249 	ibt_chan_sizes_t	qp_sizes;	/* Queue and SGL */
250 	ibt_attr_flags_t	qp_flags;	/* SQ Signaling Type etc */
251 	ibt_opaque1_t		qp_opaque1;
252 	ibt_opaque1_t		qp_opaque2;
253 	ibt_srq_hdl_t		qp_srq_hdl;	/* SRQ ibt hdl */
254 	ibt_opaque2_t		qp_opaque3;
255 	ibt_fc_attr_t		qp_fc;
256 } ibt_qp_alloc_attr_t;
257 
258 
259 /*
260  * QP query info
261  */
262 /* RC transport specific */
263 typedef struct ibt_qp_rc_attr_s {
264 	uint32_t		rc_sq_psn:24;	/* SQ PSN */
265 	uint32_t		rc_rq_psn:24;	/* RQ PSN */
266 	ib_qpn_t		rc_dst_qpn;	/* Destination QPN */
267 	ibt_cep_cmstate_t	rc_mig_state;	/* Channel Migration State */
268 	ibt_rnr_retry_cnt_t	rc_rnr_retry_cnt;
269 	uint8_t			rc_retry_cnt:3;
270 	uint8_t			rc_rdma_ra_out;	/* max RDMA-R/Atomic sent */
271 						/* Number of RDMA RD's & */
272 						/* Atomics outstanding */
273 	uint8_t			rc_rdma_ra_in;	/* Incoming RDMA-R/Atomic */
274 						/* Responder resources for */
275 						/* handling incoming RDMA */
276 						/* RD's & Atomics */
277 	ibt_rnr_nak_time_t	rc_min_rnr_nak;	/* min RNR-NAK timer */
278 	ib_mtu_t		rc_path_mtu;
279 	ibt_cep_path_t		rc_path;	/* primary path */
280 	ibt_cep_path_t		rc_alt_path;	/* alternate path */
281 } ibt_qp_rc_attr_t;
282 
283 /*
284  * Reserved For Future Use.
285  * UC transport specific
286  */
287 typedef struct ibt_qp_uc_attr_s {
288 	uint32_t		uc_sq_psn:24;	/* SQ PSN */
289 	uint32_t		uc_rq_psn:24;	/* RQ PSN */
290 	ib_qpn_t		uc_dst_qpn;	/* destination QPN */
291 	ibt_cep_cmstate_t	uc_mig_state;	/* Channel Migration State */
292 	ib_mtu_t		uc_path_mtu;
293 	ibt_cep_path_t		uc_path;	/* primary path */
294 	ibt_cep_path_t		uc_alt_path;	/* alternate path */
295 } ibt_qp_uc_attr_t;
296 
297 /*
298  * Reserved For Future Use.
299  * RD transport specific
300  */
301 typedef struct ibt_qp_rd_attr_s {
302 	ib_qkey_t		rd_qkey;
303 	ibt_rnr_nak_time_t	rd_min_rnr_nak;	/* min RNR-NAK timer */
304 } ibt_qp_rd_attr_t;
305 
306 /* UD transport specific */
307 typedef struct ibt_qp_ud_attr_s {
308 	ib_qkey_t	ud_qkey;	/* Q_Key */
309 	uint32_t	ud_sq_psn:24;	/* SQ PSN */
310 	uint16_t	ud_pkey_ix;	/* P_Key Index */
311 	uint8_t		ud_port;	/* port */
312 	ibt_rss_attr_t	ud_rss;		/* RSS stuff */
313 	ibt_fc_attr_t	ud_fc;
314 } ibt_qp_ud_attr_t;
315 
316 /*
317  * Common QP Info
318  */
319 typedef struct ibt_qp_info_s {
320 	uint_t			qp_sq_sz;	/* SQ WQEs */
321 	uint_t			qp_rq_sz;	/* RQ WQEs */
322 	ibt_cep_state_t		qp_state;	/* QP state */
323 	ibt_cep_state_t		qp_current_state; /* current state for */
324 						/* modify_qp to RTS state */
325 	ibt_cep_flags_t		qp_flags;	/* QP flags */
326 	ibt_tran_srv_t		qp_trans;	/* transport service type */
327 	union {					/* transport specific */
328 		ibt_qp_rc_attr_t	rc;
329 		ibt_qp_rd_attr_t	rd;	/* Reserved For Future Use */
330 		ibt_qp_uc_attr_t	uc;	/* Reserved For Future Use */
331 		ibt_qp_ud_attr_t	ud;
332 	} qp_transport;
333 } ibt_qp_info_t;
334 
335 /*
336  * QP Query Attributes definition.
337  */
338 typedef struct ibt_qp_query_attr_s {
339 	ibt_cq_hdl_t		qp_sq_cq;	/* SQ CQ */
340 	ibt_cq_hdl_t		qp_rq_cq;	/* RQ CQ */
341 	ibt_rdd_hdl_t		qp_rdd_hdl;	/* Reserved */
342 	ib_qpn_t		qp_qpn;		/* QPN */
343 	uint_t			qp_sq_sgl;	/* max SQ SGL */
344 	uint_t			qp_rq_sgl;	/* max RQ SGL */
345 	ibt_qp_info_t		qp_info;	/* Modifiable attributes */
346 	ibt_srq_hdl_t		qp_srq;		/* SRQ hdl or NULL */
347 	ibt_attr_flags_t	qp_flags;
348 	ibt_fexch_query_attr_t	qp_query_fexch;	/* FEXCH query only set */
349 } ibt_qp_query_attr_t;
350 
351 
352 /*
353  * Reserved For Future Use.
354  * EEC Info.
355  */
356 typedef struct ibt_eec_info_s {
357 	uint32_t		eec_sq_psn:24;	/* SQ PSN */
358 	uint32_t		eec_rq_psn:24;	/* RQ PSN */
359 	ib_eecn_t		eec_dst_eecn;	/* destination EECN */
360 	ibt_cep_state_t		eec_state;	/* EEC state */
361 	ibt_cep_cmstate_t	eec_mig;	/* channel migration state */
362 	uint8_t			eec_rdma_ra_out;	/* RDMA-R/Atomics out */
363 	uint8_t			eec_rdma_ra_in;		/* RDMA-R/Atomics in */
364 	uint8_t			eec_retry_cnt:3;
365 	ibt_rnr_retry_cnt_t	eec_rnr_retry_cnt;
366 	ib_mtu_t		eec_path_mtu;
367 	ibt_cep_path_t		eec_prim_path;	/* primary path */
368 	ibt_cep_path_t		eec_alt_path;	/* alternate path */
369 } ibt_eec_info_t;
370 
371 /*
372  * Reserved For Future Use.
373  * EEC Query Attributes definition.
374  */
375 typedef struct ibt_eec_query_attr_s {
376 	ib_eecn_t		eec_eecn;	/* The EEC Number */
377 	ibt_rdd_hdl_t		eec_rdd_hdl;
378 	ibt_eec_info_t		eec_info;	/* Modifiable attributes */
379 } ibt_eec_query_attr_t;
380 
381 
382 #define	ibt_ah_flags_t	ibt_ud_dest_flags_t
383 #define	IBT_AH_NO_FLAGS		IBT_UD_DEST_NO_FLAGS
384 #define	IBT_AH_USER_MAP		IBT_UD_DEST_USER_MAP
385 #define	IBT_AH_DEFER_ALLOC	IBT_UD_DEST_DEFER_ALLOC
386 
387 
388 /*
389  * ibt_hca_attr_t
390  */
391 #define	hca_max_rdd		hca_opaque2	/* Max RDDs in HCA */
392 #define	hca_max_eec		hca_opaque3	/* Max EEContexts in HCA */
393 #define	hca_max_rd_sgl		hca_opaque4	/* Max SGL entries per RD WR */
394 #define	hca_max_rdma_in_ee	hca_opaque5	/* Max RDMA Reads/Atomics in */
395 						/* per EEC with HCA as target */
396 #define	hca_max_rdma_out_ee	hca_opaque6	/* Max RDMA Reads/Atomics out */
397 						/* per EE by this HCA */
398 #define	hca_max_ipv6_qp		hca_max_ipv6_chan
399 #define	hca_max_ether_qp	hca_max_ether_chan
400 #define	hca_eec_max_ci_priv_sz	hca_opaque7
401 #define	hca_rdd_max_ci_priv_sz	hca_opaque8
402 #define	hca_max_map_per_fmr	hca_opaque9
403 
404 #ifdef __cplusplus
405 }
406 #endif
407 
408 #endif	/* _SYS_IB_IBTL_IBTL_CI_TYPES_H */
409