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