xref: /illumos-gate/usr/src/uts/common/sys/ib/ibtl/ibvti.h (revision 6a634c9d)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5f07a6d2aSShantkumar Hiremath  * Common Development and Distribution License (the "License").
6f07a6d2aSShantkumar Hiremath  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*17a2b317SBill Taylor  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef	_SYS_IB_IBTL_IBVTI_H
267c478bd9Sstevel@tonic-gate #define	_SYS_IB_IBTL_IBVTI_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * ibvti.h
307c478bd9Sstevel@tonic-gate  *
317c478bd9Sstevel@tonic-gate  * This file contains private verbs level transport interface extensions.
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibti_common.h>
347c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_ci_types.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef __cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #define	IBT_CM_NO_QP		IBT_CM_NO_CHAN		/* ibt_cm_reason_t */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #define	IBT_CM_SREP_QPN_VALID	IBT_CM_SREP_CHAN_VALID	/* ibt_sidr_status_t */
437c478bd9Sstevel@tonic-gate #define	IBT_CM_SREP_NO_QP	IBT_CM_SREP_NO_CHAN	/* ibt_sidr_status_t */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #define	IBT_OCHAN_CM_RETRY	IBT_OCHAN_OPAQUE1 /* ibt_chan_open_flags_t */
467c478bd9Sstevel@tonic-gate #define	IBT_OCHAN_STARTING_PSN	IBT_OCHAN_OPAQUE2 /* ibt_chan_open_flags_t */
477c478bd9Sstevel@tonic-gate #define	IBT_OCHAN_LOCAL_CM_TM	IBT_OCHAN_OPAQUE3 /* ibt_chan_open_flags_t */
487c478bd9Sstevel@tonic-gate #define	IBT_OCHAN_REMOTE_CM_TM	IBT_OCHAN_OPAQUE4 /* ibt_chan_open_flags_t */
497c478bd9Sstevel@tonic-gate #define	IBT_OCHAN_RDC_EXISTS	IBT_OCHAN_OPAQUE5 /* ibt_chan_open_flags_t */
509c468ea9SPramod Gunjikar #define	IBT_OCHAN_OFUV		IBT_OCHAN_OPAQUE6 /* ibt_chan_open_flags_t */
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #define	oc_cm_retry_cnt		oc_opaque1	/* ibt_chan_open_args_t */
537c478bd9Sstevel@tonic-gate 						/* The number of times the */
547c478bd9Sstevel@tonic-gate 						/* CM will retry its MADs */
557c478bd9Sstevel@tonic-gate 						/* when IBT_OCHAN_CM_RETRY */
567c478bd9Sstevel@tonic-gate 						/* is set */
577c478bd9Sstevel@tonic-gate #define	oc_starting_psn		oc_opaque2	/* ibt_chan_open_args_t */
587c478bd9Sstevel@tonic-gate 						/* use oc_starting_psn when */
597c478bd9Sstevel@tonic-gate 						/* IBT_OCHAN_STARTING_PSN is */
607c478bd9Sstevel@tonic-gate 						/* set */
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	oc_local_cm_time	oc_opaque3	/* ibt_chan_open_args_t */
637c478bd9Sstevel@tonic-gate 						/* The maximum time in */
647c478bd9Sstevel@tonic-gate 						/* microseconds that local */
657c478bd9Sstevel@tonic-gate 						/* client takes to  respond */
667c478bd9Sstevel@tonic-gate 						/* for a CM callback */
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #define	oc_remote_cm_time	oc_opaque4	/* ibt_chan_open_args_t */
697c478bd9Sstevel@tonic-gate 						/* The maximum time in */
707c478bd9Sstevel@tonic-gate 						/* microseconds that remote */
717c478bd9Sstevel@tonic-gate 						/* node takes to  respond */
727c478bd9Sstevel@tonic-gate 						/* for a CM MAD */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #define	cm_eec_hdl		cm_opaque	/* ibt_cm_event_t */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate #define	req_remote_eecn		req_opaque1	/* ibt_cm_req_rcv_t */
777c478bd9Sstevel@tonic-gate #define	req_local_eecn		req_opaque2	/* ibt_cm_req_rcv_t */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define	IBT_CM_RDC_EXISTS	0x4		/* ibt_cm_flags_t */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate #define	ai_dlid			ai_opaque1	/* Local dest, or router LID */
827c478bd9Sstevel@tonic-gate #define	ai_src_path		ai_opaque2	/* Source path bits */
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * Note that variables of type ibt_qp_hdl_t (really ibt_channel_hdl_t)
877c478bd9Sstevel@tonic-gate  * can be used in some of the IBTI interfaces, e.g., ibt_open_rc_channel().
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate #define	ibt_qp_hdl_t		ibt_channel_hdl_t
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /*
937c478bd9Sstevel@tonic-gate  * FUNCTION PROTOTYPES.
947c478bd9Sstevel@tonic-gate  */
957c478bd9Sstevel@tonic-gate /*
967c478bd9Sstevel@tonic-gate  * ibt_alloc_ah()
977c478bd9Sstevel@tonic-gate  *	Allocates and returns an address handle (ibt_ah_hdl_t).
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_flags_t flags,
1007c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t pd, ibt_adds_vect_t *adds_vectp, ibt_ah_hdl_t *ah_p);
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1037c478bd9Sstevel@tonic-gate  * ibt_free_ah()
1047c478bd9Sstevel@tonic-gate  *	Release/de-allocate the specified handle.
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah);
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate /*
1097c478bd9Sstevel@tonic-gate  * ibt_query_ah
1107c478bd9Sstevel@tonic-gate  *	Obtain the address vector information for the specified address handle.
1117c478bd9Sstevel@tonic-gate  */
1127c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
1137c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t *pd_p, ibt_adds_vect_t *adds_vectp);
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate /*
1167c478bd9Sstevel@tonic-gate  * ibt_modify_ah
1177c478bd9Sstevel@tonic-gate  *	Modify the address vector information for the specified address handle.
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_ah(ibt_hca_hdl_t hca_hdl, ibt_ah_hdl_t ah,
1207c478bd9Sstevel@tonic-gate     ibt_adds_vect_t *adds_vectp);
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /*
1247c478bd9Sstevel@tonic-gate  * ibt_alloc_qp()
1257c478bd9Sstevel@tonic-gate  *	Allocate a QP with specified attributes.
1267c478bd9Sstevel@tonic-gate  *
1277c478bd9Sstevel@tonic-gate  * Note:
1287c478bd9Sstevel@tonic-gate  *	QPs allocated by ibt_alloc_qp are in the RESET state.  The client
1297c478bd9Sstevel@tonic-gate  *	needs to transition an RC QP into the INIT state if it is going to
1307c478bd9Sstevel@tonic-gate  *	use ibt_open_rc_channel to establish the connection.
1317c478bd9Sstevel@tonic-gate  *	The client needs to transition an UD QP into the RTS state.
1327c478bd9Sstevel@tonic-gate  */
1337c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_qp(ibt_hca_hdl_t hca_hdl, ibt_qp_type_t type,
1347c478bd9Sstevel@tonic-gate     ibt_qp_alloc_attr_t *qp_attr, ibt_chan_sizes_t *queue_sizes_p,
1357c478bd9Sstevel@tonic-gate     ib_qpn_t *qpn_p, ibt_qp_hdl_t *ibt_qp_p);
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate /*
1387c478bd9Sstevel@tonic-gate  * ibt_alloc_special_qp()
1397c478bd9Sstevel@tonic-gate  *	Allocate a special QP with specified attributes.
1407c478bd9Sstevel@tonic-gate  *
1417c478bd9Sstevel@tonic-gate  * Note:
1427c478bd9Sstevel@tonic-gate  *	QPs allocated by ibt_alloc_special_qp are in the RESET state.
1437c478bd9Sstevel@tonic-gate  *	The client needs to transition an UD QP into the RTS state.
1447c478bd9Sstevel@tonic-gate  */
1457c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_special_qp(ibt_hca_hdl_t hca_hdl, uint8_t port,
1467c478bd9Sstevel@tonic-gate     ibt_sqp_type_t type, ibt_qp_alloc_attr_t *qp_attr,
1477c478bd9Sstevel@tonic-gate     ibt_chan_sizes_t *queue_sizes_p, ibt_qp_hdl_t *ibt_qp_p);
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate /*
1507c478bd9Sstevel@tonic-gate  * ibt_flush_qp()
1517c478bd9Sstevel@tonic-gate  *	Transition a QP into error state to flush all outstanding
1527c478bd9Sstevel@tonic-gate  *	work requests. Must be called before calling ibt_free_qp().
1537c478bd9Sstevel@tonic-gate  *	Use ibt_close_rc_channel for RC QPs that have been opened
1547c478bd9Sstevel@tonic-gate  *	successfully.
1557c478bd9Sstevel@tonic-gate  */
1567c478bd9Sstevel@tonic-gate ibt_status_t ibt_flush_qp(ibt_qp_hdl_t ibt_qp);
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate /*
1597c478bd9Sstevel@tonic-gate  * ibt_initialize_qp()
1607c478bd9Sstevel@tonic-gate  *	Transition a QP from RESET state into a usable state.
1617c478bd9Sstevel@tonic-gate  *	An RC QP is transitioned into the INIT state, ready for
1627c478bd9Sstevel@tonic-gate  *	a call to ibt_open_rc_channel().  A UD QP is transitioned
1637c478bd9Sstevel@tonic-gate  *	all the way to the RTS state.
1647c478bd9Sstevel@tonic-gate  */
1657c478bd9Sstevel@tonic-gate ibt_status_t ibt_initialize_qp(ibt_qp_hdl_t ibt_qp,
1667c478bd9Sstevel@tonic-gate     ibt_qp_info_t *modify_attrp);
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate /*
1707c478bd9Sstevel@tonic-gate  * ibt_free_qp()
1717c478bd9Sstevel@tonic-gate  *	De-allocate or free the resources associated with an existing QP.
1727c478bd9Sstevel@tonic-gate  */
1737c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_qp(ibt_qp_hdl_t ibt_qp);
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate /*
1777c478bd9Sstevel@tonic-gate  * ibt_query_qp()
1787c478bd9Sstevel@tonic-gate  *	Query the attributes of an existing QP.
1797c478bd9Sstevel@tonic-gate  */
1807c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_qp(ibt_qp_hdl_t ibt_qp, ibt_qp_query_attr_t *qp_attrp);
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /*
1847c478bd9Sstevel@tonic-gate  * ibt_modify_qp()
1857c478bd9Sstevel@tonic-gate  *	Modify the attributes of an existing QP.
1867c478bd9Sstevel@tonic-gate  */
1877c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_qp(ibt_qp_hdl_t ibt_qp, ibt_cep_modify_flags_t flags,
1887c478bd9Sstevel@tonic-gate     ibt_qp_info_t *qp_attr, ibt_queue_sizes_t *actual_sz);
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate /*
1917c478bd9Sstevel@tonic-gate  * ibt_set_qp_private(), ibt_get_qp_private()
1927c478bd9Sstevel@tonic-gate  *	Set/Get the client private data.
1937c478bd9Sstevel@tonic-gate  */
1947c478bd9Sstevel@tonic-gate void ibt_set_qp_private(ibt_qp_hdl_t ibt_qp, void *clnt_private);
1957c478bd9Sstevel@tonic-gate void *ibt_get_qp_private(ibt_qp_hdl_t ibt_qp);
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate /*
1997c478bd9Sstevel@tonic-gate  * ibt_qp_to_hca_guid
2007c478bd9Sstevel@tonic-gate  *      A helper function to retrieve HCA GUID for the specified QP.
2017c478bd9Sstevel@tonic-gate  */
2027c478bd9Sstevel@tonic-gate ib_guid_t ibt_qp_to_hca_guid(ibt_qp_hdl_t ibt_qp);
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate /*
2067c478bd9Sstevel@tonic-gate  * ibt_recover_ud_qp()
2077c478bd9Sstevel@tonic-gate  *      Recover an UD QP which has transitioned to SQ Error state. The
2087c478bd9Sstevel@tonic-gate  *      ibt_recover_ud_qp() transitions the QP from SQ Error state to
2097c478bd9Sstevel@tonic-gate  *	Ready-To-Send QP state.
2107c478bd9Sstevel@tonic-gate  *
2117c478bd9Sstevel@tonic-gate  *      If a work request posted to a UD QP's send queue completes with
2127c478bd9Sstevel@tonic-gate  *      an error (see ibt_wc_status_t), the QP gets transitioned to SQ
2137c478bd9Sstevel@tonic-gate  *      Error state. In order to reuse this QP, ibt_recover_ud_qp() can
2147c478bd9Sstevel@tonic-gate  *      be used to recover the QP to a usable (Ready-to-Send) state.
2157c478bd9Sstevel@tonic-gate  */
2167c478bd9Sstevel@tonic-gate ibt_status_t ibt_recover_ud_qp(ibt_qp_hdl_t ibt_qp);
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate /*
2207c478bd9Sstevel@tonic-gate  * Datagram Domain Functions
2217c478bd9Sstevel@tonic-gate  */
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate /*
2247c478bd9Sstevel@tonic-gate  * ibt_ud_get_dqpn
2257c478bd9Sstevel@tonic-gate  *	Finds the destination QPN at the specified destination that the
2267c478bd9Sstevel@tonic-gate  *	specified service can be reached on. The IBTF CM initiates the
2277c478bd9Sstevel@tonic-gate  *	service ID resolution protocol (SIDR) to determine a destination QPN.
2287c478bd9Sstevel@tonic-gate  */
2297c478bd9Sstevel@tonic-gate ibt_status_t ibt_ud_get_dqpn(ibt_ud_dest_attr_t *attr,
2307c478bd9Sstevel@tonic-gate     ibt_execution_mode_t mode, ibt_ud_returns_t *returns);
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate /*
2337c478bd9Sstevel@tonic-gate  * ibt_get_module_failure()
2347c478bd9Sstevel@tonic-gate  *
2357c478bd9Sstevel@tonic-gate  *	Used to obtain a special IBTF failure code for IB module specific
2367c478bd9Sstevel@tonic-gate  *	failures, i.e. failures other than those defined in ibt_status_t.
2377c478bd9Sstevel@tonic-gate  */
2387c478bd9Sstevel@tonic-gate ibt_status_t ibt_get_module_failure(ibt_failure_type_t type, uint64_t ena);
2397c478bd9Sstevel@tonic-gate 
240f07a6d2aSShantkumar Hiremath ibt_status_t ibt_ofuvcm_get_req_data(void *, ibt_ofuvcm_req_data_t *);
241f07a6d2aSShantkumar Hiremath 
242f07a6d2aSShantkumar Hiremath ibt_status_t ibt_ofuvcm_proceed(ibt_cm_event_type_t, void *,
243f07a6d2aSShantkumar Hiremath     ibt_cm_status_t, ibt_cm_proceed_reply_t *, void *,
244f07a6d2aSShantkumar Hiremath     ibt_priv_data_len_t);
245f07a6d2aSShantkumar Hiremath 
2467c478bd9Sstevel@tonic-gate #ifdef __cplusplus
2477c478bd9Sstevel@tonic-gate }
2487c478bd9Sstevel@tonic-gate #endif
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBVTI_H */
251