xref: /onnv-gate/usr/src/uts/common/sys/ib/ibtl/ibti.h (revision 12965:b65a8427f8fe)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
58580SBill.Taylor@Sun.COM  * Common Development and Distribution License (the "License").
68580SBill.Taylor@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*12965SWilliam.Taylor@Oracle.COM  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef	_SYS_IB_IBTL_IBTI_H
260Sstevel@tonic-gate #define	_SYS_IB_IBTL_IBTI_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate /*
290Sstevel@tonic-gate  * ibti.h
300Sstevel@tonic-gate  *
310Sstevel@tonic-gate  * This file contains the IBTI prototypes and associated data structures.
320Sstevel@tonic-gate  * It is the only header file that should be included by IBTI clients.
330Sstevel@tonic-gate  */
340Sstevel@tonic-gate #include <sys/ib/ibtl/ibti_common.h>
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #ifdef __cplusplus
370Sstevel@tonic-gate extern "C" {
380Sstevel@tonic-gate #endif
390Sstevel@tonic-gate 
400Sstevel@tonic-gate /*
410Sstevel@tonic-gate  * Allocate channel flags.
420Sstevel@tonic-gate  */
430Sstevel@tonic-gate typedef enum ibt_chan_alloc_flags_e {
440Sstevel@tonic-gate 	IBT_ACHAN_NO_FLAGS		= 0,
450Sstevel@tonic-gate 	IBT_ACHAN_CLONE			= (1 << 0),
460Sstevel@tonic-gate 	IBT_ACHAN_USER_MAP		= (1 << 1),
470Sstevel@tonic-gate 	IBT_ACHAN_DEFER_ALLOC		= (1 << 2),
488580SBill.Taylor@Sun.COM 	IBT_ACHAN_USES_SRQ		= (1 << 3),
49*12965SWilliam.Taylor@Oracle.COM 	IBT_ACHAN_USES_RSS		= (1 << 4),
50*12965SWilliam.Taylor@Oracle.COM 
51*12965SWilliam.Taylor@Oracle.COM 	/* UD variants for FC support */
52*12965SWilliam.Taylor@Oracle.COM 	IBT_ACHAN_USES_RFCI		= (1 << 5),	/* from RFCI pool */
53*12965SWilliam.Taylor@Oracle.COM 	IBT_ACHAN_USES_FCMD		= (1 << 6),
54*12965SWilliam.Taylor@Oracle.COM 	IBT_ACHAN_USES_FEXCH		= (1 << 7)	/* from FEXCH pool */
550Sstevel@tonic-gate } ibt_chan_alloc_flags_t;
560Sstevel@tonic-gate 
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
590Sstevel@tonic-gate  * Allocate RC channel ibt_alloc_rc_channel() argument.
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate typedef struct ibt_rc_chan_alloc_args_s {
620Sstevel@tonic-gate 	ibt_attr_flags_t	rc_flags;	/* Signal type etc */
630Sstevel@tonic-gate 	ibt_cep_flags_t		rc_control;
640Sstevel@tonic-gate 	uint8_t			rc_hca_port_num;
650Sstevel@tonic-gate 	ibt_chan_sizes_t	rc_sizes;
660Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_scq;	/* Send CQ */
670Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_rcq;	/* Recv CQ */
680Sstevel@tonic-gate 	ibt_pd_hdl_t		rc_pd;	/* PD */
690Sstevel@tonic-gate 	ibt_channel_hdl_t	rc_clone_chan;	/* Optional Clone handle */
700Sstevel@tonic-gate 	ibt_srq_hdl_t		rc_srq;		/* Optional Shared Rcv Queue */
710Sstevel@tonic-gate } ibt_rc_chan_alloc_args_t;
720Sstevel@tonic-gate 
730Sstevel@tonic-gate /*
740Sstevel@tonic-gate  * RC channel query attributes structure.
750Sstevel@tonic-gate  */
760Sstevel@tonic-gate typedef struct ibt_rc_chan_query_attr_s {
770Sstevel@tonic-gate 	ib_guid_t		rc_hca_guid;	/* Local HCA GUID */
780Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_scq;		/* SendCQ handle */
790Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_rcq;		/* RecvCQ handle */
800Sstevel@tonic-gate 	ibt_pd_hdl_t		rc_pd;		/* PD Handle. */
810Sstevel@tonic-gate 	ibt_cep_state_t		rc_state;	/* Channel state */
820Sstevel@tonic-gate 	ib_mtu_t		rc_path_mtu;
830Sstevel@tonic-gate 	uint8_t			rc_path_retry_cnt:3;
840Sstevel@tonic-gate 	ibt_rnr_retry_cnt_t	rc_path_rnr_retry_cnt;
850Sstevel@tonic-gate 	ibt_rnr_nak_time_t	rc_min_rnr_nak;	/* min RNR-NAK timer */
860Sstevel@tonic-gate 	ibt_cep_path_t		rc_prim_path;
870Sstevel@tonic-gate 	ibt_cep_path_t		rc_alt_path;
880Sstevel@tonic-gate 	ibt_chan_sizes_t	rc_chan_sizes;	/* Queue/SGL sizes */
890Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_out;	/* max RDMA-Reads/Atomics out */
900Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_in;	/* max RDMA-Reads/Atomics in */
910Sstevel@tonic-gate 	ibt_attr_flags_t	rc_flags;	/* SQ Signaling Type etc */
920Sstevel@tonic-gate 	ibt_cep_flags_t		rc_control;	/* Control Flags */
930Sstevel@tonic-gate 	ibt_cep_cmstate_t	rc_mig_state;
940Sstevel@tonic-gate 	ib_qpn_t		rc_qpn;		/* Local QPN */
950Sstevel@tonic-gate 	ib_qpn_t		rc_dst_qpn;	/* Destination QPN */
960Sstevel@tonic-gate 	ibt_srq_hdl_t		rc_srq;		/* Optional Shared Rcv Queue */
970Sstevel@tonic-gate } ibt_rc_chan_query_attr_t;
980Sstevel@tonic-gate 
990Sstevel@tonic-gate /*
1000Sstevel@tonic-gate  * RC Channel Modify Attributes definition.
1010Sstevel@tonic-gate  *
1020Sstevel@tonic-gate  * It is only possible to modify a channel that has previously been
1030Sstevel@tonic-gate  * opened. The channel must either be in operational state (IBT_STATE_RTS)
1040Sstevel@tonic-gate  * or paused (IBT_STATE_SQD). If channel is in paused state, then a modify
1050Sstevel@tonic-gate  * operation will unpause the channel.
1060Sstevel@tonic-gate  *
1070Sstevel@tonic-gate  * See the ibt_modify_rc_channel() for details of the required corresponding
1080Sstevel@tonic-gate  * modify flags.
1090Sstevel@tonic-gate  * Not specified attributes should be set to "NULL" or "0".
1100Sstevel@tonic-gate  */
1110Sstevel@tonic-gate typedef struct ibt_rc_chan_modify_attr_s {
1120Sstevel@tonic-gate 	ibt_cep_flags_t		rc_control;	/* Channel Control Flags */
1130Sstevel@tonic-gate 	uint_t			rc_sq_sz;	/* Set SQ Max outstanding WRs */
1140Sstevel@tonic-gate 	uint_t			rc_rq_sz;	/* Set RQ Max outstanding WRs */
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate 	ibt_adds_vect_t		rc_prim_adds_vect; /* Primary Path Address */
1170Sstevel@tonic-gate 	ibt_adds_vect_t		rc_alt_adds_vect; /* Alternate Path Address */
1180Sstevel@tonic-gate 	uint8_t			rc_path_retry_cnt:3;
1190Sstevel@tonic-gate 	ibt_rnr_retry_cnt_t	rc_path_rnr_retry_cnt;
1200Sstevel@tonic-gate 	ibt_rnr_nak_time_t	rc_min_rnr_nak;	/* min RNR-NAK timer */
1210Sstevel@tonic-gate 	uint8_t			rc_prim_port_num; /* Port of Primary Path */
1220Sstevel@tonic-gate 	uint8_t			rc_alt_port_num; /* Port of Alternate Path */
1230Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_out;	/* Initiator Depth, Number of */
1240Sstevel@tonic-gate 						/* RDMA RD's & Atomics */
1250Sstevel@tonic-gate 						/* outstanding. */
1260Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_in; /* Responder resources for */
1270Sstevel@tonic-gate 						/* handling incoming RDMA rds */
1280Sstevel@tonic-gate 						/* and Atomics. */
1290Sstevel@tonic-gate } ibt_rc_chan_modify_attr_t;
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate /*
1320Sstevel@tonic-gate  * UD remote destination query attributes
1330Sstevel@tonic-gate  */
1340Sstevel@tonic-gate typedef struct ibt_ud_dest_query_attr_s {
1350Sstevel@tonic-gate 	ibt_hca_hdl_t		ud_hca_hdl;	/* Local HCA Handle */
1360Sstevel@tonic-gate 	ib_qpn_t		ud_dst_qpn;	/* Destination QPN */
1370Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;	/* Q_Key */
1380Sstevel@tonic-gate 	ibt_adds_vect_t 	ud_addr_vect;	/* Address Information */
1390Sstevel@tonic-gate 	ibt_pd_hdl_t		ud_pd;
1400Sstevel@tonic-gate } ibt_ud_dest_query_attr_t;
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate /*
1430Sstevel@tonic-gate  * Allocate UD channel ibt_alloc_ud_channel() arguments; see below at
1440Sstevel@tonic-gate  * ibt_alloc_ud_channel() for a description of what's required and optional.
1450Sstevel@tonic-gate  */
1460Sstevel@tonic-gate typedef struct ibt_ud_chan_alloc_args_s {
1470Sstevel@tonic-gate 	ibt_attr_flags_t	ud_flags;	/* Sig type etc */
1480Sstevel@tonic-gate 	uint8_t			ud_hca_port_num;
1490Sstevel@tonic-gate 	uint16_t		ud_pkey_ix;	/* P_Key Index */
1500Sstevel@tonic-gate 	ibt_chan_sizes_t	ud_sizes;
1510Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;	/* Q_Key */
1520Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_scq;		/* Send CQ */
1530Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_rcq;		/* Recv CQ */
1540Sstevel@tonic-gate 	ibt_pd_hdl_t		ud_pd;		/* PD */
1550Sstevel@tonic-gate 	ibt_channel_hdl_t	ud_clone_chan;	/* Optional clone handle */
1560Sstevel@tonic-gate 	ibt_srq_hdl_t		ud_srq;		/* Optional Shared Rcv Queue */
1578580SBill.Taylor@Sun.COM 	ibt_rss_attr_t		ud_rss;
158*12965SWilliam.Taylor@Oracle.COM 	ibt_fc_attr_t		ud_fc;
1590Sstevel@tonic-gate } ibt_ud_chan_alloc_args_t;
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate /*
1620Sstevel@tonic-gate  * UD channel query attributes.
1630Sstevel@tonic-gate  */
1640Sstevel@tonic-gate typedef struct ibt_ud_chan_query_attr_s {
1650Sstevel@tonic-gate 	ib_qpn_t		ud_qpn;			/* QPN */
1660Sstevel@tonic-gate 	ib_guid_t		ud_hca_guid;		/* Local HCA GUID */
1670Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_scq;			/* SendCQ handle. */
1680Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_rcq;			/* RecvCQ handle. */
1690Sstevel@tonic-gate 	ibt_pd_hdl_t		ud_pd;			/* PD Handle. */
1700Sstevel@tonic-gate 	uint8_t			ud_hca_port_num;	/* Local HCA port */
1710Sstevel@tonic-gate 	ibt_cep_state_t		ud_state;		/* Channel state */
1720Sstevel@tonic-gate 	uint16_t		ud_pkey_ix;		/* P_Key Index */
1730Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;		/* Q_Key */
1740Sstevel@tonic-gate 	ibt_chan_sizes_t	ud_chan_sizes;		/* Queue/SGL sizes */
1750Sstevel@tonic-gate 	ibt_attr_flags_t	ud_flags;		/* Signaling Type etc */
1760Sstevel@tonic-gate 	ibt_srq_hdl_t		ud_srq;		/* Optional Shared Rcv Queue */
1778580SBill.Taylor@Sun.COM 	ibt_rss_attr_t		ud_rss;
178*12965SWilliam.Taylor@Oracle.COM 	ibt_fc_attr_t		ud_fc;
179*12965SWilliam.Taylor@Oracle.COM 	ibt_fexch_query_attr_t	ud_query_fc;	/* query only set */
1800Sstevel@tonic-gate } ibt_ud_chan_query_attr_t;
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate /*
1830Sstevel@tonic-gate  * UD Channel Modify Attributes definition.
1840Sstevel@tonic-gate  *
1850Sstevel@tonic-gate  * It is only possible to modify a channel that is either in the operational
1860Sstevel@tonic-gate  * state (IBT_STATE_RTS) or paused (IBT_STATE_SQD). If channel is in paused
1870Sstevel@tonic-gate  * state, then a modify operation will unpause the channel.
1880Sstevel@tonic-gate  *
1890Sstevel@tonic-gate  * See the ibt_modify_ud_channel() for details of the required corresponding
1900Sstevel@tonic-gate  * modify flags.
1910Sstevel@tonic-gate  */
1920Sstevel@tonic-gate typedef struct ibt_ud_chan_modify_attr_s {
1930Sstevel@tonic-gate 	uint_t			ud_sq_sz;	/* Set SQ Max outstanding WRs */
1940Sstevel@tonic-gate 	uint_t			ud_rq_sz;	/* Set RQ Max outstanding WRs */
1950Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;	/* Set Q_Key */
1968580SBill.Taylor@Sun.COM 	ibt_rss_attr_t		ud_rss;		/* Set RSS stuff */
197*12965SWilliam.Taylor@Oracle.COM 	ibt_fc_attr_t		ud_fc;
1980Sstevel@tonic-gate } ibt_ud_chan_modify_attr_t;
1990Sstevel@tonic-gate 
2000Sstevel@tonic-gate 
2010Sstevel@tonic-gate /*
2020Sstevel@tonic-gate  * FUNCTION PROTOTYPES
2030Sstevel@tonic-gate  */
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate /*
2060Sstevel@tonic-gate  * CONNECTION ESTABLISHMENT/TEAR DOWN FUNCTIONS.
2070Sstevel@tonic-gate  */
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate /*
2100Sstevel@tonic-gate  * ibt_alloc_rc_channel
2110Sstevel@tonic-gate  * 	Allocates a RC communication channels that satisfy the specified
2120Sstevel@tonic-gate  *	channel attributes.
2130Sstevel@tonic-gate  */
2140Sstevel@tonic-gate ibt_status_t ibt_alloc_rc_channel(ibt_hca_hdl_t hca_hdl,
2150Sstevel@tonic-gate     ibt_chan_alloc_flags_t flags, ibt_rc_chan_alloc_args_t *args,
2160Sstevel@tonic-gate     ibt_channel_hdl_t *rc_chan_p, ibt_chan_sizes_t *sizes);
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate /*
2190Sstevel@tonic-gate  * ibt_flush_channel
2200Sstevel@tonic-gate  *	Flush the specified channel. Outstanding work requests are flushed
2210Sstevel@tonic-gate  *	so that the client can do the associated clean up. After that, the
2220Sstevel@tonic-gate  *	client will usually deregister the previously registered memory,
2230Sstevel@tonic-gate  *	then free the channel by calling ibt_free_channel().  RC channels
2240Sstevel@tonic-gate  *	that have been successfully opened will fail this call, as they
2250Sstevel@tonic-gate  *	need to instead be handled by ibt_close_rc_channel().
2260Sstevel@tonic-gate  */
2270Sstevel@tonic-gate ibt_status_t ibt_flush_channel(ibt_channel_hdl_t chan);
2280Sstevel@tonic-gate 
2290Sstevel@tonic-gate /*
2300Sstevel@tonic-gate  * ibt_free_channel
2310Sstevel@tonic-gate  *	Releases the resources associated with the specified channel
2320Sstevel@tonic-gate  */
2330Sstevel@tonic-gate ibt_status_t ibt_free_channel(ibt_channel_hdl_t chan);
2340Sstevel@tonic-gate 
2350Sstevel@tonic-gate /*
2360Sstevel@tonic-gate  * ibt_query_rc_channel
2370Sstevel@tonic-gate  *	Query an RC channel's attributes. Should only be called on an
2380Sstevel@tonic-gate  *	opened RC channel. If called on a channel before it is opened,
2390Sstevel@tonic-gate  *	some channel attributes may change when the channel is opened.
2400Sstevel@tonic-gate  */
2410Sstevel@tonic-gate ibt_status_t ibt_query_rc_channel(ibt_channel_hdl_t rc_chan,
2420Sstevel@tonic-gate     ibt_rc_chan_query_attr_t *chan_attrs);
2430Sstevel@tonic-gate 
2440Sstevel@tonic-gate /*
2450Sstevel@tonic-gate  * ibt_modify_rc_channel()
2460Sstevel@tonic-gate  * 	Modifies a previous opened operational or paused RC channel's
2470Sstevel@tonic-gate  *	attributes.
2480Sstevel@tonic-gate  *
2490Sstevel@tonic-gate  * NOTE:
2500Sstevel@tonic-gate  *	It is only possible to modify a channel that has previously been opened.
2510Sstevel@tonic-gate  *	The channel must either be in operational state (IBT_STATE_RTS) or
2520Sstevel@tonic-gate  *	paused (IBT_STATE_SQD). If channel is in paused state, then a modify
2530Sstevel@tonic-gate  *	operation will will unpause the channel.
2540Sstevel@tonic-gate  */
2550Sstevel@tonic-gate ibt_status_t ibt_modify_rc_channel(ibt_channel_hdl_t rc_chan,
2560Sstevel@tonic-gate     ibt_cep_modify_flags_t flags, ibt_rc_chan_modify_attr_t *attrs,
2570Sstevel@tonic-gate     ibt_queue_sizes_t *actual_sz);
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate /*
2600Sstevel@tonic-gate  * ibt_alloc_ud_channel
2610Sstevel@tonic-gate  *	Allocate UD channels that satisfy the specified channel attributes.
2620Sstevel@tonic-gate  */
2630Sstevel@tonic-gate ibt_status_t ibt_alloc_ud_channel(ibt_hca_hdl_t hca_hdl,
2640Sstevel@tonic-gate     ibt_chan_alloc_flags_t flags, ibt_ud_chan_alloc_args_t *args,
2650Sstevel@tonic-gate     ibt_channel_hdl_t *ud_chan_p, ibt_chan_sizes_t *sizes);
2660Sstevel@tonic-gate 
2670Sstevel@tonic-gate /*
2688580SBill.Taylor@Sun.COM  * ibt_alloc_ud_channel_range
2698580SBill.Taylor@Sun.COM  *	Allocate a range of UD channels that have consecutive QPNs for RSS.
2708580SBill.Taylor@Sun.COM  */
2718580SBill.Taylor@Sun.COM ibt_status_t ibt_alloc_ud_channel_range(ibt_hca_hdl_t hca_hdl,
2728580SBill.Taylor@Sun.COM     uint_t log2, ibt_chan_alloc_flags_t flags,
2738580SBill.Taylor@Sun.COM     ibt_ud_chan_alloc_args_t *args, ibt_cq_hdl_t *send_cq_p,
2748580SBill.Taylor@Sun.COM     ibt_cq_hdl_t *recv_cq_p, ib_qpn_t *base_qpn_p,
2758580SBill.Taylor@Sun.COM     ibt_channel_hdl_t *ud_chan_p, ibt_chan_sizes_t *sizes);
2768580SBill.Taylor@Sun.COM 
2778580SBill.Taylor@Sun.COM /*
2780Sstevel@tonic-gate  * ibt_query_ud_channel
2790Sstevel@tonic-gate  *	Query a UD channel's attributes.
2800Sstevel@tonic-gate  */
2810Sstevel@tonic-gate ibt_status_t ibt_query_ud_channel(ibt_channel_hdl_t ud_chan,
2820Sstevel@tonic-gate     ibt_ud_chan_query_attr_t *ud_chan_attrs);
2830Sstevel@tonic-gate 
2840Sstevel@tonic-gate /*
2850Sstevel@tonic-gate  * ibt_modify_ud_channel()
2860Sstevel@tonic-gate  * 	Modifies an UD channel's attributes, as specified by a
2870Sstevel@tonic-gate  *	ibt_cep_modify_flags_t parameter to those specified in the
2880Sstevel@tonic-gate  *	ibt_ud_chan_modify_attr_t structure.
2890Sstevel@tonic-gate  *
2900Sstevel@tonic-gate  * NOTE:
2910Sstevel@tonic-gate  *	It is only possible to modify a channel that is either in the
2920Sstevel@tonic-gate  *	operational state (IBT_STATE_RTS) or paused (IBT_STATE_SQD). If
2930Sstevel@tonic-gate  *	channel is in paused state, then a modify operation will unpause the
2940Sstevel@tonic-gate  *	channel.
2950Sstevel@tonic-gate  */
2960Sstevel@tonic-gate ibt_status_t ibt_modify_ud_channel(ibt_channel_hdl_t ud_chan,
2970Sstevel@tonic-gate     ibt_cep_modify_flags_t flags, ibt_ud_chan_modify_attr_t *attrs,
2980Sstevel@tonic-gate     ibt_queue_sizes_t *actual_sz);
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate /*
3010Sstevel@tonic-gate  * ibt_recover_ud_channel()
3020Sstevel@tonic-gate  *	Recover an UD Channel which has transitioned to SQ Error state. The
3030Sstevel@tonic-gate  *	ibt_recover_ud_channel() transitions the channel from SQ Error state
3040Sstevel@tonic-gate  *	to Ready-To-Send channel state.
3050Sstevel@tonic-gate  *
3060Sstevel@tonic-gate  *	If a work request posted to a UD channel's send queue completes with
3070Sstevel@tonic-gate  *	an error (see ibt_wc_status_t), the channel gets transitioned to SQ
3080Sstevel@tonic-gate  *	Error state. In order to reuse this channel, ibt_recover_ud_channel()
3090Sstevel@tonic-gate  *	can be used to recover the channel to a usable (Ready-to-Send) state.
3100Sstevel@tonic-gate  */
3110Sstevel@tonic-gate ibt_status_t ibt_recover_ud_channel(ibt_channel_hdl_t ud_chan);
3120Sstevel@tonic-gate 
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate /*
3150Sstevel@tonic-gate  * ibt_alloc_ud_dest
3160Sstevel@tonic-gate  *	Allocate a UD destination handle.  This allocates local resources
3170Sstevel@tonic-gate  *	that will need subsequent modification/initialization before use
3180Sstevel@tonic-gate  *	(in send work requests).  Functions that can be used to do this are
3190Sstevel@tonic-gate  *	ibt_modify_ud_dest (data supplied by caller), ibt_modify_reply_ud_dest
3200Sstevel@tonic-gate  *	(data supplied from a successfully completed receive work request),
3210Sstevel@tonic-gate  *	and ibt_request_ud_dest (data retrieved using SIDR protocol).
3220Sstevel@tonic-gate  */
3230Sstevel@tonic-gate ibt_status_t ibt_alloc_ud_dest(ibt_hca_hdl_t hca_hdl,
3240Sstevel@tonic-gate     ibt_ud_dest_flags_t flags, ibt_pd_hdl_t pd, ibt_ud_dest_hdl_t *ud_dest_p);
3250Sstevel@tonic-gate 
3260Sstevel@tonic-gate /*
3270Sstevel@tonic-gate  * ibt_modify_ud_dest
3280Sstevel@tonic-gate  *	Modify a previously allocated UD destination handle from the
3290Sstevel@tonic-gate  *	argument data.  After the ud_dest has already been made usable,
3300Sstevel@tonic-gate  *	the adds_vect argument to this function is optional (NULL).
3310Sstevel@tonic-gate  */
3320Sstevel@tonic-gate ibt_status_t ibt_modify_ud_dest(ibt_ud_dest_hdl_t ud_dest, ib_qkey_t qkey,
3330Sstevel@tonic-gate     ib_qpn_t dest_qpn, ibt_adds_vect_t *adds_vect);
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate /*
3360Sstevel@tonic-gate  * ibt_modify_reply_ud_dest
3370Sstevel@tonic-gate  *	Modify a previously allocated UD destination handle, so that it
3380Sstevel@tonic-gate  *	can be used to reply to the sender of the datagram contained in the
3390Sstevel@tonic-gate  *	specified work request completion.
3400Sstevel@tonic-gate  */
3410Sstevel@tonic-gate ibt_status_t ibt_modify_reply_ud_dest(ibt_channel_hdl_t ud_chan,
3420Sstevel@tonic-gate     ibt_ud_dest_hdl_t ud_dest, ib_qkey_t qkey, ibt_wc_t *wc,
3430Sstevel@tonic-gate     ib_vaddr_t recv_buf);
3440Sstevel@tonic-gate 
3450Sstevel@tonic-gate /*
3460Sstevel@tonic-gate  * ibt_request_ud_dest
3470Sstevel@tonic-gate  *	Modify a previously allocated UD destination handle based on the
3480Sstevel@tonic-gate  *	data retrieved by making an SIDR request.
3490Sstevel@tonic-gate  */
3500Sstevel@tonic-gate ibt_status_t ibt_request_ud_dest(ibt_ud_dest_hdl_t ud_dest,
3510Sstevel@tonic-gate     ibt_execution_mode_t mode, ibt_ud_dest_attr_t *dest_attrs,
3520Sstevel@tonic-gate     ibt_ud_returns_t *ud_ret_args);
3530Sstevel@tonic-gate 
3540Sstevel@tonic-gate /*
3550Sstevel@tonic-gate  * ibt_free_ud_dest
3560Sstevel@tonic-gate  *	Releases the resources associated with the specified UD destination
3570Sstevel@tonic-gate  *	handle.
3580Sstevel@tonic-gate  */
3590Sstevel@tonic-gate ibt_status_t ibt_free_ud_dest(ibt_ud_dest_hdl_t ud_dest);
3600Sstevel@tonic-gate 
3610Sstevel@tonic-gate /*
3620Sstevel@tonic-gate  * ibt_query_ud_dest
3630Sstevel@tonic-gate  *	Query a UD destination's attributes.
3640Sstevel@tonic-gate  */
3650Sstevel@tonic-gate ibt_status_t ibt_query_ud_dest(ibt_ud_dest_hdl_t ud_dest,
3660Sstevel@tonic-gate     ibt_ud_dest_query_attr_t *dest_attrs);
3670Sstevel@tonic-gate 
3680Sstevel@tonic-gate 
3690Sstevel@tonic-gate /*
3700Sstevel@tonic-gate  * ibt_is_privileged_ud_dest
3710Sstevel@tonic-gate  *	Determine if a UD destination Handle is a privileged handle.
3720Sstevel@tonic-gate  */
3730Sstevel@tonic-gate boolean_t ibt_is_privileged_ud_dest(ibt_ud_dest_hdl_t ud_dest);
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate 
3760Sstevel@tonic-gate /*
3770Sstevel@tonic-gate  * ibt_update_channel_qkey
3780Sstevel@tonic-gate  *
3790Sstevel@tonic-gate  * ibt_update_channel_qkey() set's the Qkey in the specified channel context
3800Sstevel@tonic-gate  * to the Qkey in the specified destination handle. This function can be used
3810Sstevel@tonic-gate  * to enable sends to a privileged destination. All posted Send Work Requests
3820Sstevel@tonic-gate  * that contain a privileged destination handle now use the Qkey in the
3830Sstevel@tonic-gate  * channel context.
3840Sstevel@tonic-gate  *
3850Sstevel@tonic-gate  * ibt_update_channel_qkey() can also be used to enable the caller to receive
3860Sstevel@tonic-gate  * from the specified remote destination on the specified channel.
3870Sstevel@tonic-gate  *
3880Sstevel@tonic-gate  */
3890Sstevel@tonic-gate ibt_status_t ibt_update_channel_qkey(ibt_channel_hdl_t ud_chan,
3900Sstevel@tonic-gate     ibt_ud_dest_hdl_t ud_dest);
3910Sstevel@tonic-gate 
3920Sstevel@tonic-gate 
3930Sstevel@tonic-gate /*
3940Sstevel@tonic-gate  * ibt_set_chan_private()
3950Sstevel@tonic-gate  * ibt_get_chan_private()
3960Sstevel@tonic-gate  * 	Set/get a pointer to client private data.
3970Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
3980Sstevel@tonic-gate  */
3990Sstevel@tonic-gate void ibt_set_chan_private(ibt_channel_hdl_t chan, void *clnt_private);
4000Sstevel@tonic-gate 
4010Sstevel@tonic-gate void *ibt_get_chan_private(ibt_channel_hdl_t chan);
4020Sstevel@tonic-gate 
4030Sstevel@tonic-gate /*
4040Sstevel@tonic-gate  * ibt_channel_to_hca_guid()
4050Sstevel@tonic-gate  *
4060Sstevel@tonic-gate  *	A helper function to retrieve HCA GUID for the specified Channel.
4070Sstevel@tonic-gate  */
4080Sstevel@tonic-gate ib_guid_t ibt_channel_to_hca_guid(ibt_channel_hdl_t chan);
4090Sstevel@tonic-gate 
4100Sstevel@tonic-gate #ifdef __cplusplus
4110Sstevel@tonic-gate }
4120Sstevel@tonic-gate #endif
4130Sstevel@tonic-gate 
4140Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBTI_H */
415