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