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