xref: /titanic_51/usr/src/uts/common/sys/ib/ibtl/ibti.h (revision 17a2b317610f531d565bf4e940433aab2d9e6985)
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
503494a98SBill Taylor  * Common Development and Distribution License (the "License").
603494a98SBill Taylor  * 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_IBTI_H
267c478bd9Sstevel@tonic-gate #define	_SYS_IB_IBTL_IBTI_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * ibti.h
307c478bd9Sstevel@tonic-gate  *
317c478bd9Sstevel@tonic-gate  * This file contains the IBTI prototypes and associated data structures.
327c478bd9Sstevel@tonic-gate  * It is the only header file that should be included by IBTI clients.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibti_common.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef __cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Allocate channel flags.
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate typedef enum ibt_chan_alloc_flags_e {
447c478bd9Sstevel@tonic-gate 	IBT_ACHAN_NO_FLAGS		= 0,
457c478bd9Sstevel@tonic-gate 	IBT_ACHAN_CLONE			= (1 << 0),
467c478bd9Sstevel@tonic-gate 	IBT_ACHAN_USER_MAP		= (1 << 1),
477c478bd9Sstevel@tonic-gate 	IBT_ACHAN_DEFER_ALLOC		= (1 << 2),
4803494a98SBill Taylor 	IBT_ACHAN_USES_SRQ		= (1 << 3),
49*17a2b317SBill Taylor 	IBT_ACHAN_USES_RSS		= (1 << 4),
50*17a2b317SBill Taylor 
51*17a2b317SBill Taylor 	/* UD variants for FC support */
52*17a2b317SBill Taylor 	IBT_ACHAN_USES_RFCI		= (1 << 5),	/* from RFCI pool */
53*17a2b317SBill Taylor 	IBT_ACHAN_USES_FCMD		= (1 << 6),
54*17a2b317SBill Taylor 	IBT_ACHAN_USES_FEXCH		= (1 << 7)	/* from FEXCH pool */
557c478bd9Sstevel@tonic-gate } ibt_chan_alloc_flags_t;
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * Allocate RC channel ibt_alloc_rc_channel() argument.
607c478bd9Sstevel@tonic-gate  */
617c478bd9Sstevel@tonic-gate typedef struct ibt_rc_chan_alloc_args_s {
627c478bd9Sstevel@tonic-gate 	ibt_attr_flags_t	rc_flags;	/* Signal type etc */
637c478bd9Sstevel@tonic-gate 	ibt_cep_flags_t		rc_control;
647c478bd9Sstevel@tonic-gate 	uint8_t			rc_hca_port_num;
657c478bd9Sstevel@tonic-gate 	ibt_chan_sizes_t	rc_sizes;
667c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_scq;	/* Send CQ */
677c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_rcq;	/* Recv CQ */
687c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		rc_pd;	/* PD */
697c478bd9Sstevel@tonic-gate 	ibt_channel_hdl_t	rc_clone_chan;	/* Optional Clone handle */
707c478bd9Sstevel@tonic-gate 	ibt_srq_hdl_t		rc_srq;		/* Optional Shared Rcv Queue */
717c478bd9Sstevel@tonic-gate } ibt_rc_chan_alloc_args_t;
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * RC channel query attributes structure.
757c478bd9Sstevel@tonic-gate  */
767c478bd9Sstevel@tonic-gate typedef struct ibt_rc_chan_query_attr_s {
777c478bd9Sstevel@tonic-gate 	ib_guid_t		rc_hca_guid;	/* Local HCA GUID */
787c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_scq;		/* SendCQ handle */
797c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		rc_rcq;		/* RecvCQ handle */
807c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		rc_pd;		/* PD Handle. */
817c478bd9Sstevel@tonic-gate 	ibt_cep_state_t		rc_state;	/* Channel state */
827c478bd9Sstevel@tonic-gate 	ib_mtu_t		rc_path_mtu;
837c478bd9Sstevel@tonic-gate 	uint8_t			rc_path_retry_cnt:3;
847c478bd9Sstevel@tonic-gate 	ibt_rnr_retry_cnt_t	rc_path_rnr_retry_cnt;
857c478bd9Sstevel@tonic-gate 	ibt_rnr_nak_time_t	rc_min_rnr_nak;	/* min RNR-NAK timer */
867c478bd9Sstevel@tonic-gate 	ibt_cep_path_t		rc_prim_path;
877c478bd9Sstevel@tonic-gate 	ibt_cep_path_t		rc_alt_path;
887c478bd9Sstevel@tonic-gate 	ibt_chan_sizes_t	rc_chan_sizes;	/* Queue/SGL sizes */
897c478bd9Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_out;	/* max RDMA-Reads/Atomics out */
907c478bd9Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_in;	/* max RDMA-Reads/Atomics in */
917c478bd9Sstevel@tonic-gate 	ibt_attr_flags_t	rc_flags;	/* SQ Signaling Type etc */
927c478bd9Sstevel@tonic-gate 	ibt_cep_flags_t		rc_control;	/* Control Flags */
937c478bd9Sstevel@tonic-gate 	ibt_cep_cmstate_t	rc_mig_state;
947c478bd9Sstevel@tonic-gate 	ib_qpn_t		rc_qpn;		/* Local QPN */
957c478bd9Sstevel@tonic-gate 	ib_qpn_t		rc_dst_qpn;	/* Destination QPN */
967c478bd9Sstevel@tonic-gate 	ibt_srq_hdl_t		rc_srq;		/* Optional Shared Rcv Queue */
977c478bd9Sstevel@tonic-gate } ibt_rc_chan_query_attr_t;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate /*
1007c478bd9Sstevel@tonic-gate  * RC Channel Modify Attributes definition.
1017c478bd9Sstevel@tonic-gate  *
1027c478bd9Sstevel@tonic-gate  * It is only possible to modify a channel that has previously been
1037c478bd9Sstevel@tonic-gate  * opened. The channel must either be in operational state (IBT_STATE_RTS)
1047c478bd9Sstevel@tonic-gate  * or paused (IBT_STATE_SQD). If channel is in paused state, then a modify
1057c478bd9Sstevel@tonic-gate  * operation will unpause the channel.
1067c478bd9Sstevel@tonic-gate  *
1077c478bd9Sstevel@tonic-gate  * See the ibt_modify_rc_channel() for details of the required corresponding
1087c478bd9Sstevel@tonic-gate  * modify flags.
1097c478bd9Sstevel@tonic-gate  * Not specified attributes should be set to "NULL" or "0".
1107c478bd9Sstevel@tonic-gate  */
1117c478bd9Sstevel@tonic-gate typedef struct ibt_rc_chan_modify_attr_s {
1127c478bd9Sstevel@tonic-gate 	ibt_cep_flags_t		rc_control;	/* Channel Control Flags */
1137c478bd9Sstevel@tonic-gate 	uint_t			rc_sq_sz;	/* Set SQ Max outstanding WRs */
1147c478bd9Sstevel@tonic-gate 	uint_t			rc_rq_sz;	/* Set RQ Max outstanding WRs */
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate 	ibt_adds_vect_t		rc_prim_adds_vect; /* Primary Path Address */
1177c478bd9Sstevel@tonic-gate 	ibt_adds_vect_t		rc_alt_adds_vect; /* Alternate Path Address */
1187c478bd9Sstevel@tonic-gate 	uint8_t			rc_path_retry_cnt:3;
1197c478bd9Sstevel@tonic-gate 	ibt_rnr_retry_cnt_t	rc_path_rnr_retry_cnt;
1207c478bd9Sstevel@tonic-gate 	ibt_rnr_nak_time_t	rc_min_rnr_nak;	/* min RNR-NAK timer */
1217c478bd9Sstevel@tonic-gate 	uint8_t			rc_prim_port_num; /* Port of Primary Path */
1227c478bd9Sstevel@tonic-gate 	uint8_t			rc_alt_port_num; /* Port of Alternate Path */
1237c478bd9Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_out;	/* Initiator Depth, Number of */
1247c478bd9Sstevel@tonic-gate 						/* RDMA RD's & Atomics */
1257c478bd9Sstevel@tonic-gate 						/* outstanding. */
1267c478bd9Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_in; /* Responder resources for */
1277c478bd9Sstevel@tonic-gate 						/* handling incoming RDMA rds */
1287c478bd9Sstevel@tonic-gate 						/* and Atomics. */
1297c478bd9Sstevel@tonic-gate } ibt_rc_chan_modify_attr_t;
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /*
1327c478bd9Sstevel@tonic-gate  * UD remote destination query attributes
1337c478bd9Sstevel@tonic-gate  */
1347c478bd9Sstevel@tonic-gate typedef struct ibt_ud_dest_query_attr_s {
1357c478bd9Sstevel@tonic-gate 	ibt_hca_hdl_t		ud_hca_hdl;	/* Local HCA Handle */
1367c478bd9Sstevel@tonic-gate 	ib_qpn_t		ud_dst_qpn;	/* Destination QPN */
1377c478bd9Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;	/* Q_Key */
1387c478bd9Sstevel@tonic-gate 	ibt_adds_vect_t 	ud_addr_vect;	/* Address Information */
1397c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		ud_pd;
1407c478bd9Sstevel@tonic-gate } ibt_ud_dest_query_attr_t;
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate /*
1437c478bd9Sstevel@tonic-gate  * Allocate UD channel ibt_alloc_ud_channel() arguments; see below at
1447c478bd9Sstevel@tonic-gate  * ibt_alloc_ud_channel() for a description of what's required and optional.
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate typedef struct ibt_ud_chan_alloc_args_s {
1477c478bd9Sstevel@tonic-gate 	ibt_attr_flags_t	ud_flags;	/* Sig type etc */
1487c478bd9Sstevel@tonic-gate 	uint8_t			ud_hca_port_num;
1497c478bd9Sstevel@tonic-gate 	uint16_t		ud_pkey_ix;	/* P_Key Index */
1507c478bd9Sstevel@tonic-gate 	ibt_chan_sizes_t	ud_sizes;
1517c478bd9Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;	/* Q_Key */
1527c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_scq;		/* Send CQ */
1537c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_rcq;		/* Recv CQ */
1547c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		ud_pd;		/* PD */
1557c478bd9Sstevel@tonic-gate 	ibt_channel_hdl_t	ud_clone_chan;	/* Optional clone handle */
1567c478bd9Sstevel@tonic-gate 	ibt_srq_hdl_t		ud_srq;		/* Optional Shared Rcv Queue */
15703494a98SBill Taylor 	ibt_rss_attr_t		ud_rss;
158*17a2b317SBill Taylor 	ibt_fc_attr_t		ud_fc;
1597c478bd9Sstevel@tonic-gate } ibt_ud_chan_alloc_args_t;
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate /*
1627c478bd9Sstevel@tonic-gate  * UD channel query attributes.
1637c478bd9Sstevel@tonic-gate  */
1647c478bd9Sstevel@tonic-gate typedef struct ibt_ud_chan_query_attr_s {
1657c478bd9Sstevel@tonic-gate 	ib_qpn_t		ud_qpn;			/* QPN */
1667c478bd9Sstevel@tonic-gate 	ib_guid_t		ud_hca_guid;		/* Local HCA GUID */
1677c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_scq;			/* SendCQ handle. */
1687c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		ud_rcq;			/* RecvCQ handle. */
1697c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		ud_pd;			/* PD Handle. */
1707c478bd9Sstevel@tonic-gate 	uint8_t			ud_hca_port_num;	/* Local HCA port */
1717c478bd9Sstevel@tonic-gate 	ibt_cep_state_t		ud_state;		/* Channel state */
1727c478bd9Sstevel@tonic-gate 	uint16_t		ud_pkey_ix;		/* P_Key Index */
1737c478bd9Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;		/* Q_Key */
1747c478bd9Sstevel@tonic-gate 	ibt_chan_sizes_t	ud_chan_sizes;		/* Queue/SGL sizes */
1757c478bd9Sstevel@tonic-gate 	ibt_attr_flags_t	ud_flags;		/* Signaling Type etc */
1767c478bd9Sstevel@tonic-gate 	ibt_srq_hdl_t		ud_srq;		/* Optional Shared Rcv Queue */
17703494a98SBill Taylor 	ibt_rss_attr_t		ud_rss;
178*17a2b317SBill Taylor 	ibt_fc_attr_t		ud_fc;
179*17a2b317SBill Taylor 	ibt_fexch_query_attr_t	ud_query_fc;	/* query only set */
1807c478bd9Sstevel@tonic-gate } ibt_ud_chan_query_attr_t;
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate /*
1837c478bd9Sstevel@tonic-gate  * UD Channel Modify Attributes definition.
1847c478bd9Sstevel@tonic-gate  *
1857c478bd9Sstevel@tonic-gate  * It is only possible to modify a channel that is either in the operational
1867c478bd9Sstevel@tonic-gate  * state (IBT_STATE_RTS) or paused (IBT_STATE_SQD). If channel is in paused
1877c478bd9Sstevel@tonic-gate  * state, then a modify operation will unpause the channel.
1887c478bd9Sstevel@tonic-gate  *
1897c478bd9Sstevel@tonic-gate  * See the ibt_modify_ud_channel() for details of the required corresponding
1907c478bd9Sstevel@tonic-gate  * modify flags.
1917c478bd9Sstevel@tonic-gate  */
1927c478bd9Sstevel@tonic-gate typedef struct ibt_ud_chan_modify_attr_s {
1937c478bd9Sstevel@tonic-gate 	uint_t			ud_sq_sz;	/* Set SQ Max outstanding WRs */
1947c478bd9Sstevel@tonic-gate 	uint_t			ud_rq_sz;	/* Set RQ Max outstanding WRs */
1957c478bd9Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;	/* Set Q_Key */
19603494a98SBill Taylor 	ibt_rss_attr_t		ud_rss;		/* Set RSS stuff */
197*17a2b317SBill Taylor 	ibt_fc_attr_t		ud_fc;
1987c478bd9Sstevel@tonic-gate } ibt_ud_chan_modify_attr_t;
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate /*
2027c478bd9Sstevel@tonic-gate  * FUNCTION PROTOTYPES
2037c478bd9Sstevel@tonic-gate  */
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate /*
2067c478bd9Sstevel@tonic-gate  * CONNECTION ESTABLISHMENT/TEAR DOWN FUNCTIONS.
2077c478bd9Sstevel@tonic-gate  */
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate /*
2107c478bd9Sstevel@tonic-gate  * ibt_alloc_rc_channel
2117c478bd9Sstevel@tonic-gate  * 	Allocates a RC communication channels that satisfy the specified
2127c478bd9Sstevel@tonic-gate  *	channel attributes.
2137c478bd9Sstevel@tonic-gate  */
2147c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_rc_channel(ibt_hca_hdl_t hca_hdl,
2157c478bd9Sstevel@tonic-gate     ibt_chan_alloc_flags_t flags, ibt_rc_chan_alloc_args_t *args,
2167c478bd9Sstevel@tonic-gate     ibt_channel_hdl_t *rc_chan_p, ibt_chan_sizes_t *sizes);
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate /*
2197c478bd9Sstevel@tonic-gate  * ibt_flush_channel
2207c478bd9Sstevel@tonic-gate  *	Flush the specified channel. Outstanding work requests are flushed
2217c478bd9Sstevel@tonic-gate  *	so that the client can do the associated clean up. After that, the
2227c478bd9Sstevel@tonic-gate  *	client will usually deregister the previously registered memory,
2237c478bd9Sstevel@tonic-gate  *	then free the channel by calling ibt_free_channel().  RC channels
2247c478bd9Sstevel@tonic-gate  *	that have been successfully opened will fail this call, as they
2257c478bd9Sstevel@tonic-gate  *	need to instead be handled by ibt_close_rc_channel().
2267c478bd9Sstevel@tonic-gate  */
2277c478bd9Sstevel@tonic-gate ibt_status_t ibt_flush_channel(ibt_channel_hdl_t chan);
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate /*
2307c478bd9Sstevel@tonic-gate  * ibt_free_channel
2317c478bd9Sstevel@tonic-gate  *	Releases the resources associated with the specified channel
2327c478bd9Sstevel@tonic-gate  */
2337c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_channel(ibt_channel_hdl_t chan);
2347c478bd9Sstevel@tonic-gate 
2357c478bd9Sstevel@tonic-gate /*
2367c478bd9Sstevel@tonic-gate  * ibt_query_rc_channel
2377c478bd9Sstevel@tonic-gate  *	Query an RC channel's attributes. Should only be called on an
2387c478bd9Sstevel@tonic-gate  *	opened RC channel. If called on a channel before it is opened,
2397c478bd9Sstevel@tonic-gate  *	some channel attributes may change when the channel is opened.
2407c478bd9Sstevel@tonic-gate  */
2417c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_rc_channel(ibt_channel_hdl_t rc_chan,
2427c478bd9Sstevel@tonic-gate     ibt_rc_chan_query_attr_t *chan_attrs);
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate /*
2457c478bd9Sstevel@tonic-gate  * ibt_modify_rc_channel()
2467c478bd9Sstevel@tonic-gate  * 	Modifies a previous opened operational or paused RC channel's
2477c478bd9Sstevel@tonic-gate  *	attributes.
2487c478bd9Sstevel@tonic-gate  *
2497c478bd9Sstevel@tonic-gate  * NOTE:
2507c478bd9Sstevel@tonic-gate  *	It is only possible to modify a channel that has previously been opened.
2517c478bd9Sstevel@tonic-gate  *	The channel must either be in operational state (IBT_STATE_RTS) or
2527c478bd9Sstevel@tonic-gate  *	paused (IBT_STATE_SQD). If channel is in paused state, then a modify
2537c478bd9Sstevel@tonic-gate  *	operation will will unpause the channel.
2547c478bd9Sstevel@tonic-gate  */
2557c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_rc_channel(ibt_channel_hdl_t rc_chan,
2567c478bd9Sstevel@tonic-gate     ibt_cep_modify_flags_t flags, ibt_rc_chan_modify_attr_t *attrs,
2577c478bd9Sstevel@tonic-gate     ibt_queue_sizes_t *actual_sz);
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate /*
2607c478bd9Sstevel@tonic-gate  * ibt_alloc_ud_channel
2617c478bd9Sstevel@tonic-gate  *	Allocate UD channels that satisfy the specified channel attributes.
2627c478bd9Sstevel@tonic-gate  */
2637c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_ud_channel(ibt_hca_hdl_t hca_hdl,
2647c478bd9Sstevel@tonic-gate     ibt_chan_alloc_flags_t flags, ibt_ud_chan_alloc_args_t *args,
2657c478bd9Sstevel@tonic-gate     ibt_channel_hdl_t *ud_chan_p, ibt_chan_sizes_t *sizes);
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate /*
26803494a98SBill Taylor  * ibt_alloc_ud_channel_range
26903494a98SBill Taylor  *	Allocate a range of UD channels that have consecutive QPNs for RSS.
27003494a98SBill Taylor  */
27103494a98SBill Taylor ibt_status_t ibt_alloc_ud_channel_range(ibt_hca_hdl_t hca_hdl,
27203494a98SBill Taylor     uint_t log2, ibt_chan_alloc_flags_t flags,
27303494a98SBill Taylor     ibt_ud_chan_alloc_args_t *args, ibt_cq_hdl_t *send_cq_p,
27403494a98SBill Taylor     ibt_cq_hdl_t *recv_cq_p, ib_qpn_t *base_qpn_p,
27503494a98SBill Taylor     ibt_channel_hdl_t *ud_chan_p, ibt_chan_sizes_t *sizes);
27603494a98SBill Taylor 
27703494a98SBill Taylor /*
2787c478bd9Sstevel@tonic-gate  * ibt_query_ud_channel
2797c478bd9Sstevel@tonic-gate  *	Query a UD channel's attributes.
2807c478bd9Sstevel@tonic-gate  */
2817c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_ud_channel(ibt_channel_hdl_t ud_chan,
2827c478bd9Sstevel@tonic-gate     ibt_ud_chan_query_attr_t *ud_chan_attrs);
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate /*
2857c478bd9Sstevel@tonic-gate  * ibt_modify_ud_channel()
2867c478bd9Sstevel@tonic-gate  * 	Modifies an UD channel's attributes, as specified by a
2877c478bd9Sstevel@tonic-gate  *	ibt_cep_modify_flags_t parameter to those specified in the
2887c478bd9Sstevel@tonic-gate  *	ibt_ud_chan_modify_attr_t structure.
2897c478bd9Sstevel@tonic-gate  *
2907c478bd9Sstevel@tonic-gate  * NOTE:
2917c478bd9Sstevel@tonic-gate  *	It is only possible to modify a channel that is either in the
2927c478bd9Sstevel@tonic-gate  *	operational state (IBT_STATE_RTS) or paused (IBT_STATE_SQD). If
2937c478bd9Sstevel@tonic-gate  *	channel is in paused state, then a modify operation will unpause the
2947c478bd9Sstevel@tonic-gate  *	channel.
2957c478bd9Sstevel@tonic-gate  */
2967c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_ud_channel(ibt_channel_hdl_t ud_chan,
2977c478bd9Sstevel@tonic-gate     ibt_cep_modify_flags_t flags, ibt_ud_chan_modify_attr_t *attrs,
2987c478bd9Sstevel@tonic-gate     ibt_queue_sizes_t *actual_sz);
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate /*
3017c478bd9Sstevel@tonic-gate  * ibt_recover_ud_channel()
3027c478bd9Sstevel@tonic-gate  *	Recover an UD Channel which has transitioned to SQ Error state. The
3037c478bd9Sstevel@tonic-gate  *	ibt_recover_ud_channel() transitions the channel from SQ Error state
3047c478bd9Sstevel@tonic-gate  *	to Ready-To-Send channel state.
3057c478bd9Sstevel@tonic-gate  *
3067c478bd9Sstevel@tonic-gate  *	If a work request posted to a UD channel's send queue completes with
3077c478bd9Sstevel@tonic-gate  *	an error (see ibt_wc_status_t), the channel gets transitioned to SQ
3087c478bd9Sstevel@tonic-gate  *	Error state. In order to reuse this channel, ibt_recover_ud_channel()
3097c478bd9Sstevel@tonic-gate  *	can be used to recover the channel to a usable (Ready-to-Send) state.
3107c478bd9Sstevel@tonic-gate  */
3117c478bd9Sstevel@tonic-gate ibt_status_t ibt_recover_ud_channel(ibt_channel_hdl_t ud_chan);
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate /*
3157c478bd9Sstevel@tonic-gate  * ibt_alloc_ud_dest
3167c478bd9Sstevel@tonic-gate  *	Allocate a UD destination handle.  This allocates local resources
3177c478bd9Sstevel@tonic-gate  *	that will need subsequent modification/initialization before use
3187c478bd9Sstevel@tonic-gate  *	(in send work requests).  Functions that can be used to do this are
3197c478bd9Sstevel@tonic-gate  *	ibt_modify_ud_dest (data supplied by caller), ibt_modify_reply_ud_dest
3207c478bd9Sstevel@tonic-gate  *	(data supplied from a successfully completed receive work request),
3217c478bd9Sstevel@tonic-gate  *	and ibt_request_ud_dest (data retrieved using SIDR protocol).
3227c478bd9Sstevel@tonic-gate  */
3237c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_ud_dest(ibt_hca_hdl_t hca_hdl,
3247c478bd9Sstevel@tonic-gate     ibt_ud_dest_flags_t flags, ibt_pd_hdl_t pd, ibt_ud_dest_hdl_t *ud_dest_p);
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate /*
3277c478bd9Sstevel@tonic-gate  * ibt_modify_ud_dest
3287c478bd9Sstevel@tonic-gate  *	Modify a previously allocated UD destination handle from the
3297c478bd9Sstevel@tonic-gate  *	argument data.  After the ud_dest has already been made usable,
3307c478bd9Sstevel@tonic-gate  *	the adds_vect argument to this function is optional (NULL).
3317c478bd9Sstevel@tonic-gate  */
3327c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_ud_dest(ibt_ud_dest_hdl_t ud_dest, ib_qkey_t qkey,
3337c478bd9Sstevel@tonic-gate     ib_qpn_t dest_qpn, ibt_adds_vect_t *adds_vect);
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate /*
3367c478bd9Sstevel@tonic-gate  * ibt_modify_reply_ud_dest
3377c478bd9Sstevel@tonic-gate  *	Modify a previously allocated UD destination handle, so that it
3387c478bd9Sstevel@tonic-gate  *	can be used to reply to the sender of the datagram contained in the
3397c478bd9Sstevel@tonic-gate  *	specified work request completion.
3407c478bd9Sstevel@tonic-gate  */
3417c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_reply_ud_dest(ibt_channel_hdl_t ud_chan,
3427c478bd9Sstevel@tonic-gate     ibt_ud_dest_hdl_t ud_dest, ib_qkey_t qkey, ibt_wc_t *wc,
3437c478bd9Sstevel@tonic-gate     ib_vaddr_t recv_buf);
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate /*
3467c478bd9Sstevel@tonic-gate  * ibt_request_ud_dest
3477c478bd9Sstevel@tonic-gate  *	Modify a previously allocated UD destination handle based on the
3487c478bd9Sstevel@tonic-gate  *	data retrieved by making an SIDR request.
3497c478bd9Sstevel@tonic-gate  */
3507c478bd9Sstevel@tonic-gate ibt_status_t ibt_request_ud_dest(ibt_ud_dest_hdl_t ud_dest,
3517c478bd9Sstevel@tonic-gate     ibt_execution_mode_t mode, ibt_ud_dest_attr_t *dest_attrs,
3527c478bd9Sstevel@tonic-gate     ibt_ud_returns_t *ud_ret_args);
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate /*
3557c478bd9Sstevel@tonic-gate  * ibt_free_ud_dest
3567c478bd9Sstevel@tonic-gate  *	Releases the resources associated with the specified UD destination
3577c478bd9Sstevel@tonic-gate  *	handle.
3587c478bd9Sstevel@tonic-gate  */
3597c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_ud_dest(ibt_ud_dest_hdl_t ud_dest);
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate /*
3627c478bd9Sstevel@tonic-gate  * ibt_query_ud_dest
3637c478bd9Sstevel@tonic-gate  *	Query a UD destination's attributes.
3647c478bd9Sstevel@tonic-gate  */
3657c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_ud_dest(ibt_ud_dest_hdl_t ud_dest,
3667c478bd9Sstevel@tonic-gate     ibt_ud_dest_query_attr_t *dest_attrs);
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate 
3697c478bd9Sstevel@tonic-gate /*
3707c478bd9Sstevel@tonic-gate  * ibt_is_privileged_ud_dest
3717c478bd9Sstevel@tonic-gate  *	Determine if a UD destination Handle is a privileged handle.
3727c478bd9Sstevel@tonic-gate  */
3737c478bd9Sstevel@tonic-gate boolean_t ibt_is_privileged_ud_dest(ibt_ud_dest_hdl_t ud_dest);
3747c478bd9Sstevel@tonic-gate 
3757c478bd9Sstevel@tonic-gate 
3767c478bd9Sstevel@tonic-gate /*
3777c478bd9Sstevel@tonic-gate  * ibt_update_channel_qkey
3787c478bd9Sstevel@tonic-gate  *
3797c478bd9Sstevel@tonic-gate  * ibt_update_channel_qkey() set's the Qkey in the specified channel context
3807c478bd9Sstevel@tonic-gate  * to the Qkey in the specified destination handle. This function can be used
3817c478bd9Sstevel@tonic-gate  * to enable sends to a privileged destination. All posted Send Work Requests
3827c478bd9Sstevel@tonic-gate  * that contain a privileged destination handle now use the Qkey in the
3837c478bd9Sstevel@tonic-gate  * channel context.
3847c478bd9Sstevel@tonic-gate  *
3857c478bd9Sstevel@tonic-gate  * ibt_update_channel_qkey() can also be used to enable the caller to receive
3867c478bd9Sstevel@tonic-gate  * from the specified remote destination on the specified channel.
3877c478bd9Sstevel@tonic-gate  *
3887c478bd9Sstevel@tonic-gate  */
3897c478bd9Sstevel@tonic-gate ibt_status_t ibt_update_channel_qkey(ibt_channel_hdl_t ud_chan,
3907c478bd9Sstevel@tonic-gate     ibt_ud_dest_hdl_t ud_dest);
3917c478bd9Sstevel@tonic-gate 
3927c478bd9Sstevel@tonic-gate 
3937c478bd9Sstevel@tonic-gate /*
3947c478bd9Sstevel@tonic-gate  * ibt_set_chan_private()
3957c478bd9Sstevel@tonic-gate  * ibt_get_chan_private()
3967c478bd9Sstevel@tonic-gate  * 	Set/get a pointer to client private data.
3977c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
3987c478bd9Sstevel@tonic-gate  */
3997c478bd9Sstevel@tonic-gate void ibt_set_chan_private(ibt_channel_hdl_t chan, void *clnt_private);
4007c478bd9Sstevel@tonic-gate 
4017c478bd9Sstevel@tonic-gate void *ibt_get_chan_private(ibt_channel_hdl_t chan);
4027c478bd9Sstevel@tonic-gate 
4037c478bd9Sstevel@tonic-gate /*
4047c478bd9Sstevel@tonic-gate  * ibt_channel_to_hca_guid()
4057c478bd9Sstevel@tonic-gate  *
4067c478bd9Sstevel@tonic-gate  *	A helper function to retrieve HCA GUID for the specified Channel.
4077c478bd9Sstevel@tonic-gate  */
4087c478bd9Sstevel@tonic-gate ib_guid_t ibt_channel_to_hca_guid(ibt_channel_hdl_t chan);
4097c478bd9Sstevel@tonic-gate 
4107c478bd9Sstevel@tonic-gate #ifdef __cplusplus
4117c478bd9Sstevel@tonic-gate }
4127c478bd9Sstevel@tonic-gate #endif
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBTI_H */
415