xref: /titanic_41/usr/src/uts/common/sys/ib/ibtl/ibvti.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_IBVTI_H
26 #define	_SYS_IB_IBTL_IBVTI_H
27 
28 /*
29  * ibvti.h
30  *
31  * This file contains private verbs level transport interface extensions.
32  */
33 #include <sys/ib/ibtl/ibti_common.h>
34 #include <sys/ib/ibtl/ibtl_ci_types.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #define	IBT_CM_NO_QP		IBT_CM_NO_CHAN		/* ibt_cm_reason_t */
41 
42 #define	IBT_CM_SREP_QPN_VALID	IBT_CM_SREP_CHAN_VALID	/* ibt_sidr_status_t */
43 #define	IBT_CM_SREP_NO_QP	IBT_CM_SREP_NO_CHAN	/* ibt_sidr_status_t */
44 
45 #define	IBT_OCHAN_CM_RETRY	IBT_OCHAN_OPAQUE1 /* ibt_chan_open_flags_t */
46 #define	IBT_OCHAN_STARTING_PSN	IBT_OCHAN_OPAQUE2 /* ibt_chan_open_flags_t */
47 #define	IBT_OCHAN_LOCAL_CM_TM	IBT_OCHAN_OPAQUE3 /* ibt_chan_open_flags_t */
48 #define	IBT_OCHAN_REMOTE_CM_TM	IBT_OCHAN_OPAQUE4 /* ibt_chan_open_flags_t */
49 #define	IBT_OCHAN_RDC_EXISTS	IBT_OCHAN_OPAQUE5 /* ibt_chan_open_flags_t */
50 #define	IBT_OCHAN_OFUV		IBT_OCHAN_OPAQUE6 /* 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 /*
93  * FUNCTION PROTOTYPES.
94  */
95 /*
96  * ibt_alloc_ah()
97  *	Allocates and returns an address handle (ibt_ah_hdl_t).
98  */
99 ibt_status_t ibt_alloc_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_flags_t flags,
100     ibt_pd_hdl_t pd, ibt_adds_vect_t *adds_vectp, ibt_ah_hdl_t *ah_p);
101 
102 /*
103  * ibt_free_ah()
104  *	Release/de-allocate the specified handle.
105  */
106 ibt_status_t ibt_free_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah);
107 
108 /*
109  * ibt_query_ah
110  *	Obtain the address vector information for the specified address handle.
111  */
112 ibt_status_t ibt_query_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
113     ibt_pd_hdl_t *pd_p, ibt_adds_vect_t *adds_vectp);
114 
115 /*
116  * ibt_modify_ah
117  *	Modify the address vector information for the specified address handle.
118  */
119 ibt_status_t ibt_modify_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
120     ibt_adds_vect_t *adds_vectp);
121 
122 
123 /*
124  * ibt_alloc_qp()
125  *	Allocate a QP with specified attributes.
126  *
127  * Note:
128  *	QPs allocated by ibt_alloc_qp are in the RESET state.  The client
129  *	needs to transition an RC QP into the INIT state if it is going to
130  *	use ibt_open_rc_channel to establish the connection.
131  *	The client needs to transition an UD QP into the RTS state.
132  */
133 ibt_status_t ibt_alloc_qp(ibt_hca_hdl_t hca_hdl, ibt_qp_type_t type,
134     ibt_qp_alloc_attr_t *qp_attr, ibt_chan_sizes_t *queue_sizes_p,
135     ib_qpn_t *qpn_p, ibt_qp_hdl_t *ibt_qp_p);
136 
137 /*
138  * ibt_alloc_special_qp()
139  *	Allocate a special QP with specified attributes.
140  *
141  * Note:
142  *	QPs allocated by ibt_alloc_special_qp are in the RESET state.
143  *	The client needs to transition an UD QP into the RTS state.
144  */
145 ibt_status_t ibt_alloc_special_qp(ibt_hca_hdl_t hca_hdl, uint8_t port,
146     ibt_sqp_type_t type, ibt_qp_alloc_attr_t *qp_attr,
147     ibt_chan_sizes_t *queue_sizes_p, ibt_qp_hdl_t *ibt_qp_p);
148 
149 /*
150  * ibt_flush_qp()
151  *	Transition a QP into error state to flush all outstanding
152  *	work requests. Must be called before calling ibt_free_qp().
153  *	Use ibt_close_rc_channel for RC QPs that have been opened
154  *	successfully.
155  */
156 ibt_status_t ibt_flush_qp(ibt_qp_hdl_t ibt_qp);
157 
158 /*
159  * ibt_initialize_qp()
160  *	Transition a QP from RESET state into a usable state.
161  *	An RC QP is transitioned into the INIT state, ready for
162  *	a call to ibt_open_rc_channel().  A UD QP is transitioned
163  *	all the way to the RTS state.
164  */
165 ibt_status_t ibt_initialize_qp(ibt_qp_hdl_t ibt_qp,
166     ibt_qp_info_t *modify_attrp);
167 
168 
169 /*
170  * ibt_free_qp()
171  *	De-allocate or free the resources associated with an existing QP.
172  */
173 ibt_status_t ibt_free_qp(ibt_qp_hdl_t ibt_qp);
174 
175 
176 /*
177  * ibt_query_qp()
178  *	Query the attributes of an existing QP.
179  */
180 ibt_status_t ibt_query_qp(ibt_qp_hdl_t ibt_qp, ibt_qp_query_attr_t *qp_attrp);
181 
182 
183 /*
184  * ibt_modify_qp()
185  *	Modify the attributes of an existing QP.
186  */
187 ibt_status_t ibt_modify_qp(ibt_qp_hdl_t ibt_qp, ibt_cep_modify_flags_t flags,
188     ibt_qp_info_t *qp_attr, ibt_queue_sizes_t *actual_sz);
189 
190 /*
191  * ibt_set_qp_private(), ibt_get_qp_private()
192  *	Set/Get the client private data.
193  */
194 void ibt_set_qp_private(ibt_qp_hdl_t ibt_qp, void *clnt_private);
195 void *ibt_get_qp_private(ibt_qp_hdl_t ibt_qp);
196 
197 
198 /*
199  * ibt_qp_to_hca_guid
200  *      A helper function to retrieve HCA GUID for the specified QP.
201  */
202 ib_guid_t ibt_qp_to_hca_guid(ibt_qp_hdl_t ibt_qp);
203 
204 
205 /*
206  * ibt_recover_ud_qp()
207  *      Recover an UD QP which has transitioned to SQ Error state. The
208  *      ibt_recover_ud_qp() transitions the QP from SQ Error state to
209  *	Ready-To-Send QP state.
210  *
211  *      If a work request posted to a UD QP's send queue completes with
212  *      an error (see ibt_wc_status_t), the QP gets transitioned to SQ
213  *      Error state. In order to reuse this QP, ibt_recover_ud_qp() can
214  *      be used to recover the QP to a usable (Ready-to-Send) state.
215  */
216 ibt_status_t ibt_recover_ud_qp(ibt_qp_hdl_t ibt_qp);
217 
218 
219 /*
220  * Datagram Domain Functions
221  */
222 
223 /*
224  * ibt_ud_get_dqpn
225  *	Finds the destination QPN at the specified destination that the
226  *	specified service can be reached on. The IBTF CM initiates the
227  *	service ID resolution protocol (SIDR) to determine a destination QPN.
228  */
229 ibt_status_t ibt_ud_get_dqpn(ibt_ud_dest_attr_t *attr,
230     ibt_execution_mode_t mode, ibt_ud_returns_t *returns);
231 
232 /*
233  * ibt_get_module_failure()
234  *
235  *	Used to obtain a special IBTF failure code for IB module specific
236  *	failures, i.e. failures other than those defined in ibt_status_t.
237  */
238 ibt_status_t ibt_get_module_failure(ibt_failure_type_t type, uint64_t ena);
239 
240 ibt_status_t ibt_ofuvcm_get_req_data(void *, ibt_ofuvcm_req_data_t *);
241 
242 ibt_status_t ibt_ofuvcm_proceed(ibt_cm_event_type_t, void *,
243     ibt_cm_status_t, ibt_cm_proceed_reply_t *, void *,
244     ibt_priv_data_len_t);
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* _SYS_IB_IBTL_IBVTI_H */
251