xref: /illumos-gate/usr/src/uts/common/sys/ib/ibtl/ibvti.h (revision e8031f0a)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_IB_IBTL_IBVTI_H
28 #define	_SYS_IB_IBTL_IBVTI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * ibvti.h
34  *
35  * This file contains private verbs level transport interface extensions.
36  */
37 #include <sys/ib/ibtl/ibti_common.h>
38 #include <sys/ib/ibtl/ibtl_ci_types.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #define	IBT_CM_NO_QP		IBT_CM_NO_CHAN		/* ibt_cm_reason_t */
45 
46 #define	IBT_CM_SREP_QPN_VALID	IBT_CM_SREP_CHAN_VALID	/* ibt_sidr_status_t */
47 #define	IBT_CM_SREP_NO_QP	IBT_CM_SREP_NO_CHAN	/* ibt_sidr_status_t */
48 
49 #define	IBT_OCHAN_CM_RETRY	IBT_OCHAN_OPAQUE1 /* ibt_chan_open_flags_t */
50 #define	IBT_OCHAN_STARTING_PSN	IBT_OCHAN_OPAQUE2 /* ibt_chan_open_flags_t */
51 #define	IBT_OCHAN_LOCAL_CM_TM	IBT_OCHAN_OPAQUE3 /* ibt_chan_open_flags_t */
52 #define	IBT_OCHAN_REMOTE_CM_TM	IBT_OCHAN_OPAQUE4 /* ibt_chan_open_flags_t */
53 #define	IBT_OCHAN_RDC_EXISTS	IBT_OCHAN_OPAQUE5 /* ibt_chan_open_flags_t */
54 
55 #define	oc_cm_retry_cnt		oc_opaque1	/* ibt_chan_open_args_t */
56 						/* The number of times the */
57 						/* CM will retry its MADs */
58 						/* when IBT_OCHAN_CM_RETRY */
59 						/* is set */
60 #define	oc_starting_psn		oc_opaque2	/* ibt_chan_open_args_t */
61 						/* use oc_starting_psn when */
62 						/* IBT_OCHAN_STARTING_PSN is */
63 						/* set */
64 
65 #define	oc_local_cm_time	oc_opaque3	/* ibt_chan_open_args_t */
66 						/* The maximum time in */
67 						/* microseconds that local */
68 						/* client takes to  respond */
69 						/* for a CM callback */
70 
71 #define	oc_remote_cm_time	oc_opaque4	/* ibt_chan_open_args_t */
72 						/* The maximum time in */
73 						/* microseconds that remote */
74 						/* node takes to  respond */
75 						/* for a CM MAD */
76 
77 #define	cm_eec_hdl		cm_opaque	/* ibt_cm_event_t */
78 
79 #define	req_remote_eecn		req_opaque1	/* ibt_cm_req_rcv_t */
80 #define	req_local_eecn		req_opaque2	/* ibt_cm_req_rcv_t */
81 
82 #define	IBT_CM_RDC_EXISTS	0x4		/* ibt_cm_flags_t */
83 
84 #define	ai_dlid			ai_opaque1	/* Local dest, or router LID */
85 #define	ai_src_path		ai_opaque2	/* Source path bits */
86 
87 
88 /*
89  * Note that variables of type ibt_qp_hdl_t (really ibt_channel_hdl_t)
90  * can be used in some of the IBTI interfaces, e.g., ibt_open_rc_channel().
91  */
92 #define	ibt_qp_hdl_t		ibt_channel_hdl_t
93 
94 /*
95  * ibt_cq_priority_t
96  * VTI clients have full control over CQ priorities.
97  */
98 #define	IBT_CQ_PRI_1	IBT_CQ_OPAQUE_1		/* Lowest priority */
99 #define	IBT_CQ_PRI_2	IBT_CQ_OPAQUE_2
100 #define	IBT_CQ_PRI_3	IBT_CQ_OPAQUE_3
101 #define	IBT_CQ_PRI_4	IBT_CQ_OPAQUE_4
102 #define	IBT_CQ_PRI_5	IBT_CQ_OPAQUE_5
103 #define	IBT_CQ_PRI_6	IBT_CQ_OPAQUE_6
104 #define	IBT_CQ_PRI_7	IBT_CQ_OPAQUE_7
105 #define	IBT_CQ_PRI_8	IBT_CQ_OPAQUE_8
106 #define	IBT_CQ_PRI_9	IBT_CQ_OPAQUE_9
107 #define	IBT_CQ_PRI_10	IBT_CQ_OPAQUE_10
108 #define	IBT_CQ_PRI_11	IBT_CQ_OPAQUE_11
109 #define	IBT_CQ_PRI_12	IBT_CQ_OPAQUE_12
110 #define	IBT_CQ_PRI_13	IBT_CQ_OPAQUE_13
111 #define	IBT_CQ_PRI_14	IBT_CQ_OPAQUE_14
112 #define	IBT_CQ_PRI_15	IBT_CQ_OPAQUE_15
113 #define	IBT_CQ_PRI_16	IBT_CQ_OPAQUE_16	/* Highest priority */
114 
115 /*
116  * FUNCTION PROTOTYPES.
117  */
118 /*
119  * ibt_alloc_ah()
120  *	Allocates and returns an address handle (ibt_ah_hdl_t).
121  */
122 ibt_status_t ibt_alloc_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_flags_t flags,
123     ibt_pd_hdl_t pd, ibt_adds_vect_t *adds_vectp, ibt_ah_hdl_t *ah_p);
124 
125 /*
126  * ibt_free_ah()
127  *	Release/de-allocate the specified handle.
128  */
129 ibt_status_t ibt_free_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah);
130 
131 /*
132  * ibt_query_ah
133  *	Obtain the address vector information for the specified address handle.
134  */
135 ibt_status_t ibt_query_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
136     ibt_pd_hdl_t *pd_p, ibt_adds_vect_t *adds_vectp);
137 
138 /*
139  * ibt_modify_ah
140  *	Modify the address vector information for the specified address handle.
141  */
142 ibt_status_t ibt_modify_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
143     ibt_adds_vect_t *adds_vectp);
144 
145 
146 /*
147  * ibt_alloc_qp()
148  *	Allocate a QP with specified attributes.
149  *
150  * Note:
151  *	QPs allocated by ibt_alloc_qp are in the RESET state.  The client
152  *	needs to transition an RC QP into the INIT state if it is going to
153  *	use ibt_open_rc_channel to establish the connection.
154  *	The client needs to transition an UD QP into the RTS state.
155  */
156 ibt_status_t ibt_alloc_qp(ibt_hca_hdl_t hca_hdl, ibt_qp_type_t type,
157     ibt_qp_alloc_attr_t *qp_attr, ibt_chan_sizes_t *queue_sizes_p,
158     ib_qpn_t *qpn_p, ibt_qp_hdl_t *ibt_qp_p);
159 
160 /*
161  * ibt_alloc_special_qp()
162  *	Allocate a special QP with specified attributes.
163  *
164  * Note:
165  *	QPs allocated by ibt_alloc_special_qp are in the RESET state.
166  *	The client needs to transition an UD QP into the RTS state.
167  */
168 ibt_status_t ibt_alloc_special_qp(ibt_hca_hdl_t hca_hdl, uint8_t port,
169     ibt_sqp_type_t type, ibt_qp_alloc_attr_t *qp_attr,
170     ibt_chan_sizes_t *queue_sizes_p, ibt_qp_hdl_t *ibt_qp_p);
171 
172 /*
173  * ibt_flush_qp()
174  *	Transition a QP into error state to flush all outstanding
175  *	work requests. Must be called before calling ibt_free_qp().
176  *	Use ibt_close_rc_channel for RC QPs that have been opened
177  *	successfully.
178  */
179 ibt_status_t ibt_flush_qp(ibt_qp_hdl_t ibt_qp);
180 
181 /*
182  * ibt_initialize_qp()
183  *	Transition a QP from RESET state into a usable state.
184  *	An RC QP is transitioned into the INIT state, ready for
185  *	a call to ibt_open_rc_channel().  A UD QP is transitioned
186  *	all the way to the RTS state.
187  */
188 ibt_status_t ibt_initialize_qp(ibt_qp_hdl_t ibt_qp,
189     ibt_qp_info_t *modify_attrp);
190 
191 
192 /*
193  * ibt_free_qp()
194  *	De-allocate or free the resources associated with an existing QP.
195  */
196 ibt_status_t ibt_free_qp(ibt_qp_hdl_t ibt_qp);
197 
198 
199 /*
200  * ibt_query_qp()
201  *	Query the attributes of an existing QP.
202  */
203 ibt_status_t ibt_query_qp(ibt_qp_hdl_t ibt_qp, ibt_qp_query_attr_t *qp_attrp);
204 
205 
206 /*
207  * ibt_modify_qp()
208  *	Modify the attributes of an existing QP.
209  */
210 ibt_status_t ibt_modify_qp(ibt_qp_hdl_t ibt_qp, ibt_cep_modify_flags_t flags,
211     ibt_qp_info_t *qp_attr, ibt_queue_sizes_t *actual_sz);
212 
213 /*
214  * ibt_set_qp_private(), ibt_get_qp_private()
215  *	Set/Get the client private data.
216  */
217 void ibt_set_qp_private(ibt_qp_hdl_t ibt_qp, void *clnt_private);
218 void *ibt_get_qp_private(ibt_qp_hdl_t ibt_qp);
219 
220 
221 /*
222  * ibt_qp_to_hca_guid
223  *      A helper function to retrieve HCA GUID for the specified QP.
224  */
225 ib_guid_t ibt_qp_to_hca_guid(ibt_qp_hdl_t ibt_qp);
226 
227 
228 /*
229  * ibt_recover_ud_qp()
230  *      Recover an UD QP which has transitioned to SQ Error state. The
231  *      ibt_recover_ud_qp() transitions the QP from SQ Error state to
232  *	Ready-To-Send QP state.
233  *
234  *      If a work request posted to a UD QP's send queue completes with
235  *      an error (see ibt_wc_status_t), the QP gets transitioned to SQ
236  *      Error state. In order to reuse this QP, ibt_recover_ud_qp() can
237  *      be used to recover the QP to a usable (Ready-to-Send) state.
238  */
239 ibt_status_t ibt_recover_ud_qp(ibt_qp_hdl_t ibt_qp);
240 
241 
242 /*
243  * Datagram Domain Functions
244  */
245 
246 /*
247  * ibt_ud_get_dqpn
248  *	Finds the destination QPN at the specified destination that the
249  *	specified service can be reached on. The IBTF CM initiates the
250  *	service ID resolution protocol (SIDR) to determine a destination QPN.
251  */
252 ibt_status_t ibt_ud_get_dqpn(ibt_ud_dest_attr_t *attr,
253     ibt_execution_mode_t mode, ibt_ud_returns_t *returns);
254 
255 /*
256  * ibt_get_module_failure()
257  *
258  *	Used to obtain a special IBTF failure code for IB module specific
259  *	failures, i.e. failures other than those defined in ibt_status_t.
260  */
261 ibt_status_t ibt_get_module_failure(ibt_failure_type_t type, uint64_t ena);
262 
263 #ifdef __cplusplus
264 }
265 #endif
266 
267 #endif /* _SYS_IB_IBTL_IBVTI_H */
268