xref: /illumos-gate/usr/src/uts/common/sys/ib/ibtl/ibtl_types.h (revision 24b28d0419f5763eb5a6bad72f99ae67fa2a8921)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*24b28d04Shiremath  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_IB_IBTL_IBTL_TYPES_H
287c478bd9Sstevel@tonic-gate #define	_SYS_IB_IBTL_IBTL_TYPES_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * ibtl_types.h
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * All common IBTL defined types. These are common data types
367c478bd9Sstevel@tonic-gate  * that are shared by the IBTI and IBCI interfaces, it is only included
377c478bd9Sstevel@tonic-gate  * by ibti.h and ibci.h
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
407c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
417c478bd9Sstevel@tonic-gate #include <sys/ib/ib_types.h>
427c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_status.h>
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
457c478bd9Sstevel@tonic-gate extern "C" {
467c478bd9Sstevel@tonic-gate #endif
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * Define Internal IBTL handles
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate typedef	struct	ibtl_clnt_s	*ibt_clnt_hdl_t;    /* ibt_attach() */
527c478bd9Sstevel@tonic-gate typedef	struct	ibtl_hca_s	*ibt_hca_hdl_t;	    /* ibt_open_hca() */
537c478bd9Sstevel@tonic-gate typedef	struct	ibtl_channel_s	*ibt_channel_hdl_t; /* alloc_rc|ud_channel() */
547c478bd9Sstevel@tonic-gate typedef	struct	ibtl_srq_s	*ibt_srq_hdl_t;	    /* ibt_alloc_srq() */
557c478bd9Sstevel@tonic-gate typedef	struct	ibtl_cq_s	*ibt_cq_hdl_t;	    /* ibt_alloc_cq() */
567c478bd9Sstevel@tonic-gate typedef	struct	ibcm_svc_info_s	*ibt_srv_hdl_t;	    /* ibt_register_service() */
577c478bd9Sstevel@tonic-gate typedef	struct	ibcm_svc_bind_s	*ibt_sbind_hdl_t;   /* ibt_bind_service() */
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate typedef	struct	ibc_ma_s	*ibt_ma_hdl_t;	    /* ibt_map_mem_area() */
607c478bd9Sstevel@tonic-gate typedef	struct	ibc_pd_s	*ibt_pd_hdl_t;	    /* ibt_alloc_pd() */
617c478bd9Sstevel@tonic-gate typedef	struct	ibc_sched_s	*ibt_sched_hdl_t;   /* ibt_alloc_cq_sched() */
627c478bd9Sstevel@tonic-gate typedef	struct	ibc_mr_s	*ibt_mr_hdl_t;	    /* ibt_register_mr() */
637c478bd9Sstevel@tonic-gate typedef	struct	ibc_mw_s	*ibt_mw_hdl_t;	    /* ibt_alloc_mw() */
647c478bd9Sstevel@tonic-gate typedef	struct	ibt_ud_dest_s	*ibt_ud_dest_hdl_t; /* UD dest handle */
657c478bd9Sstevel@tonic-gate typedef	struct	ibc_ah_s	*ibt_ah_hdl_t;	    /* ibt_alloc_ah() */
667c478bd9Sstevel@tonic-gate typedef struct	ibtl_eec_s	*ibt_eec_hdl_t;
677c478bd9Sstevel@tonic-gate typedef	struct	ibt_rd_dest_s	*ibt_rd_dest_hdl_t;	/* Reserved for */
687c478bd9Sstevel@tonic-gate 							/* Future use */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * Some General Types.
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate typedef uint32_t	ibt_lkey_t;		/* L_Key */
747c478bd9Sstevel@tonic-gate typedef uint32_t	ibt_rkey_t;		/* R_Key */
757c478bd9Sstevel@tonic-gate typedef uint64_t	ibt_wrid_t;		/* Client assigned WR ID */
767c478bd9Sstevel@tonic-gate typedef uint32_t	ibt_immed_t;		/* WR Immediate Data */
777c478bd9Sstevel@tonic-gate typedef uint64_t	ibt_atom_arg_t;		/* WR Atomic Operation arg */
787c478bd9Sstevel@tonic-gate typedef	uint_t		ibt_cq_handler_id_t;	/* Event handler ID */
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate /*
817c478bd9Sstevel@tonic-gate  * IBT selector type, used when looking up/requesting either an
827c478bd9Sstevel@tonic-gate  * MTU, Pkt lifetime, or Static rate.
837c478bd9Sstevel@tonic-gate  * The interpretation of IBT_BEST depends on the attribute being selected.
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate typedef enum ibt_selector_e {
867c478bd9Sstevel@tonic-gate 	IBT_GT		= 0,	/* Greater than */
877c478bd9Sstevel@tonic-gate 	IBT_LT		= 1,	/* Less than */
887c478bd9Sstevel@tonic-gate 	IBT_EQU		= 2,	/* Equal to */
897c478bd9Sstevel@tonic-gate 	IBT_BEST	= 3	/* Best */
907c478bd9Sstevel@tonic-gate } ibt_selector_t;
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate /*
947c478bd9Sstevel@tonic-gate  * Static rate definitions.
957c478bd9Sstevel@tonic-gate  */
967c478bd9Sstevel@tonic-gate typedef enum ibt_srate_e {
977c478bd9Sstevel@tonic-gate 	IBT_SRATE_NOT_SPECIFIED	= 0,
987c478bd9Sstevel@tonic-gate 	IBT_SRATE_1X		= 2,
997c478bd9Sstevel@tonic-gate 	IBT_SRATE_4X		= 3,
1007c478bd9Sstevel@tonic-gate 	IBT_SRATE_12X		= 4
1017c478bd9Sstevel@tonic-gate } ibt_srate_t;
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * Static rate request type.
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate typedef struct ibt_srate_req_s {
1077c478bd9Sstevel@tonic-gate 	ibt_srate_t	r_srate;	/* Requested srate */
1087c478bd9Sstevel@tonic-gate 	ibt_selector_t	r_selector;	/* Qualifier for r_srate */
1097c478bd9Sstevel@tonic-gate } ibt_srate_req_t;
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate  * Packet Life Time Request Type.
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate typedef struct ibt_pkt_lt_req_s {
1157c478bd9Sstevel@tonic-gate 	clock_t		p_pkt_lt;	/* Requested Packet Life Time */
1167c478bd9Sstevel@tonic-gate 	ibt_selector_t	p_selector;	/* Qualifier for p_pkt_lt */
1177c478bd9Sstevel@tonic-gate } ibt_pkt_lt_req_t;
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * Queue size struct.
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate typedef struct ibt_queue_sizes_s {
1237c478bd9Sstevel@tonic-gate 	uint_t	qs_sq;		/* SendQ size. */
1247c478bd9Sstevel@tonic-gate 	uint_t	qs_rq;		/* RecvQ size. */
1257c478bd9Sstevel@tonic-gate } ibt_queue_sizes_t;
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate /*
1287c478bd9Sstevel@tonic-gate  * Channel sizes struct, used by functions that allocate/query RC or UD
1297c478bd9Sstevel@tonic-gate  * channels.
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate typedef struct ibt_chan_sizes_s {
1327c478bd9Sstevel@tonic-gate 	uint_t	cs_sq;		/* SendQ size. */
1337c478bd9Sstevel@tonic-gate 	uint_t	cs_rq;		/* ReceiveQ size. */
1347c478bd9Sstevel@tonic-gate 	uint_t	cs_sq_sgl;	/* Max SGL elements in a SQ WR. */
1357c478bd9Sstevel@tonic-gate 	uint_t	cs_rq_sgl;	/* Max SGL elements in a RQ Wr. */
1367c478bd9Sstevel@tonic-gate } ibt_chan_sizes_t;
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /*
1397c478bd9Sstevel@tonic-gate  * Shared Queue size struct.
1407c478bd9Sstevel@tonic-gate  */
1417c478bd9Sstevel@tonic-gate typedef struct ibt_srq_sizes_s {
1427c478bd9Sstevel@tonic-gate 	uint_t	srq_wr_sz;
1437c478bd9Sstevel@tonic-gate 	uint_t	srq_sgl_sz;
1447c478bd9Sstevel@tonic-gate } ibt_srq_sizes_t;
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * SRQ Modify Flags
1487c478bd9Sstevel@tonic-gate  */
1497c478bd9Sstevel@tonic-gate typedef enum ibt_srq_modify_flags_e {
1507c478bd9Sstevel@tonic-gate 	IBT_SRQ_SET_NOTHING		= 0,
1517c478bd9Sstevel@tonic-gate 	IBT_SRQ_SET_SIZE		= (1 << 1),
1527c478bd9Sstevel@tonic-gate 	IBT_SRQ_SET_LIMIT		= (1 << 2)
1537c478bd9Sstevel@tonic-gate } ibt_srq_modify_flags_t;
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate  * Execution flags, indicates if the function should block or not.
1587c478bd9Sstevel@tonic-gate  * Note: in some cases, e.g., a NULL rc_cm_handler, IBT_NONBLOCKING
1597c478bd9Sstevel@tonic-gate  * will not have an effect, and the thread will block.
1607c478bd9Sstevel@tonic-gate  * IBT_NOCALLBACKS is valid for ibt_close_rc_channel only.
1617c478bd9Sstevel@tonic-gate  */
1627c478bd9Sstevel@tonic-gate typedef enum ibt_execution_mode_e {
1637c478bd9Sstevel@tonic-gate 	IBT_BLOCKING	= 0,	/* Block */
1647c478bd9Sstevel@tonic-gate 	IBT_NONBLOCKING	= 1,	/* Return as soon as possible */
1657c478bd9Sstevel@tonic-gate 	IBT_NOCALLBACKS	= 2	/* cm_handler is not invoked after */
1667c478bd9Sstevel@tonic-gate 				/* ibt_close_rc_channel returns */
1677c478bd9Sstevel@tonic-gate } ibt_execution_mode_t;
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate /*
1707c478bd9Sstevel@tonic-gate  * Memory window alloc flags
1717c478bd9Sstevel@tonic-gate  */
1727c478bd9Sstevel@tonic-gate typedef enum ibt_mw_flags_e {
1737c478bd9Sstevel@tonic-gate 	IBT_MW_SLEEP		= 0,		/* Can block */
1747c478bd9Sstevel@tonic-gate 	IBT_MW_NOSLEEP		= (1 << 0),	/* Can't block */
1757c478bd9Sstevel@tonic-gate 	IBT_MW_USER_MAP		= (1 << 1),
1767c478bd9Sstevel@tonic-gate 	IBT_MW_DEFER_ALLOC	= (1 << 2),
1777c478bd9Sstevel@tonic-gate 	IBT_MW_TYPE_1		= (1 << 3),
1787c478bd9Sstevel@tonic-gate 	IBT_MW_TYPE_2		= (1 << 4)
1797c478bd9Sstevel@tonic-gate } ibt_mw_flags_t;
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate /*
1827c478bd9Sstevel@tonic-gate  * PD alloc flags
1837c478bd9Sstevel@tonic-gate  */
1847c478bd9Sstevel@tonic-gate typedef enum ibt_pd_flags_e {
1857c478bd9Sstevel@tonic-gate 	IBT_PD_NO_FLAGS		= 0,
1867c478bd9Sstevel@tonic-gate 	IBT_PD_USER_MAP		= (1 << 0),
1877c478bd9Sstevel@tonic-gate 	IBT_PD_DEFER_ALLOC	= (1 << 1)
1887c478bd9Sstevel@tonic-gate } ibt_pd_flags_t;
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate /*
1917c478bd9Sstevel@tonic-gate  * UD Dest alloc flags
1927c478bd9Sstevel@tonic-gate  */
1937c478bd9Sstevel@tonic-gate typedef enum ibt_ud_dest_flags_e {
1947c478bd9Sstevel@tonic-gate 	IBT_UD_DEST_NO_FLAGS	= 0,
1957c478bd9Sstevel@tonic-gate 	IBT_UD_DEST_USER_MAP	= (1 << 0),
1967c478bd9Sstevel@tonic-gate 	IBT_UD_DEST_DEFER_ALLOC	= (1 << 1)
1977c478bd9Sstevel@tonic-gate } ibt_ud_dest_flags_t;
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate /*
2007c478bd9Sstevel@tonic-gate  * SRQ alloc flags
2017c478bd9Sstevel@tonic-gate  */
2027c478bd9Sstevel@tonic-gate typedef enum ibt_srq_flags_e {
2037c478bd9Sstevel@tonic-gate 	IBT_SRQ_NO_FLAGS	= 0,
2047c478bd9Sstevel@tonic-gate 	IBT_SRQ_USER_MAP	= (1 << 0),
2057c478bd9Sstevel@tonic-gate 	IBT_SRQ_DEFER_ALLOC	= (1 << 1)
2067c478bd9Sstevel@tonic-gate } ibt_srq_flags_t;
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /*
209*24b28d04Shiremath  * ibt_alloc_lkey() alloc flags
2107c478bd9Sstevel@tonic-gate  */
2117c478bd9Sstevel@tonic-gate typedef enum ibt_lkey_flags_e {
2127c478bd9Sstevel@tonic-gate 	IBT_KEY_NO_FLAGS	= 0,
2137c478bd9Sstevel@tonic-gate 	IBT_KEY_REMOTE		= (1 << 0)
2147c478bd9Sstevel@tonic-gate } ibt_lkey_flags_t;
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate /*
2177c478bd9Sstevel@tonic-gate  *  RNR NAK retry counts.
2187c478bd9Sstevel@tonic-gate  */
2197c478bd9Sstevel@tonic-gate typedef enum ibt_rnr_retry_cnt_e {
2207c478bd9Sstevel@tonic-gate 	IBT_RNR_NO_RETRY	= 0x0,	/* Don't retry, fail on first timeout */
2217c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_1		= 0x1,	/* Retry once */
2227c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_2		= 0x2,	/* Retry twice */
2237c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_3		= 0x3,	/* Retry three times */
2247c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_4		= 0x4,	/* Retry four times */
2257c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_5		= 0x5,	/* Retry five times */
2267c478bd9Sstevel@tonic-gate 	IBT_RNR_RETRY_6		= 0x6,	/* Retry six times */
2277c478bd9Sstevel@tonic-gate 	IBT_RNR_INFINITE_RETRY	= 0x7	/* Retry forever */
2287c478bd9Sstevel@tonic-gate } ibt_rnr_retry_cnt_t;
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate /*
2317c478bd9Sstevel@tonic-gate  * Valid values for RNR NAK timer fields, part of a channel's context.
2327c478bd9Sstevel@tonic-gate  */
2337c478bd9Sstevel@tonic-gate typedef enum ibt_rnr_nak_time_e {
2347c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_655ms	= 0x0,
2357c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_10us	= 0x1,
2367c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_20us	= 0x2,
2377c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_30us	= 0x3,
2387c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_40us	= 0x4,
2397c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_60us	= 0x5,
2407c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_80us	= 0x6,
2417c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_120us	= 0x7,
2427c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_160us	= 0x8,
2437c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_240us	= 0x9,
2447c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_320us	= 0xA,
2457c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_480us	= 0xB,
2467c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_640us	= 0xC,
2477c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_960us	= 0xD,
2487c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_1280us	= 0xE,
2497c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_1920us	= 0xF,
2507c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_2560us	= 0x10,
2517c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_3840us	= 0x11,
2527c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_5120us	= 0x12,
2537c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_7680us	= 0x13,
2547c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_10ms	= 0x14,
2557c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_15ms	= 0x15,
2567c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_20ms	= 0x16,
2577c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_31ms	= 0x17,
2587c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_41ms	= 0x18,
2597c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_61ms	= 0x19,
2607c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_82ms	= 0x1A,
2617c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_123ms	= 0x1B,
2627c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_164ms	= 0x1C,
2637c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_246ms	= 0x1D,
2647c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_328ms	= 0x1E,
2657c478bd9Sstevel@tonic-gate 	IBT_RNR_NAK_492ms	= 0x1F
2667c478bd9Sstevel@tonic-gate } ibt_rnr_nak_time_t;
2677c478bd9Sstevel@tonic-gate 
2687c478bd9Sstevel@tonic-gate /*
2697c478bd9Sstevel@tonic-gate  * The definition of HCA capabilities etc as a bitfield.
2707c478bd9Sstevel@tonic-gate  */
2717c478bd9Sstevel@tonic-gate typedef enum ibt_hca_flags_e {
2727c478bd9Sstevel@tonic-gate 	IBT_HCA_NO_FLAGS	= 0,
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate 	IBT_HCA_RD		= 1 << 0,
2757c478bd9Sstevel@tonic-gate 	IBT_HCA_UD_MULTICAST	= 1 << 1,
2767c478bd9Sstevel@tonic-gate 	IBT_HCA_RAW_MULTICAST	= 1 << 2,
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate 	IBT_HCA_ATOMICS_HCA	= 1 << 3,
2797c478bd9Sstevel@tonic-gate 	IBT_HCA_ATOMICS_GLOBAL	= 1 << 4,
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate 	IBT_HCA_RESIZE_CHAN	= 1 << 5,	/* Is resize supported? */
2827c478bd9Sstevel@tonic-gate 	IBT_HCA_AUTO_PATH_MIG	= 1 << 6,	/* Is APM supported? */
2837c478bd9Sstevel@tonic-gate 	IBT_HCA_SQD_SQD_PORT	= 1 << 7,	/* Can change physical port */
2847c478bd9Sstevel@tonic-gate 						/* on transit from SQD to SQD */
2857c478bd9Sstevel@tonic-gate 	IBT_HCA_PKEY_CNTR	= 1 << 8,
2867c478bd9Sstevel@tonic-gate 	IBT_HCA_QKEY_CNTR	= 1 << 9,
2877c478bd9Sstevel@tonic-gate 	IBT_HCA_AH_PORT_CHECK	= 1 << 10,	/* HCA checks AH port match */
2887c478bd9Sstevel@tonic-gate 						/* in UD WRs */
2897c478bd9Sstevel@tonic-gate 	IBT_HCA_PORT_UP		= 1 << 11,	/* PortActive event supported */
2907c478bd9Sstevel@tonic-gate 	IBT_HCA_INIT_TYPE	= 1 << 12,	/* InitType supported */
2917c478bd9Sstevel@tonic-gate 	IBT_HCA_SI_GUID		= 1 << 13,	/* System Image GUID */
2927c478bd9Sstevel@tonic-gate 						/* supported */
2937c478bd9Sstevel@tonic-gate 	IBT_HCA_SHUTDOWN_PORT	= 1 << 14,	/* ShutdownPort supported */
2947c478bd9Sstevel@tonic-gate 	IBT_HCA_RNR_NAK		= 1 << 15,	/* RNR-NAK supported for RC */
2957c478bd9Sstevel@tonic-gate 	IBT_HCA_CURRENT_QP_STATE = 1 << 16,	/* Does modify_qp support */
2967c478bd9Sstevel@tonic-gate 						/* checking of current state? */
2977c478bd9Sstevel@tonic-gate 	IBT_HCA_SRQ 		= 1 << 17,	/* Shared Receive Queue */
2987c478bd9Sstevel@tonic-gate 	IBT_HCA_RESIZE_SRQ	= 1 << 18,	/* Is resize SRQ supported? */
2997c478bd9Sstevel@tonic-gate 	IBT_HCA_BASE_MEM_MGT	= 1 << 19,	/* Base memory mgt supported? */
3007c478bd9Sstevel@tonic-gate 	IBT_HCA_MULT_PAGE_SZ_MR	= 1 << 20,	/* Support of multiple page */
3017c478bd9Sstevel@tonic-gate 						/* sizes per memory region? */
3027c478bd9Sstevel@tonic-gate 	IBT_HCA_BLOCK_LIST	= 1 << 21,	/* Block list physical buffer */
3037c478bd9Sstevel@tonic-gate 						/* lists supported? */
3047c478bd9Sstevel@tonic-gate 	IBT_HCA_ZERO_BASED_VA	= 1 << 22,	/* Zero Based Virtual */
3057c478bd9Sstevel@tonic-gate 						/* Addresses supported? */
3067c478bd9Sstevel@tonic-gate 	IBT_HCA_LOCAL_INVAL_FENCE = 1 << 23,	/* Local invalidate fencing? */
3077c478bd9Sstevel@tonic-gate 	IBT_HCA_BASE_QUEUE_MGT	= 1 << 24,	/* Base Queue Mgt supported? */
3087c478bd9Sstevel@tonic-gate 	IBT_HCA_CKSUM_FULL	= 1 << 25,	/* Checksum offload supported */
3097c478bd9Sstevel@tonic-gate 	IBT_HCA_MEM_WIN_TYPE_2B	= 1 << 26,	/* Type 2B memory windows */
3107c478bd9Sstevel@tonic-gate 	IBT_HCA_PHYS_BUF_BLOCK	= 1 << 27	/* Block mode phys buf lists */
3117c478bd9Sstevel@tonic-gate } ibt_hca_flags_t;
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate /*
3147c478bd9Sstevel@tonic-gate  * The definition of HCA page size capabilities as a bitfield
3157c478bd9Sstevel@tonic-gate  */
3167c478bd9Sstevel@tonic-gate typedef enum ibt_page_sizes_e {
3177c478bd9Sstevel@tonic-gate 	IBT_PAGE_4K		= 0x1 << 2,
3187c478bd9Sstevel@tonic-gate 	IBT_PAGE_8K		= 0x1 << 3,
3197c478bd9Sstevel@tonic-gate 	IBT_PAGE_16K		= 0x1 << 4,
3207c478bd9Sstevel@tonic-gate 	IBT_PAGE_32K		= 0x1 << 5,
3217c478bd9Sstevel@tonic-gate 	IBT_PAGE_64K		= 0x1 << 6,
3227c478bd9Sstevel@tonic-gate 	IBT_PAGE_128K		= 0x1 << 7,
3237c478bd9Sstevel@tonic-gate 	IBT_PAGE_256K		= 0x1 << 8,
3247c478bd9Sstevel@tonic-gate 	IBT_PAGE_512K		= 0x1 << 9,
3257c478bd9Sstevel@tonic-gate 	IBT_PAGE_1M		= 0x1 << 10,
3267c478bd9Sstevel@tonic-gate 	IBT_PAGE_2M		= 0x1 << 11,
3277c478bd9Sstevel@tonic-gate 	IBT_PAGE_4M		= 0x1 << 12,
3287c478bd9Sstevel@tonic-gate 	IBT_PAGE_8M		= 0x1 << 13,
3297c478bd9Sstevel@tonic-gate 	IBT_PAGE_16M		= 0x1 << 14,
3307c478bd9Sstevel@tonic-gate 	IBT_PAGE_32M		= 0x1 << 15,
3317c478bd9Sstevel@tonic-gate 	IBT_PAGE_64M		= 0x1 << 16,
3327c478bd9Sstevel@tonic-gate 	IBT_PAGE_128M		= 0x1 << 17,
3337c478bd9Sstevel@tonic-gate 	IBT_PAGE_256M		= 0x1 << 18,
3347c478bd9Sstevel@tonic-gate 	IBT_PAGE_512M		= 0x1 << 19,
3357c478bd9Sstevel@tonic-gate 	IBT_PAGE_1G		= 0x1 << 20,
3367c478bd9Sstevel@tonic-gate 	IBT_PAGE_2G		= 0x1 << 21,
3377c478bd9Sstevel@tonic-gate 	IBT_PAGE_4G		= 0x1 << 22,
3387c478bd9Sstevel@tonic-gate 	IBT_PAGE_8G		= 0x1 << 23,
3397c478bd9Sstevel@tonic-gate 	IBT_PAGE_16G		= 0x1 << 24
3407c478bd9Sstevel@tonic-gate } ibt_page_sizes_t;
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate /*
3437c478bd9Sstevel@tonic-gate  * Memory Window Type.
3447c478bd9Sstevel@tonic-gate  */
3457c478bd9Sstevel@tonic-gate typedef enum ibt_mem_win_type_e {
3467c478bd9Sstevel@tonic-gate 	IBT_MEM_WIN_TYPE_NOT_DEFINED	= 0,
3477c478bd9Sstevel@tonic-gate 	IBT_MEM_WIN_TYPE_1		= (1 << 0),
3487c478bd9Sstevel@tonic-gate 	IBT_MEM_WIN_TYPE_2		= (1 << 1)
3497c478bd9Sstevel@tonic-gate } ibt_mem_win_type_t;
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate /*
3527c478bd9Sstevel@tonic-gate  * HCA attributes.
3537c478bd9Sstevel@tonic-gate  * Contains all HCA static attributes.
3547c478bd9Sstevel@tonic-gate  */
3557c478bd9Sstevel@tonic-gate typedef struct ibt_hca_attr_s {
3567c478bd9Sstevel@tonic-gate 	ibt_hca_flags_t	hca_flags;		/* HCA capabilities etc */
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate 	/* device/version inconsistency w/ NodeInfo and IOControllerProfile */
3597c478bd9Sstevel@tonic-gate 	uint32_t	hca_vendor_id:24;	/* 24 bit Vendor ID */
3607c478bd9Sstevel@tonic-gate 	uint16_t	hca_device_id;
3617c478bd9Sstevel@tonic-gate 	uint32_t	hca_version_id;
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate 	uint_t		hca_max_chans;		/* Max Chans supported */
3647c478bd9Sstevel@tonic-gate 	uint_t		hca_max_chan_sz;	/* Max outstanding WRs on any */
3657c478bd9Sstevel@tonic-gate 						/* channel */
3667c478bd9Sstevel@tonic-gate 
3677c478bd9Sstevel@tonic-gate 	uint_t		hca_max_sgl;		/* Max SGL entries per WR */
3687c478bd9Sstevel@tonic-gate 
3697c478bd9Sstevel@tonic-gate 	uint_t		hca_max_cq;		/* Max num of CQs supported  */
3707c478bd9Sstevel@tonic-gate 	uint_t		hca_max_cq_sz;		/* Max capacity of each CQ */
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate 	ibt_page_sizes_t	hca_page_sz;	/* Bit mask of page sizes */
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate 	uint_t		hca_max_memr;		/* Max num of HCA mem regions */
3757c478bd9Sstevel@tonic-gate 	ib_memlen_t	hca_max_memr_len;	/* Largest block, in bytes of */
3767c478bd9Sstevel@tonic-gate 						/* mem that can be registered */
3777c478bd9Sstevel@tonic-gate 	uint_t		hca_max_mem_win;	/* Max Memory windows in HCA */
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate 	uint_t		hca_max_rsc; 		/* Max Responder Resources of */
3807c478bd9Sstevel@tonic-gate 						/* this HCA for RDMAR/Atomics */
3817c478bd9Sstevel@tonic-gate 						/* with this HCA as target. */
3827c478bd9Sstevel@tonic-gate 	uint8_t		hca_max_rdma_in_chan;	/* Max RDMAR/Atomics in per */
3837c478bd9Sstevel@tonic-gate 						/* chan this HCA as target. */
3847c478bd9Sstevel@tonic-gate 	uint8_t		hca_max_rdma_out_chan;	/* Max RDMA Reads/Atomics out */
3857c478bd9Sstevel@tonic-gate 						/* per channel by this HCA */
3867c478bd9Sstevel@tonic-gate 	uint_t		hca_max_ipv6_chan;	/* Max IPV6 channels in HCA */
3877c478bd9Sstevel@tonic-gate 	uint_t		hca_max_ether_chan;	/* Max Ether channels in HCA */
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate 	uint_t		hca_max_mcg_chans;	/* Max number of channels */
3907c478bd9Sstevel@tonic-gate 						/* that can join multicast */
3917c478bd9Sstevel@tonic-gate 						/* groups */
3927c478bd9Sstevel@tonic-gate 	uint_t		hca_max_mcg;		/* Max multicast groups */
3937c478bd9Sstevel@tonic-gate 	uint_t		hca_max_chan_per_mcg;	/* Max number of channels per */
3947c478bd9Sstevel@tonic-gate 						/* Multicast group in HCA */
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate 	uint16_t	hca_max_partitions;	/* Max partitions in HCA */
3977c478bd9Sstevel@tonic-gate 	uint8_t		hca_nports;		/* Number of physical ports */
3987c478bd9Sstevel@tonic-gate 	ib_guid_t	hca_node_guid;		/* Node GUID */
3997c478bd9Sstevel@tonic-gate 
4007c478bd9Sstevel@tonic-gate 	ib_time_t	hca_local_ack_delay;
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate 	uint_t		hca_max_port_sgid_tbl_sz;
4037c478bd9Sstevel@tonic-gate 	uint16_t	hca_max_port_pkey_tbl_sz;
4047c478bd9Sstevel@tonic-gate 	uint_t		hca_max_pd;		/* Max# of Protection Domains */
4057c478bd9Sstevel@tonic-gate 	ib_guid_t	hca_si_guid;		/* Optional System Image GUID */
4067c478bd9Sstevel@tonic-gate 	uint_t		hca_hca_max_ci_priv_sz;
4077c478bd9Sstevel@tonic-gate 	uint_t		hca_chan_max_ci_priv_sz;
4087c478bd9Sstevel@tonic-gate 	uint_t		hca_cq_max_ci_priv_sz;
4097c478bd9Sstevel@tonic-gate 	uint_t		hca_pd_max_ci_priv_sz;
4107c478bd9Sstevel@tonic-gate 	uint_t		hca_mr_max_ci_priv_sz;
4117c478bd9Sstevel@tonic-gate 	uint_t		hca_mw_max_ci_priv_sz;
4127c478bd9Sstevel@tonic-gate 	uint_t		hca_ud_dest_max_ci_priv_sz;
4137c478bd9Sstevel@tonic-gate 	uint_t		hca_cq_sched_max_ci_priv_sz;
4147c478bd9Sstevel@tonic-gate 	uint_t		hca_max_ud_dest;
4157c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque2;
4167c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque3;
4177c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque4;
4187c478bd9Sstevel@tonic-gate 	uint8_t		hca_opaque5;
4197c478bd9Sstevel@tonic-gate 	uint8_t		hca_opaque6;
4207c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque7;
4217c478bd9Sstevel@tonic-gate 	uint_t		hca_opaque8;
4227c478bd9Sstevel@tonic-gate 	uint_t		hca_max_srqs;		/* Max SRQs supported */
4237c478bd9Sstevel@tonic-gate 	uint_t		hca_max_srqs_sz;	/* Max outstanding WRs on any */
4247c478bd9Sstevel@tonic-gate 						/* SRQ */
4257c478bd9Sstevel@tonic-gate 	uint_t		hca_max_srq_sgl;	/* Max SGL entries per SRQ WR */
4267c478bd9Sstevel@tonic-gate 	uint_t		hca_max_phys_buf_list_sz;
4277c478bd9Sstevel@tonic-gate 	size_t		hca_block_sz_lo;	/* Range of block sizes */
4287c478bd9Sstevel@tonic-gate 	size_t		hca_block_sz_hi;	/* supported by the HCA */
4297c478bd9Sstevel@tonic-gate 	uint_t		hca_max_cq_handlers;
4307c478bd9Sstevel@tonic-gate 	ibt_lkey_t	hca_reserved_lkey;
4317c478bd9Sstevel@tonic-gate } ibt_hca_attr_t;
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate /*
4347c478bd9Sstevel@tonic-gate  * HCA Port link states.
4357c478bd9Sstevel@tonic-gate  */
4367c478bd9Sstevel@tonic-gate typedef enum ibt_port_state_e {
4377c478bd9Sstevel@tonic-gate 	IBT_PORT_DOWN	= 1,
4387c478bd9Sstevel@tonic-gate 	IBT_PORT_INIT,
4397c478bd9Sstevel@tonic-gate 	IBT_PORT_ARM,
4407c478bd9Sstevel@tonic-gate 	IBT_PORT_ACTIVE
4417c478bd9Sstevel@tonic-gate } ibt_port_state_t;
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate /*
4447c478bd9Sstevel@tonic-gate  * HCA Port capabilities as a bitfield.
4457c478bd9Sstevel@tonic-gate  */
4467c478bd9Sstevel@tonic-gate typedef enum ibt_port_caps_e {
4477c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_NO_FLAGS		= 0,
4487c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_SM			= 1 << 0,	/* SM port */
4497c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_SM_DISABLED	= 1 << 1,
4507c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_SNMP_TUNNEL	= 1 << 2,	/* SNMP Tunneling */
4517c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_DM			= 1 << 3,	/* DM supported */
4527c478bd9Sstevel@tonic-gate 	IBT_PORT_CAP_VENDOR		= 1 << 4	/* Vendor Class */
4537c478bd9Sstevel@tonic-gate } ibt_port_caps_t;
4547c478bd9Sstevel@tonic-gate 
4557c478bd9Sstevel@tonic-gate 
4567c478bd9Sstevel@tonic-gate /*
4577c478bd9Sstevel@tonic-gate  * HCA port attributes structure definition. The number of ports per HCA
4587c478bd9Sstevel@tonic-gate  * can be found from the "ibt_hca_attr_t" structure.
4597c478bd9Sstevel@tonic-gate  *
4607c478bd9Sstevel@tonic-gate  * p_pkey_tbl is a pointer to an array of ib_pkey_t, members are
4617c478bd9Sstevel@tonic-gate  * accessed as:
4627c478bd9Sstevel@tonic-gate  *		hca_portinfo->p_pkey_tbl[i]
4637c478bd9Sstevel@tonic-gate  *
4647c478bd9Sstevel@tonic-gate  * Where 0 <= i < hca_portinfo.p_pkey_tbl_sz
4657c478bd9Sstevel@tonic-gate  *
4667c478bd9Sstevel@tonic-gate  * Similarly p_sgid_tbl is a pointer to an array of ib_gid_t.
4677c478bd9Sstevel@tonic-gate  *
4687c478bd9Sstevel@tonic-gate  * The Query Port function - ibt_query_hca_ports() allocates the memory
4697c478bd9Sstevel@tonic-gate  * required for the ibt_hca_portinfo_t struct as well as the memory
4707c478bd9Sstevel@tonic-gate  * required for the SGID and P_Key tables. The memory is freed by calling
4717c478bd9Sstevel@tonic-gate  * ibt_free_portinfo().
4727c478bd9Sstevel@tonic-gate  */
4737c478bd9Sstevel@tonic-gate typedef struct ibt_hca_portinfo_s {
4747c478bd9Sstevel@tonic-gate 	ib_lid_t		p_opaque1;	/* Base LID of port */
4757c478bd9Sstevel@tonic-gate 	ib_qkey_cntr_t		p_qkey_violations; /* Bad Q_Key cnt */
4767c478bd9Sstevel@tonic-gate 	ib_pkey_cntr_t		p_pkey_violations; /* Optional bad P_Key cnt */
4777c478bd9Sstevel@tonic-gate 	uint8_t			p_sm_sl:4;	/* SM Service level */
4787c478bd9Sstevel@tonic-gate 	ib_lid_t		p_sm_lid;	/* SM LID */
4797c478bd9Sstevel@tonic-gate 	ibt_port_state_t	p_linkstate;	/* Port state */
4807c478bd9Sstevel@tonic-gate 	uint8_t			p_port_num;
4817c478bd9Sstevel@tonic-gate 	ib_mtu_t		p_mtu;		/* Max transfer unit - pkt */
4827c478bd9Sstevel@tonic-gate 	uint8_t			p_lmc:3;	/* Local mask control */
4837c478bd9Sstevel@tonic-gate 	ib_gid_t		*p_sgid_tbl;	/* SGID Table */
4847c478bd9Sstevel@tonic-gate 	uint_t			p_sgid_tbl_sz;	/* Size of SGID table */
4857c478bd9Sstevel@tonic-gate 	uint16_t		p_pkey_tbl_sz;	/* Size of P_Key table */
4867c478bd9Sstevel@tonic-gate 	uint16_t		p_def_pkey_ix;	/* default pkey index for TI */
4877c478bd9Sstevel@tonic-gate 	ib_pkey_t		*p_pkey_tbl;	/* P_Key table */
4887c478bd9Sstevel@tonic-gate 	uint8_t			p_max_vl;	/* Max num of virtual lanes */
4897c478bd9Sstevel@tonic-gate 	uint8_t			p_init_type_reply; /* Optional InitTypeReply */
4907c478bd9Sstevel@tonic-gate 	ib_time_t		p_subnet_timeout; /* Max Subnet Timeout */
4917c478bd9Sstevel@tonic-gate 	ibt_port_caps_t		p_capabilities;	/* Port Capabilities */
4927c478bd9Sstevel@tonic-gate 	uint32_t		p_msg_sz;	/* Max message size */
4937c478bd9Sstevel@tonic-gate } ibt_hca_portinfo_t;
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate /*
4967c478bd9Sstevel@tonic-gate  * Modify HCA port attributes flags, specifies which HCA port
4977c478bd9Sstevel@tonic-gate  * attributes to modify.
4987c478bd9Sstevel@tonic-gate  */
4997c478bd9Sstevel@tonic-gate typedef enum ibt_port_modify_flags_e {
5007c478bd9Sstevel@tonic-gate 	IBT_PORT_NO_FLAGS	= 0,
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_QKEY	= 1 << 0,	/* Reset Q_Key violation */
5037c478bd9Sstevel@tonic-gate 						/* counter */
5047c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_SM	= 1 << 1,	/* SM */
5057c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_SM		= 1 << 2,
5067c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_SNMP	= 1 << 3,	/* SNMP Tunneling */
5077c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_SNMP	= 1 << 4,
5087c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_DEVMGT	= 1 << 5,	/* Device Management */
5097c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_DEVMGT	= 1 << 6,
5107c478bd9Sstevel@tonic-gate 	IBT_PORT_RESET_VENDOR	= 1 << 7,	/* Vendor Class */
5117c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_VENDOR	= 1 << 8,
5127c478bd9Sstevel@tonic-gate 	IBT_PORT_SHUTDOWN	= 1 << 9,	/* Shut down the port */
5137c478bd9Sstevel@tonic-gate 	IBT_PORT_SET_INIT_TYPE	= 1 << 10	/* InitTypeReply value */
5147c478bd9Sstevel@tonic-gate } ibt_port_modify_flags_t;
5157c478bd9Sstevel@tonic-gate 
5167c478bd9Sstevel@tonic-gate /*
517*24b28d04Shiremath  * Modify HCA port InitType bit definitions, applicable only if
518*24b28d04Shiremath  * IBT_PORT_SET_INIT_TYPE modify flag (ibt_port_modify_flags_t) is set.
5197c478bd9Sstevel@tonic-gate  */
5207c478bd9Sstevel@tonic-gate #define	IBT_PINIT_NO_LOAD		0x1
5217c478bd9Sstevel@tonic-gate #define	IBT_PINIT_PRESERVE_CONTENT	0x2
5227c478bd9Sstevel@tonic-gate #define	IBT_PINIT_PRESERVE_PRESENCE	0x4
5237c478bd9Sstevel@tonic-gate #define	IBT_PINIT_NO_RESUSCITATE	0x8
5247c478bd9Sstevel@tonic-gate 
5257c478bd9Sstevel@tonic-gate 
5267c478bd9Sstevel@tonic-gate /*
5277c478bd9Sstevel@tonic-gate  * Address vector definition.
5287c478bd9Sstevel@tonic-gate  */
5297c478bd9Sstevel@tonic-gate typedef struct ibt_adds_vect_s {
5307c478bd9Sstevel@tonic-gate 	ib_gid_t	av_dgid;	/* IPV6 dest GID in GRH */
5317c478bd9Sstevel@tonic-gate 	ib_gid_t	av_sgid;	/* SGID */
5327c478bd9Sstevel@tonic-gate 	ibt_srate_t	av_srate;	/* Max static rate */
5337c478bd9Sstevel@tonic-gate 	uint8_t		av_srvl:4;	/* Service level in LRH */
5347c478bd9Sstevel@tonic-gate 	uint_t		av_flow:20;	/* 20 bit Flow Label */
5357c478bd9Sstevel@tonic-gate 	uint8_t		av_tclass;	/* Traffic Class */
5367c478bd9Sstevel@tonic-gate 	uint8_t		av_hop;		/* Hop Limit */
5377c478bd9Sstevel@tonic-gate 	uint8_t		av_port_num;	/* Port number for UD */
5387c478bd9Sstevel@tonic-gate 	boolean_t	av_opaque1;
5397c478bd9Sstevel@tonic-gate 	ib_lid_t	av_opaque2;
5407c478bd9Sstevel@tonic-gate 	ib_path_bits_t	av_opaque3;
5417c478bd9Sstevel@tonic-gate 	uint32_t	av_opaque4;
5427c478bd9Sstevel@tonic-gate } ibt_adds_vect_t;
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate typedef struct ibt_cep_path_s {
5457c478bd9Sstevel@tonic-gate 	ibt_adds_vect_t	cep_adds_vect;		/* Address Vector */
5467c478bd9Sstevel@tonic-gate 	uint16_t	cep_pkey_ix;		/* P_Key Index */
5477c478bd9Sstevel@tonic-gate 	uint8_t		cep_hca_port_num;	/* Port number for connected */
5487c478bd9Sstevel@tonic-gate 						/* channels.  A value of 0 */
5497c478bd9Sstevel@tonic-gate 						/* indicates an invalid path */
5507c478bd9Sstevel@tonic-gate 	ib_time_t	cep_cm_opaque1;
5517c478bd9Sstevel@tonic-gate } ibt_cep_path_t;
5527c478bd9Sstevel@tonic-gate 
5537c478bd9Sstevel@tonic-gate /*
5547c478bd9Sstevel@tonic-gate  * Channel Migration State.
5557c478bd9Sstevel@tonic-gate  */
5567c478bd9Sstevel@tonic-gate typedef enum ibt_cep_cmstate_e {
5577c478bd9Sstevel@tonic-gate 	IBT_STATE_NOT_SUPPORTED	= 0,
5587c478bd9Sstevel@tonic-gate 	IBT_STATE_MIGRATED	= 1,
5597c478bd9Sstevel@tonic-gate 	IBT_STATE_REARMED	= 2,
5607c478bd9Sstevel@tonic-gate 	IBT_STATE_ARMED		= 3
5617c478bd9Sstevel@tonic-gate } ibt_cep_cmstate_t;
5627c478bd9Sstevel@tonic-gate 
5637c478bd9Sstevel@tonic-gate /*
5647c478bd9Sstevel@tonic-gate  * Transport service type
5657c478bd9Sstevel@tonic-gate  *
5667c478bd9Sstevel@tonic-gate  * NOTE: this was converted from an enum to a uint8_t to save space.
5677c478bd9Sstevel@tonic-gate  */
5687c478bd9Sstevel@tonic-gate typedef uint8_t ibt_tran_srv_t;
5697c478bd9Sstevel@tonic-gate 
5707c478bd9Sstevel@tonic-gate #define	IBT_RC_SRV		0
5717c478bd9Sstevel@tonic-gate #define	IBT_UC_SRV		1
5727c478bd9Sstevel@tonic-gate #define	IBT_RD_SRV		2
5737c478bd9Sstevel@tonic-gate #define	IBT_UD_SRV		3
5747c478bd9Sstevel@tonic-gate #define	IBT_RAWIP_SRV		4
5757c478bd9Sstevel@tonic-gate #define	IBT_RAWETHER_SRV	5
5767c478bd9Sstevel@tonic-gate 
5777c478bd9Sstevel@tonic-gate /*
5787c478bd9Sstevel@tonic-gate  * Channel (QP/EEC) state definitions.
5797c478bd9Sstevel@tonic-gate  */
5807c478bd9Sstevel@tonic-gate typedef enum ibt_cep_state_e {
5817c478bd9Sstevel@tonic-gate 	IBT_STATE_RESET	= 0,		/* Reset */
5827c478bd9Sstevel@tonic-gate 	IBT_STATE_INIT,			/* Initialized */
5837c478bd9Sstevel@tonic-gate 	IBT_STATE_RTR,			/* Ready to Receive */
5847c478bd9Sstevel@tonic-gate 	IBT_STATE_RTS,			/* Ready to Send */
5857c478bd9Sstevel@tonic-gate 	IBT_STATE_SQD,			/* Send Queue Drained */
5867c478bd9Sstevel@tonic-gate 	IBT_STATE_SQE,			/* Send Queue Error */
5877c478bd9Sstevel@tonic-gate 	IBT_STATE_ERROR,		/* Error */
5887c478bd9Sstevel@tonic-gate 	IBT_STATE_SQDRAIN,		/* Send Queue Draining */
5897c478bd9Sstevel@tonic-gate 	IBT_STATE_NUM			/* Number of states */
5907c478bd9Sstevel@tonic-gate } ibt_cep_state_t;
5917c478bd9Sstevel@tonic-gate 
5927c478bd9Sstevel@tonic-gate 
5937c478bd9Sstevel@tonic-gate /*
5947c478bd9Sstevel@tonic-gate  * Channel Attribute flags.
5957c478bd9Sstevel@tonic-gate  */
5967c478bd9Sstevel@tonic-gate typedef enum ibt_attr_flags_e {
5977c478bd9Sstevel@tonic-gate 	IBT_ALL_SIGNALED	= 0,	/* All sends signaled */
5987c478bd9Sstevel@tonic-gate 	IBT_WR_SIGNALED		= 1,	/* Signaled on a WR basis */
5997c478bd9Sstevel@tonic-gate 	IBT_FAST_REG_RES_LKEY	= (1 << 1)
6007c478bd9Sstevel@tonic-gate } ibt_attr_flags_t;
6017c478bd9Sstevel@tonic-gate 
6027c478bd9Sstevel@tonic-gate /*
6037c478bd9Sstevel@tonic-gate  * Channel End Point (CEP) Control Flags.
6047c478bd9Sstevel@tonic-gate  */
6057c478bd9Sstevel@tonic-gate typedef enum ibt_cep_flags_e {
6067c478bd9Sstevel@tonic-gate 	IBT_CEP_NO_FLAGS	= 0,		/* Enable Nothing */
6077c478bd9Sstevel@tonic-gate 	IBT_CEP_RDMA_RD		= (1 << 0),	/* Enable incoming RDMA RD's */
6087c478bd9Sstevel@tonic-gate 						/* RC & RD only */
6097c478bd9Sstevel@tonic-gate 	IBT_CEP_RDMA_WR		= (1 << 1),	/* Enable incoming RDMA WR's */
6107c478bd9Sstevel@tonic-gate 						/* RC & RD only */
6117c478bd9Sstevel@tonic-gate 	IBT_CEP_ATOMIC		= (1 << 2)	/* Enable incoming Atomics, */
6127c478bd9Sstevel@tonic-gate 						/* RC & RD only */
6137c478bd9Sstevel@tonic-gate } ibt_cep_flags_t;
6147c478bd9Sstevel@tonic-gate 
6157c478bd9Sstevel@tonic-gate /*
6167c478bd9Sstevel@tonic-gate  * Channel Modify Flags
6177c478bd9Sstevel@tonic-gate  */
6187c478bd9Sstevel@tonic-gate typedef enum ibt_cep_modify_flags_e {
6197c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_NOTHING		= 0,
6207c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_SQ_SIZE		= (1 << 1),
6217c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RQ_SIZE		= (1 << 2),
6227c478bd9Sstevel@tonic-gate 
6237c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMA_R		= (1 << 3),
6247c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMA_W		= (1 << 4),
6257c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_ATOMIC		= (1 << 5),
6267c478bd9Sstevel@tonic-gate 
6277c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_ALT_PATH		= (1 << 6),	/* Alternate Path */
6287c478bd9Sstevel@tonic-gate 
6297c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_ADDS_VECT		= (1 << 7),
6307c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_PORT		= (1 << 8),
6317c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE5		= (1 << 9),
6327c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RETRY		= (1 << 10),
6337c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RNR_NAK_RETRY 	= (1 << 11),
6347c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_MIN_RNR_NAK		= (1 << 12),
6357c478bd9Sstevel@tonic-gate 
6367c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_QKEY		= (1 << 13),
6377c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMARA_OUT		= (1 << 14),
6387c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_RDMARA_IN		= (1 << 15),
6397c478bd9Sstevel@tonic-gate 
6407c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE1		= (1 << 16),
6417c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE2		= (1 << 17),
6427c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE3		= (1 << 18),
6437c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE4		= (1 << 19),
6447c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_SQD_EVENT		= (1 << 20),
6457c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE6		= (1 << 21),
6467c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE7		= (1 << 22),
6477c478bd9Sstevel@tonic-gate 	IBT_CEP_SET_OPAQUE8		= (1 << 23)
6487c478bd9Sstevel@tonic-gate } ibt_cep_modify_flags_t;
6497c478bd9Sstevel@tonic-gate 
6507c478bd9Sstevel@tonic-gate /*
6517c478bd9Sstevel@tonic-gate  * CQ notify types.
6527c478bd9Sstevel@tonic-gate  */
6537c478bd9Sstevel@tonic-gate typedef enum ibt_cq_notify_flags_e {
6547c478bd9Sstevel@tonic-gate 	IBT_NEXT_COMPLETION	= 1,
6557c478bd9Sstevel@tonic-gate 	IBT_NEXT_SOLICITED	= 2
6567c478bd9Sstevel@tonic-gate } ibt_cq_notify_flags_t;
6577c478bd9Sstevel@tonic-gate 
6587c478bd9Sstevel@tonic-gate /*
6597c478bd9Sstevel@tonic-gate  * CQ types shared across TI and CI.
6607c478bd9Sstevel@tonic-gate  */
6617c478bd9Sstevel@tonic-gate typedef enum ibt_cq_flags_e {
6627c478bd9Sstevel@tonic-gate 	IBT_CQ_NO_FLAGS			= 0,
6637c478bd9Sstevel@tonic-gate 	IBT_CQ_HANDLER_IN_THREAD	= 1 << 0,	/* A thread calls the */
6647c478bd9Sstevel@tonic-gate 							/* CQ handler */
6657c478bd9Sstevel@tonic-gate 	IBT_CQ_USER_MAP			= 1 << 1,
6667c478bd9Sstevel@tonic-gate 	IBT_CQ_DEFER_ALLOC		= 1 << 2
6677c478bd9Sstevel@tonic-gate } ibt_cq_flags_t;
6687c478bd9Sstevel@tonic-gate 
6697c478bd9Sstevel@tonic-gate /*
6707c478bd9Sstevel@tonic-gate  * CQ types shared across TI and CI.
6717c478bd9Sstevel@tonic-gate  */
6727c478bd9Sstevel@tonic-gate typedef enum ibt_cq_sched_flags_e {
6737c478bd9Sstevel@tonic-gate 	IBT_CQS_NO_FLAGS	= 0,
6747c478bd9Sstevel@tonic-gate 	IBT_CQS_WARM_CACHE	= 1 << 0, /* run on same CPU */
6757c478bd9Sstevel@tonic-gate 	IBT_CQS_AFFINITY	= 1 << 1,
6767c478bd9Sstevel@tonic-gate 	IBT_CQS_SCHED_GROUP	= 1 << 2,
6777c478bd9Sstevel@tonic-gate 	IBT_CQS_USER_MAP	= 1 << 3,
6787c478bd9Sstevel@tonic-gate 	IBT_CQS_DEFER_ALLOC	= 1 << 4
6797c478bd9Sstevel@tonic-gate } ibt_cq_sched_flags_t;
6807c478bd9Sstevel@tonic-gate 
6817c478bd9Sstevel@tonic-gate /*
6827c478bd9Sstevel@tonic-gate  * Attributes when creating a Completion Queue.
6837c478bd9Sstevel@tonic-gate  *
6847c478bd9Sstevel@tonic-gate  * Note:
6857c478bd9Sstevel@tonic-gate  *	The IBT_CQ_HANDLER_IN_THREAD cq_flags bit should be ignored by the CI.
6867c478bd9Sstevel@tonic-gate  */
6877c478bd9Sstevel@tonic-gate typedef struct ibt_cq_attr_s {
6887c478bd9Sstevel@tonic-gate 	uint_t			cq_size;
6897c478bd9Sstevel@tonic-gate 	ibt_sched_hdl_t		cq_sched;	/* 0 = no hint, */
6907c478bd9Sstevel@tonic-gate 						/* other = cq_sched value */
6917c478bd9Sstevel@tonic-gate 	ibt_cq_flags_t		cq_flags;
6927c478bd9Sstevel@tonic-gate } ibt_cq_attr_t;
6937c478bd9Sstevel@tonic-gate 
6947c478bd9Sstevel@tonic-gate /*
6957c478bd9Sstevel@tonic-gate  * Memory Management
6967c478bd9Sstevel@tonic-gate  */
6977c478bd9Sstevel@tonic-gate 
6987c478bd9Sstevel@tonic-gate /* Memory management flags */
6997c478bd9Sstevel@tonic-gate typedef enum ibt_mr_flags_e {
7007c478bd9Sstevel@tonic-gate 	IBT_MR_SLEEP			= 0,
7017c478bd9Sstevel@tonic-gate 	IBT_MR_NOSLEEP			= (1 << 1),
7027c478bd9Sstevel@tonic-gate 	IBT_MR_NONCOHERENT		= (1 << 2),
7037c478bd9Sstevel@tonic-gate 	IBT_MR_PHYS_IOVA		= (1 << 3),  /* ibt_(re)register_buf */
7047c478bd9Sstevel@tonic-gate 
7057c478bd9Sstevel@tonic-gate 	/* Access control flags */
7067c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_WINDOW_BIND	= (1 << 4),
7077c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_LOCAL_WRITE	= (1 << 5),
7087c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_REMOTE_READ	= (1 << 6),
7097c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_REMOTE_WRITE	= (1 << 7),
7107c478bd9Sstevel@tonic-gate 	IBT_MR_ENABLE_REMOTE_ATOMIC	= (1 << 8),
7117c478bd9Sstevel@tonic-gate 
7127c478bd9Sstevel@tonic-gate 	/* Reregister flags */
7137c478bd9Sstevel@tonic-gate 	IBT_MR_CHANGE_TRANSLATION	= (1 << 9),
7147c478bd9Sstevel@tonic-gate 	IBT_MR_CHANGE_ACCESS		= (1 << 10),
7157c478bd9Sstevel@tonic-gate 	IBT_MR_CHANGE_PD		= (1 << 11),
7167c478bd9Sstevel@tonic-gate 
7177c478bd9Sstevel@tonic-gate 	/* Additional registration flags */
7187c478bd9Sstevel@tonic-gate 	IBT_MR_ZBVA			= (1 << 12),
7197c478bd9Sstevel@tonic-gate 
7207c478bd9Sstevel@tonic-gate 	/* Additional physical registration flags */
7217c478bd9Sstevel@tonic-gate 	IBT_MR_CONSUMER_KEY		= (1 << 13)	/* Consumer owns key */
7227c478bd9Sstevel@tonic-gate 							/* portion of keys */
7237c478bd9Sstevel@tonic-gate } ibt_mr_flags_t;
7247c478bd9Sstevel@tonic-gate 
7257c478bd9Sstevel@tonic-gate 
7267c478bd9Sstevel@tonic-gate /* Memory Region attribute flags */
7277c478bd9Sstevel@tonic-gate typedef enum ibt_mr_attr_flags_e {
7287c478bd9Sstevel@tonic-gate 	/* Access control flags */
7297c478bd9Sstevel@tonic-gate 	IBT_MR_WINDOW_BIND		= (1 << 0),
7307c478bd9Sstevel@tonic-gate 	IBT_MR_LOCAL_WRITE		= (1 << 1),
7317c478bd9Sstevel@tonic-gate 	IBT_MR_REMOTE_READ		= (1 << 2),
7327c478bd9Sstevel@tonic-gate 	IBT_MR_REMOTE_WRITE		= (1 << 3),
7337c478bd9Sstevel@tonic-gate 	IBT_MR_REMOTE_ATOMIC		= (1 << 4),
7347c478bd9Sstevel@tonic-gate 	IBT_MR_ZERO_BASED_VA		= (1 << 5),
7357c478bd9Sstevel@tonic-gate 	IBT_MR_CONSUMER_OWNED_KEY	= (1 << 6),
7367c478bd9Sstevel@tonic-gate 	IBT_MR_SHARED			= (1 << 7)
7377c478bd9Sstevel@tonic-gate } ibt_mr_attr_flags_t;
7387c478bd9Sstevel@tonic-gate 
7397c478bd9Sstevel@tonic-gate /* Memory region physical descriptor. */
7407c478bd9Sstevel@tonic-gate typedef struct ibt_phys_buf_s {
7417c478bd9Sstevel@tonic-gate 	union {
7427c478bd9Sstevel@tonic-gate 		uint64_t	_p_ll;		/* 64 bit DMA address */
7437c478bd9Sstevel@tonic-gate 		uint32_t	_p_la[2];	/* 2 x 32 bit address */
7447c478bd9Sstevel@tonic-gate 	} _phys_buf;
7457c478bd9Sstevel@tonic-gate 	size_t	p_size;
7467c478bd9Sstevel@tonic-gate } ibt_phys_buf_t;
7477c478bd9Sstevel@tonic-gate 
7487c478bd9Sstevel@tonic-gate #define	p_laddr		_phys_buf._p_ll
7497c478bd9Sstevel@tonic-gate #ifdef	_LONG_LONG_HTOL
7507c478bd9Sstevel@tonic-gate #define	p_notused	_phys_buf._p_la[0]
7517c478bd9Sstevel@tonic-gate #define	p_addr		_phys_buf._p_la[1]
7527c478bd9Sstevel@tonic-gate #else
7537c478bd9Sstevel@tonic-gate #define	p_addr		_phys_buf._p_la[0]
7547c478bd9Sstevel@tonic-gate #define	p_notused	_phys_buf._p_la[1]
7557c478bd9Sstevel@tonic-gate #endif
7567c478bd9Sstevel@tonic-gate 
7577c478bd9Sstevel@tonic-gate 
7587c478bd9Sstevel@tonic-gate /* Memory region descriptor. */
7597c478bd9Sstevel@tonic-gate typedef struct ibt_mr_desc_s {
7607c478bd9Sstevel@tonic-gate 	ib_vaddr_t	md_vaddr;	/* IB virtual adds of memory */
7617c478bd9Sstevel@tonic-gate 	ibt_lkey_t	md_lkey;
7627c478bd9Sstevel@tonic-gate 	ibt_rkey_t	md_rkey;
7637c478bd9Sstevel@tonic-gate 	boolean_t	md_sync_required;
7647c478bd9Sstevel@tonic-gate } ibt_mr_desc_t;
7657c478bd9Sstevel@tonic-gate 
7667c478bd9Sstevel@tonic-gate /* Physical Memory region descriptor. */
7677c478bd9Sstevel@tonic-gate typedef struct ibt_pmr_desc_s {
7687c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pmd_iova;	/* Returned I/O Virtual Address */
7697c478bd9Sstevel@tonic-gate 	ibt_lkey_t	pmd_lkey;
7707c478bd9Sstevel@tonic-gate 	ibt_rkey_t	pmd_rkey;
7717c478bd9Sstevel@tonic-gate 	uint_t 		pmd_phys_buf_list_sz;	/* Allocated Phys buf sz */
7727c478bd9Sstevel@tonic-gate 	boolean_t	pmd_sync_required;
7737c478bd9Sstevel@tonic-gate } ibt_pmr_desc_t;
7747c478bd9Sstevel@tonic-gate 
7757c478bd9Sstevel@tonic-gate /* Memory region protection bounds. */
7767c478bd9Sstevel@tonic-gate typedef struct ibt_mr_prot_bounds_s {
7777c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pb_addr;	/* Beginning address */
7787c478bd9Sstevel@tonic-gate 	size_t		pb_len;		/* Length of protected region */
7797c478bd9Sstevel@tonic-gate } ibt_mr_prot_bounds_t;
7807c478bd9Sstevel@tonic-gate 
7817c478bd9Sstevel@tonic-gate /* Memory Region (Re)Register attributes */
7827c478bd9Sstevel@tonic-gate typedef struct ibt_mr_attr_s {
7837c478bd9Sstevel@tonic-gate 	ib_vaddr_t	mr_vaddr;	/* Virtual address to register */
7847c478bd9Sstevel@tonic-gate 	ib_memlen_t	mr_len;		/* Length of region to register */
7857c478bd9Sstevel@tonic-gate 	struct as	*mr_as;		/* A pointer to an address space */
7867c478bd9Sstevel@tonic-gate 					/* structure. This parameter should */
7877c478bd9Sstevel@tonic-gate 					/* be set to NULL, which implies */
7887c478bd9Sstevel@tonic-gate 					/* kernel address space. */
7897c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t	mr_flags;
7907c478bd9Sstevel@tonic-gate } ibt_mr_attr_t;
7917c478bd9Sstevel@tonic-gate 
7927c478bd9Sstevel@tonic-gate /* Physical Memory Region (Re)Register */
7937c478bd9Sstevel@tonic-gate typedef struct ibt_pmr_attr_s {
7947c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pmr_iova;	/* I/O virtual address requested by */
7957c478bd9Sstevel@tonic-gate 					/* client for the first byte of the */
7967c478bd9Sstevel@tonic-gate 					/* region */
7977c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_len;	/* Length of region to register */
7987c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_offset;	/* Offset of the regions starting */
7997c478bd9Sstevel@tonic-gate 					/* IOVA within the 1st physical */
8007c478bd9Sstevel@tonic-gate 					/* buffer */
8017c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t	pmr_flags;
8027c478bd9Sstevel@tonic-gate 	ibt_lkey_t	pmr_lkey;	/* Reregister only */
8037c478bd9Sstevel@tonic-gate 	ibt_rkey_t	pmr_rkey;	/* Reregister only */
8047c478bd9Sstevel@tonic-gate 	uint8_t		pmr_key;	/* Key to use on new Lkey & Rkey */
8057c478bd9Sstevel@tonic-gate 	uint_t		pmr_num_buf;	/* Num of entries in the mr_buf_list */
8067c478bd9Sstevel@tonic-gate 	ibt_phys_buf_t	*pmr_buf_list;	/* List of physical buffers accessed */
8077c478bd9Sstevel@tonic-gate 					/* as an array */
8087c478bd9Sstevel@tonic-gate } ibt_pmr_attr_t;
8097c478bd9Sstevel@tonic-gate 
8107c478bd9Sstevel@tonic-gate 
8117c478bd9Sstevel@tonic-gate /*
8127c478bd9Sstevel@tonic-gate  * Memory Region (Re)Register attributes - used by ibt_register_shared_mr(),
8137c478bd9Sstevel@tonic-gate  * ibt_register_buf() and ibt_reregister_buf().
8147c478bd9Sstevel@tonic-gate  */
8157c478bd9Sstevel@tonic-gate typedef struct ibt_smr_attr_s {
8167c478bd9Sstevel@tonic-gate 	ib_vaddr_t		mr_vaddr;
8177c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t		mr_flags;
8187c478bd9Sstevel@tonic-gate 	uint8_t			mr_key;		/* Only for physical */
8197c478bd9Sstevel@tonic-gate 						/* ibt_(Re)register_buf() */
8207c478bd9Sstevel@tonic-gate 	ibt_lkey_t		mr_lkey;	/* Only for physical */
8217c478bd9Sstevel@tonic-gate 	ibt_rkey_t		mr_rkey;	/* ibt_Reregister_buf() */
8227c478bd9Sstevel@tonic-gate } ibt_smr_attr_t;
8237c478bd9Sstevel@tonic-gate 
8247c478bd9Sstevel@tonic-gate /*
8257c478bd9Sstevel@tonic-gate  * key states.
8267c478bd9Sstevel@tonic-gate  */
8277c478bd9Sstevel@tonic-gate typedef enum ibt_key_state_e {
8287c478bd9Sstevel@tonic-gate 	IBT_KEY_INVALID	= 0,
8297c478bd9Sstevel@tonic-gate 	IBT_KEY_FREE,
8307c478bd9Sstevel@tonic-gate 	IBT_KEY_VALID
8317c478bd9Sstevel@tonic-gate } ibt_key_state_t;
8327c478bd9Sstevel@tonic-gate 
8337c478bd9Sstevel@tonic-gate /* Memory region query attributes */
8347c478bd9Sstevel@tonic-gate typedef struct ibt_mr_query_attr_s {
8357c478bd9Sstevel@tonic-gate 	ibt_lkey_t		mr_lkey;
8367c478bd9Sstevel@tonic-gate 	ibt_rkey_t		mr_rkey;
8377c478bd9Sstevel@tonic-gate 	ibt_mr_prot_bounds_t	mr_lbounds;	/* Actual local CI protection */
8387c478bd9Sstevel@tonic-gate 						/* bounds */
8397c478bd9Sstevel@tonic-gate 	ibt_mr_prot_bounds_t	mr_rbounds;	/* Actual remote CI */
8407c478bd9Sstevel@tonic-gate 						/* protection bounds */
8417c478bd9Sstevel@tonic-gate 	ibt_mr_attr_flags_t	mr_attr_flags;	/* Access rights etc. */
8427c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		mr_pd;		/* Protection domain */
8437c478bd9Sstevel@tonic-gate 	boolean_t		mr_sync_required;
8447c478bd9Sstevel@tonic-gate 	ibt_key_state_t		mr_lkey_state;
8457c478bd9Sstevel@tonic-gate 	uint_t			mr_phys_buf_list_sz;
8467c478bd9Sstevel@tonic-gate } ibt_mr_query_attr_t;
8477c478bd9Sstevel@tonic-gate 
8487c478bd9Sstevel@tonic-gate /* Memory window query attributes */
8497c478bd9Sstevel@tonic-gate typedef struct ibt_mw_query_attr_s {
8507c478bd9Sstevel@tonic-gate 	ibt_pd_hdl_t		mw_pd;
8517c478bd9Sstevel@tonic-gate 	ibt_mem_win_type_t	mw_type;
8527c478bd9Sstevel@tonic-gate 	ibt_rkey_t		mw_rkey;
8537c478bd9Sstevel@tonic-gate 	ibt_key_state_t		mw_state;
8547c478bd9Sstevel@tonic-gate } ibt_mw_query_attr_t;
8557c478bd9Sstevel@tonic-gate 
8567c478bd9Sstevel@tonic-gate 
857*24b28d04Shiremath /* Memory Region Sync Flags. */
8587c478bd9Sstevel@tonic-gate #define	IBT_SYNC_READ	0x1	/* Make memory changes visible to incoming */
8597c478bd9Sstevel@tonic-gate 				/* RDMA reads */
8607c478bd9Sstevel@tonic-gate 
8617c478bd9Sstevel@tonic-gate #define	IBT_SYNC_WRITE	0x2	/* Make the affects of an incoming RDMA write */
8627c478bd9Sstevel@tonic-gate 				/* visible to the consumer */
8637c478bd9Sstevel@tonic-gate 
8647c478bd9Sstevel@tonic-gate /* Memory region sync args */
8657c478bd9Sstevel@tonic-gate typedef struct ibt_mr_sync_s {
8667c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	ms_handle;
8677c478bd9Sstevel@tonic-gate 	ib_vaddr_t	ms_vaddr;
8687c478bd9Sstevel@tonic-gate 	ib_memlen_t	ms_len;
8697c478bd9Sstevel@tonic-gate 	uint32_t	ms_flags;	/* IBT_SYNC_READ or  IBT_SYNC_WRITE */
8707c478bd9Sstevel@tonic-gate } ibt_mr_sync_t;
8717c478bd9Sstevel@tonic-gate 
8727c478bd9Sstevel@tonic-gate /*
8737c478bd9Sstevel@tonic-gate  * Flags for Virtual Address to HCA Physical Address translation.
8747c478bd9Sstevel@tonic-gate  */
8757c478bd9Sstevel@tonic-gate typedef enum ibt_va_flags_e {
8767c478bd9Sstevel@tonic-gate 	IBT_VA_NO_FLAGS		= 0
8777c478bd9Sstevel@tonic-gate } ibt_va_flags_t;
8787c478bd9Sstevel@tonic-gate 
8797c478bd9Sstevel@tonic-gate 
8807c478bd9Sstevel@tonic-gate /*  Address Translation parameters */
8817c478bd9Sstevel@tonic-gate typedef struct ibt_va_attr_s {
8827c478bd9Sstevel@tonic-gate 	ib_vaddr_t	va_vaddr;	/* Virtual address to register */
8837c478bd9Sstevel@tonic-gate 	ib_memlen_t	va_len;		/* Length of region to register */
8847c478bd9Sstevel@tonic-gate 	struct as	*va_as;		/* A pointer to an address space */
8857c478bd9Sstevel@tonic-gate 					/* structure. */
8867c478bd9Sstevel@tonic-gate 	ibt_va_flags_t	va_flags;
8877c478bd9Sstevel@tonic-gate } ibt_va_attr_t;
8887c478bd9Sstevel@tonic-gate 
8897c478bd9Sstevel@tonic-gate /*
8907c478bd9Sstevel@tonic-gate  * WORK REQUEST AND WORK REQUEST COMPLETION DEFINITIONS.
8917c478bd9Sstevel@tonic-gate  */
8927c478bd9Sstevel@tonic-gate 
8937c478bd9Sstevel@tonic-gate /*
8947c478bd9Sstevel@tonic-gate  * Work Request and Work Request Completion types - These types are used
8957c478bd9Sstevel@tonic-gate  *   to indicate the type of work requests posted to a work queue
8967c478bd9Sstevel@tonic-gate  *   or the type of completion received.  Immediate Data is indicated via
8977c478bd9Sstevel@tonic-gate  *   ibt_wr_flags_t or ibt_wc_flags_t.
8987c478bd9Sstevel@tonic-gate  *
8997c478bd9Sstevel@tonic-gate  *   IBT_WRC_RECV and IBT_WRC_RECV_RDMAWI are only used as opcodes in the
9007c478bd9Sstevel@tonic-gate  *   work completions.
9017c478bd9Sstevel@tonic-gate  *
9027c478bd9Sstevel@tonic-gate  * NOTE: this was converted from an enum to a uint8_t to save space.
9037c478bd9Sstevel@tonic-gate  */
9047c478bd9Sstevel@tonic-gate typedef uint8_t ibt_wrc_opcode_t;
9057c478bd9Sstevel@tonic-gate 
9067c478bd9Sstevel@tonic-gate #define	IBT_WRC_SEND		1	/* Send */
9077c478bd9Sstevel@tonic-gate #define	IBT_WRC_RDMAR		2	/* RDMA Read */
9087c478bd9Sstevel@tonic-gate #define	IBT_WRC_RDMAW		3	/* RDMA Write */
9097c478bd9Sstevel@tonic-gate #define	IBT_WRC_CSWAP		4	/* Compare & Swap Atomic */
9107c478bd9Sstevel@tonic-gate #define	IBT_WRC_FADD		5	/* Fetch & Add Atomic */
9117c478bd9Sstevel@tonic-gate #define	IBT_WRC_BIND		6	/* Bind Memory Window */
9127c478bd9Sstevel@tonic-gate #define	IBT_WRC_RECV		7	/* Receive */
9137c478bd9Sstevel@tonic-gate #define	IBT_WRC_RECV_RDMAWI	8	/* Received RDMA Write w/ Immediate */
9147c478bd9Sstevel@tonic-gate #define	IBT_WRC_FAST_REG_PMR	9	/* Fast Register Physical mem region */
9157c478bd9Sstevel@tonic-gate #define	IBT_WRC_LOCAL_INVALIDATE 10
9167c478bd9Sstevel@tonic-gate 
9177c478bd9Sstevel@tonic-gate 
9187c478bd9Sstevel@tonic-gate /*
9197c478bd9Sstevel@tonic-gate  * Work Request Completion flags - These flags indicate what type
9207c478bd9Sstevel@tonic-gate  *   of data is present in the Work Request Completion structure
9217c478bd9Sstevel@tonic-gate  */
9227c478bd9Sstevel@tonic-gate typedef uint8_t ibt_wc_flags_t;
9237c478bd9Sstevel@tonic-gate 
9247c478bd9Sstevel@tonic-gate #define	IBT_WC_NO_FLAGS			0
9257c478bd9Sstevel@tonic-gate #define	IBT_WC_GRH_PRESENT		(1 << 0)
9267c478bd9Sstevel@tonic-gate #define	IBT_WC_IMMED_DATA_PRESENT	(1 << 1)
9277c478bd9Sstevel@tonic-gate #define	IBT_WC_RKEY_INVALIDATED		(1 << 2)
9287c478bd9Sstevel@tonic-gate #define	IBT_WC_CKSUM_OK			(1 << 3)
9297c478bd9Sstevel@tonic-gate 
9307c478bd9Sstevel@tonic-gate 
9317c478bd9Sstevel@tonic-gate /*
9327c478bd9Sstevel@tonic-gate  * Work Request Completion - This structure encapsulates the information
9337c478bd9Sstevel@tonic-gate  *   necessary to define a work request completion.
9347c478bd9Sstevel@tonic-gate  */
9357c478bd9Sstevel@tonic-gate typedef struct ibt_wc_s {
9367c478bd9Sstevel@tonic-gate 	ibt_wrid_t		wc_id;		/* Work Request Id */
9377c478bd9Sstevel@tonic-gate 	uint64_t		wc_fma_ena;	/* fault management err data */
9387c478bd9Sstevel@tonic-gate 	ib_msglen_t		wc_bytes_xfer;	/* Number of Bytes */
9397c478bd9Sstevel@tonic-gate 						/* Transferred */
9407c478bd9Sstevel@tonic-gate 	ibt_wc_flags_t		wc_flags;	/* WR Completion Flags */
9417c478bd9Sstevel@tonic-gate 	ibt_wrc_opcode_t	wc_type;	/* Operation Type */
9427c478bd9Sstevel@tonic-gate 	uint16_t		wc_cksum;	/* payload checksum */
9437c478bd9Sstevel@tonic-gate 	ibt_immed_t		wc_immed_data;	/* Immediate Data */
9447c478bd9Sstevel@tonic-gate 	uint32_t		wc_freed_rc;	/* Freed Resource Count */
9457c478bd9Sstevel@tonic-gate 	ibt_wc_status_t		wc_status;	/* Completion Status */
9467c478bd9Sstevel@tonic-gate 	uint8_t			wc_sl:4;	/* Remote SL */
9477c478bd9Sstevel@tonic-gate 	uint16_t		wc_ethertype;	/* Ethertype Field - RE */
9487c478bd9Sstevel@tonic-gate 	ib_lid_t		wc_opaque1;
9497c478bd9Sstevel@tonic-gate 	uint16_t		wc_opaque2;
9507c478bd9Sstevel@tonic-gate 	ib_qpn_t		wc_qpn;		/* Source QPN Datagram only */
9517c478bd9Sstevel@tonic-gate 	ib_eecn_t		wc_opaque3;
9527c478bd9Sstevel@tonic-gate 	ib_qpn_t		wc_local_qpn;
9537c478bd9Sstevel@tonic-gate 	ibt_rkey_t		wc_rkey;
9547c478bd9Sstevel@tonic-gate 	ib_path_bits_t		wc_opaque4;
9557c478bd9Sstevel@tonic-gate } ibt_wc_t;
9567c478bd9Sstevel@tonic-gate 
9577c478bd9Sstevel@tonic-gate 
9587c478bd9Sstevel@tonic-gate /*
9597c478bd9Sstevel@tonic-gate  * WR Flags. Common for both RC and UD
9607c478bd9Sstevel@tonic-gate  *
9617c478bd9Sstevel@tonic-gate  * NOTE: this was converted from an enum to a uint8_t to save space.
9627c478bd9Sstevel@tonic-gate  */
9637c478bd9Sstevel@tonic-gate typedef uint8_t ibt_wr_flags_t;
9647c478bd9Sstevel@tonic-gate 
9657c478bd9Sstevel@tonic-gate #define	IBT_WR_NO_FLAGS		0
9667c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_IMMED	(1 << 0)	/* Immediate Data Indicator */
9677c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_SIGNAL	(1 << 1)	/* Signaled, if set */
9687c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_FENCE	(1 << 2)	/* Fence Indicator */
9697c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_SOLICIT	(1 << 3)	/* Solicited Event Indicator */
9707c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_REMOTE_INVAL	(1 << 4) /* Remote Invalidate */
9717c478bd9Sstevel@tonic-gate #define	IBT_WR_SEND_CKSUM	(1 << 5)	/* Checksum offload Indicator */
9727c478bd9Sstevel@tonic-gate 
9737c478bd9Sstevel@tonic-gate /*
9747c478bd9Sstevel@tonic-gate  * Access control flags for Bind Memory Window operation,
9757c478bd9Sstevel@tonic-gate  * applicable for RC/UC/RD only.
9767c478bd9Sstevel@tonic-gate  *
9777c478bd9Sstevel@tonic-gate  * If IBT_WR_BIND_WRITE or IBT_WR_BIND_ATOMIC is desired then
9787c478bd9Sstevel@tonic-gate  * it is required that Memory Region should have Local Write Access.
9797c478bd9Sstevel@tonic-gate  */
9807c478bd9Sstevel@tonic-gate typedef enum ibt_bind_flags_e {
9817c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_READ	= (1 << 0),	/* enable remote read */
9827c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_WRITE	= (1 << 1),	/* enable remote write */
9837c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_ATOMIC	= (1 << 2),	/* enable remote atomics */
9847c478bd9Sstevel@tonic-gate 	IBT_WR_BIND_ZBVA	= (1 << 3)	/* Zero Based Virtual Address */
9857c478bd9Sstevel@tonic-gate } ibt_bind_flags_t;
9867c478bd9Sstevel@tonic-gate 
9877c478bd9Sstevel@tonic-gate /*
9887c478bd9Sstevel@tonic-gate  * Data Segment for scatter-gather list
9897c478bd9Sstevel@tonic-gate  *
9907c478bd9Sstevel@tonic-gate  * SGL consists of an array of data segments and the length of the SGL.
9917c478bd9Sstevel@tonic-gate  */
9927c478bd9Sstevel@tonic-gate typedef struct ibt_wr_ds_s {
9937c478bd9Sstevel@tonic-gate 	ib_vaddr_t	ds_va;		/* Virtual Address */
9947c478bd9Sstevel@tonic-gate 	ibt_lkey_t	ds_key;		/* L_Key */
9957c478bd9Sstevel@tonic-gate 	ib_msglen_t	ds_len;		/* Length of DS */
9967c478bd9Sstevel@tonic-gate } ibt_wr_ds_t;
9977c478bd9Sstevel@tonic-gate 
9987c478bd9Sstevel@tonic-gate /*
9997c478bd9Sstevel@tonic-gate  * Bind Memory Window WR
10007c478bd9Sstevel@tonic-gate  *
10017c478bd9Sstevel@tonic-gate  * WR ID from ibt_send_wr_t applies here too, SWG_0038 errata.
10027c478bd9Sstevel@tonic-gate  */
10037c478bd9Sstevel@tonic-gate typedef struct ibt_wr_bind_s {
10047c478bd9Sstevel@tonic-gate 	ibt_bind_flags_t	bind_flags;
10057c478bd9Sstevel@tonic-gate 	ibt_rkey_t		bind_rkey;		/* Mem Window's R_key */
10067c478bd9Sstevel@tonic-gate 	ibt_lkey_t		bind_lkey;		/* Mem Region's L_Key */
10077c478bd9Sstevel@tonic-gate 	ibt_rkey_t		bind_rkey_out;		/* OUT: new R_Key */
10087c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t		bind_ibt_mr_hdl;	/* Mem Region handle */
10097c478bd9Sstevel@tonic-gate 	ibt_mw_hdl_t		bind_ibt_mw_hdl;	/* Mem Window handle */
10107c478bd9Sstevel@tonic-gate 	ib_vaddr_t		bind_va;		/* Virtual Address */
10117c478bd9Sstevel@tonic-gate 	ib_memlen_t		bind_len;		/* Length of Window */
10127c478bd9Sstevel@tonic-gate } ibt_wr_bind_t;
10137c478bd9Sstevel@tonic-gate 
10147c478bd9Sstevel@tonic-gate /*
10157c478bd9Sstevel@tonic-gate  * Atomic WR
10167c478bd9Sstevel@tonic-gate  *
10177c478bd9Sstevel@tonic-gate  * Operation type (compare & swap or fetch & add) in ibt_wrc_opcode_t.
10187c478bd9Sstevel@tonic-gate  *
10197c478bd9Sstevel@tonic-gate  * A copy of the original contents of the remote memory will be stored
10207c478bd9Sstevel@tonic-gate  * in the local data segment described by wr_sgl within ibt_send_wr_t,
10217c478bd9Sstevel@tonic-gate  * and wr_nds should be set to 1.
10227c478bd9Sstevel@tonic-gate  *
10237c478bd9Sstevel@tonic-gate  * Atomic operation operands:
10247c478bd9Sstevel@tonic-gate  *   Compare & Swap Operation:
10257c478bd9Sstevel@tonic-gate  *	atom_arg1 - Compare Operand
10267c478bd9Sstevel@tonic-gate  *	atom_arg2 - Swap Operand
10277c478bd9Sstevel@tonic-gate  *
10287c478bd9Sstevel@tonic-gate  *   Fetch & Add Operation:
10297c478bd9Sstevel@tonic-gate  *	atom_arg1 - Add Operand
10307c478bd9Sstevel@tonic-gate  *	atom_arg2 - ignored
10317c478bd9Sstevel@tonic-gate  */
10327c478bd9Sstevel@tonic-gate typedef struct ibt_wr_atomic_s {
10337c478bd9Sstevel@tonic-gate 	ib_vaddr_t	atom_raddr;	/* Remote address. */
10347c478bd9Sstevel@tonic-gate 	ibt_atom_arg_t	atom_arg1;	/* operand #1 */
10357c478bd9Sstevel@tonic-gate 	ibt_atom_arg_t	atom_arg2;	/* operand #2 */
10367c478bd9Sstevel@tonic-gate 	ibt_rkey_t	atom_rkey;	/* R_Key. */
10377c478bd9Sstevel@tonic-gate } ibt_wr_atomic_t;
10387c478bd9Sstevel@tonic-gate 
10397c478bd9Sstevel@tonic-gate /*
10407c478bd9Sstevel@tonic-gate  * RDMA WR
10417c478bd9Sstevel@tonic-gate  * Immediate Data indicator in ibt_wr_flags_t.
10427c478bd9Sstevel@tonic-gate  */
10437c478bd9Sstevel@tonic-gate typedef struct ibt_wr_rdma_s {
10447c478bd9Sstevel@tonic-gate 	ib_vaddr_t	rdma_raddr;	/* Remote address. */
10457c478bd9Sstevel@tonic-gate 	ibt_rkey_t	rdma_rkey;	/* R_Key. */
10467c478bd9Sstevel@tonic-gate 	ibt_immed_t	rdma_immed;	/* Immediate Data */
10477c478bd9Sstevel@tonic-gate } ibt_wr_rdma_t;
10487c478bd9Sstevel@tonic-gate 
10497c478bd9Sstevel@tonic-gate /*
10507c478bd9Sstevel@tonic-gate  * Fast Register Physical Memory Region Work Request.
10517c478bd9Sstevel@tonic-gate  */
10527c478bd9Sstevel@tonic-gate typedef struct ibt_wr_reg_pmr_s {
10537c478bd9Sstevel@tonic-gate 	ib_vaddr_t	pmr_iova;	/* I/O virtual address requested by */
10547c478bd9Sstevel@tonic-gate 					/* client for the first byte of the */
10557c478bd9Sstevel@tonic-gate 					/* region */
10567c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_len;	/* Length of region to register */
10577c478bd9Sstevel@tonic-gate 	ib_memlen_t	pmr_offset;	/* Offset of the regions starting */
10587c478bd9Sstevel@tonic-gate 					/* IOVA within the 1st physical */
10597c478bd9Sstevel@tonic-gate 					/* buffer */
10607c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	pmr_mr_hdl;
10617c478bd9Sstevel@tonic-gate 	ibt_phys_buf_t	*pmr_buf_list;	/* List of physical buffers accessed */
10627c478bd9Sstevel@tonic-gate 					/* as an array */
1063*24b28d04Shiremath 	uint_t		pmr_num_buf;	/* Num of entries in the pmr_buf_list */
10647c478bd9Sstevel@tonic-gate 	ibt_lkey_t	pmr_lkey;
10657c478bd9Sstevel@tonic-gate 	ibt_rkey_t	pmr_rkey;
10667c478bd9Sstevel@tonic-gate 	ibt_mr_flags_t	pmr_flags;
10677c478bd9Sstevel@tonic-gate 	uint8_t		pmr_key;	/* Key to use on new Lkey & Rkey */
10687c478bd9Sstevel@tonic-gate } ibt_wr_reg_pmr_t;
10697c478bd9Sstevel@tonic-gate 
10707c478bd9Sstevel@tonic-gate /*
10717c478bd9Sstevel@tonic-gate  * Local Invalidate.
10727c478bd9Sstevel@tonic-gate  */
10737c478bd9Sstevel@tonic-gate typedef struct ibt_wr_li_s {
10747c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	li_mr_hdl;	/* Null for MW invalidates */
10757c478bd9Sstevel@tonic-gate 	ibt_mw_hdl_t	li_mw_hdl;	/* Null for MR invalidates */
10767c478bd9Sstevel@tonic-gate 	ibt_lkey_t	li_lkey;	/* Ignore for MW invalidates */
10777c478bd9Sstevel@tonic-gate 	ibt_rkey_t	li_rkey;
10787c478bd9Sstevel@tonic-gate } ibt_wr_li_t;
10797c478bd9Sstevel@tonic-gate 
10807c478bd9Sstevel@tonic-gate /*
10817c478bd9Sstevel@tonic-gate  * Reserved For Future Use.
10827c478bd9Sstevel@tonic-gate  * Raw IPv6 Send WR
10837c478bd9Sstevel@tonic-gate  */
10847c478bd9Sstevel@tonic-gate typedef struct ibt_wr_ripv6_s {
10857c478bd9Sstevel@tonic-gate 	ib_lid_t	rip_dlid;	/* DLID */
10867c478bd9Sstevel@tonic-gate 	ib_path_bits_t  rip_slid_bits;	/* SLID path bits, SWG_0033 errata */
10877c478bd9Sstevel@tonic-gate 	uint8_t		rip_sl:4;	/* SL */
10887c478bd9Sstevel@tonic-gate 	ibt_srate_t	rip_rate;	/* Max Static Rate, SWG_0007 errata */
10897c478bd9Sstevel@tonic-gate } ibt_wr_ripv6_t;
10907c478bd9Sstevel@tonic-gate 
10917c478bd9Sstevel@tonic-gate /*
10927c478bd9Sstevel@tonic-gate  * Reserved For Future Use.
10937c478bd9Sstevel@tonic-gate  * Raw Ethertype Send WR
10947c478bd9Sstevel@tonic-gate  */
10957c478bd9Sstevel@tonic-gate typedef struct ibt_wr_reth_s {
10967c478bd9Sstevel@tonic-gate 	ib_ethertype_t  reth_type;	/* Ethertype */
10977c478bd9Sstevel@tonic-gate 	ib_lid_t	reth_dlid;	/* DLID */
10987c478bd9Sstevel@tonic-gate 	ib_path_bits_t	reth_slid_bits;	/* SLID path bits, SWG_0033 errata */
10997c478bd9Sstevel@tonic-gate 	uint8_t		reth_sl:4;	/* SL */
11007c478bd9Sstevel@tonic-gate 	ibt_srate_t	reth_rate;	/* Max Static Rate, SWG_0007 errata */
11017c478bd9Sstevel@tonic-gate } ibt_wr_reth_t;
11027c478bd9Sstevel@tonic-gate 
11037c478bd9Sstevel@tonic-gate /*
11047c478bd9Sstevel@tonic-gate  * Reserved For future Use.
11057c478bd9Sstevel@tonic-gate  * RD Send WR, Operation type in ibt_wrc_opcode_t.
11067c478bd9Sstevel@tonic-gate  */
11077c478bd9Sstevel@tonic-gate typedef struct ibt_wr_rd_s {
11087c478bd9Sstevel@tonic-gate 	ibt_rd_dest_hdl_t	rdwr_dest_hdl;
11097c478bd9Sstevel@tonic-gate 	union {
11107c478bd9Sstevel@tonic-gate 	    ibt_immed_t		send_immed;	/* IBT_WRC_SEND */
11117c478bd9Sstevel@tonic-gate 	    ibt_wr_rdma_t	rdma;		/* IBT_WRC_RDMAR */
11127c478bd9Sstevel@tonic-gate 						/* IBT_WRC_RDMAW */
11137c478bd9Sstevel@tonic-gate 	    ibt_wr_li_t		*li;		/* IBT_WRC_LOCAL_INVALIDATE */
11147c478bd9Sstevel@tonic-gate 	    ibt_wr_atomic_t	*atomic;	/* IBT_WRC_FADD */
11157c478bd9Sstevel@tonic-gate 						/* IBT_WRC_CSWAP */
11167c478bd9Sstevel@tonic-gate 	    ibt_wr_bind_t	*bind;		/* IBT_WRC_BIND */
11177c478bd9Sstevel@tonic-gate 	    ibt_wr_reg_pmr_t	*reg_pmr;	/* IBT_WRC_FAST_REG_PMR */
11187c478bd9Sstevel@tonic-gate 	} rdwr;
11197c478bd9Sstevel@tonic-gate } ibt_wr_rd_t;
11207c478bd9Sstevel@tonic-gate 
11217c478bd9Sstevel@tonic-gate /*
11227c478bd9Sstevel@tonic-gate  * Reserved For Future Use.
11237c478bd9Sstevel@tonic-gate  * UC Send WR, Operation type in ibt_wrc_opcode_t, the only valid
11247c478bd9Sstevel@tonic-gate  * ones are:
11257c478bd9Sstevel@tonic-gate  *		IBT_WRC_SEND
11267c478bd9Sstevel@tonic-gate  *		IBT_WRC_RDMAW
11277c478bd9Sstevel@tonic-gate  *		IBT_WRC_BIND
11287c478bd9Sstevel@tonic-gate  */
11297c478bd9Sstevel@tonic-gate typedef struct ibt_wr_uc_s {
11307c478bd9Sstevel@tonic-gate 	union {
11317c478bd9Sstevel@tonic-gate 	    ibt_immed_t		send_immed;	/* IBT_WRC_SEND */
11327c478bd9Sstevel@tonic-gate 	    ibt_wr_rdma_t	rdma;		/* IBT_WRC_RDMAW */
11337c478bd9Sstevel@tonic-gate 	    ibt_wr_li_t		*li;		/* IBT_WRC_LOCAL_INVALIDATE */
11347c478bd9Sstevel@tonic-gate 	    ibt_wr_bind_t	*bind;		/* IBT_WRC_BIND */
11357c478bd9Sstevel@tonic-gate 	    ibt_wr_reg_pmr_t	*reg_pmr;	/* IBT_WRC_FAST_REG_PMR */
11367c478bd9Sstevel@tonic-gate 	} ucwr;
11377c478bd9Sstevel@tonic-gate } ibt_wr_uc_t;
11387c478bd9Sstevel@tonic-gate 
11397c478bd9Sstevel@tonic-gate /*
11407c478bd9Sstevel@tonic-gate  * RC Send WR, Operation type in ibt_wrc_opcode_t.
11417c478bd9Sstevel@tonic-gate  */
11427c478bd9Sstevel@tonic-gate typedef struct ibt_wr_rc_s {
11437c478bd9Sstevel@tonic-gate 	union {
11447c478bd9Sstevel@tonic-gate 	    ibt_immed_t		send_immed;	/* IBT_WRC_SEND w/ immediate */
11457c478bd9Sstevel@tonic-gate 	    ibt_rkey_t		send_inval;	/* IBT_WRC_SEND w/ invalidate */
11467c478bd9Sstevel@tonic-gate 	    ibt_wr_rdma_t	rdma;		/* IBT_WRC_RDMAR */
11477c478bd9Sstevel@tonic-gate 						/* IBT_WRC_RDMAW */
11487c478bd9Sstevel@tonic-gate 	    ibt_wr_li_t		*li;		/* IBT_WRC_LOCAL_INVALIDATE */
11497c478bd9Sstevel@tonic-gate 	    ibt_wr_atomic_t	*atomic;	/* IBT_WRC_CSWAP */
11507c478bd9Sstevel@tonic-gate 						/* IBT_WRC_FADD */
11517c478bd9Sstevel@tonic-gate 	    ibt_wr_bind_t	*bind;		/* IBT_WRC_BIND */
11527c478bd9Sstevel@tonic-gate 	    ibt_wr_reg_pmr_t	*reg_pmr;	/* IBT_WRC_FAST_REG_PMR */
11537c478bd9Sstevel@tonic-gate 	} rcwr;
11547c478bd9Sstevel@tonic-gate } ibt_wr_rc_t;
11557c478bd9Sstevel@tonic-gate 
11567c478bd9Sstevel@tonic-gate /*
11577c478bd9Sstevel@tonic-gate  * UD Send WR, the only valid Operation is IBT_WRC_SEND.
11587c478bd9Sstevel@tonic-gate  */
11597c478bd9Sstevel@tonic-gate typedef struct ibt_wr_ud_s {
11607c478bd9Sstevel@tonic-gate 	ibt_immed_t		udwr_immed;
11617c478bd9Sstevel@tonic-gate 	ibt_ud_dest_hdl_t	udwr_dest;
11627c478bd9Sstevel@tonic-gate } ibt_wr_ud_t;
11637c478bd9Sstevel@tonic-gate 
11647c478bd9Sstevel@tonic-gate /*
11657c478bd9Sstevel@tonic-gate  * Send Work Request (WR) attributes structure.
11667c478bd9Sstevel@tonic-gate  *
11677c478bd9Sstevel@tonic-gate  * Operation type in ibt_wrc_opcode_t.
11687c478bd9Sstevel@tonic-gate  * Immediate Data indicator in ibt_wr_flags_t.
11697c478bd9Sstevel@tonic-gate  */
11707c478bd9Sstevel@tonic-gate typedef struct ibt_send_wr_s {
11717c478bd9Sstevel@tonic-gate 	ibt_wrid_t		wr_id;		/* WR ID */
11727c478bd9Sstevel@tonic-gate 	ibt_wr_flags_t		wr_flags;	/* Work Request Flags. */
11737c478bd9Sstevel@tonic-gate 	ibt_tran_srv_t		wr_trans;	/* Transport Type. */
11747c478bd9Sstevel@tonic-gate 	ibt_wrc_opcode_t	wr_opcode;	/* Operation Type. */
11757c478bd9Sstevel@tonic-gate 	uint8_t			wr_rsvd;	/* maybe later */
11767c478bd9Sstevel@tonic-gate 	uint32_t		wr_nds;		/* Number of data segments */
11777c478bd9Sstevel@tonic-gate 						/* pointed to by wr_sgl */
11787c478bd9Sstevel@tonic-gate 	ibt_wr_ds_t		*wr_sgl;	/* SGL */
11797c478bd9Sstevel@tonic-gate 	union {
11807c478bd9Sstevel@tonic-gate 		ibt_wr_ud_t	ud;
11817c478bd9Sstevel@tonic-gate 		ibt_wr_rc_t	rc;
11827c478bd9Sstevel@tonic-gate 		ibt_wr_rd_t	rd;	/* Reserved For Future Use */
11837c478bd9Sstevel@tonic-gate 		ibt_wr_uc_t	uc;	/* Reserved For Future Use */
11847c478bd9Sstevel@tonic-gate 		ibt_wr_reth_t	reth;	/* Reserved For Future Use */
11857c478bd9Sstevel@tonic-gate 		ibt_wr_ripv6_t	ripv6;	/* Reserved For Future Use */
11867c478bd9Sstevel@tonic-gate 	} wr;				/* operation specific */
11877c478bd9Sstevel@tonic-gate } ibt_send_wr_t;
11887c478bd9Sstevel@tonic-gate 
11897c478bd9Sstevel@tonic-gate /*
11907c478bd9Sstevel@tonic-gate  * Receive Work Request (WR) attributes structure.
11917c478bd9Sstevel@tonic-gate  */
11927c478bd9Sstevel@tonic-gate typedef struct ibt_recv_wr_s {
11937c478bd9Sstevel@tonic-gate 	ibt_wrid_t		wr_id;		/* WR ID */
11947c478bd9Sstevel@tonic-gate 	uint32_t		wr_nds;		/* number of data segments */
11957c478bd9Sstevel@tonic-gate 						/* pointed to by wr_sgl */
11967c478bd9Sstevel@tonic-gate 	ibt_wr_ds_t		*wr_sgl;	/* SGL */
11977c478bd9Sstevel@tonic-gate } ibt_recv_wr_t;
11987c478bd9Sstevel@tonic-gate 
11997c478bd9Sstevel@tonic-gate 
12007c478bd9Sstevel@tonic-gate /*
12017c478bd9Sstevel@tonic-gate  * Asynchronous Events and Errors.
12027c478bd9Sstevel@tonic-gate  *
1203*24b28d04Shiremath  * The following codes are not used in calls to ibc_async_handler, but
12047c478bd9Sstevel@tonic-gate  * are used by IBTL to inform IBT clients of a significant event.
12057c478bd9Sstevel@tonic-gate  *
12067c478bd9Sstevel@tonic-gate  *  IBT_HCA_ATTACH_EVENT	- New HCA available.
12077c478bd9Sstevel@tonic-gate  *  IBT_HCA_DETACH_EVENT	- HCA is requesting not to be used.
12087c478bd9Sstevel@tonic-gate  *
12097c478bd9Sstevel@tonic-gate  * ERRORs on a channel indicate that the channel has entered error state.
12107c478bd9Sstevel@tonic-gate  * EVENTs on a channel indicate that the channel has not changed state.
12117c478bd9Sstevel@tonic-gate  *
12127c478bd9Sstevel@tonic-gate  */
12137c478bd9Sstevel@tonic-gate typedef enum ibt_async_code_e {
12147c478bd9Sstevel@tonic-gate 	IBT_EVENT_PATH_MIGRATED			= 0x000001,
12157c478bd9Sstevel@tonic-gate 	IBT_EVENT_SQD				= 0x000002,
12167c478bd9Sstevel@tonic-gate 	IBT_EVENT_COM_EST			= 0x000004,
12177c478bd9Sstevel@tonic-gate 	IBT_ERROR_CATASTROPHIC_CHAN		= 0x000008,
12187c478bd9Sstevel@tonic-gate 	IBT_ERROR_INVALID_REQUEST_CHAN		= 0x000010,
12197c478bd9Sstevel@tonic-gate 	IBT_ERROR_ACCESS_VIOLATION_CHAN		= 0x000020,
12207c478bd9Sstevel@tonic-gate 	IBT_ERROR_PATH_MIGRATE_REQ		= 0x000040,
12217c478bd9Sstevel@tonic-gate 
12227c478bd9Sstevel@tonic-gate 	IBT_ERROR_CQ				= 0x000080,
12237c478bd9Sstevel@tonic-gate 
12247c478bd9Sstevel@tonic-gate 	IBT_EVENT_PORT_UP			= 0x000100,
12257c478bd9Sstevel@tonic-gate 	IBT_ERROR_PORT_DOWN			= 0x000200,
12267c478bd9Sstevel@tonic-gate 	IBT_ERROR_LOCAL_CATASTROPHIC		= 0x000400,
12277c478bd9Sstevel@tonic-gate 
12287c478bd9Sstevel@tonic-gate 	IBT_HCA_ATTACH_EVENT			= 0x000800,
12297c478bd9Sstevel@tonic-gate 	IBT_HCA_DETACH_EVENT			= 0x001000,
12307c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE1			= 0x002000,
12317c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE2			= 0x004000,
12327c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE3			= 0x008000,
12337c478bd9Sstevel@tonic-gate 	IBT_ASYNC_OPAQUE4			= 0x010000,
12347c478bd9Sstevel@tonic-gate 	IBT_EVENT_LIMIT_REACHED_SRQ		= 0x020000,
12357c478bd9Sstevel@tonic-gate 	IBT_EVENT_EMPTY_CHAN			= 0x040000,
12367c478bd9Sstevel@tonic-gate 	IBT_ERROR_CATASTROPHIC_SRQ		= 0x080000
12377c478bd9Sstevel@tonic-gate } ibt_async_code_t;
12387c478bd9Sstevel@tonic-gate 
12397c478bd9Sstevel@tonic-gate 
12407c478bd9Sstevel@tonic-gate /*
12417c478bd9Sstevel@tonic-gate  * ibt_ci_data_in() and ibt_ci_data_out() flags.
12427c478bd9Sstevel@tonic-gate  */
12437c478bd9Sstevel@tonic-gate typedef enum ibt_ci_data_flags_e {
12447c478bd9Sstevel@tonic-gate 	IBT_CI_NO_FLAGS		= 0,
12457c478bd9Sstevel@tonic-gate 	IBT_CI_COMPLETE_ALLOC	= (1 << 0)
12467c478bd9Sstevel@tonic-gate } ibt_ci_data_flags_t;
12477c478bd9Sstevel@tonic-gate 
12487c478bd9Sstevel@tonic-gate /*
12497c478bd9Sstevel@tonic-gate  * Used by ibt_ci_data_in() and ibt_ci_data_out() identifies the type of handle
12507c478bd9Sstevel@tonic-gate  * mapping data is being obtained for.
12517c478bd9Sstevel@tonic-gate  */
12527c478bd9Sstevel@tonic-gate typedef enum ibt_object_type_e {
12537c478bd9Sstevel@tonic-gate 	IBT_HDL_HCA	=	1,
12547c478bd9Sstevel@tonic-gate 	IBT_HDL_CHANNEL,
12557c478bd9Sstevel@tonic-gate 	IBT_HDL_CQ,
12567c478bd9Sstevel@tonic-gate 	IBT_HDL_PD,
12577c478bd9Sstevel@tonic-gate 	IBT_HDL_MR,
12587c478bd9Sstevel@tonic-gate 	IBT_HDL_MW,
12597c478bd9Sstevel@tonic-gate 	IBT_HDL_UD_DEST,
12607c478bd9Sstevel@tonic-gate 	IBT_HDL_SCHED,
12617c478bd9Sstevel@tonic-gate 	IBT_HDL_OPAQUE1,
12627c478bd9Sstevel@tonic-gate 	IBT_HDL_OPAQUE2,
12637c478bd9Sstevel@tonic-gate 	IBT_HDL_SRQ
12647c478bd9Sstevel@tonic-gate } ibt_object_type_t;
12657c478bd9Sstevel@tonic-gate 
12667c478bd9Sstevel@tonic-gate /*
12677c478bd9Sstevel@tonic-gate  * Memory error handler data structures; code, and payload data.
12687c478bd9Sstevel@tonic-gate  */
12697c478bd9Sstevel@tonic-gate typedef enum ibt_mem_code_s {
12707c478bd9Sstevel@tonic-gate 	IBT_MEM_AREA	= 0x1,
12717c478bd9Sstevel@tonic-gate 	IBT_MEM_REGION	= 0x2
12727c478bd9Sstevel@tonic-gate } ibt_mem_code_t;
12737c478bd9Sstevel@tonic-gate 
12747c478bd9Sstevel@tonic-gate typedef struct ibt_mem_data_s {
12757c478bd9Sstevel@tonic-gate 	uint64_t	ev_fma_ena;	/* FMA Error data */
12767c478bd9Sstevel@tonic-gate 	ibt_mr_hdl_t	ev_mr_hdl;	/* MR handle */
12777c478bd9Sstevel@tonic-gate 	ibt_ma_hdl_t	ev_ma_hdl;	/* MA handle */
12787c478bd9Sstevel@tonic-gate } ibt_mem_data_t;
12797c478bd9Sstevel@tonic-gate 
12807c478bd9Sstevel@tonic-gate /*
12817c478bd9Sstevel@tonic-gate  * Special case failure type.
12827c478bd9Sstevel@tonic-gate  */
12837c478bd9Sstevel@tonic-gate typedef enum ibt_failure_type_e {
12847c478bd9Sstevel@tonic-gate 	IBT_FAILURE_STANDARD	= 0,
12857c478bd9Sstevel@tonic-gate 	IBT_FAILURE_CI,
12867c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBMF,
12877c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBTL,
12887c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBCM,
12897c478bd9Sstevel@tonic-gate 	IBT_FAILURE_IBDM
12907c478bd9Sstevel@tonic-gate } ibt_failure_type_t;
12917c478bd9Sstevel@tonic-gate 
12927c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
12937c478bd9Sstevel@tonic-gate }
12947c478bd9Sstevel@tonic-gate #endif
12957c478bd9Sstevel@tonic-gate 
12967c478bd9Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBTL_TYPES_H */
1297