xref: /titanic_50/usr/src/uts/common/sys/ib/ibtl/ibci.h (revision b97d6ca7333c353b6ca20c20c99fb1be8d32a8de)
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_IBCI_H
26 #define	_SYS_IB_IBTL_IBCI_H
27 
28 /*
29  * ibci.h
30  *
31  * Define the data structures and function prototypes that comprise
32  * the IB Channel API (API for HCA drivers).  All CI handles are opaque
33  * to the IBTF here, real data is accessed in the HCA driver by a
34  * typecast to a driver specific struct.
35  */
36 
37 #include <sys/ib/ibtl/ibtl_types.h>
38 #include <sys/ib/ibtl/ibtl_ci_types.h>
39 #include <sys/modctl.h>
40 
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 /*
47  * Define CI opaque IBTF handles.
48  */
49 typedef	struct	ibtl_qp_s	*ibtl_qp_hdl_t;		/* ibt_alloc_qp() */
50 typedef struct	ibtl_eec_s	*ibtl_eec_hdl_t;	/* ibt_alloc_eec() */
51 
52 /*
53  * Define IBTF opaque CI handles.
54  */
55 typedef struct ibc_hca_s	*ibc_hca_hdl_t; /* HCA/CI Handle */
56 typedef struct ibc_pd_s		*ibc_pd_hdl_t;	/* Protection Domain Handle */
57 typedef	struct ibc_rdd_s	*ibc_rdd_hdl_t;	/* Reliable Datagram Domain */
58 typedef struct ibc_ah_s		*ibc_ah_hdl_t;	/* Address Handle */
59 typedef struct ibc_qp_s		*ibc_qp_hdl_t;	/* Queue Pair Handle */
60 typedef struct ibc_srq_s	*ibc_srq_hdl_t;	/* Shared Receive Queue Hdl */
61 typedef struct ibc_qpn_s	*ibc_qpn_hdl_t;	/* Queue Pair Number Handle */
62 typedef struct ibc_cq_s		*ibc_cq_hdl_t;	/* Completion Queue Handle */
63 typedef struct ibc_eec_s	*ibc_eec_hdl_t; /* End-to-End Context Handle */
64 typedef struct ibc_mem_alloc_s	*ibc_mem_alloc_hdl_t; /* Memory Handle */
65 
66 #define	ibc_sched_hdl_t		ibt_sched_hdl_t	/* CQ Sched Handle */
67 #define	ibc_fmr_pool_hdl_t	ibt_fmr_pool_hdl_t /* FMR Pool Handle */
68 #define	ibc_mr_hdl_t	ibt_mr_hdl_t	/* Memory Region Handle */
69 #define	ibc_mw_hdl_t	ibt_mw_hdl_t	/* Memory Window Handle */
70 #define	ibc_ma_hdl_t	ibt_ma_hdl_t	/* Memory Area Handle */
71 #define	ibc_mi_hdl_t	ibt_mi_hdl_t	/* Memory IOV Handle */
72 
73 /* Handle used by CI for up calls to IBTF */
74 typedef struct ibtl_hca_devinfo_s *ibc_clnt_hdl_t;	/* ibc_attach() */
75 
76 /*
77  * Fields opaque to TI, but visible to CI
78  */
79 
80 /*
81  * ibt_qp_alloc_attr_t
82  */
83 #define	qp_ibc_scq_hdl	qp_opaque1
84 #define	qp_ibc_rcq_hdl	qp_opaque2
85 #define	qp_ibc_srq_hdl	qp_opaque3
86 
87 
88 /*
89  * ibt_status_t
90  */
91 #define	IBT_HCA_RAWD_CHAN_EXCEEDED	IBT_ERR_OPAQUE1	/* Requested raw QP */
92 							/* exceeds HCA max */
93 							/* limit */
94 #define	IBT_CHAN_RAWD_NOT_SUPPORTED	IBT_ERR_OPAQUE2	/* Raw datagram QPs */
95 							/* not supported */
96 #define	IBT_CHAN_RD_NOT_SUPPORTED	IBT_ERR_OPAQUE3	/* RD not supported */
97 #define	IBT_EEC_HDL_INVALID		IBT_ERR_OPAQUE4	/* Invalid EEC handle */
98 #define	IBT_EEC_STATE_INVALID		IBT_ERR_OPAQUE5	/* Invalid EEC State */
99 #define	IBT_EEC_ATTR_RO			IBT_ERR_OPAQUE6	/* Can't Change EEC */
100 							/* Attribute */
101 #define	IBT_RDD_IN_USE			IBT_ERR_OPAQUE7	/* RDD in Use */
102 #define	IBT_RDD_HDL_INVALID		IBT_ERR_OPAQUE8	/* Invalid RDD */
103 #define	IBT_RNR_NAK_TIMER_INVALID	IBT_ERR_OPAQUE9	/* Invalid RNR NAK */
104 							/* Timer Value */
105 #define	IBT_RDD_NOT_SUPPORTED		IBT_ERR_OPAQUE10
106 
107 
108 /*
109  * ibt_wc_status_t
110  */
111 #define	IBT_WC_LOCAL_EEC_OP_ERR		12	/* Internal consistency error */
112 #define	IBT_WC_LOCAL_RDD_VIOLATION_ERR	30	/* The RDD associated with */
113 						/* the QP does not match */
114 						/* the RDD associated with */
115 						/* the EE Context */
116 #define	IBT_WC_REMOTE_RD_REQ_INVALID	31	/* Detected an invalid */
117 						/* incoming RD message */
118 #define	IBT_WC_EEC_REMOTE_ABORTED	32	/* Requester aborted the */
119 						/* operation */
120 #define	IBT_WC_EEC_NUM_INVALID		33	/* Invalid EEC Number */
121 						/* detected */
122 #define	IBT_WC_EEC_STATE_INVALID	34	/* Invalid EEC state */
123 
124 /*
125  * ibt_async_code_t
126  */
127 #define	IBT_EVENT_PATH_MIGRATED_EEC	IBT_ASYNC_OPAQUE1
128 #define	IBT_ERROR_CATASTROPHIC_EEC	IBT_ASYNC_OPAQUE3
129 #define	IBT_ERROR_PATH_MIGRATE_REQ_EEC	IBT_ASYNC_OPAQUE4
130 
131 /*
132  * ibt_object_type_t
133  */
134 #define	IBT_HDL_EEC	IBT_HDL_OPAQUE1
135 #define	IBT_HDL_RDD	IBT_HDL_OPAQUE2
136 
137 
138 /*
139  * ibt_wc_t
140  */
141 #define	wc_eecn		wc_detail	/* End-to-End Context RD's only */
142 
143 
144 /* Channel Interface version */
145 typedef int ibc_version_t;
146 #define	IBCI_V1	1
147 #define	IBCI_V2	2
148 #define	IBCI_V3	3
149 #define	IBCI_V4	4
150 
151 
152 typedef enum ibc_free_qp_flags_e {
153 	IBC_FREE_QP_AND_QPN	= 0,	/* free all qp resources */
154 	IBC_FREE_QP_ONLY	= 1	/* OK to free the QP, but the QPN */
155 					/* cannot be reused until a future */
156 					/* call to ibc_release_qpn(qpn_hdl), */
157 					/* where qpn_hdl is a return value */
158 					/* of ibc_free_qp() */
159 } ibc_free_qp_flags_t;
160 
161 /*
162  * RDD alloc flags
163  */
164 typedef enum ibc_rdd_flags_e {
165 	IBT_RDD_NO_FLAGS	= 0,
166 	IBT_RDD_USER_MAP	= (1 << 0),
167 	IBT_RDD_DEFER_ALLOC	= (1 << 1)
168 } ibc_rdd_flags_t;
169 
170 /*
171  * EEC alloc flags
172  */
173 typedef enum ibc_eec_flags_e {
174 	IBT_EEC_NO_FLAGS	= 0,
175 	IBT_EEC_USER_MAP	= (1 << 0),
176 	IBT_EEC_DEFER_ALLOC	= (1 << 1)
177 } ibc_eec_flags_t;
178 
179 /*
180  * Event data for asynchronous events and errors. The QP/EEC/CQ/SRQ handle,
181  * or port number associated with the Event/Error is passed as an argument
182  * to the async handler.
183  */
184 typedef struct ibc_async_event_s {
185 	uint64_t	ev_fma_ena;	/* fault management error data */
186 	ibtl_qp_hdl_t	ev_qp_hdl;	/* IBTF QP handle. */
187 	ibtl_eec_hdl_t	ev_eec_hdl;	/* IBTF EEC handle. */
188 	ibt_cq_hdl_t	ev_cq_hdl;	/* IBT CQ handle. */
189 	ibt_srq_hdl_t	ev_srq_hdl;	/* SRQ handle */
190 	ibt_port_change_t ev_port_flags; /* Port Change flags */
191 	uint8_t		ev_port;	/* For PORT UP/DOWN/CHANGE events */
192 	ibt_fc_syndrome_t ev_fc;	/* FEXCH syndrome */
193 } ibc_async_event_t;
194 
195 
196 typedef struct ibc_operations_s {
197 	/* HCA */
198 	ibt_status_t (*ibc_query_hca_ports)(ibc_hca_hdl_t hca, uint8_t port,
199 	    ibt_hca_portinfo_t *info_p);
200 	ibt_status_t (*ibc_modify_ports)(ibc_hca_hdl_t hca, uint8_t port,
201 	    ibt_port_modify_flags_t flags, uint8_t init_type);
202 	ibt_status_t (*ibc_modify_system_image)(ibc_hca_hdl_t hca,
203 	    ib_guid_t sys_guid);
204 
205 	/* Protection Domain */
206 	ibt_status_t (*ibc_alloc_pd)(ibc_hca_hdl_t hca, ibt_pd_flags_t flags,
207 	    ibc_pd_hdl_t *pd_p);
208 	ibt_status_t (*ibc_free_pd)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd);
209 
210 	/* Reliable Datagram Domain */
211 	ibt_status_t (*ibc_alloc_rdd)(ibc_hca_hdl_t hca, ibc_rdd_flags_t flags,
212 	    ibc_rdd_hdl_t *rdd_p);
213 	ibt_status_t (*ibc_free_rdd)(ibc_hca_hdl_t hca, ibc_rdd_hdl_t rdd);
214 
215 	/* Address Handle */
216 	ibt_status_t (*ibc_alloc_ah)(ibc_hca_hdl_t hca, ibt_ah_flags_t flags,
217 	    ibc_pd_hdl_t pd, ibt_adds_vect_t *attr_p, ibc_ah_hdl_t *ah_p);
218 	ibt_status_t (*ibc_free_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah);
219 	ibt_status_t (*ibc_query_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah,
220 	    ibc_pd_hdl_t *pd_p, ibt_adds_vect_t *attr_p);
221 	ibt_status_t (*ibc_modify_ah)(ibc_hca_hdl_t hca, ibc_ah_hdl_t ah,
222 	    ibt_adds_vect_t *attr_p);
223 
224 	/* Queue Pair */
225 	ibt_status_t (*ibc_alloc_qp)(ibc_hca_hdl_t hca, ibtl_qp_hdl_t ibtl_qp,
226 	    ibt_qp_type_t type, ibt_qp_alloc_attr_t *attr_p,
227 	    ibt_chan_sizes_t *queue_sizes_p, ib_qpn_t *qpn, ibc_qp_hdl_t *qp_p);
228 	ibt_status_t (*ibc_alloc_special_qp)(ibc_hca_hdl_t hca, uint8_t port,
229 	    ibtl_qp_hdl_t ibt_qp, ibt_sqp_type_t type,
230 	    ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p,
231 	    ibc_qp_hdl_t *qp_p);
232 	ibt_status_t (*ibc_alloc_qp_range)(ibc_hca_hdl_t hca, uint_t log2,
233 	    ibtl_qp_hdl_t *ibtl_qp_p, ibt_qp_type_t type,
234 	    ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p,
235 	    ibc_cq_hdl_t *send_cq_p, ibc_cq_hdl_t *recv_cq_p,
236 	    ib_qpn_t *qpn_p, ibc_qp_hdl_t *qp_p);
237 	ibt_status_t (*ibc_free_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp,
238 	    ibc_free_qp_flags_t free_qp_flags, ibc_qpn_hdl_t *qpnh_p);
239 	ibt_status_t (*ibc_release_qpn)(ibc_hca_hdl_t hca, ibc_qpn_hdl_t qpnh);
240 	ibt_status_t (*ibc_query_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp,
241 	    ibt_qp_query_attr_t *attr_p);
242 	ibt_status_t (*ibc_modify_qp)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp,
243 	    ibt_cep_modify_flags_t flags, ibt_qp_info_t *info_p,
244 	    ibt_queue_sizes_t *actual_sz);
245 
246 	/* Completion Queues */
247 	ibt_status_t (*ibc_alloc_cq)(ibc_hca_hdl_t hca, ibt_cq_hdl_t ibt_cq,
248 	    ibt_cq_attr_t *attr_p, ibc_cq_hdl_t *cq_p, uint_t *actual_size);
249 	ibt_status_t (*ibc_free_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq);
250 	ibt_status_t (*ibc_query_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq,
251 	    uint_t *entries, uint_t *count_p, uint_t *usec_p,
252 	    ibt_cq_handler_id_t *hid_p);
253 	ibt_status_t (*ibc_resize_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq,
254 	    uint_t size, uint_t *actual_size);
255 	ibt_status_t (*ibc_modify_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq,
256 	    uint_t count, uint_t usec, ibt_cq_handler_id_t hid);
257 	ibt_status_t (*ibc_alloc_cq_sched)(ibc_hca_hdl_t hca,
258 	    ibt_cq_sched_attr_t *attr, ibc_sched_hdl_t *sched_hdl_p);
259 	ibt_status_t (*ibc_free_cq_sched)(ibc_hca_hdl_t hca,
260 	    ibc_sched_hdl_t sched_hdl);
261 	ibt_status_t (*ibc_query_cq_handler_id)(ibc_hca_hdl_t hca,
262 	    ibt_cq_handler_id_t hid, ibt_cq_handler_attr_t *attrs);
263 
264 	/* EE Context */
265 	ibt_status_t (*ibc_alloc_eec)(ibc_hca_hdl_t hca, ibc_eec_flags_t flags,
266 	    ibtl_eec_hdl_t ibtl_eec, ibc_rdd_hdl_t rdd, ibc_eec_hdl_t *eec_p);
267 	ibt_status_t (*ibc_free_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec);
268 	ibt_status_t (*ibc_query_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec,
269 	    ibt_eec_query_attr_t *attr_p);
270 	ibt_status_t (*ibc_modify_eec)(ibc_hca_hdl_t hca, ibc_eec_hdl_t eec,
271 	    ibt_cep_modify_flags_t flags, ibt_eec_info_t *info_p);
272 
273 	/* Memory Registration */
274 	ibt_status_t (*ibc_register_mr)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
275 	    ibt_mr_attr_t *attr_p, void *ibtl_reserved, ibc_mr_hdl_t *mr_p,
276 	    ibt_mr_desc_t *mem_desc);
277 	ibt_status_t (*ibc_register_buf)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
278 	    ibt_smr_attr_t *attrp, struct buf *buf, void *ibtl_reserved,
279 	    ibc_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc);
280 	ibt_status_t (*ibc_register_shared_mr)(ibc_hca_hdl_t hca,
281 	    ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_smr_attr_t *attr_p,
282 	    void *ibtl_reserved, ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc);
283 	ibt_status_t (*ibc_deregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr);
284 	ibt_status_t (*ibc_query_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr,
285 	    ibt_mr_query_attr_t *info_p);
286 	ibt_status_t (*ibc_reregister_mr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr,
287 	    ibc_pd_hdl_t pd, ibt_mr_attr_t *attr_p, void *ibtl_reserved,
288 	    ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc);
289 	ibt_status_t (*ibc_reregister_buf)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr,
290 	    ibc_pd_hdl_t pd, ibt_smr_attr_t *attrp, struct buf *buf,
291 	    void *ibtl_reserved, ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mem_desc);
292 	ibt_status_t (*ibc_sync_mr)(ibc_hca_hdl_t hca,
293 	    ibt_mr_sync_t *mr_segments, size_t	num_segments);
294 
295 	/* Memory Window */
296 	ibt_status_t (*ibc_alloc_mw)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
297 	    ibt_mw_flags_t flags, ibc_mw_hdl_t *mw_p, ibt_rkey_t *rkey_p);
298 	ibt_status_t (*ibc_free_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw);
299 	ibt_status_t (*ibc_query_mw)(ibc_hca_hdl_t hca, ibc_mw_hdl_t mw,
300 	    ibt_mw_query_attr_t *mw_attr_p);
301 
302 	/* Multicast Group */
303 	ibt_status_t (*ibc_attach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp,
304 	    ib_gid_t gid, ib_lid_t lid);
305 	ibt_status_t (*ibc_detach_mcg)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp,
306 	    ib_gid_t gid, ib_lid_t lid);
307 
308 	/* WR processing */
309 	ibt_status_t (*ibc_post_send)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp,
310 	    ibt_send_wr_t *wr_p, uint_t num_wr, uint_t *num_posted);
311 	ibt_status_t (*ibc_post_recv)(ibc_hca_hdl_t hca, ibc_qp_hdl_t qp,
312 	    ibt_recv_wr_t *wr_p, uint_t num_wr, uint_t *num_posted);
313 	ibt_status_t (*ibc_poll_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq,
314 	    ibt_wc_t *wc_p, uint_t num_wc, uint_t *num_polled);
315 	ibt_status_t (*ibc_notify_cq)(ibc_hca_hdl_t hca, ibc_cq_hdl_t cq,
316 	    ibt_cq_notify_flags_t flags);
317 
318 	/* CI Object Private Data */
319 	ibt_status_t (*ibc_ci_data_in)(ibc_hca_hdl_t hca,
320 	    ibt_ci_data_flags_t flags, ibt_object_type_t object,
321 	    void *ibc_object_handle, void *data_p, size_t data_sz);
322 	ibt_status_t (*ibc_ci_data_out)(ibc_hca_hdl_t hca,
323 	    ibt_ci_data_flags_t flags, ibt_object_type_t object,
324 	    void *ibc_object_handle, void *data_p, size_t data_sz);
325 
326 	/* Shared Receive Queues */
327 	ibt_status_t (*ibc_alloc_srq)(ibc_hca_hdl_t hca, ibt_srq_flags_t flags,
328 	    ibt_srq_hdl_t ibt_srq, ibc_pd_hdl_t pd, ibt_srq_sizes_t *sizes,
329 	    ibc_srq_hdl_t *ibc_srq_p, ibt_srq_sizes_t *real_size_p);
330 	ibt_status_t (*ibc_free_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq);
331 	ibt_status_t (*ibc_query_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq,
332 	    ibc_pd_hdl_t *pd_p, ibt_srq_sizes_t *sizes_p, uint_t *limit);
333 	ibt_status_t (*ibc_modify_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq,
334 	    ibt_srq_modify_flags_t flags, uint_t size, uint_t limit,
335 	    uint_t *real_size_p);
336 	ibt_status_t (*ibc_post_srq)(ibc_hca_hdl_t hca, ibc_srq_hdl_t srq,
337 	    ibt_recv_wr_t *wr, uint_t num_wr, uint_t *num_posted_p);
338 
339 	/* Address translation */
340 	ibt_status_t (*ibc_map_mem_area)(ibc_hca_hdl_t hca_hdl,
341 	    ibt_va_attr_t *va_attrs, void *ibtl_reserved,
342 	    uint_t paddr_list_len, ibt_reg_req_t *reg_req,
343 	    ibc_ma_hdl_t *ma_hdl_p);
344 	ibt_status_t (*ibc_unmap_mem_area)(ibc_hca_hdl_t hca_hdl,
345 	    ibc_ma_hdl_t ma_hdl);
346 	ibt_status_t (*ibc_map_mem_iov)(ibc_hca_hdl_t hca_hdl,
347 	    ibt_iov_attr_t *iov_attr, ibt_all_wr_t *wr,
348 	    ibc_mi_hdl_t *mi_hdl);
349 	ibt_status_t (*ibc_unmap_mem_iov)(ibc_hca_hdl_t hca_hdl,
350 	    ibc_mi_hdl_t mi_hdl);
351 
352 	/* Allocate L_Key */
353 	ibt_status_t (*ibc_alloc_lkey)(ibc_hca_hdl_t hca_hdl, ibc_pd_hdl_t pd,
354 	    ibt_lkey_flags_t flags, uint_t phys_buf_list_sz,
355 	    ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p);
356 
357 	/* Physical Register Memory Region */
358 	ibt_status_t (*ibc_register_physical_mr)(ibc_hca_hdl_t hca,
359 	    ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, void *ibtl_reserved,
360 	    ibc_mr_hdl_t *mr_p, ibt_pmr_desc_t *mem_desc_p);
361 	ibt_status_t (*ibc_reregister_physical_mr)(ibc_hca_hdl_t hca,
362 	    ibc_mr_hdl_t mr, ibc_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr,
363 	    void *ibtl_reserved, ibc_mr_hdl_t *mr_p,
364 	    ibt_pmr_desc_t *mem_desc_p);
365 
366 	/* Fast Memory Registration (FMR) */
367 	ibt_status_t (*ibc_create_fmr_pool)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
368 	    ibt_fmr_pool_attr_t *fmr_params, ibc_fmr_pool_hdl_t *fmr_pool_p);
369 	ibt_status_t (*ibc_destroy_fmr_pool)(ibc_hca_hdl_t hca,
370 	    ibc_fmr_pool_hdl_t fmr_pool);
371 	ibt_status_t (*ibc_flush_fmr_pool)(ibc_hca_hdl_t hca,
372 	    ibc_fmr_pool_hdl_t fmr_pool);
373 	ibt_status_t (*ibc_register_physical_fmr)(ibc_hca_hdl_t hca,
374 	    ibc_fmr_pool_hdl_t fmr_pool, ibt_pmr_attr_t *mem_pattr,
375 	    void *ibtl_reserved, ibc_mr_hdl_t *mr_hdl_p,
376 	    ibt_pmr_desc_t *mem_desc_p);
377 	ibt_status_t (*ibc_deregister_fmr)(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr);
378 
379 	/* IO memory management */
380 	ibt_status_t (*ibc_alloc_io_mem)(ibc_hca_hdl_t hca_hdl, size_t size,
381 	    ibt_mr_flags_t mr_flag, caddr_t *kaddrp,
382 	    ibc_mem_alloc_hdl_t *mem_alloc_hdl);
383 	ibt_status_t (*ibc_free_io_mem)(ibc_hca_hdl_t hca_hdl,
384 	    ibc_mem_alloc_hdl_t mem_alloc_hdl);
385 
386 	/* Extended RC (XRC) */
387 	ibt_status_t (*ibc_alloc_xrc_domain)();
388 	ibt_status_t (*ibc_free_xrc_domain)();
389 	ibt_status_t (*ibc_alloc_xrc_srq)();
390 	ibt_status_t (*ibc_free_xrc_srq)();
391 	ibt_status_t (*ibc_query_xrc_srq)();
392 	ibt_status_t (*ibc_modify_xrc_srq)();
393 	ibt_status_t (*ibc_alloc_xrc_tgt_qp)();
394 	ibt_status_t (*ibc_free_xrc_tgt_qp)();
395 	ibt_status_t (*ibc_query_xrc_tgt_qp)();
396 	ibt_status_t (*ibc_modify_xrc_tgt_qp)();
397 
398 	/* DMA memory region */
399 	ibt_status_t (*ibc_register_dma_mr)(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
400 	    ibt_dmr_attr_t *attr_p, void *ibtl_reserved, ibc_mr_hdl_t *mr_p,
401 	    ibt_mr_desc_t *mem_desc);
402 
403 	/* OPS extensions for next round of enhancements */
404 	ibt_status_t (*ibc_enhancement1)();
405 	ibt_status_t (*ibc_enhancement2)();
406 	ibt_status_t (*ibc_enhancement3)();
407 	ibt_status_t (*ibc_enhancement4)();
408 } ibc_operations_t;
409 
410 
411 /*
412  * The ibc_hca_info_s structure is used for HCA drivers to communicate its
413  * HCA specific information to IBTF when it attaches a device via ibc_attach().
414  *
415  * IBTF assumes that the structures pointed to by the hca_ops and hca_attr
416  * structure members are persistent.
417  */
418 typedef struct ibc_hca_info_s {
419 	ibc_version_t		hca_ci_vers;	/* CI Version */
420 	ibc_hca_hdl_t		hca_handle;	/* used for call through */
421 						/* "hca_ops" */
422 	ibc_operations_t	*hca_ops;
423 	ibt_hca_attr_t		*hca_attr;
424 } ibc_hca_info_t;
425 
426 
427 /* Channel Interface return status */
428 typedef enum ibc_status_e {
429 	IBC_SUCCESS = 0,
430 	IBC_FAILURE = 1
431 } ibc_status_t;
432 
433 /*
434  * CI up-calls to IBTF.
435  */
436 
437 /*
438  * ibc_init
439  *	Registers CI clients with the Solaris I/O framework
440  *
441  * ibc_fini
442  *	Un-Registers CI clients with the Solaris I/O framework
443  */
444 int ibc_init(struct modlinkage *modlp);
445 void ibc_fini(struct modlinkage *modlp);
446 
447 /*
448  * ibc_attach
449  *	Register HCA device with IBTF. During this call HCA driver provides
450  *	driver's information neededby IBTF.
451  *
452  * ibc_post_attach
453  *	After a successful ibc_attach, this must be called.
454  *
455  * ibc_pre_detach
456  *	Attempt to De-Register HCA Device from IBTF.
457  *	This requires the cooperation of IBTF clients to
458  *	stop using this HCA.  Upon success, the HCA driver
459  *	is committed to calling ibc_detach.
460  *
461  * ibc_detach
462  *	De-Register HCA Device from IBTF.
463  *	This function will succeed if ibc_pre_detach has previously
464  *	succeeded for this device.
465  */
466 ibc_status_t ibc_attach(ibc_clnt_hdl_t *ibc_hdl_p, ibc_hca_info_t *info_p);
467 void ibc_post_attach(ibc_clnt_hdl_t ibc_hdl);
468 ibc_status_t ibc_pre_detach(ibc_clnt_hdl_t ibc_hdl, ddi_detach_cmd_t cmd);
469 void ibc_detach(ibc_clnt_hdl_t ibc_hdl);
470 
471 /*
472  * ibc_cq_handler
473  *	IBTF Completion Queue Notification Handler.
474  */
475 void ibc_cq_handler(ibc_clnt_hdl_t ibc_hdl, ibt_cq_hdl_t ibt_cq);
476 
477 /*
478  * ibc_async_handler
479  *	IBTF Asynchronous event/error handler.
480  */
481 void ibc_async_handler(ibc_clnt_hdl_t ibc_hdl, ibt_async_code_t code,
482     ibc_async_event_t *event_p);
483 
484 /*
485  * ibc_memory_handler
486  *	IBTF memory event/error handler.
487  */
488 void ibc_memory_handler(ibc_clnt_hdl_t ibc_hdl, ibt_mem_code_t code,
489     ibt_mem_data_t *data_p, void *ibtl_reserved);
490 
491 /*
492  * ibc_get_ci_failure()
493  *
494  *	Used to obtain a special IBTF failure code for CI specific failures,
495  *	failures other than those defined in ibt_status_t.
496  */
497 ibt_status_t ibc_get_ci_failure(uint64_t ena);
498 
499 #ifdef __cplusplus
500 }
501 #endif
502 
503 #endif	/* _SYS_IB_IBTL_IBCI_H */
504