xref: /titanic_41/usr/src/uts/common/sys/ib/ibtl/ibvti.h (revision 2f172c55ef76964744bc62b4500ece87f3089b4d)
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 
52 #define	oc_cm_retry_cnt		oc_opaque1	/* ibt_chan_open_args_t */
53 						/* The number of times the */
54 						/* CM will retry its MADs */
55 						/* when IBT_OCHAN_CM_RETRY */
56 						/* is set */
57 #define	oc_starting_psn		oc_opaque2	/* ibt_chan_open_args_t */
58 						/* use oc_starting_psn when */
59 						/* IBT_OCHAN_STARTING_PSN is */
60 						/* set */
61 
62 #define	oc_local_cm_time	oc_opaque3	/* ibt_chan_open_args_t */
63 						/* The maximum time in */
64 						/* microseconds that local */
65 						/* client takes to  respond */
66 						/* for a CM callback */
67 
68 #define	oc_remote_cm_time	oc_opaque4	/* ibt_chan_open_args_t */
69 						/* The maximum time in */
70 						/* microseconds that remote */
71 						/* node takes to  respond */
72 						/* for a CM MAD */
73 
74 #define	cm_eec_hdl		cm_opaque	/* ibt_cm_event_t */
75 
76 #define	req_remote_eecn		req_opaque1	/* ibt_cm_req_rcv_t */
77 #define	req_local_eecn		req_opaque2	/* ibt_cm_req_rcv_t */
78 
79 #define	IBT_CM_RDC_EXISTS	0x4		/* ibt_cm_flags_t */
80 
81 #define	ai_dlid			ai_opaque1	/* Local dest, or router LID */
82 #define	ai_src_path		ai_opaque2	/* Source path bits */
83 
84 
85 /*
86  * Note that variables of type ibt_qp_hdl_t (really ibt_channel_hdl_t)
87  * can be used in some of the IBTI interfaces, e.g., ibt_open_rc_channel().
88  */
89 #define	ibt_qp_hdl_t		ibt_channel_hdl_t
90 
91 /*
92  * ibt_cq_priority_t
93  * VTI clients have full control over CQ priorities.
94  */
95 #define	IBT_CQ_PRI_1	IBT_CQ_OPAQUE_1		/* Lowest priority */
96 #define	IBT_CQ_PRI_2	IBT_CQ_OPAQUE_2
97 #define	IBT_CQ_PRI_3	IBT_CQ_OPAQUE_3
98 #define	IBT_CQ_PRI_4	IBT_CQ_OPAQUE_4
99 #define	IBT_CQ_PRI_5	IBT_CQ_OPAQUE_5
100 #define	IBT_CQ_PRI_6	IBT_CQ_OPAQUE_6
101 #define	IBT_CQ_PRI_7	IBT_CQ_OPAQUE_7
102 #define	IBT_CQ_PRI_8	IBT_CQ_OPAQUE_8
103 #define	IBT_CQ_PRI_9	IBT_CQ_OPAQUE_9
104 #define	IBT_CQ_PRI_10	IBT_CQ_OPAQUE_10
105 #define	IBT_CQ_PRI_11	IBT_CQ_OPAQUE_11
106 #define	IBT_CQ_PRI_12	IBT_CQ_OPAQUE_12
107 #define	IBT_CQ_PRI_13	IBT_CQ_OPAQUE_13
108 #define	IBT_CQ_PRI_14	IBT_CQ_OPAQUE_14
109 #define	IBT_CQ_PRI_15	IBT_CQ_OPAQUE_15
110 #define	IBT_CQ_PRI_16	IBT_CQ_OPAQUE_16	/* Highest priority */
111 
112 /*
113  * FUNCTION PROTOTYPES.
114  */
115 /*
116  * ibt_alloc_ah()
117  *	Allocates and returns an address handle (ibt_ah_hdl_t).
118  */
119 ibt_status_t ibt_alloc_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_flags_t flags,
120     ibt_pd_hdl_t pd, ibt_adds_vect_t *adds_vectp, ibt_ah_hdl_t *ah_p);
121 
122 /*
123  * ibt_free_ah()
124  *	Release/de-allocate the specified handle.
125  */
126 ibt_status_t ibt_free_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah);
127 
128 /*
129  * ibt_query_ah
130  *	Obtain the address vector information for the specified address handle.
131  */
132 ibt_status_t ibt_query_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
133     ibt_pd_hdl_t *pd_p, ibt_adds_vect_t *adds_vectp);
134 
135 /*
136  * ibt_modify_ah
137  *	Modify the address vector information for the specified address handle.
138  */
139 ibt_status_t ibt_modify_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
140     ibt_adds_vect_t *adds_vectp);
141 
142 
143 /*
144  * ibt_alloc_qp()
145  *	Allocate a QP with specified attributes.
146  *
147  * Note:
148  *	QPs allocated by ibt_alloc_qp are in the RESET state.  The client
149  *	needs to transition an RC QP into the INIT state if it is going to
150  *	use ibt_open_rc_channel to establish the connection.
151  *	The client needs to transition an UD QP into the RTS state.
152  */
153 ibt_status_t ibt_alloc_qp(ibt_hca_hdl_t hca_hdl, ibt_qp_type_t type,
154     ibt_qp_alloc_attr_t *qp_attr, ibt_chan_sizes_t *queue_sizes_p,
155     ib_qpn_t *qpn_p, ibt_qp_hdl_t *ibt_qp_p);
156 
157 /*
158  * ibt_alloc_special_qp()
159  *	Allocate a special QP with specified attributes.
160  *
161  * Note:
162  *	QPs allocated by ibt_alloc_special_qp are in the RESET state.
163  *	The client needs to transition an UD QP into the RTS state.
164  */
165 ibt_status_t ibt_alloc_special_qp(ibt_hca_hdl_t hca_hdl, uint8_t port,
166     ibt_sqp_type_t type, ibt_qp_alloc_attr_t *qp_attr,
167     ibt_chan_sizes_t *queue_sizes_p, ibt_qp_hdl_t *ibt_qp_p);
168 
169 /*
170  * ibt_flush_qp()
171  *	Transition a QP into error state to flush all outstanding
172  *	work requests. Must be called before calling ibt_free_qp().
173  *	Use ibt_close_rc_channel for RC QPs that have been opened
174  *	successfully.
175  */
176 ibt_status_t ibt_flush_qp(ibt_qp_hdl_t ibt_qp);
177 
178 /*
179  * ibt_initialize_qp()
180  *	Transition a QP from RESET state into a usable state.
181  *	An RC QP is transitioned into the INIT state, ready for
182  *	a call to ibt_open_rc_channel().  A UD QP is transitioned
183  *	all the way to the RTS state.
184  */
185 ibt_status_t ibt_initialize_qp(ibt_qp_hdl_t ibt_qp,
186     ibt_qp_info_t *modify_attrp);
187 
188 
189 /*
190  * ibt_free_qp()
191  *	De-allocate or free the resources associated with an existing QP.
192  */
193 ibt_status_t ibt_free_qp(ibt_qp_hdl_t ibt_qp);
194 
195 
196 /*
197  * ibt_query_qp()
198  *	Query the attributes of an existing QP.
199  */
200 ibt_status_t ibt_query_qp(ibt_qp_hdl_t ibt_qp, ibt_qp_query_attr_t *qp_attrp);
201 
202 
203 /*
204  * ibt_modify_qp()
205  *	Modify the attributes of an existing QP.
206  */
207 ibt_status_t ibt_modify_qp(ibt_qp_hdl_t ibt_qp, ibt_cep_modify_flags_t flags,
208     ibt_qp_info_t *qp_attr, ibt_queue_sizes_t *actual_sz);
209 
210 /*
211  * ibt_set_qp_private(), ibt_get_qp_private()
212  *	Set/Get the client private data.
213  */
214 void ibt_set_qp_private(ibt_qp_hdl_t ibt_qp, void *clnt_private);
215 void *ibt_get_qp_private(ibt_qp_hdl_t ibt_qp);
216 
217 
218 /*
219  * ibt_qp_to_hca_guid
220  *      A helper function to retrieve HCA GUID for the specified QP.
221  */
222 ib_guid_t ibt_qp_to_hca_guid(ibt_qp_hdl_t ibt_qp);
223 
224 
225 /*
226  * ibt_recover_ud_qp()
227  *      Recover an UD QP which has transitioned to SQ Error state. The
228  *      ibt_recover_ud_qp() transitions the QP from SQ Error state to
229  *	Ready-To-Send QP state.
230  *
231  *      If a work request posted to a UD QP's send queue completes with
232  *      an error (see ibt_wc_status_t), the QP gets transitioned to SQ
233  *      Error state. In order to reuse this QP, ibt_recover_ud_qp() can
234  *      be used to recover the QP to a usable (Ready-to-Send) state.
235  */
236 ibt_status_t ibt_recover_ud_qp(ibt_qp_hdl_t ibt_qp);
237 
238 
239 /*
240  * Datagram Domain Functions
241  */
242 
243 /*
244  * ibt_ud_get_dqpn
245  *	Finds the destination QPN at the specified destination that the
246  *	specified service can be reached on. The IBTF CM initiates the
247  *	service ID resolution protocol (SIDR) to determine a destination QPN.
248  */
249 ibt_status_t ibt_ud_get_dqpn(ibt_ud_dest_attr_t *attr,
250     ibt_execution_mode_t mode, ibt_ud_returns_t *returns);
251 
252 /*
253  * ibt_get_module_failure()
254  *
255  *	Used to obtain a special IBTF failure code for IB module specific
256  *	failures, i.e. failures other than those defined in ibt_status_t.
257  */
258 ibt_status_t ibt_get_module_failure(ibt_failure_type_t type, uint64_t ena);
259 
260 ibt_status_t ibt_ofuvcm_get_req_data(void *, ibt_ofuvcm_req_data_t *);
261 
262 ibt_status_t ibt_ofuvcm_proceed(ibt_cm_event_type_t, void *,
263     ibt_cm_status_t, ibt_cm_proceed_reply_t *, void *,
264     ibt_priv_data_len_t);
265 
266 #ifdef __cplusplus
267 }
268 #endif
269 
270 #endif /* _SYS_IB_IBTL_IBVTI_H */
271