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
5015f8fffShiremath  * Common Development and Distribution License (the "License").
6015f8fffShiremath  * 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 /*
221cfa752fSRamaswamy Tummala  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef	_SYS_IB_IBTL_IBTI_COMMON_H
267c478bd9Sstevel@tonic-gate #define	_SYS_IB_IBTL_IBTI_COMMON_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * ibti_common.h
307c478bd9Sstevel@tonic-gate  *
317c478bd9Sstevel@tonic-gate  * This file contains the shared/common transport data types and function
327c478bd9Sstevel@tonic-gate  * prototypes.
337c478bd9Sstevel@tonic-gate  */
341cfa752fSRamaswamy Tummala #include <sys/types.h>
351cfa752fSRamaswamy Tummala #include <sys/ib/ib_types.h>
361cfa752fSRamaswamy Tummala #include <sys/ib/ibtl/ibtl_status.h>
377c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_types.h>
387c478bd9Sstevel@tonic-gate #include <sys/ib/ibtl/ibti_cm.h>
397c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
407c478bd9Sstevel@tonic-gate #include <sys/byteorder.h>
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef __cplusplus
437c478bd9Sstevel@tonic-gate extern "C" {
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * Max number of paths that can be requested in an ibt_get_paths() call,
487c478bd9Sstevel@tonic-gate  * if IBT_PATH_PERF or IBT_PATH_AVAIL flag (ibt_path_flags_t) is set.
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate #define	IBT_MAX_SPECIAL_PATHS	2
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * The name of DDI Event, generated when the properties of IOC device
547c478bd9Sstevel@tonic-gate  * node properties were modified.
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #define	IB_PROP_UPDATE_EVENT	"SUNW,IB:IB_PROP_UPDATE"
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /* Transport Interface version */
60*17a2b317SBill Taylor typedef int ibt_version_t;
61*17a2b317SBill Taylor #define	IBTI_V1		1
62*17a2b317SBill Taylor #define	IBTI_V2		2
63*17a2b317SBill Taylor #define	IBTI_V3		3
64*17a2b317SBill Taylor #define	IBTI_V4		4
65*17a2b317SBill Taylor #define	IBTI_V_CURR	IBTI_V4
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /*
687c478bd9Sstevel@tonic-gate  * Driver class type. Identifies a type of client driver so that
697c478bd9Sstevel@tonic-gate  * "IBTF Policy" decisions can be made on a driver class basis.
707c478bd9Sstevel@tonic-gate  * The last class should always be IBT_CLNT_NUM, and any new classes added
717c478bd9Sstevel@tonic-gate  * must be defined before IBT_CLNT_NUM. The class values must be above 0.
727c478bd9Sstevel@tonic-gate  * Any class values below or equal to 0 shall be invalid
737c478bd9Sstevel@tonic-gate  */
747c478bd9Sstevel@tonic-gate typedef enum ibt_clnt_class_e {
757c478bd9Sstevel@tonic-gate 	IBT_STORAGE_DEV = 0x1,	/* SCSI, FC, etc.. */
767c478bd9Sstevel@tonic-gate 	IBT_NETWORK_DEV,	/* Network driver with associated client H/W */
777c478bd9Sstevel@tonic-gate 	IBT_GENERIC_DEV,	/* Generic client H/W device driver */
787c478bd9Sstevel@tonic-gate 	IBT_NETWORK,		/* Network driver with no associated */
797c478bd9Sstevel@tonic-gate 				/* client H/W, e.g., IPoIB */
807c478bd9Sstevel@tonic-gate 	IBT_GENERIC,		/* A generic IB driver not */
817c478bd9Sstevel@tonic-gate 				/* associated with client H/W */
827c478bd9Sstevel@tonic-gate 	IBT_USER,		/* A user application IBT interface driver */
837c478bd9Sstevel@tonic-gate 	IBT_IBMA,		/* The IBMA Module */
847c478bd9Sstevel@tonic-gate 	IBT_CM,			/* The CM Module */
857c478bd9Sstevel@tonic-gate 	IBT_DM,			/* The DM Module */
8667d84f12SRajkumar Sivaprakasam 	IBT_DM_AGENT,		/* DM Agent Module */
879c468ea9SPramod Gunjikar 	IBT_GENERIC_MISC,	/* Generic Misc Module */
887c478bd9Sstevel@tonic-gate 	IBT_CLASS_NUM		/* Place holder for class count */
897c478bd9Sstevel@tonic-gate } ibt_clnt_class_t;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #define	IBT_TEST_DEV	999	/* Place holder for modules that test IBTL */
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #define	IBT_CLNT_DEVICE_CLASS(class)	((class) == IBT_STORAGE_DEV || \
947c478bd9Sstevel@tonic-gate 					(class) == IBT_NETWORK_DEV || \
957c478bd9Sstevel@tonic-gate 					(class) == IBT_GENERIC_DEV)
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate #define	IBT_CLNT_GENERAL_CLASS(class)	((class) == IBT_NETWORK || \
987c478bd9Sstevel@tonic-gate 					(class) == IBT_GENERIC || \
9967d84f12SRajkumar Sivaprakasam 					(class) == IBT_DM_AGENT || \
10067d84f12SRajkumar Sivaprakasam 					(class) == IBT_TEST_DEV || \
1019c468ea9SPramod Gunjikar 					(class) == IBT_GENERIC_MISC ||	\
1027c478bd9Sstevel@tonic-gate 					(class) == IBT_USER)
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #define	IBT_CLNT_MGMT_CLASS(class)	((class) == IBT_IBMA || \
10567d84f12SRajkumar Sivaprakasam 					(class) == IBT_CM || \
10667d84f12SRajkumar Sivaprakasam 					(class) == IBT_DM)
10767d84f12SRajkumar Sivaprakasam 
10867d84f12SRajkumar Sivaprakasam /*
10967d84f12SRajkumar Sivaprakasam  * These are some special client classes which don't have a 'dip' hence have
11067d84f12SRajkumar Sivaprakasam  * to be handled specially in ibt_attach, where we bypass the check for a valid
11167d84f12SRajkumar Sivaprakasam  * dip if the client belongs to the class below.
11267d84f12SRajkumar Sivaprakasam  */
11367d84f12SRajkumar Sivaprakasam #define	IBT_MISCMOD_CLIENTS(class)	((class) == IBT_IBMA || \
1147c478bd9Sstevel@tonic-gate 					(class) == IBT_CM || \
1157c478bd9Sstevel@tonic-gate 					(class) == IBT_DM || \
11667d84f12SRajkumar Sivaprakasam 					(class) == IBT_DM_AGENT || \
1179c468ea9SPramod Gunjikar 					(class) == IBT_GENERIC_MISC ||	\
1187c478bd9Sstevel@tonic-gate 					(class) == IBT_TEST_DEV)
11967d84f12SRajkumar Sivaprakasam 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * Event record & status returns for asynchronous events and errors.
1227c478bd9Sstevel@tonic-gate  */
1237c478bd9Sstevel@tonic-gate typedef struct ibt_async_event_s {
1247c478bd9Sstevel@tonic-gate 	uint64_t		ev_fma_ena;		/* FMA Error data */
1257c478bd9Sstevel@tonic-gate 	ibt_channel_hdl_t	ev_chan_hdl;		/* Channel handle */
1267c478bd9Sstevel@tonic-gate 	ibt_cq_hdl_t		ev_cq_hdl;		/* CQ handle */
1277c478bd9Sstevel@tonic-gate 	ib_guid_t		ev_hca_guid;		/* HCA node GUID */
1287c478bd9Sstevel@tonic-gate 	ibt_srq_hdl_t		ev_srq_hdl;		/* SRQ handle */
12903494a98SBill Taylor 	ibt_port_change_t	ev_port_flags;		/* Port Change flags */
13003494a98SBill Taylor 	uint8_t			ev_port;		/* HCA port */
131*17a2b317SBill Taylor 	ibt_fc_syndrome_t	ev_fc;			/* FEXCH syndrome */
1327c478bd9Sstevel@tonic-gate } ibt_async_event_t;
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate /*
1357c478bd9Sstevel@tonic-gate  * IBT Client Callback function typedefs.
1367c478bd9Sstevel@tonic-gate  *
1377c478bd9Sstevel@tonic-gate  * ibt_async_handler_t
1387c478bd9Sstevel@tonic-gate  *	Pointer to an async event/error handler function.  This function is
1397c478bd9Sstevel@tonic-gate  *	called when an async event/error is detected on a HCA that is being
1407c478bd9Sstevel@tonic-gate  *	used by the IBT client driver that registered the function.
1417c478bd9Sstevel@tonic-gate  */
1427c478bd9Sstevel@tonic-gate typedef void (*ibt_async_handler_t)(void *clnt_private,
1437c478bd9Sstevel@tonic-gate     ibt_hca_hdl_t hca_hdl, ibt_async_code_t code, ibt_async_event_t *event);
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate /*
1467c478bd9Sstevel@tonic-gate  * IBT Client Memory Error Callback function typedefs.
1477c478bd9Sstevel@tonic-gate  *
1487c478bd9Sstevel@tonic-gate  * ibt_memory_handler_t
1497c478bd9Sstevel@tonic-gate  *	Pointer to an memory event/error handler function.
1507c478bd9Sstevel@tonic-gate  */
1517c478bd9Sstevel@tonic-gate typedef void (*ibt_memory_handler_t)(void *clnt_private,
1527c478bd9Sstevel@tonic-gate     ibt_hca_hdl_t hca_hdl, ibt_mem_code_t code, ibt_mem_data_t *data);
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate /*
1557c478bd9Sstevel@tonic-gate  * Define a client module information structure. All clients MUST
1567c478bd9Sstevel@tonic-gate  * define a global of type ibt_clnt_modinfo_t. A pointer to this global
1577c478bd9Sstevel@tonic-gate  * is passed into the IBTF by a client when calling ibt_attach().
1587c478bd9Sstevel@tonic-gate  * This struct must persist during the life of the client.
1597c478bd9Sstevel@tonic-gate  *
1607c478bd9Sstevel@tonic-gate  * The client's mi_async_handler is called when an async event/error is
1617c478bd9Sstevel@tonic-gate  * detected on a HCA that is being used by this client.
1627c478bd9Sstevel@tonic-gate  */
1637c478bd9Sstevel@tonic-gate typedef struct ibt_clnt_modinfo_s {
1647c478bd9Sstevel@tonic-gate 	ibt_version_t		mi_ibt_version;		/* TI version */
1657c478bd9Sstevel@tonic-gate 	ibt_clnt_class_t	mi_clnt_class;		/* Type of client */
1667c478bd9Sstevel@tonic-gate 	ibt_async_handler_t	mi_async_handler;	/* Async Handler */
1677c478bd9Sstevel@tonic-gate 	ibt_memory_handler_t	mi_reserved;		/* Memory handler */
1687c478bd9Sstevel@tonic-gate 	char			*mi_clnt_name;		/* Client Name. */
1697c478bd9Sstevel@tonic-gate } ibt_clnt_modinfo_t;
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate /*
1737c478bd9Sstevel@tonic-gate  * Definitions for use with ibt_register_subnet_notices()
1747c478bd9Sstevel@tonic-gate  */
1757c478bd9Sstevel@tonic-gate typedef enum ibt_subnet_event_code_e {
1767c478bd9Sstevel@tonic-gate 	IBT_SM_EVENT_MCG_CREATED = 1,
1777c478bd9Sstevel@tonic-gate 	IBT_SM_EVENT_MCG_DELETED = 2,
1787c478bd9Sstevel@tonic-gate 	IBT_SM_EVENT_AVAILABLE	 = 3,
1797c478bd9Sstevel@tonic-gate 	IBT_SM_EVENT_UNAVAILABLE = 4,
1807c478bd9Sstevel@tonic-gate 	IBT_SM_EVENT_GID_AVAIL	 = 5,
1817c478bd9Sstevel@tonic-gate 	IBT_SM_EVENT_GID_UNAVAIL = 6
1827c478bd9Sstevel@tonic-gate } ibt_subnet_event_code_t;
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate typedef struct ibt_subnet_event_s {
1857c478bd9Sstevel@tonic-gate 	ib_gid_t sm_notice_gid;
1867c478bd9Sstevel@tonic-gate } ibt_subnet_event_t;
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate typedef void (*ibt_sm_notice_handler_t)(void *private, ib_gid_t gid,
1897c478bd9Sstevel@tonic-gate     ibt_subnet_event_code_t code, ibt_subnet_event_t *event);
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate /*
1937c478bd9Sstevel@tonic-gate  * MTU Request type.
1947c478bd9Sstevel@tonic-gate  */
1957c478bd9Sstevel@tonic-gate typedef struct ibt_mtu_req_s {
1967c478bd9Sstevel@tonic-gate 	ib_mtu_t	r_mtu;		/* Requested MTU */
1977c478bd9Sstevel@tonic-gate 	ibt_selector_t	r_selector;	/* Qualifier for r_mtu */
1987c478bd9Sstevel@tonic-gate } ibt_mtu_req_t;
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate /*
2027c478bd9Sstevel@tonic-gate  * Qflags, used by ibt_resize_queues().
2037c478bd9Sstevel@tonic-gate  */
2047c478bd9Sstevel@tonic-gate typedef enum ibt_qflags_e {
2057c478bd9Sstevel@tonic-gate 	IBT_SEND_Q	= 1 << 0,	/* Op applies to the Send Q */
2067c478bd9Sstevel@tonic-gate 	IBT_RECV_Q	= 1 << 1	/* Op applies to the Recv Q */
2077c478bd9Sstevel@tonic-gate } ibt_qflags_t;
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate /*
2117c478bd9Sstevel@tonic-gate  * ibt_cq_handler_t
2127c478bd9Sstevel@tonic-gate  *	Pointer to a work request completion handler function.  This function
2137c478bd9Sstevel@tonic-gate  *	is called when a WR completes on a CQ that is being used by the IBTF
2147c478bd9Sstevel@tonic-gate  *	client driver that registered the function.
2157c478bd9Sstevel@tonic-gate  */
2167c478bd9Sstevel@tonic-gate typedef void (*ibt_cq_handler_t)(ibt_cq_hdl_t ibt_cq, void *arg);
2177c478bd9Sstevel@tonic-gate 
21803494a98SBill Taylor /* default CQ handler ID */
21903494a98SBill Taylor #define	IBT_CQ_HID_DEFAULT	(1)
22003494a98SBill Taylor 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * Service Data and flags.
2237c478bd9Sstevel@tonic-gate  *	(IBTA Spec Release 1.1, Vol-1 Ref: 15.2.5.14.4)
2247c478bd9Sstevel@tonic-gate  *
2257c478bd9Sstevel@tonic-gate  * The ServiceData8.1 (sb_data8[0]) through ServiceData64.2 (sb_data64[1])
2267c478bd9Sstevel@tonic-gate  * components together constitutes a 64-byte area in which any data may be
2277c478bd9Sstevel@tonic-gate  * placed. It is intended to be a convenient way for a service to provide its
2287c478bd9Sstevel@tonic-gate  * clients with some initial data.
2297c478bd9Sstevel@tonic-gate  *
2307c478bd9Sstevel@tonic-gate  * In addition, this 64-byte area is formally divided into a total of 30
2317c478bd9Sstevel@tonic-gate  * components, 16 8-bit (uint8_t) components, then 8 16-bit (uint16_t)
2327c478bd9Sstevel@tonic-gate  * components, then 6 32-bit (uint32_t) components, then 2 64-bit (uint64_t)
2337c478bd9Sstevel@tonic-gate  * components,  thereby assigning ComponentMask bits (ibt_srv_data_flags_t) to
2347c478bd9Sstevel@tonic-gate  * variously-sized segments of the data. All data are in host endian format.
2357c478bd9Sstevel@tonic-gate  * This allows query operations (ibt_get_paths()) to be used which match
2367c478bd9Sstevel@tonic-gate  * parts of the Service Data, making it possible, for example, for
2377c478bd9Sstevel@tonic-gate  * service-specific parts of the ServiceData to serve as a binary-coded
2387c478bd9Sstevel@tonic-gate  * extension to the ServiceName for purposes of lookup.
2397c478bd9Sstevel@tonic-gate  */
2407c478bd9Sstevel@tonic-gate typedef enum ibt_srv_data_flags_e {
2417c478bd9Sstevel@tonic-gate 	IBT_NO_SDATA	= 0,
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate 	IBT_SDATA8_0	= (1 << 0),
2447c478bd9Sstevel@tonic-gate 	IBT_SDATA8_1	= (1 << 1),
2457c478bd9Sstevel@tonic-gate 	IBT_SDATA8_2	= (1 << 2),
2467c478bd9Sstevel@tonic-gate 	IBT_SDATA8_3	= (1 << 3),
2477c478bd9Sstevel@tonic-gate 	IBT_SDATA8_4	= (1 << 4),
2487c478bd9Sstevel@tonic-gate 	IBT_SDATA8_5	= (1 << 5),
2497c478bd9Sstevel@tonic-gate 	IBT_SDATA8_6	= (1 << 6),
2507c478bd9Sstevel@tonic-gate 	IBT_SDATA8_7	= (1 << 7),
2517c478bd9Sstevel@tonic-gate 	IBT_SDATA8_8	= (1 << 8),
2527c478bd9Sstevel@tonic-gate 	IBT_SDATA8_9	= (1 << 9),
2537c478bd9Sstevel@tonic-gate 	IBT_SDATA8_10	= (1 << 10),
2547c478bd9Sstevel@tonic-gate 	IBT_SDATA8_11	= (1 << 11),
2557c478bd9Sstevel@tonic-gate 	IBT_SDATA8_12	= (1 << 12),
2567c478bd9Sstevel@tonic-gate 	IBT_SDATA8_13	= (1 << 13),
2577c478bd9Sstevel@tonic-gate 	IBT_SDATA8_14	= (1 << 14),
2587c478bd9Sstevel@tonic-gate 	IBT_SDATA8_15	= (1 << 15),
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate 	IBT_SDATA16_0	= (1 << 16),
2617c478bd9Sstevel@tonic-gate 	IBT_SDATA16_1	= (1 << 17),
2627c478bd9Sstevel@tonic-gate 	IBT_SDATA16_2	= (1 << 18),
2637c478bd9Sstevel@tonic-gate 	IBT_SDATA16_3	= (1 << 19),
2647c478bd9Sstevel@tonic-gate 	IBT_SDATA16_4	= (1 << 20),
2657c478bd9Sstevel@tonic-gate 	IBT_SDATA16_5	= (1 << 21),
2667c478bd9Sstevel@tonic-gate 	IBT_SDATA16_6	= (1 << 22),
2677c478bd9Sstevel@tonic-gate 	IBT_SDATA16_7	= (1 << 23),
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate 	IBT_SDATA32_0	= (1 << 24),
2707c478bd9Sstevel@tonic-gate 	IBT_SDATA32_1	= (1 << 25),
2717c478bd9Sstevel@tonic-gate 	IBT_SDATA32_2	= (1 << 26),
2727c478bd9Sstevel@tonic-gate 	IBT_SDATA32_3	= (1 << 27),
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate 	IBT_SDATA64_0	= (1 << 28),
2757c478bd9Sstevel@tonic-gate 	IBT_SDATA64_1	= (1 << 29),
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate 	IBT_SDATA_ALL	= 0x3FFFFFFF
2787c478bd9Sstevel@tonic-gate } ibt_srv_data_flags_t;
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate typedef struct ibt_srv_data_s {
2817c478bd9Sstevel@tonic-gate 	uint8_t		s_data8[16];	/* 8-bit service data fields. */
2827c478bd9Sstevel@tonic-gate 	uint16_t	s_data16[8];	/* 16-bit service data fields. */
2837c478bd9Sstevel@tonic-gate 	uint32_t	s_data32[4];	/* 32-bit service data fields. */
2847c478bd9Sstevel@tonic-gate 	uint64_t	s_data64[2];	/* 64-bit service data fields. */
2857c478bd9Sstevel@tonic-gate } ibt_srv_data_t;
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate /*
2887c478bd9Sstevel@tonic-gate  * Path flags, used in ibt_get_paths()
2897c478bd9Sstevel@tonic-gate  */
2907c478bd9Sstevel@tonic-gate typedef enum ibt_path_flags_e {
2917c478bd9Sstevel@tonic-gate 	IBT_PATH_NO_FLAGS	= 0,
2927c478bd9Sstevel@tonic-gate 	IBT_PATH_APM		= 1 << 0,	/* APM is desired. */
2937c478bd9Sstevel@tonic-gate 	IBT_PATH_AVAIL		= 1 << 2,
2947c478bd9Sstevel@tonic-gate 	IBT_PATH_PERF		= 1 << 3,
2957c478bd9Sstevel@tonic-gate 	IBT_PATH_MULTI_SVC_DEST	= 1 << 4,	/* Multiple ServiceRecords */
2967c478bd9Sstevel@tonic-gate 	IBT_PATH_HOP		= 1 << 5,	/* pa_hop is specified. */
2977c478bd9Sstevel@tonic-gate 	IBT_PATH_PKEY		= 1 << 6	/* pa_pkey is specified. */
2987c478bd9Sstevel@tonic-gate } ibt_path_flags_t;
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate /*
3017c478bd9Sstevel@tonic-gate  * Path attributes.
3027c478bd9Sstevel@tonic-gate  *
3037c478bd9Sstevel@tonic-gate  * The ibt_path_attr_t structure is used to specify required attributes in a
3047c478bd9Sstevel@tonic-gate  * path from the requesting (source) node to a specified destination node.
3057c478bd9Sstevel@tonic-gate  * Attributes that are don't care should be set to NULL or '0'.
3067c478bd9Sstevel@tonic-gate  * A destination must be specified, where a destination can be defined as
3077c478bd9Sstevel@tonic-gate  * one of the following:
3087c478bd9Sstevel@tonic-gate  *
3097c478bd9Sstevel@tonic-gate  *	o Service Name
3107c478bd9Sstevel@tonic-gate  *	o Service ID (SID)
3117c478bd9Sstevel@tonic-gate  *	o Array of DGIDs.
3127c478bd9Sstevel@tonic-gate  *	o Service Name and Array of DGIDs.
3137c478bd9Sstevel@tonic-gate  */
3147c478bd9Sstevel@tonic-gate typedef struct ibt_path_attr_s {
3157c478bd9Sstevel@tonic-gate 	ib_gid_t		*pa_dgids;	/* Array of DGIDs */
3167c478bd9Sstevel@tonic-gate 	ib_gid_t		pa_sgid;
3177c478bd9Sstevel@tonic-gate 	ib_guid_t		pa_hca_guid;
3187c478bd9Sstevel@tonic-gate 	char			*pa_sname;	/* ASCII Service name  */
3197c478bd9Sstevel@tonic-gate 						/* NULL Terminated */
3207c478bd9Sstevel@tonic-gate 	ib_svc_id_t		pa_sid;		/* Service ID */
3217c478bd9Sstevel@tonic-gate 	ibt_srv_data_flags_t	pa_sd_flags;	/* Service Data flags. */
3227c478bd9Sstevel@tonic-gate 	ibt_srv_data_t		pa_sdata;	/* Service Data */
3237c478bd9Sstevel@tonic-gate 	uint8_t			pa_hca_port_num;
3247c478bd9Sstevel@tonic-gate 	uint8_t			pa_num_dgids;	/* size of pa_dgids array */
3257c478bd9Sstevel@tonic-gate 	uint8_t			pa_sl:4;
3267c478bd9Sstevel@tonic-gate 	ibt_mtu_req_t		pa_mtu;
3277c478bd9Sstevel@tonic-gate 	ibt_srate_req_t		pa_srate;
3287c478bd9Sstevel@tonic-gate 	ibt_pkt_lt_req_t	pa_pkt_lt;	/* Packet Life Time Request */
3297c478bd9Sstevel@tonic-gate 	uint_t			pa_flow:20;
3307c478bd9Sstevel@tonic-gate 	uint8_t			pa_hop;		/* IBT_PATH_HOP */
3317c478bd9Sstevel@tonic-gate 	uint8_t			pa_tclass;
3327c478bd9Sstevel@tonic-gate 	ib_pkey_t		pa_pkey;	/* IBT_PATH_PKEY */
3337c478bd9Sstevel@tonic-gate } ibt_path_attr_t;
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate /*
3367c478bd9Sstevel@tonic-gate  * Path Information.
3377c478bd9Sstevel@tonic-gate  *
3387c478bd9Sstevel@tonic-gate  * The ibt_get_paths() performs SA Path record lookups to select a path(s) to
3397c478bd9Sstevel@tonic-gate  * a given destination(s), details of selected path(s) are returned in this
3407c478bd9Sstevel@tonic-gate  * structure.
3417c478bd9Sstevel@tonic-gate  *
3427c478bd9Sstevel@tonic-gate  * The ibt_path_info_t contains all the attributes of the best path(s), as
3437c478bd9Sstevel@tonic-gate  * as determined by IBTL, to the specified destination(s), including the
3447c478bd9Sstevel@tonic-gate  * local HCA and HCA port to use to access the fabric.
3457c478bd9Sstevel@tonic-gate  *
3467c478bd9Sstevel@tonic-gate  * The Service ID (pi_sid) and Service Data (pi_sdata) are returned only for
3477c478bd9Sstevel@tonic-gate  * lookups based on Service ID or/and Service Name.
3487c478bd9Sstevel@tonic-gate  */
3497c478bd9Sstevel@tonic-gate typedef struct ibt_path_info_s {
3507c478bd9Sstevel@tonic-gate 	ib_guid_t	pi_hca_guid;		/* Local HCA GUID; 0 implies */
3517c478bd9Sstevel@tonic-gate 						/* this record is invalid */
3527c478bd9Sstevel@tonic-gate 	ib_svc_id_t	pi_sid;			/* Service ID */
3537c478bd9Sstevel@tonic-gate 	ibt_srv_data_t	pi_sdata;		/* Service Data */
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate 	ibt_cep_path_t	pi_prim_cep_path;	/* Contains CEP adds info */
3567c478bd9Sstevel@tonic-gate 	ibt_cep_path_t	pi_alt_cep_path;	/* RC & UC Only, valid if */
3577c478bd9Sstevel@tonic-gate 						/* cep_hca_port_num is not */
3587c478bd9Sstevel@tonic-gate 						/* '0' */
3597c478bd9Sstevel@tonic-gate 	ib_mtu_t	pi_path_mtu;		/* Common path MTU */
3607c478bd9Sstevel@tonic-gate 	ib_time_t	pi_prim_pkt_lt;
3617c478bd9Sstevel@tonic-gate 	ib_time_t	pi_alt_pkt_lt;
3627c478bd9Sstevel@tonic-gate } ibt_path_info_t;
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate /*
3657c478bd9Sstevel@tonic-gate  * Optional Alternate Path attributes.
3667c478bd9Sstevel@tonic-gate  *
3677c478bd9Sstevel@tonic-gate  * The ibt_alt_path_attr_t structure is used to specify additional optional
3687c478bd9Sstevel@tonic-gate  * attributes when requesting an alternate path for an existing channel.
3697c478bd9Sstevel@tonic-gate  *
3707c478bd9Sstevel@tonic-gate  * Attributes that are don't care should be set to NULL or '0'.
3717c478bd9Sstevel@tonic-gate  */
3727c478bd9Sstevel@tonic-gate typedef struct ibt_alt_path_attr_s {
3737c478bd9Sstevel@tonic-gate 	ib_gid_t		apa_sgid;
3747c478bd9Sstevel@tonic-gate 	ib_gid_t		apa_dgid;
3757c478bd9Sstevel@tonic-gate 	ibt_srate_req_t		apa_srate;
3767c478bd9Sstevel@tonic-gate 	ibt_pkt_lt_req_t	apa_pkt_lt;	/* Packet Life Time Request */
3777c478bd9Sstevel@tonic-gate 	uint_t			apa_flow:20;
3787c478bd9Sstevel@tonic-gate 	uint8_t			apa_sl:4;
3797c478bd9Sstevel@tonic-gate 	uint8_t			apa_hop;
3807c478bd9Sstevel@tonic-gate 	uint8_t			apa_tclass;
3817c478bd9Sstevel@tonic-gate } ibt_alt_path_attr_t;
3827c478bd9Sstevel@tonic-gate 
3837c478bd9Sstevel@tonic-gate /*
3847c478bd9Sstevel@tonic-gate  * Path Information for Alternate Path - input to ibt_set_alt_path().
3857c478bd9Sstevel@tonic-gate  */
3867c478bd9Sstevel@tonic-gate typedef struct ibt_alt_path_info_s {
3877c478bd9Sstevel@tonic-gate 	ibt_cep_path_t	ap_alt_cep_path;	/* RC & UC Only, valid if */
3887c478bd9Sstevel@tonic-gate 						/* cep_hca_port_num is not */
3897c478bd9Sstevel@tonic-gate 						/* '0' */
3907c478bd9Sstevel@tonic-gate 	ib_time_t	ap_alt_pkt_lt;
3917c478bd9Sstevel@tonic-gate } ibt_alt_path_info_t;
3927c478bd9Sstevel@tonic-gate 
3937c478bd9Sstevel@tonic-gate /*
3947c478bd9Sstevel@tonic-gate  * Open Channel flags, Used in ibt_open_rc_channel call
3957c478bd9Sstevel@tonic-gate  */
3967c478bd9Sstevel@tonic-gate typedef enum ibt_chan_open_flags_e {
3977c478bd9Sstevel@tonic-gate 	IBT_OCHAN_NO_FLAGS		= 0,
3987c478bd9Sstevel@tonic-gate 	IBT_OCHAN_REDIRECTED		= 1 << 0,
3997c478bd9Sstevel@tonic-gate 	IBT_OCHAN_PORT_REDIRECTED	= 1 << 1,
4007c478bd9Sstevel@tonic-gate 	IBT_OCHAN_DUP			= 1 << 2,
4017c478bd9Sstevel@tonic-gate 	IBT_OCHAN_PORT_FIXED		= 1 << 3,
4027c478bd9Sstevel@tonic-gate 	IBT_OCHAN_OPAQUE1		= 1 << 4,
4037c478bd9Sstevel@tonic-gate 	IBT_OCHAN_OPAQUE2		= 1 << 5,
4047c478bd9Sstevel@tonic-gate 	IBT_OCHAN_OPAQUE3		= 1 << 6,
4057c478bd9Sstevel@tonic-gate 	IBT_OCHAN_OPAQUE4		= 1 << 7,
4069c468ea9SPramod Gunjikar 	IBT_OCHAN_OPAQUE5		= 1 << 8,
4079c468ea9SPramod Gunjikar 	IBT_OCHAN_OPAQUE6		= 1 << 9
4087c478bd9Sstevel@tonic-gate } ibt_chan_open_flags_t;
4097c478bd9Sstevel@tonic-gate 
4107c478bd9Sstevel@tonic-gate /*
4117c478bd9Sstevel@tonic-gate  * Arguments for ibt_open_rc_channel().
4127c478bd9Sstevel@tonic-gate  *
4137c478bd9Sstevel@tonic-gate  * oc_priv_data should be NULL or point to a buffer allocated by the caller,
4147c478bd9Sstevel@tonic-gate  * the size of which should be in oc_priv_data_len, where oc_priv_data_len <=
4157c478bd9Sstevel@tonic-gate  * IBT_REQ_PRIV_DATA_SZ.
4167c478bd9Sstevel@tonic-gate  *
4177c478bd9Sstevel@tonic-gate  * When ibt_open_rc_channel returns with ibt_cm_reason_t of
4187c478bd9Sstevel@tonic-gate  * IBT_CM_REDIRECT_PORT, the client can re-issue ibt_open_rc_channel setting
4197c478bd9Sstevel@tonic-gate  * new fields as follows:
4207c478bd9Sstevel@tonic-gate  *
4217c478bd9Sstevel@tonic-gate  * Set (ibt_chan_args_t)->oc_cm_cep_path  =
4227c478bd9Sstevel@tonic-gate  *    original (ibt_chan_open_args_t)->oc_path->pi_prim_cep_path.
4237c478bd9Sstevel@tonic-gate  * Set (ibt_chan_args_t)->oc_cm_pkt_lt  =
4247c478bd9Sstevel@tonic-gate  *    original (ibt_chan_open_args_t)->oc_prim_pkt_lt.
4257c478bd9Sstevel@tonic-gate  * Update (ibt_chan_args_t)->oc_path based on path information returned
4267c478bd9Sstevel@tonic-gate  * from ibt_get_paths using the gid in the return data below:
4277c478bd9Sstevel@tonic-gate  * 	(ibt_rc_returns_t)->rc_arej_info.ari_redirect_info.ari_gid.
4287c478bd9Sstevel@tonic-gate  * Set flags to IBT_OCHAN_PORT_REDIRECTED.
4297c478bd9Sstevel@tonic-gate  *
4307c478bd9Sstevel@tonic-gate  * Note : oc_cm_path is not used for any other scenario, and must be set for
4317c478bd9Sstevel@tonic-gate  * IBT_OCHAN_PORT_REDIRECTED.
4327c478bd9Sstevel@tonic-gate  *
4337c478bd9Sstevel@tonic-gate  * When ibt_open_rc_channel returns with ibt_cm_reason_t of
4347c478bd9Sstevel@tonic-gate  * IBT_CM_REDIRECT_CM, the client can re-issue ibt_open_rc_channel setting
4357c478bd9Sstevel@tonic-gate  * new fields as follows:
4367c478bd9Sstevel@tonic-gate  *
4377c478bd9Sstevel@tonic-gate  * Update (ibt_chan_args_t)->oc_path based on path information returned
4387c478bd9Sstevel@tonic-gate  * from ibt_get_paths using the return data in
4397c478bd9Sstevel@tonic-gate  * (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info.
4407c478bd9Sstevel@tonic-gate  *
4417c478bd9Sstevel@tonic-gate  * Set (ibt_chan_args_t)->oc_cm_redirect_info =
4427c478bd9Sstevel@tonic-gate  *    Returned (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info.
4437c478bd9Sstevel@tonic-gate  * Set flags to IBT_OCHAN_REDIRECTED.
4447c478bd9Sstevel@tonic-gate  *
4457c478bd9Sstevel@tonic-gate  * Note:
4467c478bd9Sstevel@tonic-gate  *
4477c478bd9Sstevel@tonic-gate  * IBT_OCHAN_PORT_REDIRECTED flag cannot be used to specify a remote CM MAD
4487c478bd9Sstevel@tonic-gate  * address, that is on a different subnet than the RC connection itself.
4497c478bd9Sstevel@tonic-gate  *
4507c478bd9Sstevel@tonic-gate  * Not specified attributes should be set to "NULL" or "0".
4517c478bd9Sstevel@tonic-gate  */
4527c478bd9Sstevel@tonic-gate typedef struct ibt_chan_open_args_s {
4537c478bd9Sstevel@tonic-gate 	ibt_path_info_t 	*oc_path;	/* Primary & Alternate */
4547c478bd9Sstevel@tonic-gate 	ibt_cm_handler_t 	oc_cm_handler;	/* cm_handler - required */
4557c478bd9Sstevel@tonic-gate 	void			*oc_cm_clnt_private;	/* First argument to */
4567c478bd9Sstevel@tonic-gate 							/* cm_handler */
4577c478bd9Sstevel@tonic-gate 	ibt_rnr_retry_cnt_t	oc_path_rnr_retry_cnt;
4587c478bd9Sstevel@tonic-gate 	uint8_t			oc_path_retry_cnt:3;
4597c478bd9Sstevel@tonic-gate 	uint8_t			oc_rdma_ra_out;
4607c478bd9Sstevel@tonic-gate 	uint8_t			oc_rdma_ra_in;
4617c478bd9Sstevel@tonic-gate 	ibt_priv_data_len_t	oc_priv_data_len;	/* Number of bytes of */
4627c478bd9Sstevel@tonic-gate 							/* REQ Private data */
4637c478bd9Sstevel@tonic-gate 	void			*oc_priv_data;		/* REQ private data */
4647c478bd9Sstevel@tonic-gate 	ibt_channel_hdl_t	oc_dup_channel; 	/* IBT_OCHAN_DUP */
4657c478bd9Sstevel@tonic-gate 	ibt_redirect_info_t	*oc_cm_redirect_info;	/* Redirect params */
4667c478bd9Sstevel@tonic-gate 							/* for port and CM */
4677c478bd9Sstevel@tonic-gate 							/* redirection */
4687c478bd9Sstevel@tonic-gate 	ibt_cep_path_t		*oc_cm_cep_path;	/* Optional Path for */
4697c478bd9Sstevel@tonic-gate 							/* CM MADs on */
4707c478bd9Sstevel@tonic-gate 							/* port redirection */
4717c478bd9Sstevel@tonic-gate 	ib_time_t		oc_cm_pkt_lt;		/* Pkt life time for */
4727c478bd9Sstevel@tonic-gate 							/* CM MADs */
4737c478bd9Sstevel@tonic-gate 	uint32_t		oc_opaque1:4;
4747c478bd9Sstevel@tonic-gate 	uint32_t		oc_opaque2:24;
4757c478bd9Sstevel@tonic-gate 	uint32_t		oc_opaque3;
4767c478bd9Sstevel@tonic-gate 	uint32_t		oc_opaque4;
4777c478bd9Sstevel@tonic-gate } ibt_chan_open_args_t;
4787c478bd9Sstevel@tonic-gate 
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate /*
4817c478bd9Sstevel@tonic-gate  * Define an optional RC return arguments structure. This contains return
4827c478bd9Sstevel@tonic-gate  * parameters from ibt_open_rc_channel() when called in BLOCKING mode.
4837c478bd9Sstevel@tonic-gate  *
4847c478bd9Sstevel@tonic-gate  * rc_priv_data should be NULL or point to a buffer allocated by the caller,
4857c478bd9Sstevel@tonic-gate  * the size of which should be in rc_priv_data_len, where rc_priv_data_len <=
4867c478bd9Sstevel@tonic-gate  * IBT_REP_PRIV_DATA_SZ.
4877c478bd9Sstevel@tonic-gate  */
4887c478bd9Sstevel@tonic-gate typedef struct ibt_rc_returns_s {
4897c478bd9Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_in;	/* Arbitrated resp resources */
4907c478bd9Sstevel@tonic-gate 	uint8_t			rc_rdma_ra_out;	/* Arbitrated initiator depth */
4917c478bd9Sstevel@tonic-gate 	ibt_arej_info_t		rc_arej_info;
4927c478bd9Sstevel@tonic-gate 	ibt_cm_reason_t		rc_status;
4937c478bd9Sstevel@tonic-gate 	uint8_t			rc_failover_status;	/* Failover status */
4947c478bd9Sstevel@tonic-gate 	ibt_priv_data_len_t	rc_priv_data_len;
4957c478bd9Sstevel@tonic-gate 	void			*rc_priv_data;
4967c478bd9Sstevel@tonic-gate } ibt_rc_returns_t;
4977c478bd9Sstevel@tonic-gate 
4987c478bd9Sstevel@tonic-gate /*
4997c478bd9Sstevel@tonic-gate  * Define a callback function that can be used in Non-Blocking calls to
5007c478bd9Sstevel@tonic-gate  * ibt_recycle_rc().
5017c478bd9Sstevel@tonic-gate  */
5027c478bd9Sstevel@tonic-gate 
5037c478bd9Sstevel@tonic-gate typedef	void	(*ibt_recycle_handler_t)(ibt_status_t ibt_status, void *arg);
5047c478bd9Sstevel@tonic-gate 
5057c478bd9Sstevel@tonic-gate /*
5067c478bd9Sstevel@tonic-gate  * Define an optional return arguments structure from ibt_set_alt_path()
5077c478bd9Sstevel@tonic-gate  * This contains return parameters, when called in BLOCKING mode.
5087c478bd9Sstevel@tonic-gate  *
5097c478bd9Sstevel@tonic-gate  * ap_priv_data should be NULL or point to a buffer allocated by the caller,
5107c478bd9Sstevel@tonic-gate  * the size of which should be in ap_priv_data_len, where ap_priv_data_len <=
5117c478bd9Sstevel@tonic-gate  * IBT_APR_PRIV_DATA_SZ.
5127c478bd9Sstevel@tonic-gate  * The private data from APR is returned in ap_priv_data.
5137c478bd9Sstevel@tonic-gate  * The caller specifies amount of APR private data to be returned in
5147c478bd9Sstevel@tonic-gate  * ap_priv_data_len.
5157c478bd9Sstevel@tonic-gate  */
5167c478bd9Sstevel@tonic-gate typedef struct ibt_ap_returns_s {
5177c478bd9Sstevel@tonic-gate 	ibt_ap_status_t		ap_status;
5187c478bd9Sstevel@tonic-gate 	boolean_t		ap_arej_info_valid;
5197c478bd9Sstevel@tonic-gate 	ibt_arej_info_t		ap_arej_info;	/* Only valid if redirect */
5207c478bd9Sstevel@tonic-gate 	ibt_priv_data_len_t	ap_priv_data_len;
5217c478bd9Sstevel@tonic-gate 	void			*ap_priv_data;
5227c478bd9Sstevel@tonic-gate } ibt_ap_returns_t;
5237c478bd9Sstevel@tonic-gate 
5247c478bd9Sstevel@tonic-gate /*
5257c478bd9Sstevel@tonic-gate  * UD remote destination attributes.
5267c478bd9Sstevel@tonic-gate  *
5277c478bd9Sstevel@tonic-gate  * ud_sid, ud_addr, ud_pkt_lt and ud_pkey_ix must be specified.
5287c478bd9Sstevel@tonic-gate  * These values can be as returned in an ibt_path_info_t struct from an
5297c478bd9Sstevel@tonic-gate  * ibt_get_paths() call.
5307c478bd9Sstevel@tonic-gate  *
5317c478bd9Sstevel@tonic-gate  * ud_priv_data should be NULL or point to a buffer allocated by the caller,
5327c478bd9Sstevel@tonic-gate  * the size of which is in ud_priv_data_len, where ud_priv_data_len <=
5337c478bd9Sstevel@tonic-gate  * IBT_SIDR_REQ_PRIV_DATA_SZ.
5347c478bd9Sstevel@tonic-gate  */
5357c478bd9Sstevel@tonic-gate typedef struct ibt_ud_dest_attr_s {
5367c478bd9Sstevel@tonic-gate 	ib_svc_id_t		ud_sid;		/* Service ID */
5377c478bd9Sstevel@tonic-gate 	ibt_adds_vect_t		*ud_addr;	/* Address Info */
5387c478bd9Sstevel@tonic-gate 	uint16_t		ud_pkey_ix;	/* Pkey Index */
5397c478bd9Sstevel@tonic-gate 	ib_time_t		ud_pkt_lt;
5407c478bd9Sstevel@tonic-gate 	ibt_cm_ud_handler_t	ud_cm_handler;	/* An optional CM UD event */
5417c478bd9Sstevel@tonic-gate 						/* which must be NULL */
5427c478bd9Sstevel@tonic-gate 						/* if not specified. */
5437c478bd9Sstevel@tonic-gate 	void			*ud_cm_private; /* First arg to ud_cm_handler */
5447c478bd9Sstevel@tonic-gate 	ibt_priv_data_len_t	ud_priv_data_len;
5457c478bd9Sstevel@tonic-gate 	void			*ud_priv_data;	/* SIDR REQ private data */
5467c478bd9Sstevel@tonic-gate } ibt_ud_dest_attr_t;
5477c478bd9Sstevel@tonic-gate 
5487c478bd9Sstevel@tonic-gate /*
5497c478bd9Sstevel@tonic-gate  * Define an optional UD return arguments structure.
5507c478bd9Sstevel@tonic-gate  *
5517c478bd9Sstevel@tonic-gate  * ud_priv_data should be NULL or point to a buffer allocated by the caller,
5527c478bd9Sstevel@tonic-gate  * the size of which should be in ud_priv_data_len, where ud_priv_data_len <=
5537c478bd9Sstevel@tonic-gate  * IBT_SIDR_REP_PRIV_DATA_SZ.
5547c478bd9Sstevel@tonic-gate  */
5557c478bd9Sstevel@tonic-gate typedef struct ibt_ud_returns_s {
5567c478bd9Sstevel@tonic-gate 	ibt_sidr_status_t	ud_status;
5577c478bd9Sstevel@tonic-gate 	ibt_redirect_info_t	ud_redirect;
5587c478bd9Sstevel@tonic-gate 	ib_qpn_t		ud_dqpn;	/* Returned destination QPN */
5597c478bd9Sstevel@tonic-gate 	ib_qkey_t		ud_qkey;	/* Q_Key for destination QPN */
5607c478bd9Sstevel@tonic-gate 	ibt_priv_data_len_t	ud_priv_data_len;
5617c478bd9Sstevel@tonic-gate 	void			*ud_priv_data;
5627c478bd9Sstevel@tonic-gate } ibt_ud_returns_t;
5637c478bd9Sstevel@tonic-gate 
5647c478bd9Sstevel@tonic-gate /*
5657c478bd9Sstevel@tonic-gate  * Multicast group attributes
5667c478bd9Sstevel@tonic-gate  * Not specified attributes should be set to "NULL" or "0".
5677c478bd9Sstevel@tonic-gate  * Used by ibt_join_mcg()/ibt_query_mcg().
5687c478bd9Sstevel@tonic-gate  *
5697c478bd9Sstevel@tonic-gate  * mc_qkey, mc_pkey, mc_flow, mc_tclass, mc_sl, mc_join_state are required for
5707c478bd9Sstevel@tonic-gate  * create - ibt_join_mcg().
5717c478bd9Sstevel@tonic-gate  */
5727c478bd9Sstevel@tonic-gate typedef struct ibt_mcg_attr_s {
5737c478bd9Sstevel@tonic-gate 	ib_gid_t		mc_mgid;	/* MGID */
5747c478bd9Sstevel@tonic-gate 	ib_gid_t		mc_pgid;	/* SGID of the end port being */
5757c478bd9Sstevel@tonic-gate 						/* added to the MCG. */
5767c478bd9Sstevel@tonic-gate 	ib_qkey_t		mc_qkey;	/* Q_Key */
5777c478bd9Sstevel@tonic-gate 	ib_pkey_t		mc_pkey;	/* Partition key for this MCG */
5787c478bd9Sstevel@tonic-gate 	ibt_mtu_req_t		mc_mtu_req;	/* MTU */
5797c478bd9Sstevel@tonic-gate 	ibt_srate_req_t		mc_rate_req;	/* Static rate */
5807c478bd9Sstevel@tonic-gate 	ibt_pkt_lt_req_t	mc_pkt_lt_req;	/* Packet Life Time Request */
5817c478bd9Sstevel@tonic-gate 	uint_t			mc_flow:20;	/* FlowLabel. */
5827c478bd9Sstevel@tonic-gate 	uint8_t			mc_hop;		/* HopLimit */
5837c478bd9Sstevel@tonic-gate 	uint8_t			mc_tclass;	/* Traffic Class. */
5847c478bd9Sstevel@tonic-gate 	uint8_t			mc_sl:4;	/* Service Level */
5857c478bd9Sstevel@tonic-gate 	uint8_t			mc_scope:4,	/* Multicast Address Scope */
5867c478bd9Sstevel@tonic-gate 				mc_join_state:4; /* FULL For create */
5877c478bd9Sstevel@tonic-gate 	ib_lid_t		mc_opaque1;
5887c478bd9Sstevel@tonic-gate } ibt_mcg_attr_t;
5897c478bd9Sstevel@tonic-gate 
5907c478bd9Sstevel@tonic-gate /*
5917c478bd9Sstevel@tonic-gate  * Multicast group attributes.
5927c478bd9Sstevel@tonic-gate  * returned by ibt_join_mcg()/ibt_query_mcg().
5937c478bd9Sstevel@tonic-gate  */
5947c478bd9Sstevel@tonic-gate typedef struct ibt_mcg_info_s {
5957c478bd9Sstevel@tonic-gate 	ibt_adds_vect_t		mc_adds_vect;   /* Address information */
5967c478bd9Sstevel@tonic-gate 	ib_mtu_t		mc_mtu;		/* MTU */
5977c478bd9Sstevel@tonic-gate 	ib_qkey_t		mc_qkey;	/* Q_Key */
5987c478bd9Sstevel@tonic-gate 	uint16_t		mc_pkey_ix;	/* Pkey Index */
5997c478bd9Sstevel@tonic-gate 	uint8_t			mc_scope:4;	/* Multicast Address Scope */
6007c478bd9Sstevel@tonic-gate 	clock_t			mc_opaque2;
6017c478bd9Sstevel@tonic-gate } ibt_mcg_info_t;
6027c478bd9Sstevel@tonic-gate 
6037c478bd9Sstevel@tonic-gate /*
6047c478bd9Sstevel@tonic-gate  * Define a callback function that can be used in Non-Blocking calls to
6057c478bd9Sstevel@tonic-gate  * ibt_join_mcg().
6067c478bd9Sstevel@tonic-gate  */
6077c478bd9Sstevel@tonic-gate typedef void (*ibt_mcg_handler_t)(void *arg, ibt_status_t retval,
6087c478bd9Sstevel@tonic-gate     ibt_mcg_info_t *mcg_info_p);
6097c478bd9Sstevel@tonic-gate 
6107c478bd9Sstevel@tonic-gate 
6117c478bd9Sstevel@tonic-gate /*
6127c478bd9Sstevel@tonic-gate  * Service Flags - sd_flags
6137c478bd9Sstevel@tonic-gate  *
6147c478bd9Sstevel@tonic-gate  *    IBT_SRV_PEER_TYPE_SID	Peer-to-peer Service IDs.
6157c478bd9Sstevel@tonic-gate  */
6167c478bd9Sstevel@tonic-gate 
6177c478bd9Sstevel@tonic-gate typedef enum ibt_service_flags_e {
6187c478bd9Sstevel@tonic-gate 	IBT_SRV_NO_FLAGS	= 0x0,
6197c478bd9Sstevel@tonic-gate 	IBT_SRV_PEER_TYPE_SID	= 0x1
6207c478bd9Sstevel@tonic-gate } ibt_service_flags_t;
6217c478bd9Sstevel@tonic-gate 
6227c478bd9Sstevel@tonic-gate /*
6237c478bd9Sstevel@tonic-gate  * Define a Service ID Registration structure.
6247c478bd9Sstevel@tonic-gate  */
6257c478bd9Sstevel@tonic-gate typedef struct ibt_srv_desc_s {
6267c478bd9Sstevel@tonic-gate 	ibt_cm_ud_handler_t	sd_ud_handler;	/* UD Service Handler */
6277c478bd9Sstevel@tonic-gate 	ibt_cm_handler_t	sd_handler;	/* Non-UD Service Handler */
6287c478bd9Sstevel@tonic-gate 	ibt_service_flags_t	sd_flags;	/* Flags */
6297c478bd9Sstevel@tonic-gate } ibt_srv_desc_t;
6307c478bd9Sstevel@tonic-gate 
6317c478bd9Sstevel@tonic-gate /*
6327c478bd9Sstevel@tonic-gate  * Flag to indicate ibt_bind_service() to or NOT-to clean-up Stale matching
6337c478bd9Sstevel@tonic-gate  * Local Service Records with SA prior to binding the new request.
6347c478bd9Sstevel@tonic-gate  */
6357c478bd9Sstevel@tonic-gate #define	IBT_SBIND_NO_FLAGS	0
6367c478bd9Sstevel@tonic-gate #define	IBT_SBIND_NO_CLEANUP	1
6377c478bd9Sstevel@tonic-gate 
6387c478bd9Sstevel@tonic-gate /*
6397c478bd9Sstevel@tonic-gate  * Define a Service ID Binding structure (data for service records).
6407c478bd9Sstevel@tonic-gate  */
6417c478bd9Sstevel@tonic-gate typedef struct ibt_srv_bind_s {
6427c478bd9Sstevel@tonic-gate 	uint64_t	sb_key[2];	/* Service Key */
6437c478bd9Sstevel@tonic-gate 	char		*sb_name;	/* Service Name (up to 63 chars) */
6447c478bd9Sstevel@tonic-gate 	uint32_t	sb_lease;	/* Service Lease period (in seconds) */
6457c478bd9Sstevel@tonic-gate 	ib_pkey_t	sb_pkey;	/* Service P_Key */
6467c478bd9Sstevel@tonic-gate 	ibt_srv_data_t	sb_data;	/* Service Data */
6477c478bd9Sstevel@tonic-gate 	uint_t		sb_flag;	/* indicates to/not-to clean-up stale */
6487c478bd9Sstevel@tonic-gate 					/* matching local service records. */
6497c478bd9Sstevel@tonic-gate } ibt_srv_bind_t;
6507c478bd9Sstevel@tonic-gate 
6517c478bd9Sstevel@tonic-gate /*
6527c478bd9Sstevel@tonic-gate  * ibt_cm_delay() flags.
6537c478bd9Sstevel@tonic-gate  *
6547c478bd9Sstevel@tonic-gate  * Refer to InfiniBand Architecture Release Volume 1 Rev 1.0a:
6557c478bd9Sstevel@tonic-gate  * Section 12.6.6 MRA
6567c478bd9Sstevel@tonic-gate  */
6577c478bd9Sstevel@tonic-gate typedef enum ibt_cmdelay_flags_e {
6587c478bd9Sstevel@tonic-gate 	IBT_CM_DELAY_REQ	= 0,
6597c478bd9Sstevel@tonic-gate 	IBT_CM_DELAY_REP	= 1,
6607c478bd9Sstevel@tonic-gate 	IBT_CM_DELAY_LAP	= 2
6617c478bd9Sstevel@tonic-gate } ibt_cmdelay_flags_t;
6627c478bd9Sstevel@tonic-gate 
6637c478bd9Sstevel@tonic-gate /*
6647c478bd9Sstevel@tonic-gate  * The payload for DDI events passed on IB_PROP_UPDATE_EVENT.
6657c478bd9Sstevel@tonic-gate  * This is passed as the bus nexus data to event_handler(9e).
6667c478bd9Sstevel@tonic-gate  */
6677c478bd9Sstevel@tonic-gate typedef struct ibt_prop_update_payload_s {
6687c478bd9Sstevel@tonic-gate 	union {
6697c478bd9Sstevel@tonic-gate 		struct {
6707c478bd9Sstevel@tonic-gate 			uint32_t	srv_updated:1;
6717c478bd9Sstevel@tonic-gate 			uint32_t	gid_updated:1;
6727c478bd9Sstevel@tonic-gate 		} _ib_prop_update_struct;
6737c478bd9Sstevel@tonic-gate 		uint32_t	prop_updated;
6747c478bd9Sstevel@tonic-gate 	} _ib_prop_update_union;
6757c478bd9Sstevel@tonic-gate 	ibt_status_t		ib_reprobe_status;
6767c478bd9Sstevel@tonic-gate 
6777c478bd9Sstevel@tonic-gate #define	ib_srv_prop_updated	\
6787c478bd9Sstevel@tonic-gate     _ib_prop_update_union._ib_prop_update_struct.srv_updated
6797c478bd9Sstevel@tonic-gate #define	ib_gid_prop_updated	\
6807c478bd9Sstevel@tonic-gate     _ib_prop_update_union._ib_prop_update_struct.gid_updated
6817c478bd9Sstevel@tonic-gate #define	ib_prop_updated		\
6827c478bd9Sstevel@tonic-gate     _ib_prop_update_union.prop_updated
6837c478bd9Sstevel@tonic-gate } ibt_prop_update_payload_t;
6847c478bd9Sstevel@tonic-gate 
6857c478bd9Sstevel@tonic-gate 
6867c478bd9Sstevel@tonic-gate /*
6877c478bd9Sstevel@tonic-gate  * FUNCTION PROTOTYPES.
6887c478bd9Sstevel@tonic-gate  */
6897c478bd9Sstevel@tonic-gate 
6907c478bd9Sstevel@tonic-gate /*
6917c478bd9Sstevel@tonic-gate  * ibt_attach() and ibt_detach():
6927c478bd9Sstevel@tonic-gate  *	These are the calls into IBTF used during client driver attach() and
69324b28d04Shiremath  *	detach().
6947c478bd9Sstevel@tonic-gate  *
6957c478bd9Sstevel@tonic-gate  *	The IBTF returns an ibt_clnt_hdl_t to the client. This handle is used
6967c478bd9Sstevel@tonic-gate  *	to identify this client device in all subsequent calls into the IBTF.
6977c478bd9Sstevel@tonic-gate  *
6987c478bd9Sstevel@tonic-gate  *	The ibt_detach() routine is called from a client driver's detach()
6997c478bd9Sstevel@tonic-gate  *	routine to deregister itself from the IBTF.
7007c478bd9Sstevel@tonic-gate  */
7017c478bd9Sstevel@tonic-gate ibt_status_t ibt_attach(ibt_clnt_modinfo_t *mod_infop, dev_info_t *arg,
7027c478bd9Sstevel@tonic-gate     void *clnt_private, ibt_clnt_hdl_t *ibt_hdl_p);
7037c478bd9Sstevel@tonic-gate 
7047c478bd9Sstevel@tonic-gate ibt_status_t ibt_detach(ibt_clnt_hdl_t ibt_hdl);
7057c478bd9Sstevel@tonic-gate 
7067c478bd9Sstevel@tonic-gate /*
7077c478bd9Sstevel@tonic-gate  * HCA FUNCTIONS
7087c478bd9Sstevel@tonic-gate  */
7097c478bd9Sstevel@tonic-gate 
7107c478bd9Sstevel@tonic-gate /*
7117c478bd9Sstevel@tonic-gate  * ibt_get_hca_list()
7127c478bd9Sstevel@tonic-gate  *	Returns the number of HCAs in a system and their node GUIDS.
7137c478bd9Sstevel@tonic-gate  *
7147c478bd9Sstevel@tonic-gate  *	If hca_list_p is not NULL then the memory for the array of GUIDs is
7157c478bd9Sstevel@tonic-gate  *	allocated by the IBTF and should be freed by the caller using
7167c478bd9Sstevel@tonic-gate  *	ibt_free_hca_list(). If hca_list_p is NULL then no memory is allocated
7177c478bd9Sstevel@tonic-gate  *	by ibt_get_hca_list and only the number of HCAs in a system is returned.
7187c478bd9Sstevel@tonic-gate  *
7197c478bd9Sstevel@tonic-gate  *	It is assumed that the caller can block in kmem_alloc.
7207c478bd9Sstevel@tonic-gate  *
7217c478bd9Sstevel@tonic-gate  * ibt_free_hca_list()
7227c478bd9Sstevel@tonic-gate  *	Free the memory allocated by ibt_get_hca_list().
7237c478bd9Sstevel@tonic-gate  */
7247c478bd9Sstevel@tonic-gate uint_t ibt_get_hca_list(ib_guid_t **hca_list_p);
7257c478bd9Sstevel@tonic-gate 
7267c478bd9Sstevel@tonic-gate void ibt_free_hca_list(ib_guid_t *hca_list, uint_t entries);
7277c478bd9Sstevel@tonic-gate 
7287c478bd9Sstevel@tonic-gate /*
7297c478bd9Sstevel@tonic-gate  * ibt_open_hca()	- Open/Close a HCA. HCA can only be opened/closed
7307c478bd9Sstevel@tonic-gate  * ibt_close_hca()	  once. ibt_open_hca() takes a client's ibt handle
7317c478bd9Sstevel@tonic-gate  *			  and a GUID and returns a unique IBT client HCA
7327c478bd9Sstevel@tonic-gate  *			  handle.
7337c478bd9Sstevel@tonic-gate  *
7347c478bd9Sstevel@tonic-gate  * These routines can not be called from interrupt context.
7357c478bd9Sstevel@tonic-gate  */
7367c478bd9Sstevel@tonic-gate ibt_status_t ibt_open_hca(ibt_clnt_hdl_t ibt_hdl, ib_guid_t hca_guid,
7377c478bd9Sstevel@tonic-gate     ibt_hca_hdl_t *hca_hdl);
7387c478bd9Sstevel@tonic-gate 
7397c478bd9Sstevel@tonic-gate ibt_status_t ibt_close_hca(ibt_hca_hdl_t hca_hdl);
7407c478bd9Sstevel@tonic-gate 
7417c478bd9Sstevel@tonic-gate 
7427c478bd9Sstevel@tonic-gate /*
7437c478bd9Sstevel@tonic-gate  * ibt_query_hca()
7447c478bd9Sstevel@tonic-gate  * ibt_query_hca_byguid()
7457c478bd9Sstevel@tonic-gate  * 	Returns the static attributes of the specified HCA
7467c478bd9Sstevel@tonic-gate  */
7477c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_hca(ibt_hca_hdl_t hca_hdl, ibt_hca_attr_t *hca_attrs);
7487c478bd9Sstevel@tonic-gate 
7497c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_hca_byguid(ib_guid_t hca_guid,
7507c478bd9Sstevel@tonic-gate     ibt_hca_attr_t *hca_attrs);
7517c478bd9Sstevel@tonic-gate 
7527c478bd9Sstevel@tonic-gate 
7537c478bd9Sstevel@tonic-gate /*
7547c478bd9Sstevel@tonic-gate  * ibt_query_hca_ports()
7557c478bd9Sstevel@tonic-gate  * ibt_query_hca_ports_byguid()
7567c478bd9Sstevel@tonic-gate  *	Returns HCA port/ports attributes for the specified HCA port/ports.
7577c478bd9Sstevel@tonic-gate  *	ibt_query_hca_ports() allocates the memory required for the
7587c478bd9Sstevel@tonic-gate  *	ibt_hca_portinfo_t struct as well as the memory required for the SGID
7597c478bd9Sstevel@tonic-gate  *	and P_Key tables contained within that struct.
7607c478bd9Sstevel@tonic-gate  *
7617c478bd9Sstevel@tonic-gate  * ibt_free_portinfo()
7627c478bd9Sstevel@tonic-gate  *	Frees the memory allocated for a specified ibt_hca_portinfo_t struct.
7637c478bd9Sstevel@tonic-gate  */
7647c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_hca_ports(ibt_hca_hdl_t hca_hdl, uint8_t port,
7657c478bd9Sstevel@tonic-gate     ibt_hca_portinfo_t **port_info_p, uint_t *ports_p, uint_t *size_p);
7667c478bd9Sstevel@tonic-gate 
7677c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_hca_ports_byguid(ib_guid_t hca_guid, uint8_t port,
7687c478bd9Sstevel@tonic-gate     ibt_hca_portinfo_t **port_info_p, uint_t *ports_p, uint_t *size_p);
7697c478bd9Sstevel@tonic-gate 
7707c478bd9Sstevel@tonic-gate void ibt_free_portinfo(ibt_hca_portinfo_t *port_info, uint_t size);
7717c478bd9Sstevel@tonic-gate 
7727c478bd9Sstevel@tonic-gate /*
7737c478bd9Sstevel@tonic-gate  * ibt_set_hca_private()	- Set/get the client private data.
7747c478bd9Sstevel@tonic-gate  * ibt_get_hca_private()
7757c478bd9Sstevel@tonic-gate  */
7767c478bd9Sstevel@tonic-gate void ibt_set_hca_private(ibt_hca_hdl_t hca_hdl, void *clnt_private);
7777c478bd9Sstevel@tonic-gate void *ibt_get_hca_private(ibt_hca_hdl_t hca_hdl);
7787c478bd9Sstevel@tonic-gate 
7797c478bd9Sstevel@tonic-gate /*
7807c478bd9Sstevel@tonic-gate  * ibt_hca_handle_to_guid()
7817c478bd9Sstevel@tonic-gate  *	A helper function to retrieve HCA GUID for the specified handle.
7827c478bd9Sstevel@tonic-gate  *	Returns HCA GUID on which the specified Channel is allocated. Valid
7837c478bd9Sstevel@tonic-gate  *	if it is non-NULL on return.
7847c478bd9Sstevel@tonic-gate  */
7857c478bd9Sstevel@tonic-gate ib_guid_t ibt_hca_handle_to_guid(ibt_hca_hdl_t hca);
7867c478bd9Sstevel@tonic-gate 
7877c478bd9Sstevel@tonic-gate /*
7887c478bd9Sstevel@tonic-gate  * ibt_hca_guid_to_handle()
7897c478bd9Sstevel@tonic-gate  *	A helper function to retrieve a hca handle from a HCA GUID.
7907c478bd9Sstevel@tonic-gate  */
7917c478bd9Sstevel@tonic-gate ibt_status_t ibt_hca_guid_to_handle(ibt_clnt_hdl_t ibt_hdl, ib_guid_t hca_guid,
7927c478bd9Sstevel@tonic-gate     ibt_hca_hdl_t *hca_hdl);
7937c478bd9Sstevel@tonic-gate 
7947c478bd9Sstevel@tonic-gate /*
7957c478bd9Sstevel@tonic-gate  * CONNECTION ESTABLISHMENT/TEAR DOWN FUNCTIONS.
7967c478bd9Sstevel@tonic-gate  */
7977c478bd9Sstevel@tonic-gate 
7987c478bd9Sstevel@tonic-gate /*
7997c478bd9Sstevel@tonic-gate  * ibt_get_paths
8007c478bd9Sstevel@tonic-gate  *	Finds the best path to a specified destination (as determined by the
8017c478bd9Sstevel@tonic-gate  *	IBTL) that satisfies the requirements specified in an ibt_path_attr_t
8027c478bd9Sstevel@tonic-gate  *	struct.
8037c478bd9Sstevel@tonic-gate  */
8047c478bd9Sstevel@tonic-gate ibt_status_t ibt_get_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags,
8057c478bd9Sstevel@tonic-gate     ibt_path_attr_t *attr, uint8_t max_paths, ibt_path_info_t *paths,
8067c478bd9Sstevel@tonic-gate     uint8_t *num_paths_p);
8077c478bd9Sstevel@tonic-gate 
8087c478bd9Sstevel@tonic-gate 
8097c478bd9Sstevel@tonic-gate /*
8107c478bd9Sstevel@tonic-gate  * Callback function that can be used in ibt_aget_paths(), a Non-Blocking
8117c478bd9Sstevel@tonic-gate  * version of ibt_get_paths().
8127c478bd9Sstevel@tonic-gate  */
8137c478bd9Sstevel@tonic-gate typedef void (*ibt_path_handler_t)(void *arg, ibt_status_t retval,
8147c478bd9Sstevel@tonic-gate     ibt_path_info_t *paths, uint8_t num_paths);
8157c478bd9Sstevel@tonic-gate 
8167c478bd9Sstevel@tonic-gate /*
8177c478bd9Sstevel@tonic-gate  * Find path(s) to a given destination or service asynchronously.
8187c478bd9Sstevel@tonic-gate  * ibt_aget_paths() is a Non-Blocking version of ibt_get_paths().
8197c478bd9Sstevel@tonic-gate  */
8207c478bd9Sstevel@tonic-gate ibt_status_t ibt_aget_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags,
8217c478bd9Sstevel@tonic-gate     ibt_path_attr_t *attr, uint8_t max_paths, ibt_path_handler_t func,
8227c478bd9Sstevel@tonic-gate     void  *arg);
8237c478bd9Sstevel@tonic-gate 
8247c478bd9Sstevel@tonic-gate /*
8257c478bd9Sstevel@tonic-gate  * ibt_get_alt_path
8267c478bd9Sstevel@tonic-gate  *	Finds the best alternate path to a specified channel (as determined by
8277c478bd9Sstevel@tonic-gate  *	the IBTL) that satisfies the requirements specified in an
8287c478bd9Sstevel@tonic-gate  *	ibt_alt_path_attr_t struct.  The specified channel must have been
8297c478bd9Sstevel@tonic-gate  *	previously opened successfully using ibt_open_rc_channel.
8307c478bd9Sstevel@tonic-gate  */
8317c478bd9Sstevel@tonic-gate ibt_status_t ibt_get_alt_path(ibt_channel_hdl_t chan, ibt_path_flags_t flags,
8327c478bd9Sstevel@tonic-gate     ibt_alt_path_attr_t *attr, ibt_alt_path_info_t *alt_path);
8337c478bd9Sstevel@tonic-gate 
8347c478bd9Sstevel@tonic-gate /*
8357c478bd9Sstevel@tonic-gate  * ibt_open_rc_channel
8367c478bd9Sstevel@tonic-gate  * 	ibt_open_rc_channel() opens a previously allocated RC communication
8377c478bd9Sstevel@tonic-gate  *	channel. The IBTL initiates the channel establishment protocol.
8387c478bd9Sstevel@tonic-gate  */
8397c478bd9Sstevel@tonic-gate ibt_status_t ibt_open_rc_channel(ibt_channel_hdl_t rc_chan,
8407c478bd9Sstevel@tonic-gate     ibt_chan_open_flags_t flags, ibt_execution_mode_t mode,
8417c478bd9Sstevel@tonic-gate     ibt_chan_open_args_t *args, ibt_rc_returns_t *returns);
8427c478bd9Sstevel@tonic-gate 
8437c478bd9Sstevel@tonic-gate /*
8447c478bd9Sstevel@tonic-gate  * ibt_close_rc_channel
8457c478bd9Sstevel@tonic-gate  *	Close the specified channel. Outstanding work requests are flushed
8467c478bd9Sstevel@tonic-gate  *	so that the client can do the associated clean up. After that, the
8477c478bd9Sstevel@tonic-gate  *	client will usually deregister the previously registered memory,
8487c478bd9Sstevel@tonic-gate  *	then free the channel by calling ibt_free_rc_channel().
8497c478bd9Sstevel@tonic-gate  *
8507c478bd9Sstevel@tonic-gate  *	This function will reuse CM event Handler provided in
8517c478bd9Sstevel@tonic-gate  *	ibt_open_rc_channel().
8527c478bd9Sstevel@tonic-gate  */
8537c478bd9Sstevel@tonic-gate ibt_status_t ibt_close_rc_channel(ibt_channel_hdl_t rc_chan,
8547c478bd9Sstevel@tonic-gate     ibt_execution_mode_t mode, void *priv_data,
8557c478bd9Sstevel@tonic-gate     ibt_priv_data_len_t priv_data_len, uint8_t *ret_status,
8567c478bd9Sstevel@tonic-gate     void *ret_priv_data, ibt_priv_data_len_t *ret_priv_data_len_p);
8577c478bd9Sstevel@tonic-gate 
8587c478bd9Sstevel@tonic-gate /*
8597c478bd9Sstevel@tonic-gate  * ibt_prime_close_rc_channel
8607c478bd9Sstevel@tonic-gate  *
8617c478bd9Sstevel@tonic-gate  *	Allocates resources required for a close rc channel operation.
8627c478bd9Sstevel@tonic-gate  *	Calling ibt_prime_close_rc_channel() allows a channel to be
8637c478bd9Sstevel@tonic-gate  *	subsequently closed in interrupt context.
8647c478bd9Sstevel@tonic-gate  *
8657c478bd9Sstevel@tonic-gate  *	A call is first made to ibt_prime_close_rc_channel in non-interrupt
8667c478bd9Sstevel@tonic-gate  *	context, followed by ibt_close_rc_channel in non-blocking mode from
8677c478bd9Sstevel@tonic-gate  *	interrupt context
8687c478bd9Sstevel@tonic-gate  *
8697c478bd9Sstevel@tonic-gate  *	ibt_prime_close_rc_channel() can only be called on a previously opened
8707c478bd9Sstevel@tonic-gate  *	channel.
8717c478bd9Sstevel@tonic-gate  */
8727c478bd9Sstevel@tonic-gate ibt_status_t ibt_prime_close_rc_channel(ibt_channel_hdl_t rc_chan);
8737c478bd9Sstevel@tonic-gate 
8747c478bd9Sstevel@tonic-gate /*
8757c478bd9Sstevel@tonic-gate  * ibt_recycle_rc
8767c478bd9Sstevel@tonic-gate  *
8777c478bd9Sstevel@tonic-gate  *      Recycle a RC channel which has transitioned to Error state. The
8787c478bd9Sstevel@tonic-gate  *      ibt_recycle_rc() function transitions the channel from Error
8797c478bd9Sstevel@tonic-gate  *      state (IBT_STATE_ERROR) to the state ready for use by
8807c478bd9Sstevel@tonic-gate  *      ibt_open_rc_channel. Basically, this function is very similar to
8817c478bd9Sstevel@tonic-gate  *      ibt_alloc_rc_channel, but reuses an existing RC channel.
8827c478bd9Sstevel@tonic-gate  *
8837c478bd9Sstevel@tonic-gate  * Clients are allowed to make resource clean up/free calls in the CM handler
8847c478bd9Sstevel@tonic-gate  *
8857c478bd9Sstevel@tonic-gate  * Client(s) must not invoke blocking version (ie., func specified as NULL) of
8867c478bd9Sstevel@tonic-gate  * ibt_recycle_rc from cm callback for IBT_CM_EVENT_CONN_CLOSED
8877c478bd9Sstevel@tonic-gate  *
8887c478bd9Sstevel@tonic-gate  * Clients are strongly advised not to issue blocking calls from  func, as this
8897c478bd9Sstevel@tonic-gate  * would block the CM threads, and could delay or block other client connections
8907c478bd9Sstevel@tonic-gate  * and ibtl related API invocations.
8917c478bd9Sstevel@tonic-gate  */
8927c478bd9Sstevel@tonic-gate ibt_status_t ibt_recycle_rc(ibt_channel_hdl_t rc_chan, ibt_cep_flags_t control,
8937c478bd9Sstevel@tonic-gate     uint8_t hca_port_num, ibt_recycle_handler_t func, void *arg);
8947c478bd9Sstevel@tonic-gate 
8957c478bd9Sstevel@tonic-gate /*
8967c478bd9Sstevel@tonic-gate  * ibt_recycle_ud
8977c478bd9Sstevel@tonic-gate  *
8987c478bd9Sstevel@tonic-gate  *      Recycle a UD channel which has transitioned to Error state. The
8997c478bd9Sstevel@tonic-gate  *      ibt_recycle_ud() function transitions the channel from Error
9007c478bd9Sstevel@tonic-gate  *      state (IBT_STATE_ERROR) to a usable state (IBT_STATE_RTS).
9017c478bd9Sstevel@tonic-gate  *      Basically, this function is very similar to ibt_alloc_ud_channel,
9027c478bd9Sstevel@tonic-gate  *	but reuses an existing UD channel.
9037c478bd9Sstevel@tonic-gate  */
9047c478bd9Sstevel@tonic-gate ibt_status_t ibt_recycle_ud(ibt_channel_hdl_t ud_chan, uint8_t hca_port_num,
9057c478bd9Sstevel@tonic-gate     uint16_t pkey_ix, ib_qkey_t qkey);
9067c478bd9Sstevel@tonic-gate 
9077c478bd9Sstevel@tonic-gate /*
9087c478bd9Sstevel@tonic-gate  * MODIFY CHANNEL ATTRIBUTE FUNCTIONs.
9097c478bd9Sstevel@tonic-gate  */
9107c478bd9Sstevel@tonic-gate 
9117c478bd9Sstevel@tonic-gate /*
9127c478bd9Sstevel@tonic-gate  * ibt_pause_sendq
9137c478bd9Sstevel@tonic-gate  * ibt_unpause_sendq
9147c478bd9Sstevel@tonic-gate  *	Place the send queue of the specified channel into the send queue
9157c478bd9Sstevel@tonic-gate  *	drained state.
9167c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
9177c478bd9Sstevel@tonic-gate  */
9187c478bd9Sstevel@tonic-gate ibt_status_t ibt_pause_sendq(ibt_channel_hdl_t chan,
9197c478bd9Sstevel@tonic-gate     ibt_cep_modify_flags_t modify_flags);
9207c478bd9Sstevel@tonic-gate 
9217c478bd9Sstevel@tonic-gate ibt_status_t ibt_unpause_sendq(ibt_channel_hdl_t chan);
9227c478bd9Sstevel@tonic-gate 
9237c478bd9Sstevel@tonic-gate /*
9247c478bd9Sstevel@tonic-gate  * ibt_resize_queues()
9257c478bd9Sstevel@tonic-gate  *	Resize the SendQ/RecvQ sizes of a channel.
9267c478bd9Sstevel@tonic-gate  *
9277c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
9287c478bd9Sstevel@tonic-gate  */
9297c478bd9Sstevel@tonic-gate ibt_status_t ibt_resize_queues(ibt_channel_hdl_t chan, ibt_qflags_t flags,
9307c478bd9Sstevel@tonic-gate     ibt_queue_sizes_t *request_sz, ibt_queue_sizes_t *actual_sz);
9317c478bd9Sstevel@tonic-gate 
9327c478bd9Sstevel@tonic-gate /*
9337c478bd9Sstevel@tonic-gate  * ibt_query_queues()
9347c478bd9Sstevel@tonic-gate  *
9357c478bd9Sstevel@tonic-gate  *	Query the SendQ/RecvQ sizes of a channel.
9367c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
9377c478bd9Sstevel@tonic-gate  */
9387c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_queues(ibt_channel_hdl_t chan,
9397c478bd9Sstevel@tonic-gate     ibt_queue_sizes_t *actual_sz);
9407c478bd9Sstevel@tonic-gate 
9417c478bd9Sstevel@tonic-gate /*
9427c478bd9Sstevel@tonic-gate  * ibt_modify_rdma
9437c478bd9Sstevel@tonic-gate  *	Enable/disable RDMA operations.
9447c478bd9Sstevel@tonic-gate  *
9457c478bd9Sstevel@tonic-gate  *	Applicable for RC channels only.
9467c478bd9Sstevel@tonic-gate  */
9477c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_rdma(ibt_channel_hdl_t rc_chan,
9487c478bd9Sstevel@tonic-gate     ibt_cep_modify_flags_t modify_flags, ibt_cep_flags_t flags);
9497c478bd9Sstevel@tonic-gate 
9507c478bd9Sstevel@tonic-gate 
9517c478bd9Sstevel@tonic-gate /*
9527c478bd9Sstevel@tonic-gate  * ibt_set_rdma_resource
9537c478bd9Sstevel@tonic-gate  *	Change the number of resources to be used for incoming and outgoing
9547c478bd9Sstevel@tonic-gate  *	RDMA reads & Atomics.
9557c478bd9Sstevel@tonic-gate  */
9567c478bd9Sstevel@tonic-gate ibt_status_t ibt_set_rdma_resource(ibt_channel_hdl_t rc_chan,
9577c478bd9Sstevel@tonic-gate     ibt_cep_modify_flags_t modify_flags, uint8_t rdma_ra_out,
9587c478bd9Sstevel@tonic-gate     uint8_t rdma_ra_in);
9597c478bd9Sstevel@tonic-gate 
9607c478bd9Sstevel@tonic-gate /*
9617c478bd9Sstevel@tonic-gate  * ibt_change_port
9627c478bd9Sstevel@tonic-gate  *	Change the primary physical port of an RC channel. (This is done only
9637c478bd9Sstevel@tonic-gate  *	if HCA supports this capability).  Can only be called on a paused
9647c478bd9Sstevel@tonic-gate  *	channel.
9657c478bd9Sstevel@tonic-gate  *	Applicable for RC channels only.
9667c478bd9Sstevel@tonic-gate  */
9677c478bd9Sstevel@tonic-gate ibt_status_t ibt_change_port(ibt_channel_hdl_t rc_chan, uint8_t port_num);
9687c478bd9Sstevel@tonic-gate 
9697c478bd9Sstevel@tonic-gate 
9707c478bd9Sstevel@tonic-gate /*
9717c478bd9Sstevel@tonic-gate  * SERVICE REGISTRATION FUNCTIONS
9727c478bd9Sstevel@tonic-gate  */
9737c478bd9Sstevel@tonic-gate 
9747c478bd9Sstevel@tonic-gate /*
9757c478bd9Sstevel@tonic-gate  * ibt_register_service()
9767c478bd9Sstevel@tonic-gate  * ibt_deregister_service()
9777c478bd9Sstevel@tonic-gate  *	Register/deregister a Service (range of Service IDs) with the IBTF.
9787c478bd9Sstevel@tonic-gate  *
9797c478bd9Sstevel@tonic-gate  * ibt_bind_service()
9807c478bd9Sstevel@tonic-gate  * ibt_unbind_service()
9817c478bd9Sstevel@tonic-gate  * ibt_unbind_all_services()
9827c478bd9Sstevel@tonic-gate  *	Bind a Service to a given port (GID), and optionally create
9837c478bd9Sstevel@tonic-gate  *	service record(s) with the SA for ibt_get_paths() to find.
9847c478bd9Sstevel@tonic-gate  */
9857c478bd9Sstevel@tonic-gate ibt_status_t ibt_register_service(ibt_clnt_hdl_t ibt_hdl,
9867c478bd9Sstevel@tonic-gate     ibt_srv_desc_t *service, ib_svc_id_t sid, int num_sids,
9877c478bd9Sstevel@tonic-gate     ibt_srv_hdl_t *srv_hdl_p, ib_svc_id_t *ret_sid_p);
9887c478bd9Sstevel@tonic-gate 
9897c478bd9Sstevel@tonic-gate ibt_status_t ibt_deregister_service(ibt_clnt_hdl_t ibt_hdl,
9907c478bd9Sstevel@tonic-gate     ibt_srv_hdl_t srv_hdl);
9917c478bd9Sstevel@tonic-gate 
9927c478bd9Sstevel@tonic-gate ibt_status_t ibt_bind_service(ibt_srv_hdl_t srv_hdl, ib_gid_t gid,
9937c478bd9Sstevel@tonic-gate     ibt_srv_bind_t *srv_bind, void *cm_private, ibt_sbind_hdl_t *sb_hdl_p);
9947c478bd9Sstevel@tonic-gate 
9957c478bd9Sstevel@tonic-gate ibt_status_t ibt_unbind_service(ibt_srv_hdl_t srv_hdl, ibt_sbind_hdl_t sb_hdl);
9967c478bd9Sstevel@tonic-gate ibt_status_t ibt_unbind_all_services(ibt_srv_hdl_t srv_hdl);
9977c478bd9Sstevel@tonic-gate 
9987c478bd9Sstevel@tonic-gate /*
9997c478bd9Sstevel@tonic-gate  * ibt_cm_delay
10007c478bd9Sstevel@tonic-gate  *	A client CM handler/srv_handler function can call this function to
10017c478bd9Sstevel@tonic-gate  *	extend its response time to a CM event.
10027c478bd9Sstevel@tonic-gate  *	Applicable for RC channels only.
10037c478bd9Sstevel@tonic-gate  */
10047c478bd9Sstevel@tonic-gate ibt_status_t ibt_cm_delay(ibt_cmdelay_flags_t flags, void *cm_session_id,
10057c478bd9Sstevel@tonic-gate     clock_t service_time, void *priv_data, ibt_priv_data_len_t priv_data_len);
10067c478bd9Sstevel@tonic-gate 
10077c478bd9Sstevel@tonic-gate /*
10087c478bd9Sstevel@tonic-gate  * ibt_cm_proceed
10097c478bd9Sstevel@tonic-gate  *
10107c478bd9Sstevel@tonic-gate  * An IBT client calls ibt_cm_proceed() to proceed with a connection that
10117c478bd9Sstevel@tonic-gate  * previously deferred by the client returning IBT_CM_DEFER on a CM handler
10127c478bd9Sstevel@tonic-gate  * callback. CM events that can be deferred and continued with ibt_cm_proceed()
10137c478bd9Sstevel@tonic-gate  * are REQ_RCV, REP_RCV, LAP_RCV, and DREQ_RCV.
10147c478bd9Sstevel@tonic-gate  *
10157c478bd9Sstevel@tonic-gate  * NOTE :
10167c478bd9Sstevel@tonic-gate  *
10177c478bd9Sstevel@tonic-gate  * Typically CM completes processing of a client's CM handler return, with
10187c478bd9Sstevel@tonic-gate  * IBT_CM_DEFER status, before  processing of the corresponding ibt_cm_proceed()
10197c478bd9Sstevel@tonic-gate  * is started. However a race exists where by CM may not have completed the
10207c478bd9Sstevel@tonic-gate  * client's handler return processing when ibt_cm_proceed() is called by a
10217c478bd9Sstevel@tonic-gate  * client. In this case ibt_cm_proceed() will block until processing of the
10227c478bd9Sstevel@tonic-gate  * client's CM handler return is complete.
10237c478bd9Sstevel@tonic-gate  *
10247c478bd9Sstevel@tonic-gate  * A client that returns IBT_CM_DEFER from the cm handler must
10257c478bd9Sstevel@tonic-gate  * subsequently make a call to ibt_cm_proceed(). It is illegal to call
10267c478bd9Sstevel@tonic-gate  * ibt_cm_proceed() on a channel that has not had the connection
10277c478bd9Sstevel@tonic-gate  * establishment deferred.
10287c478bd9Sstevel@tonic-gate  *
10297c478bd9Sstevel@tonic-gate  * Client cannot call ibt_cm_proceed from the cm handler.
10307c478bd9Sstevel@tonic-gate  */
10317c478bd9Sstevel@tonic-gate ibt_status_t ibt_cm_proceed(ibt_cm_event_type_t event, void *session_id,
10327c478bd9Sstevel@tonic-gate     ibt_cm_status_t status, ibt_cm_proceed_reply_t *cm_event_data,
10337c478bd9Sstevel@tonic-gate     void *priv_data, ibt_priv_data_len_t priv_data_len);
10347c478bd9Sstevel@tonic-gate 
10357c478bd9Sstevel@tonic-gate /*
10367c478bd9Sstevel@tonic-gate  * ibt_cm_ud_proceed
10377c478bd9Sstevel@tonic-gate  *
10387c478bd9Sstevel@tonic-gate  * An IBT client calls ibt_cm_ud_proceed() to proceed with an
10397c478bd9Sstevel@tonic-gate  * IBT_CM_UD_EVENT_SIDR_REQ  UD event that was previously deferred by the
10407c478bd9Sstevel@tonic-gate  * client returning IBT_CM_DEFER on a CM UD handler callback.
10417c478bd9Sstevel@tonic-gate  * NOTE :
10427c478bd9Sstevel@tonic-gate  *
10437c478bd9Sstevel@tonic-gate  * Typically CM completes processing of a client's CM handler return, with
10447c478bd9Sstevel@tonic-gate  * IBT_CM_DEFER status, before  processing of the corresponding
10457c478bd9Sstevel@tonic-gate  * ibt_cm_ud_proceed() is started. However a race exists where by CM may not
10467c478bd9Sstevel@tonic-gate  * have completed the client's handler return processing when
10477c478bd9Sstevel@tonic-gate  * ibt_cm_ud_proceed() is called by a client. In this case ibt_cm_ud_proceed()
10487c478bd9Sstevel@tonic-gate  * will block until processing of the client's CM handler return is complete.
10497c478bd9Sstevel@tonic-gate  *
10507c478bd9Sstevel@tonic-gate  * A client that returns IBT_CM_DEFER from the cm handler must
10517c478bd9Sstevel@tonic-gate  * subsequently make a call to ibt_cm_ud_proceed(). It is illegal to call
10527c478bd9Sstevel@tonic-gate  * ibt_cm_ud_proceed() on a channel that has not had the connection
10537c478bd9Sstevel@tonic-gate  * establishment deferred.
10547c478bd9Sstevel@tonic-gate  *
10557c478bd9Sstevel@tonic-gate  * Client cannot call ibt_cm_ud_proceed from the cm handler.
10567c478bd9Sstevel@tonic-gate  */
10577c478bd9Sstevel@tonic-gate ibt_status_t ibt_cm_ud_proceed(void *session_id, ibt_channel_hdl_t ud_channel,
10587c478bd9Sstevel@tonic-gate     ibt_cm_status_t status, ibt_redirect_info_t *redirect_infop,
10597c478bd9Sstevel@tonic-gate     void *priv_data, ibt_priv_data_len_t priv_data_len);
10607c478bd9Sstevel@tonic-gate 
10617c478bd9Sstevel@tonic-gate 
10627c478bd9Sstevel@tonic-gate /*
10637c478bd9Sstevel@tonic-gate  * COMPLETION QUEUES.
10647c478bd9Sstevel@tonic-gate  *
10657c478bd9Sstevel@tonic-gate  * ibt_alloc_cq_sched()
10667c478bd9Sstevel@tonic-gate  *	Reserve CQ scheduling class resources
10677c478bd9Sstevel@tonic-gate  *
10687c478bd9Sstevel@tonic-gate  * ibt_free_cq_sched()
10697c478bd9Sstevel@tonic-gate  *	Free CQ scheduling class resources
10707c478bd9Sstevel@tonic-gate  */
10717c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_cq_sched(ibt_hca_hdl_t hca_hdl,
10727c478bd9Sstevel@tonic-gate     ibt_cq_sched_attr_t *attr, ibt_sched_hdl_t *sched_hdl_p);
10737c478bd9Sstevel@tonic-gate 
10747c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_cq_sched(ibt_hca_hdl_t hca_hdl,
1075*17a2b317SBill Taylor     ibt_sched_hdl_t sched_hdl);
10767c478bd9Sstevel@tonic-gate 
10777c478bd9Sstevel@tonic-gate /*
10787c478bd9Sstevel@tonic-gate  * ibt_alloc_cq()
10797c478bd9Sstevel@tonic-gate  *	Allocate a completion queue.
10807c478bd9Sstevel@tonic-gate  */
10817c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_cq(ibt_hca_hdl_t hca_hdl, ibt_cq_attr_t *cq_attr,
10827c478bd9Sstevel@tonic-gate     ibt_cq_hdl_t *ibt_cq_p, uint_t *real_size);
10837c478bd9Sstevel@tonic-gate 
10847c478bd9Sstevel@tonic-gate /*
10857c478bd9Sstevel@tonic-gate  * ibt_free_cq()
10867c478bd9Sstevel@tonic-gate  *	Free allocated CQ resources.
10877c478bd9Sstevel@tonic-gate  */
10887c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_cq(ibt_cq_hdl_t ibt_cq);
10897c478bd9Sstevel@tonic-gate 
10907c478bd9Sstevel@tonic-gate 
10917c478bd9Sstevel@tonic-gate /*
10927c478bd9Sstevel@tonic-gate  * ibt_enable_cq_notify()
10937c478bd9Sstevel@tonic-gate  *	Enable notification requests on the specified CQ.
10947c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
10957c478bd9Sstevel@tonic-gate  *
10967c478bd9Sstevel@tonic-gate  *	Completion notifications are disabled by setting the completion
10977c478bd9Sstevel@tonic-gate  *	handler to NULL by calling ibt_set_cq_handler().
10987c478bd9Sstevel@tonic-gate  */
10997c478bd9Sstevel@tonic-gate ibt_status_t ibt_enable_cq_notify(ibt_cq_hdl_t ibt_cq,
11007c478bd9Sstevel@tonic-gate     ibt_cq_notify_flags_t notify_type);
11017c478bd9Sstevel@tonic-gate 
11027c478bd9Sstevel@tonic-gate /*
11037c478bd9Sstevel@tonic-gate  * ibt_set_cq_handler()
11047c478bd9Sstevel@tonic-gate  *	Register a work request completion handler with the IBTF.
11057c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
11067c478bd9Sstevel@tonic-gate  *
11077c478bd9Sstevel@tonic-gate  *	Completion notifications are disabled by setting the completion
11087c478bd9Sstevel@tonic-gate  *	handler to NULL. When setting the handler to NULL, no additional
11097c478bd9Sstevel@tonic-gate  *	calls to the CQ handler will be initiated.
11107c478bd9Sstevel@tonic-gate  *
11117c478bd9Sstevel@tonic-gate  *	This function does not otherwise change the state of previous
11127c478bd9Sstevel@tonic-gate  *	calls to ibt_enable_cq_notify().
11137c478bd9Sstevel@tonic-gate  */
11147c478bd9Sstevel@tonic-gate void ibt_set_cq_handler(ibt_cq_hdl_t ibt_cq,
11157c478bd9Sstevel@tonic-gate     ibt_cq_handler_t completion_handler, void *arg);
11167c478bd9Sstevel@tonic-gate 
11177c478bd9Sstevel@tonic-gate /*
11187c478bd9Sstevel@tonic-gate  * ibt_poll_cq()
11197c478bd9Sstevel@tonic-gate  *	Poll the specified CQ for the completion of work requests (WRs).
11207c478bd9Sstevel@tonic-gate  *	If the CQ contains completed WRs, up to num_wc of them are returned.
11217c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
11227c478bd9Sstevel@tonic-gate  */
11237c478bd9Sstevel@tonic-gate ibt_status_t ibt_poll_cq(ibt_cq_hdl_t ibt_cq, ibt_wc_t *work_completions,
11247c478bd9Sstevel@tonic-gate     uint_t num_wc, uint_t *num_polled);
11257c478bd9Sstevel@tonic-gate 
11267c478bd9Sstevel@tonic-gate /*
11277c478bd9Sstevel@tonic-gate  * ibt_query_cq()
11287c478bd9Sstevel@tonic-gate  *	Return the total number of entries in the CQ.
11297c478bd9Sstevel@tonic-gate  */
113003494a98SBill Taylor ibt_status_t ibt_query_cq(ibt_cq_hdl_t ibt_cq, uint_t *entries,
113103494a98SBill Taylor     uint_t *count_p, uint_t *usec_p, ibt_cq_handler_id_t *hid_p);
11327c478bd9Sstevel@tonic-gate 
1133*17a2b317SBill Taylor /*
1134*17a2b317SBill Taylor  * ibt_query_cq_handler_id()
1135*17a2b317SBill Taylor  *	Return interrupt characteristics of the CQ handler
1136*17a2b317SBill Taylor  */
1137*17a2b317SBill Taylor ibt_status_t ibt_query_cq_handler_id(ibt_hca_hdl_t hca_hdl,
1138*17a2b317SBill Taylor     ibt_cq_handler_id_t hid, ibt_cq_handler_attr_t *attrs);
1139*17a2b317SBill Taylor 
11407c478bd9Sstevel@tonic-gate /*
11417c478bd9Sstevel@tonic-gate  * ibt_resize_cq()
11427c478bd9Sstevel@tonic-gate  *	Change the size of a CQ.
11437c478bd9Sstevel@tonic-gate  */
11447c478bd9Sstevel@tonic-gate ibt_status_t ibt_resize_cq(ibt_cq_hdl_t ibt_cq, uint_t new_sz, uint_t *real_sz);
11457c478bd9Sstevel@tonic-gate 
114603494a98SBill Taylor /*
114703494a98SBill Taylor  * ibt_modify_cq()
114803494a98SBill Taylor  *	Change the interrupt moderation values of a CQ.
114903494a98SBill Taylor  *	"count" is number of completions before interrupting.
115003494a98SBill Taylor  *	"usec" is the number of microseconds before interrupting.
115103494a98SBill Taylor  */
115203494a98SBill Taylor ibt_status_t ibt_modify_cq(ibt_cq_hdl_t ibt_cq, uint_t count, uint_t usec,
115303494a98SBill Taylor     ibt_cq_handler_id_t hid);
115403494a98SBill Taylor 
11557c478bd9Sstevel@tonic-gate /*
11567c478bd9Sstevel@tonic-gate  * ibt_set_cq_private()
11577c478bd9Sstevel@tonic-gate  * ibt_get_cq_private()
11587c478bd9Sstevel@tonic-gate  *	Set/get the client private data.
11597c478bd9Sstevel@tonic-gate  */
11607c478bd9Sstevel@tonic-gate void ibt_set_cq_private(ibt_cq_hdl_t ibt_cq, void *clnt_private);
11617c478bd9Sstevel@tonic-gate void *ibt_get_cq_private(ibt_cq_hdl_t ibt_cq);
11627c478bd9Sstevel@tonic-gate 
11637c478bd9Sstevel@tonic-gate 
11647c478bd9Sstevel@tonic-gate /*
11657c478bd9Sstevel@tonic-gate  * Memory Management Functions.
11667c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
11677c478bd9Sstevel@tonic-gate  *
11687c478bd9Sstevel@tonic-gate  * ibt_register_mr()
11697c478bd9Sstevel@tonic-gate  * 	Prepares a virtually addressed memory region for use by a HCA. A
11707c478bd9Sstevel@tonic-gate  *	description of the registered memory suitable for use in Work Requests
11717c478bd9Sstevel@tonic-gate  *	(WRs) is returned in the ibt_mr_desc_t parameter.
11727c478bd9Sstevel@tonic-gate  *
11737c478bd9Sstevel@tonic-gate  * ibt_register_buf()
11747c478bd9Sstevel@tonic-gate  * 	Prepares a memory region described by a buf(9S) struct for use by a
11757c478bd9Sstevel@tonic-gate  *	HCA. A description of the registered memory suitable for use in
11767c478bd9Sstevel@tonic-gate  *	Work Requests (WRs) is returned in the ibt_mr_desc_t parameter.
11777c478bd9Sstevel@tonic-gate  *
11787c478bd9Sstevel@tonic-gate  * ibt_query_mr()
11797c478bd9Sstevel@tonic-gate  *	Retrieves information about a specified memory region.
11807c478bd9Sstevel@tonic-gate  *
11817c478bd9Sstevel@tonic-gate  * ibt_deregister_mr()
11827c478bd9Sstevel@tonic-gate  *	Remove a memory region from a HCA translation table, and free all
11837c478bd9Sstevel@tonic-gate  *	resources associated with the memory region.
11847c478bd9Sstevel@tonic-gate  *
11857c478bd9Sstevel@tonic-gate  * ibt_reregister_mr()
11867c478bd9Sstevel@tonic-gate  * ibt_reregister_buf()
11877c478bd9Sstevel@tonic-gate  *	Modify the attributes of an existing memory region.
11887c478bd9Sstevel@tonic-gate  *
11897c478bd9Sstevel@tonic-gate  * ibt_register_shared_mr()
11907c478bd9Sstevel@tonic-gate  *	Given an existing memory region, a new memory region associated with
11917c478bd9Sstevel@tonic-gate  *	the same physical locations is created.
11927c478bd9Sstevel@tonic-gate  *
11937c478bd9Sstevel@tonic-gate  * ibt_sync_mr()
11947c478bd9Sstevel@tonic-gate  *	Sync a memory region for either RDMA reads or RDMA writes
11957c478bd9Sstevel@tonic-gate  *
11967c478bd9Sstevel@tonic-gate  * ibt_alloc_mw()
11977c478bd9Sstevel@tonic-gate  *	Allocate a memory window.
11987c478bd9Sstevel@tonic-gate  *
11997c478bd9Sstevel@tonic-gate  * ibt_query_mw()
12007c478bd9Sstevel@tonic-gate  *	Retrieves information about a specified memory window.
12017c478bd9Sstevel@tonic-gate  *
12027c478bd9Sstevel@tonic-gate  * ibt_free_mw()
12037c478bd9Sstevel@tonic-gate  *	De-allocate the Memory Window.
12047c478bd9Sstevel@tonic-gate  */
12057c478bd9Sstevel@tonic-gate ibt_status_t ibt_register_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
12067c478bd9Sstevel@tonic-gate     ibt_mr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc);
12077c478bd9Sstevel@tonic-gate 
12087c478bd9Sstevel@tonic-gate ibt_status_t ibt_register_buf(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
12097c478bd9Sstevel@tonic-gate     ibt_smr_attr_t *mem_bpattr, struct buf *bp, ibt_mr_hdl_t *mr_hdl_p,
12107c478bd9Sstevel@tonic-gate     ibt_mr_desc_t *mem_desc);
12117c478bd9Sstevel@tonic-gate 
12127c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
12137c478bd9Sstevel@tonic-gate     ibt_mr_query_attr_t *attr);
12147c478bd9Sstevel@tonic-gate 
12157c478bd9Sstevel@tonic-gate ibt_status_t ibt_deregister_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl);
12167c478bd9Sstevel@tonic-gate 
12177c478bd9Sstevel@tonic-gate ibt_status_t ibt_reregister_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
12187c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t pd, ibt_mr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p,
12197c478bd9Sstevel@tonic-gate     ibt_mr_desc_t *mem_desc);
12207c478bd9Sstevel@tonic-gate 
12217c478bd9Sstevel@tonic-gate ibt_status_t ibt_reregister_buf(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
12227c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t pd, ibt_smr_attr_t *mem_bpattr, struct buf *bp,
12237c478bd9Sstevel@tonic-gate     ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc);
12247c478bd9Sstevel@tonic-gate 
12257c478bd9Sstevel@tonic-gate ibt_status_t ibt_register_shared_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
12267c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t pd, ibt_smr_attr_t *mem_sattr, ibt_mr_hdl_t *mr_hdl_p,
12277c478bd9Sstevel@tonic-gate     ibt_mr_desc_t *mem_desc);
12287c478bd9Sstevel@tonic-gate 
12297c478bd9Sstevel@tonic-gate ibt_status_t ibt_sync_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_sync_t *mr_segments,
12307c478bd9Sstevel@tonic-gate     size_t num_segments);
12317c478bd9Sstevel@tonic-gate 
12327c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_mw(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
12337c478bd9Sstevel@tonic-gate     ibt_mw_flags_t flags, ibt_mw_hdl_t *mw_hdl_p, ibt_rkey_t *rkey);
12347c478bd9Sstevel@tonic-gate 
12357c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_mw(ibt_hca_hdl_t hca_hdl, ibt_mw_hdl_t mw_hdl,
12367c478bd9Sstevel@tonic-gate     ibt_mw_query_attr_t *mw_attr_p);
12377c478bd9Sstevel@tonic-gate 
12387c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_mw(ibt_hca_hdl_t hca_hdl, ibt_mw_hdl_t mw_hdl);
12397c478bd9Sstevel@tonic-gate 
12407c478bd9Sstevel@tonic-gate /*
12417c478bd9Sstevel@tonic-gate  * ibt_alloc_lkey()
12427c478bd9Sstevel@tonic-gate  * 	Allocates physical buffer list resources for use in memory
12437c478bd9Sstevel@tonic-gate  *	registrations.
12447c478bd9Sstevel@tonic-gate  *
12457c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
12467c478bd9Sstevel@tonic-gate  */
12477c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_lkey(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
12487c478bd9Sstevel@tonic-gate     ibt_lkey_flags_t flags, uint_t phys_buf_list_sz, ibt_mr_hdl_t *mr_p,
12497c478bd9Sstevel@tonic-gate     ibt_pmr_desc_t *mem_desc_p);
12507c478bd9Sstevel@tonic-gate 
12517c478bd9Sstevel@tonic-gate 
12527c478bd9Sstevel@tonic-gate /*
12537c478bd9Sstevel@tonic-gate  * Physical Memory Management Functions.
12547c478bd9Sstevel@tonic-gate  *	Applicable for both RC and UD channels.
12557c478bd9Sstevel@tonic-gate  *
12567c478bd9Sstevel@tonic-gate  * ibt_register_phys_mr()
12577c478bd9Sstevel@tonic-gate  *	Prepares a physically addressed memory region for use by a HCA.
12587c478bd9Sstevel@tonic-gate  *
12597c478bd9Sstevel@tonic-gate  * ibt_reregister_phys_mr()
12607c478bd9Sstevel@tonic-gate  *	Modify the attributes of an existing memory region.
12617c478bd9Sstevel@tonic-gate  */
12627c478bd9Sstevel@tonic-gate ibt_status_t ibt_register_phys_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
12637c478bd9Sstevel@tonic-gate     ibt_pmr_attr_t *mem_pattr, ibt_mr_hdl_t *mr_hdl_p,
12647c478bd9Sstevel@tonic-gate     ibt_pmr_desc_t *mem_desc_p);
12657c478bd9Sstevel@tonic-gate 
12667c478bd9Sstevel@tonic-gate ibt_status_t ibt_reregister_phys_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
12677c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, ibt_mr_hdl_t *mr_hdl_p,
12687c478bd9Sstevel@tonic-gate     ibt_pmr_desc_t *mem_desc_p);
12697c478bd9Sstevel@tonic-gate 
12707c478bd9Sstevel@tonic-gate 
1271*17a2b317SBill Taylor /*
1272*17a2b317SBill Taylor  * Register DMA Memory Region
1273*17a2b317SBill Taylor  */
1274*17a2b317SBill Taylor ibt_status_t ibt_register_dma_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
1275*17a2b317SBill Taylor     ibt_dmr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc);
1276*17a2b317SBill Taylor 
1277*17a2b317SBill Taylor 
12787c478bd9Sstevel@tonic-gate /*
12797c478bd9Sstevel@tonic-gate  * Address Translation.
12807c478bd9Sstevel@tonic-gate  */
12817c478bd9Sstevel@tonic-gate 
12827c478bd9Sstevel@tonic-gate /*
12837c478bd9Sstevel@tonic-gate  * ibt_map_mem_area()
12847c478bd9Sstevel@tonic-gate  *	Translate a kernel virtual address range into HCA physical addresses.
12857c478bd9Sstevel@tonic-gate  *	A set of physical addresses, that can be used with "Reserved L_Key",
12867c478bd9Sstevel@tonic-gate  *	register physical,  and "Fast Registration Work Request" operations
12877c478bd9Sstevel@tonic-gate  *	is returned.
12887c478bd9Sstevel@tonic-gate  */
12897c478bd9Sstevel@tonic-gate ibt_status_t ibt_map_mem_area(ibt_hca_hdl_t hca_hdl, ibt_va_attr_t *va_attrs,
1290c7facc54SBill Taylor     uint_t paddr_list_len, ibt_reg_req_t *reg_req, ibt_ma_hdl_t *ma_hdl_p);
12917c478bd9Sstevel@tonic-gate 
12927c478bd9Sstevel@tonic-gate /*
12937c478bd9Sstevel@tonic-gate  * ibt_unmap_mem_area()
12947c478bd9Sstevel@tonic-gate  *	Un pin physical pages pinned during an ibt_map_mem_area() call.
12957c478bd9Sstevel@tonic-gate  */
12967c478bd9Sstevel@tonic-gate ibt_status_t ibt_unmap_mem_area(ibt_hca_hdl_t hca_hdl, ibt_ma_hdl_t ma_hdl);
12977c478bd9Sstevel@tonic-gate 
129803494a98SBill Taylor /* ibt_map_mem_iov() */
129903494a98SBill Taylor ibt_status_t ibt_map_mem_iov(ibt_hca_hdl_t hca_hdl,
130003494a98SBill Taylor     ibt_iov_attr_t *iov_attr, ibt_all_wr_t *wr, ibt_mi_hdl_t *mi_hdl);
130103494a98SBill Taylor 
130203494a98SBill Taylor /* ibt_unmap_mem_iov() */
130303494a98SBill Taylor ibt_status_t ibt_unmap_mem_iov(ibt_hca_hdl_t hca_hdl, ibt_mi_hdl_t mi_hdl);
130403494a98SBill Taylor 
13057c478bd9Sstevel@tonic-gate /*
13067c478bd9Sstevel@tonic-gate  * Work Request Functions
13077c478bd9Sstevel@tonic-gate  *	Applicable for RC and UD channels.
13087c478bd9Sstevel@tonic-gate  *
13097c478bd9Sstevel@tonic-gate  * ibt_post_send()
13107c478bd9Sstevel@tonic-gate  *	Post send work requests to the specified channel.
13117c478bd9Sstevel@tonic-gate  *
13127c478bd9Sstevel@tonic-gate  * ibt_post_recv()
13137c478bd9Sstevel@tonic-gate  * ibt_post_srq()
13147c478bd9Sstevel@tonic-gate  *	Post receive work requests to the specified channel.
13157c478bd9Sstevel@tonic-gate  */
13167c478bd9Sstevel@tonic-gate ibt_status_t ibt_post_send(ibt_channel_hdl_t chan, ibt_send_wr_t *wr_list,
13177c478bd9Sstevel@tonic-gate     uint_t num_wr, uint_t *posted);
13187c478bd9Sstevel@tonic-gate 
13197c478bd9Sstevel@tonic-gate ibt_status_t ibt_post_recv(ibt_channel_hdl_t chan, ibt_recv_wr_t *wr_list,
13207c478bd9Sstevel@tonic-gate     uint_t num_wr, uint_t *posted);
13217c478bd9Sstevel@tonic-gate 
13227c478bd9Sstevel@tonic-gate ibt_status_t ibt_post_srq(ibt_srq_hdl_t srq, ibt_recv_wr_t *wr_list,
13237c478bd9Sstevel@tonic-gate     uint_t num_wr, uint_t *posted);
13247c478bd9Sstevel@tonic-gate 
13257c478bd9Sstevel@tonic-gate 
13267c478bd9Sstevel@tonic-gate /*
13277c478bd9Sstevel@tonic-gate  * Alternate Path Migration Functions.
13287c478bd9Sstevel@tonic-gate  *	Applicable for RC channels only.
13297c478bd9Sstevel@tonic-gate  *
13307c478bd9Sstevel@tonic-gate  *
13317c478bd9Sstevel@tonic-gate  * ibt_get_alt_path()
13327c478bd9Sstevel@tonic-gate  *	Finds the best alternate path to a specified channel (as determined by
13337c478bd9Sstevel@tonic-gate  *	the IBTL) that satisfies the requirements specified in an
13347c478bd9Sstevel@tonic-gate  *	ibt_alt_path_attr_t struct.  The specified channel must have been
13357c478bd9Sstevel@tonic-gate  *	previously opened successfully using ibt_open_rc_channel.
13367c478bd9Sstevel@tonic-gate  *	This function also ensures that the service being accessed by the
13377c478bd9Sstevel@tonic-gate  *	channel is available at the selected alternate port.
13387c478bd9Sstevel@tonic-gate  *
13397c478bd9Sstevel@tonic-gate  *	Note: The apa_dgid must be on the same destination channel adapter,
13407c478bd9Sstevel@tonic-gate  *	if specified.
13417c478bd9Sstevel@tonic-gate  *
13427c478bd9Sstevel@tonic-gate  *
13437c478bd9Sstevel@tonic-gate  * ibt_set_alt_path()
13447c478bd9Sstevel@tonic-gate  *	Load the specified alternate path. Causes the CM to send an LAP message
13457c478bd9Sstevel@tonic-gate  *	to the remote node. If successful, the local channel is updated with
13467c478bd9Sstevel@tonic-gate  *	the new alternate path and the channel migration state is set to REARM.
13477c478bd9Sstevel@tonic-gate  *	Can only be called on a previously opened RC channel. The channel must
13487c478bd9Sstevel@tonic-gate  *	be either in RTS or paused state.
13497c478bd9Sstevel@tonic-gate  *
13507c478bd9Sstevel@tonic-gate  *
13517c478bd9Sstevel@tonic-gate  * ibt_migrate_path()
13527c478bd9Sstevel@tonic-gate  *	Force the CI to use the alternate path. The alternate path becomes
13537c478bd9Sstevel@tonic-gate  *	the primary path. A new alternate path should be loaded and enabled.
13547c478bd9Sstevel@tonic-gate  */
13557c478bd9Sstevel@tonic-gate ibt_status_t ibt_get_alt_path(ibt_channel_hdl_t rc_chan, ibt_path_flags_t flags,
13567c478bd9Sstevel@tonic-gate     ibt_alt_path_attr_t *attr, ibt_alt_path_info_t *alt_pathp);
13577c478bd9Sstevel@tonic-gate 
13587c478bd9Sstevel@tonic-gate ibt_status_t ibt_set_alt_path(ibt_channel_hdl_t rc_chan,
13597c478bd9Sstevel@tonic-gate     ibt_execution_mode_t mode, ibt_alt_path_info_t *alt_pinfo, void *priv_data,
13607c478bd9Sstevel@tonic-gate     ibt_priv_data_len_t priv_data_len, ibt_ap_returns_t *ret_args);
13617c478bd9Sstevel@tonic-gate 
13627c478bd9Sstevel@tonic-gate ibt_status_t ibt_migrate_path(ibt_channel_hdl_t rc_chan);
13637c478bd9Sstevel@tonic-gate 
13647c478bd9Sstevel@tonic-gate 
13657c478bd9Sstevel@tonic-gate /*
13667c478bd9Sstevel@tonic-gate  * Multicast group Functions.
13677c478bd9Sstevel@tonic-gate  *	Applicable for UD channels only.
13687c478bd9Sstevel@tonic-gate  */
13697c478bd9Sstevel@tonic-gate 
13707c478bd9Sstevel@tonic-gate /*
13717c478bd9Sstevel@tonic-gate  * ibt_attach_mcg()
13727c478bd9Sstevel@tonic-gate  *	Attaches a UD channel to the specified multicast group. On successful
13737c478bd9Sstevel@tonic-gate  *	completion, this channel will be provided with a copy of every
13747c478bd9Sstevel@tonic-gate  *	multicast message addressed to the group specified by the MGID
13757c478bd9Sstevel@tonic-gate  *	(mcg_info->mc_adds_vect.av_dgid) and received on the HCA port with
13767c478bd9Sstevel@tonic-gate  *	which the channel is associated.
13777c478bd9Sstevel@tonic-gate  */
13787c478bd9Sstevel@tonic-gate ibt_status_t ibt_attach_mcg(ibt_channel_hdl_t ud_chan,
13797c478bd9Sstevel@tonic-gate     ibt_mcg_info_t *mcg_info);
13807c478bd9Sstevel@tonic-gate 
13817c478bd9Sstevel@tonic-gate /*
13827c478bd9Sstevel@tonic-gate  * ibt_detach_mcg()
13837c478bd9Sstevel@tonic-gate  *	Detach the specified UD channel from the specified multicast group.
13847c478bd9Sstevel@tonic-gate  */
13857c478bd9Sstevel@tonic-gate ibt_status_t ibt_detach_mcg(ibt_channel_hdl_t ud_chan,
13867c478bd9Sstevel@tonic-gate     ibt_mcg_info_t *mcg_info);
13877c478bd9Sstevel@tonic-gate 
13887c478bd9Sstevel@tonic-gate /*
13897c478bd9Sstevel@tonic-gate  * ibt_join_mcg()
13907c478bd9Sstevel@tonic-gate  *	Join a multicast group.  The first full member "join" causes the MCG
13917c478bd9Sstevel@tonic-gate  *	to be created.
13927c478bd9Sstevel@tonic-gate  */
13937c478bd9Sstevel@tonic-gate ibt_status_t ibt_join_mcg(ib_gid_t rgid, ibt_mcg_attr_t *mcg_attr,
13947c478bd9Sstevel@tonic-gate     ibt_mcg_info_t *mcg_info_p,  ibt_mcg_handler_t func, void  *arg);
13957c478bd9Sstevel@tonic-gate 
13967c478bd9Sstevel@tonic-gate /*
13977c478bd9Sstevel@tonic-gate  * ibt_leave_mcg()
13987c478bd9Sstevel@tonic-gate  *	The port associated with the port GID shall be removed from the
13997c478bd9Sstevel@tonic-gate  *	multicast group specified by MGID (mc_gid) or from all the multicast
14007c478bd9Sstevel@tonic-gate  *	groups of which it is a member if the MGID (mc_gid) is not specified
14017c478bd9Sstevel@tonic-gate  *	(i.e. mc_gid.mgid_prefix must have 8-bits of 11111111 at the start of
14027c478bd9Sstevel@tonic-gate  *	the GID to identify this as being a multicast GID).
14037c478bd9Sstevel@tonic-gate  *
14047c478bd9Sstevel@tonic-gate  *	The last full member to leave causes the destruction of the Multicast
14057c478bd9Sstevel@tonic-gate  *	Group.
14067c478bd9Sstevel@tonic-gate  */
14077c478bd9Sstevel@tonic-gate ibt_status_t ibt_leave_mcg(ib_gid_t rgid, ib_gid_t mc_gid, ib_gid_t port_gid,
14087c478bd9Sstevel@tonic-gate     uint8_t mc_join_state);
14097c478bd9Sstevel@tonic-gate 
14107c478bd9Sstevel@tonic-gate /*
14117c478bd9Sstevel@tonic-gate  * ibt_query_mcg()
14127c478bd9Sstevel@tonic-gate  *	Request information on multicast groups that match the parameters
14137c478bd9Sstevel@tonic-gate  *	specified in mcg_attr. Information on each multicast group is returned
14147c478bd9Sstevel@tonic-gate  *	to the caller in the form of an array of ibt_mcg_info_t.
14157c478bd9Sstevel@tonic-gate  *	ibt_query_mcg() allocates the memory for this array and returns a
14167c478bd9Sstevel@tonic-gate  *	pointer to the array (mcgs_p) and the number of entries in the array
14177c478bd9Sstevel@tonic-gate  *	(entries_p). This memory should be freed by the client using
14187c478bd9Sstevel@tonic-gate  *	ibt_free_mcg_info().
14197c478bd9Sstevel@tonic-gate  */
14207c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_mcg(ib_gid_t rgid, ibt_mcg_attr_t *mcg_attr,
14217c478bd9Sstevel@tonic-gate     uint_t mcgs_max_num, ibt_mcg_info_t **mcgs_info_p, uint_t *entries_p);
14227c478bd9Sstevel@tonic-gate 
14237c478bd9Sstevel@tonic-gate /*
14247c478bd9Sstevel@tonic-gate  * ibt_free_mcg_info()
14257c478bd9Sstevel@tonic-gate  *	Free the memory allocated by successful ibt_query_mcg()
14267c478bd9Sstevel@tonic-gate  */
14277c478bd9Sstevel@tonic-gate void ibt_free_mcg_info(ibt_mcg_info_t *mcgs_info, uint_t entries);
14287c478bd9Sstevel@tonic-gate 
14297c478bd9Sstevel@tonic-gate 
14307c478bd9Sstevel@tonic-gate /*
14317c478bd9Sstevel@tonic-gate  * ibt_register_subnet_notices()
14327c478bd9Sstevel@tonic-gate  *	Register a handler to be called for subnet notifications.
14337c478bd9Sstevel@tonic-gate  */
14347c478bd9Sstevel@tonic-gate void ibt_register_subnet_notices(ibt_clnt_hdl_t ibt_hdl,
14357c478bd9Sstevel@tonic-gate     ibt_sm_notice_handler_t sm_notice_handler, void *private);
14367c478bd9Sstevel@tonic-gate 
14377c478bd9Sstevel@tonic-gate 
14387c478bd9Sstevel@tonic-gate /*
14397c478bd9Sstevel@tonic-gate  * Protection Domain Functions.
14407c478bd9Sstevel@tonic-gate  *
14417c478bd9Sstevel@tonic-gate  * ibt_alloc_pd()
14427c478bd9Sstevel@tonic-gate  * ibt_free_pd()
14437c478bd9Sstevel@tonic-gate  * 	Allocate/Release a protection domain
14447c478bd9Sstevel@tonic-gate  */
14457c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_flags_t flags,
14467c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t *pd);
14477c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd);
14487c478bd9Sstevel@tonic-gate 
14497c478bd9Sstevel@tonic-gate /*
14507c478bd9Sstevel@tonic-gate  * P_Key to P_Key Index conversion Functions.
14517c478bd9Sstevel@tonic-gate  *
14527c478bd9Sstevel@tonic-gate  * ibt_pkey2index_byguid
14537c478bd9Sstevel@tonic-gate  * ibt_pkey2index	Convert a P_Key into a P_Key index.
14547c478bd9Sstevel@tonic-gate  *
14557c478bd9Sstevel@tonic-gate  * ibt_index2pkey_byguid
14567c478bd9Sstevel@tonic-gate  * ibt_index2pkey	Convert a P_Key Index into a P_Key.
14577c478bd9Sstevel@tonic-gate  */
14587c478bd9Sstevel@tonic-gate ibt_status_t ibt_pkey2index(ibt_hca_hdl_t hca_hdl, uint8_t port_num,
14597c478bd9Sstevel@tonic-gate     ib_pkey_t pkey, uint16_t *pkey_ix);
14607c478bd9Sstevel@tonic-gate 
14617c478bd9Sstevel@tonic-gate ibt_status_t ibt_index2pkey(ibt_hca_hdl_t hca_hdl, uint8_t port_num,
14627c478bd9Sstevel@tonic-gate     uint16_t pkey_ix, ib_pkey_t *pkey);
14637c478bd9Sstevel@tonic-gate 
14647c478bd9Sstevel@tonic-gate ibt_status_t ibt_pkey2index_byguid(ib_guid_t hca_guid, uint8_t port_num,
14657c478bd9Sstevel@tonic-gate     ib_pkey_t pkey, uint16_t *pkey_ix);
14667c478bd9Sstevel@tonic-gate 
14677c478bd9Sstevel@tonic-gate ibt_status_t ibt_index2pkey_byguid(ib_guid_t hca_guid, uint8_t port_num,
14687c478bd9Sstevel@tonic-gate     uint16_t pkey_ix, ib_pkey_t *pkey);
14697c478bd9Sstevel@tonic-gate 
14707c478bd9Sstevel@tonic-gate /*
14717c478bd9Sstevel@tonic-gate  *  ibt_ci_data_in()
14727c478bd9Sstevel@tonic-gate  *
14737c478bd9Sstevel@tonic-gate  *  Pass CI specific userland data for CI objects to the CI.
14747c478bd9Sstevel@tonic-gate  */
14757c478bd9Sstevel@tonic-gate ibt_status_t ibt_ci_data_in(ibt_hca_hdl_t hca, ibt_ci_data_flags_t flags,
14767c478bd9Sstevel@tonic-gate     ibt_object_type_t object, void *ibt_object_handle, void *data_p,
14777c478bd9Sstevel@tonic-gate     size_t data_sz);
14787c478bd9Sstevel@tonic-gate 
14797c478bd9Sstevel@tonic-gate /*
14807c478bd9Sstevel@tonic-gate  *  ibt_ci_data_out()
14817c478bd9Sstevel@tonic-gate  *
14827c478bd9Sstevel@tonic-gate  *  Obtain CI specific userland data for CI objects.
14837c478bd9Sstevel@tonic-gate  */
14847c478bd9Sstevel@tonic-gate ibt_status_t ibt_ci_data_out(ibt_hca_hdl_t hca, ibt_ci_data_flags_t flags,
14857c478bd9Sstevel@tonic-gate     ibt_object_type_t object, void *ibt_object_handle, void *data_p,
14867c478bd9Sstevel@tonic-gate     size_t data_sz);
14877c478bd9Sstevel@tonic-gate 
14887c478bd9Sstevel@tonic-gate 
14897c478bd9Sstevel@tonic-gate /*
14907c478bd9Sstevel@tonic-gate  * Node Information.
14917c478bd9Sstevel@tonic-gate  */
14927c478bd9Sstevel@tonic-gate 
14937c478bd9Sstevel@tonic-gate /* Node type : n_node_type */
14947c478bd9Sstevel@tonic-gate #define	IBT_NODE_TYPE_CHANNEL_ADAPTER	1	/* HCA or TCA */
14957c478bd9Sstevel@tonic-gate #define	IBT_NODE_TYPE_SWITCH		2
14967c478bd9Sstevel@tonic-gate #define	IBT_NODE_TYPE_ROUTER		3
14977c478bd9Sstevel@tonic-gate 
14987c478bd9Sstevel@tonic-gate typedef struct ibt_node_info_s {
14997c478bd9Sstevel@tonic-gate 	ib_guid_t	n_sys_img_guid;	/* System Image GUID */
15007c478bd9Sstevel@tonic-gate 	ib_guid_t	n_node_guid;	/* Node GUID */
15017c478bd9Sstevel@tonic-gate 	ib_guid_t	n_port_guid;	/* Port GUID */
15027c478bd9Sstevel@tonic-gate 	uint16_t	n_dev_id;	/* Device ID */
15037c478bd9Sstevel@tonic-gate 	uint32_t	n_revision;	/* Device Revision */
15047c478bd9Sstevel@tonic-gate 	uint32_t	n_vendor_id:24;	/* Device Vendor ID */
15057c478bd9Sstevel@tonic-gate 	uint8_t		n_num_ports;	/* Number of ports on this node. */
15067c478bd9Sstevel@tonic-gate 	uint8_t		n_port_num;	/* Port number. */
15077c478bd9Sstevel@tonic-gate 	uint8_t		n_node_type;	/* Node type */
15087c478bd9Sstevel@tonic-gate 	char		n_description[64]; /* NULL terminated ASCII string */
15097c478bd9Sstevel@tonic-gate } ibt_node_info_t;
15107c478bd9Sstevel@tonic-gate 
15117c478bd9Sstevel@tonic-gate 
15127c478bd9Sstevel@tonic-gate /*
15137c478bd9Sstevel@tonic-gate  * ibt_gid_to_node_info()
15147c478bd9Sstevel@tonic-gate  *	Retrieve node information for the specified GID.
15157c478bd9Sstevel@tonic-gate  */
15167c478bd9Sstevel@tonic-gate ibt_status_t ibt_gid_to_node_info(ib_gid_t gid, ibt_node_info_t *node_info_p);
15177c478bd9Sstevel@tonic-gate 
15187c478bd9Sstevel@tonic-gate /*
15197c478bd9Sstevel@tonic-gate  * ibt_reprobe_dev
15207c478bd9Sstevel@tonic-gate  *	Reprobe properties for IOC device node.
15217c478bd9Sstevel@tonic-gate  */
15227c478bd9Sstevel@tonic-gate ibt_status_t	ibt_reprobe_dev(dev_info_t *dip);
15237c478bd9Sstevel@tonic-gate 
15247c478bd9Sstevel@tonic-gate /*
15257c478bd9Sstevel@tonic-gate  * ibt_get_companion_port_gids()
15267c478bd9Sstevel@tonic-gate  *
15277c478bd9Sstevel@tonic-gate  *	Get list of GID's available on a companion port(s) of the specified
15287c478bd9Sstevel@tonic-gate  *	GID or list of GIDs available on a specified Node GUID/System Image
15297c478bd9Sstevel@tonic-gate  *	GUID.
15307c478bd9Sstevel@tonic-gate  */
15317c478bd9Sstevel@tonic-gate ibt_status_t ibt_get_companion_port_gids(ib_gid_t gid, ib_guid_t hca_guid,
15327c478bd9Sstevel@tonic-gate     ib_guid_t sysimg_guid, ib_gid_t **gids_p, uint_t *num_gids_p);
15337c478bd9Sstevel@tonic-gate 
15347c478bd9Sstevel@tonic-gate /*
15357c478bd9Sstevel@tonic-gate  * SHARED RECEIVE QUEUE
15367c478bd9Sstevel@tonic-gate  */
15377c478bd9Sstevel@tonic-gate 
15387c478bd9Sstevel@tonic-gate 
15397c478bd9Sstevel@tonic-gate /*
15407c478bd9Sstevel@tonic-gate  * ibt_alloc_srq()
15417c478bd9Sstevel@tonic-gate  *	Allocate a shared receive queue.
15427c478bd9Sstevel@tonic-gate  */
15437c478bd9Sstevel@tonic-gate ibt_status_t ibt_alloc_srq(ibt_hca_hdl_t hca_hdl, ibt_srq_flags_t flags,
15447c478bd9Sstevel@tonic-gate     ibt_pd_hdl_t pd, ibt_srq_sizes_t *sizes, ibt_srq_hdl_t *ibt_srq_p,
15457c478bd9Sstevel@tonic-gate     ibt_srq_sizes_t *real_size_p);
15467c478bd9Sstevel@tonic-gate 
15477c478bd9Sstevel@tonic-gate /*
15487c478bd9Sstevel@tonic-gate  * ibt_free_srq()
15497c478bd9Sstevel@tonic-gate  *	Free allocated SRQ resources.
15507c478bd9Sstevel@tonic-gate  */
15517c478bd9Sstevel@tonic-gate ibt_status_t ibt_free_srq(ibt_srq_hdl_t ibt_srq);
15527c478bd9Sstevel@tonic-gate 
15537c478bd9Sstevel@tonic-gate /*
15547c478bd9Sstevel@tonic-gate  * ibt_query_srq()
15557c478bd9Sstevel@tonic-gate  *	Query a shared receive queue.
15567c478bd9Sstevel@tonic-gate  */
15577c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_srq(ibt_srq_hdl_t ibt_srq, ibt_pd_hdl_t *pd_p,
15587c478bd9Sstevel@tonic-gate     ibt_srq_sizes_t *sizes_p, uint_t *limit_p);
15597c478bd9Sstevel@tonic-gate 
15607c478bd9Sstevel@tonic-gate /*
15617c478bd9Sstevel@tonic-gate  * ibt_modify_srq()
15627c478bd9Sstevel@tonic-gate  *	Modify a shared receive queue.
15637c478bd9Sstevel@tonic-gate  */
15647c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_srq(ibt_srq_hdl_t ibt_srq, ibt_srq_modify_flags_t flags,
15657c478bd9Sstevel@tonic-gate     uint_t size, uint_t limit, uint_t *real_size_p);
15667c478bd9Sstevel@tonic-gate 
15677c478bd9Sstevel@tonic-gate /*
15687c478bd9Sstevel@tonic-gate  * ibt_set_srq_private()
15697c478bd9Sstevel@tonic-gate  * ibt_get_srq_private()
15707c478bd9Sstevel@tonic-gate  *	Set/get the SRQ client private data.
15717c478bd9Sstevel@tonic-gate  */
15727c478bd9Sstevel@tonic-gate void ibt_set_srq_private(ibt_srq_hdl_t ibt_srq, void *clnt_private);
15737c478bd9Sstevel@tonic-gate void *ibt_get_srq_private(ibt_srq_hdl_t ibt_srq);
15747c478bd9Sstevel@tonic-gate 
15757c478bd9Sstevel@tonic-gate /*
15767c478bd9Sstevel@tonic-gate  * ibt_check_failure()
15777c478bd9Sstevel@tonic-gate  * 	Function to test for special case failures
15787c478bd9Sstevel@tonic-gate  */
15797c478bd9Sstevel@tonic-gate ibt_failure_type_t ibt_check_failure(ibt_status_t status, uint64_t *reserved_p);
15807c478bd9Sstevel@tonic-gate 
15817c478bd9Sstevel@tonic-gate 
15827c478bd9Sstevel@tonic-gate /*
15837c478bd9Sstevel@tonic-gate  * ibt_hw_is_present() returns 0 when there is no IB hardware actively
15847c478bd9Sstevel@tonic-gate  * running.  This is primarily useful for modules like rpcmod which needs a
15857c478bd9Sstevel@tonic-gate  * quick check to decide whether or not it should try to use InfiniBand.
15867c478bd9Sstevel@tonic-gate  */
15877c478bd9Sstevel@tonic-gate int ibt_hw_is_present();
15887c478bd9Sstevel@tonic-gate 
1589015f8fffShiremath /*
1590015f8fffShiremath  * Fast Memory Registration (FMR).
1591015f8fffShiremath  *
1592015f8fffShiremath  * ibt_create_fmr_pool
1593015f8fffShiremath  *	Not fast-path.
1594015f8fffShiremath  *	ibt_create_fmr_pool() verifies that the HCA supports FMR and allocates
1595015f8fffShiremath  *	and initializes an "FMR pool".  This pool contains state specific to
1596015f8fffShiremath  *	this registration, including the watermark setting to determine when
1597015f8fffShiremath  *	to sync, and the total number of FMR regions available within this pool.
1598015f8fffShiremath  *
1599015f8fffShiremath  * ibt_destroy_fmr_pool
1600015f8fffShiremath  *	ibt_destroy_fmr_pool() deallocates all of the FMR regions in a specific
1601015f8fffShiremath  *	pool.  All state and information regarding the pool are destroyed and
1602015f8fffShiremath  *	returned as free space once again.  No more use of FMR regions in this
1603015f8fffShiremath  *	pool are possible without a subsequent call to ibt_create_fmr_pool().
1604015f8fffShiremath  *
1605015f8fffShiremath  * ibt_flush_fmr_pool
1606015f8fffShiremath  *	ibt_flush_fmr_pool forces a flush to occur.  At the client's request,
1607015f8fffShiremath  *	any unmapped FMR regions (See 'ibt_deregister_mr())') are returned to
1608015f8fffShiremath  *	a free state.  This function allows for an asynchronous cleanup of
1609015f8fffShiremath  *	formerly used FMR regions.  Sync operation is also performed internally
1610015f8fffShiremath  *	by HCA driver, when 'watermark' settings for the number of free FMR
1611015f8fffShiremath  *	regions left in the "pool" is reached.
1612015f8fffShiremath  *
1613015f8fffShiremath  * ibt_register_physical_fmr
1614015f8fffShiremath  *	ibt_register_physical_fmr() assigns a "free" entry from the FMR Pool.
1615015f8fffShiremath  *	It first consults the "FMR cache" to see if this is a duplicate memory
1616015f8fffShiremath  *	registration to something already in use.  If not, then a free entry
1617015f8fffShiremath  *	in the "pool" is marked used.
1618015f8fffShiremath  *
1619015f8fffShiremath  * ibt_deregister_fmr
1620015f8fffShiremath  *	The ibt_deregister_fmr un-maps the resources reserved from the FMR
1621015f8fffShiremath  *	pool by ibt_register_physical_fmr().   The ibt_deregister_fmr() will
1622015f8fffShiremath  *	mark the region as free in the FMR Pool.
1623015f8fffShiremath  */
1624015f8fffShiremath ibt_status_t ibt_create_fmr_pool(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
1625015f8fffShiremath     ibt_fmr_pool_attr_t *fmr_params, ibt_fmr_pool_hdl_t *fmr_pool_p);
1626015f8fffShiremath 
1627015f8fffShiremath ibt_status_t ibt_destroy_fmr_pool(ibt_hca_hdl_t hca_hdl,
1628015f8fffShiremath     ibt_fmr_pool_hdl_t fmr_pool);
1629015f8fffShiremath 
1630015f8fffShiremath ibt_status_t ibt_flush_fmr_pool(ibt_hca_hdl_t hca_hdl,
1631015f8fffShiremath     ibt_fmr_pool_hdl_t fmr_pool);
1632015f8fffShiremath 
1633015f8fffShiremath ibt_status_t ibt_register_physical_fmr(ibt_hca_hdl_t hca_hdl,
1634015f8fffShiremath     ibt_fmr_pool_hdl_t fmr_pool, ibt_pmr_attr_t *mem_pattr,
1635015f8fffShiremath     ibt_mr_hdl_t *mr_hdl_p, ibt_pmr_desc_t *mem_desc_p);
1636015f8fffShiremath 
1637015f8fffShiremath ibt_status_t ibt_deregister_fmr(ibt_hca_hdl_t hca, ibt_mr_hdl_t mr_hdl);
1638015f8fffShiremath 
1639015f8fffShiremath /*
1640015f8fffShiremath  * IP SUPPORT
1641015f8fffShiremath  */
1642015f8fffShiremath 
1643015f8fffShiremath /*
1644015f8fffShiremath  * IP get_paths
1645015f8fffShiremath  * Returns an array (or single) of paths and source IP addresses. In the
1646015f8fffShiremath  * simplest form just the destination IP address is specified, and one path
1647015f8fffShiremath  * is requested, then one ibt_path_info_t struct and one source IP.
1648015f8fffShiremath  *
1649015f8fffShiremath  * More than one path can be requested to a single destination, in which case
1650015f8fffShiremath  * the requested number of ibt_path_info_t's are returned, and the same
1651015f8fffShiremath  * number of SRC IP address, with the first SRC IP address corrosponding
1652015f8fffShiremath  * to the first ibt_path_info_t, etc.
1653015f8fffShiremath  *
1654015f8fffShiremath  * Restrictions on the source end point can be specified, in the form of a
1655015f8fffShiremath  * source IP address (this implicitly defines the HCA, HCA port and Pkey)
1656015f8fffShiremath  * HCA, HCA port, and sgid (implicitly defines HCA and HCA port).
1657015f8fffShiremath  * Combinations are allowed but they  must be consistent.
1658015f8fffShiremath  *
1659015f8fffShiremath  * Path attributes can also be specified, these can also affect local HCA
1660015f8fffShiremath  * selection.
1661015f8fffShiremath  *
1662015f8fffShiremath  * ibt_get_ip_paths()  internally does (among other things):
1663015f8fffShiremath  *
1664015f8fffShiremath  *   o ibt_get_list_of_ibd_ipaddr_and_macaddr( OUT list_ipaddr_macaddr)
1665015f8fffShiremath  *
1666015f8fffShiremath  *   o extract_pkey_and_sgid(IN list_ipaddr_macaddr, OUT list_pkey_and_sgid)
1667015f8fffShiremath  *
1668015f8fffShiremath  *   o map_dst_ip_addr(IN dst_ip_addr, OUT dst_pkey, OUT dgid) - See Note
1669015f8fffShiremath  *
1670015f8fffShiremath  *   o filter_by_pkey(IN list_pkey_and_sgid, IN dst_pkey, OUT list_of_sgid)
1671015f8fffShiremath  *
1672015f8fffShiremath  *   o do_multipath_query(IN list_of_sgid, IN dst_pkey, IN dgid, OUT path_list)
1673015f8fffShiremath  *
1674015f8fffShiremath  *   o pick_a_good_path(IN path_list, OUT the_path)
1675015f8fffShiremath  *
1676015f8fffShiremath  *   o find_matching_src_ip(IN the_path, IN list_ipaddr_macaddr, OUT src_ip)
1677015f8fffShiremath  *
1678015f8fffShiremath  * The ibd instance which got the ARP response is only on one P_Key
1679015f8fffShiremath  * knowing the ibd instance (or which IPonIB MCG) got the ARP response
1680015f8fffShiremath  * determins the P_Key associated with a dgid. If the proposedi "ip2mac()"
1681015f8fffShiremath  * API is used to get an IP to GID translations, then returned 'sockaddr_dl'
1682015f8fffShiremath  * contains the interface name and index.
1683015f8fffShiremath  *
1684015f8fffShiremath  *
1685015f8fffShiremath  * Example:
1686015f8fffShiremath  *   ip_path_attr.ipa_dst_ip = dst_ip_addr;
1687015f8fffShiremath  *   ip_path_attr.ipa_ndst = 1;
1688015f8fffShiremath  *   ip_path_attr.ipa_max_paths = 1;
1689015f8fffShiremath  *
1690015f8fffShiremath  *   status = ibt_get_ip_paths(clnt_hdl, flags, &ip_path_attr, &paths,
1691015f8fffShiremath  *      &num_paths_p, &src_ip);
1692015f8fffShiremath  *
1693015f8fffShiremath  *   sid = ibt_get_ip_sid(protocol_num, dst_port);
1694015f8fffShiremath  *   path_info->sid = sid;
1695015f8fffShiremath  *
1696015f8fffShiremath  *   ip_cm_info.src_addr = src_ip;
1697015f8fffShiremath  *   ip_cm_info.dst_addr = dst_ip_addr;
1698015f8fffShiremath  *   ip_cm_info.src_port = src_port
1699015f8fffShiremath  *
1700015f8fffShiremath  *   ibt_format_ip_private_data(ip_cm_info, priv_data_len, &priv_data);
1701015f8fffShiremath  *   ibt_open_rc_channel(chan, private_data);
1702015f8fffShiremath  */
1703015f8fffShiremath typedef struct ibt_ip_path_attr_s {
1704015f8fffShiremath 	ibt_ip_addr_t		*ipa_dst_ip;		/* Required */
1705015f8fffShiremath 	ibt_ip_addr_t		ipa_src_ip;		/* Optional */
1706015f8fffShiremath 	ib_guid_t		ipa_hca_guid;		/* Optional */
1707015f8fffShiremath 	uint8_t			ipa_hca_port_num;	/* Optional */
1708015f8fffShiremath 	uint8_t			ipa_max_paths;		/* Required */
1709015f8fffShiremath 	uint8_t			ipa_ndst;		/* Required */
1710015f8fffShiremath 	uint8_t			ipa_sl:4;		/* Optional */
1711015f8fffShiremath 	ibt_mtu_req_t		ipa_mtu;		/* Optional */
1712015f8fffShiremath 	ibt_srate_req_t		ipa_srate;		/* Optional */
1713015f8fffShiremath 	ibt_pkt_lt_req_t	ipa_pkt_lt;		/* Optional */
1714015f8fffShiremath 	uint_t			ipa_flow:20;		/* Optional */
1715015f8fffShiremath 	uint8_t			ipa_hop;		/* Optional */
1716015f8fffShiremath 	uint8_t			ipa_tclass;		/* Optional */
1717*17a2b317SBill Taylor 	zoneid_t		ipa_zoneid;	/* Default 0 = Global Zone */
1718015f8fffShiremath } ibt_ip_path_attr_t;
1719015f8fffShiremath 
1720015f8fffShiremath /*
1721015f8fffShiremath  * Path SRC IP addresses
1722015f8fffShiremath  */
1723015f8fffShiremath typedef struct ibt_path_ip_src_s {
1724015f8fffShiremath 	ibt_ip_addr_t	ip_primary;
1725015f8fffShiremath 	ibt_ip_addr_t	ip_alternate;
1726015f8fffShiremath } ibt_path_ip_src_t;
1727015f8fffShiremath 
1728015f8fffShiremath 
1729015f8fffShiremath ibt_status_t ibt_get_ip_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags,
1730015f8fffShiremath     ibt_ip_path_attr_t *attr, ibt_path_info_t *paths_p, uint8_t *num_paths_p,
1731015f8fffShiremath     ibt_path_ip_src_t *src_ip_p);
1732015f8fffShiremath 
1733*17a2b317SBill Taylor /*
1734*17a2b317SBill Taylor  * ibt_get_src_ip()
1735*17a2b317SBill Taylor  *	Get List of IP-Address that matches the parameters specified in
1736*17a2b317SBill Taylor  *	srcip_attr.  As a given MAC address can have both IPv4 and IPv6
1737*17a2b317SBill Taylor  *	addressed configured, caller can optional request to return only
1738*17a2b317SBill Taylor  *	the desired family by specifying the "sip_family" field.  If
1739*17a2b317SBill Taylor  *	"sip_family" is AF_UNSPEC, then all assigned IP address (IPv4
1740*17a2b317SBill Taylor  *	and/or IPv6) will be returned. In case of IPv6 address, scope_id
1741*17a2b317SBill Taylor  *	for that specific address will also be returned.
1742*17a2b317SBill Taylor  *	"sip_zoneid" will specify the zones the user is interested in.
1743*17a2b317SBill Taylor  *
1744*17a2b317SBill Taylor  *	Information on each ip-address is returned to the caller in the
1745*17a2b317SBill Taylor  *	form of an array of ibt_srcip_info_t.  ibt_get_src_ip() allocates the
1746*17a2b317SBill Taylor  *	memory for this array and returns a pointer to the array (src_info_p)
1747*17a2b317SBill Taylor  *	and the number of entries in the array (entries_p). This memory
1748*17a2b317SBill Taylor  *	should be freed by the client using ibt_free_srcip_info().
1749*17a2b317SBill Taylor  *
1750*17a2b317SBill Taylor  * ibt_free_srcip_info()
1751*17a2b317SBill Taylor  *	Free the memory allocated by successful ibt_get_src_ip()
1752*17a2b317SBill Taylor  */
1753*17a2b317SBill Taylor typedef struct ibt_srcip_attr_s {
1754*17a2b317SBill Taylor 	ib_gid_t	sip_gid;	/* REQUIRED: Local Port GID */
1755*17a2b317SBill Taylor 	zoneid_t	sip_zoneid;	/* Zero means Global Zone */
1756*17a2b317SBill Taylor 	ib_pkey_t	sip_pkey;	/* Optional */
1757*17a2b317SBill Taylor 	sa_family_t	sip_family;	/* Optional : IPv4 or IPv6 */
1758*17a2b317SBill Taylor } ibt_srcip_attr_t;
1759*17a2b317SBill Taylor 
1760*17a2b317SBill Taylor /*
1761*17a2b317SBill Taylor  * ip_flag : Flag to indicate whether the returned list of ip-address
1762*17a2b317SBill Taylor  * has any duplicate records.
1763*17a2b317SBill Taylor  */
1764*17a2b317SBill Taylor #define	IBT_IPADDR_NO_FLAGS	0
1765*17a2b317SBill Taylor #define	IBT_IPADDR_DUPLICATE	1
1766*17a2b317SBill Taylor 
1767*17a2b317SBill Taylor typedef struct ibt_srcip_info_s {
1768*17a2b317SBill Taylor 	ibt_ip_addr_t	ip_addr;
1769*17a2b317SBill Taylor 	zoneid_t	ip_zoneid;	/* ZoneId of this ip-addr */
1770*17a2b317SBill Taylor 	uint_t		ip_flag;	/* Flag to indicate any gotchas */
1771*17a2b317SBill Taylor } ibt_srcip_info_t;
1772*17a2b317SBill Taylor 
1773*17a2b317SBill Taylor ibt_status_t ibt_get_src_ip(ibt_srcip_attr_t *srcip_attr,
1774*17a2b317SBill Taylor     ibt_srcip_info_t **src_info_p, uint_t *entries_p);
1775*17a2b317SBill Taylor 
1776*17a2b317SBill Taylor void ibt_free_srcip_info(ibt_srcip_info_t *src_info, uint_t entries);
1777*17a2b317SBill Taylor 
1778015f8fffShiremath 
1779015f8fffShiremath /*
1780015f8fffShiremath  * Callback function that can be used in ibt_aget_ip_paths(), a Non-Blocking
1781015f8fffShiremath  * version of ibt_get_ip_paths().
1782015f8fffShiremath  */
1783015f8fffShiremath typedef void (*ibt_ip_path_handler_t)(void *arg, ibt_status_t retval,
1784015f8fffShiremath     ibt_path_info_t *paths_p, uint8_t num_paths, ibt_path_ip_src_t *src_ip_p);
1785015f8fffShiremath 
1786015f8fffShiremath /*
1787015f8fffShiremath  * Find path(s) to a given destination or service asynchronously.
1788015f8fffShiremath  * ibt_aget_ip_paths() is a Non-Blocking version of ibt_get_ip_paths().
1789015f8fffShiremath  */
1790015f8fffShiremath ibt_status_t ibt_aget_ip_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags,
1791015f8fffShiremath     ibt_ip_path_attr_t *attr, ibt_ip_path_handler_t func, void  *arg);
1792015f8fffShiremath 
1793015f8fffShiremath /*
1794015f8fffShiremath  * IP RDMA protocol functions
1795015f8fffShiremath  */
1796015f8fffShiremath 
1797015f8fffShiremath /*
1798015f8fffShiremath  * IBTF manages the port number space for non well known ports. If a ULP
1799015f8fffShiremath  * is not using TCP/UDP and a well known port, then ibt_get_ip_sid() returns
1800015f8fffShiremath  * an sid based on the IP protocol number '0' (reserved) and an IBTF assigned
1801015f8fffShiremath  * port number.  ibt_release_ip_sid() should be used to release the hold
1802015f8fffShiremath  * of SID created by ibt_get_ip_sid().
1803015f8fffShiremath  */
1804015f8fffShiremath ib_svc_id_t ibt_get_ip_sid(uint8_t protocol_num, in_port_t dst_port);
1805015f8fffShiremath ibt_status_t ibt_release_ip_sid(ib_svc_id_t sid);
1806015f8fffShiremath 
1807015f8fffShiremath uint8_t ibt_get_ip_protocol_num(ib_svc_id_t sid);
1808015f8fffShiremath in_port_t ibt_get_ip_dst_port(ib_svc_id_t sid);
1809015f8fffShiremath 
1810015f8fffShiremath /*
1811015f8fffShiremath  * Functions to format/extract the RDMA IP CM private data
1812015f8fffShiremath  */
1813015f8fffShiremath typedef struct ibt_ip_cm_info_s {
1814015f8fffShiremath 	ibt_ip_addr_t	src_addr;
1815015f8fffShiremath 	ibt_ip_addr_t	dst_addr;
1816015f8fffShiremath 	in_port_t	src_port;
1817015f8fffShiremath } ibt_ip_cm_info_t;
1818015f8fffShiremath 
1819015f8fffShiremath /*
1820015f8fffShiremath  * If a ULP is using IP addressing as defined by the RDMA IP CM Service IBTA
1821015f8fffShiremath  * Annex 11, then it must always allocate a private data buffer for use in
1822015f8fffShiremath  * the ibt_open_rc_channel(9F) call. The minimum size of the buffer is
1823015f8fffShiremath  * IBT_IP_HDR_PRIV_DATA_SZ, if the ULP has no ULP specific private data.
1824015f8fffShiremath  * This allows ibt_format_ip_private_data() to place the RDMA IP CM service
1825015f8fffShiremath  * hello message in the private data of the REQ. If the ULP has some ULP
1826015f8fffShiremath  * specific private data then it should allocate a buffer big enough to
1827015f8fffShiremath  * contain that data plus an additional IBT_IP_HDR_PRIV_DATA_SZ bytes.
1828015f8fffShiremath  * The ULP should place its  ULP specific private data at offset
1829015f8fffShiremath  * IBT_IP_HDR_PRIV_DATA_SZ in the allocated buffer before calling
1830015f8fffShiremath  * ibt_format_ip_private_data().
1831015f8fffShiremath  */
1832015f8fffShiremath ibt_status_t ibt_format_ip_private_data(ibt_ip_cm_info_t *ip_cm_info,
1833015f8fffShiremath     ibt_priv_data_len_t priv_data_len, void *priv_data_p);
1834015f8fffShiremath ibt_status_t ibt_get_ip_data(ibt_priv_data_len_t priv_data_len,
1835015f8fffShiremath     void *priv_data, ibt_ip_cm_info_t *ip_info_p);
1836015f8fffShiremath 
1837015f8fffShiremath /*
1838015f8fffShiremath  * The ibt_alt_ip_path_attr_t structure is used to specify additional optional
1839015f8fffShiremath  * attributes when requesting an alternate path for an existing channel.
1840015f8fffShiremath  *
1841015f8fffShiremath  * Attributes that are don't care should be set to NULL or '0'.
1842015f8fffShiremath  */
1843015f8fffShiremath typedef struct ibt_alt_ip_path_attr_s {
1844015f8fffShiremath 	ibt_ip_addr_t		apa_dst_ip;
1845015f8fffShiremath 	ibt_ip_addr_t		apa_src_ip;
1846015f8fffShiremath 	ibt_srate_req_t		apa_srate;
1847015f8fffShiremath 	ibt_pkt_lt_req_t	apa_pkt_lt;	/* Packet Life Time Request */
1848015f8fffShiremath 	uint_t			apa_flow:20;
1849015f8fffShiremath 	uint8_t			apa_sl:4;
1850015f8fffShiremath 	uint8_t			apa_hop;
1851015f8fffShiremath 	uint8_t			apa_tclass;
1852*17a2b317SBill Taylor 	zoneid_t		apa_zoneid;	/* Default 0 = Global Zone */
1853015f8fffShiremath } ibt_alt_ip_path_attr_t;
1854015f8fffShiremath 
1855015f8fffShiremath ibt_status_t ibt_get_ip_alt_path(ibt_channel_hdl_t rc_chan,
1856015f8fffShiremath     ibt_path_flags_t flags, ibt_alt_ip_path_attr_t *attr,
1857015f8fffShiremath     ibt_alt_path_info_t *alt_path);
18587c478bd9Sstevel@tonic-gate 
18597c478bd9Sstevel@tonic-gate /*
18607c478bd9Sstevel@tonic-gate  * CONTRACT PRIVATE ONLY INTERFACES
18617c478bd9Sstevel@tonic-gate  *
18627c478bd9Sstevel@tonic-gate  * DO NOT USE THE FOLLOWING FUNCTIONS WITHOUT SIGNING THE CONTRACT
18637c478bd9Sstevel@tonic-gate  * WITH IBTF GROUP.
18647c478bd9Sstevel@tonic-gate  */
18657c478bd9Sstevel@tonic-gate 
18667c478bd9Sstevel@tonic-gate /* Define an Address Record structure (data for ATS service records). */
18677c478bd9Sstevel@tonic-gate typedef struct ibt_ar_s {
18687c478bd9Sstevel@tonic-gate 	ib_gid_t	ar_gid;		/* GID of local HCA port */
18697c478bd9Sstevel@tonic-gate 	ib_pkey_t	ar_pkey;	/* P_Key valid on port of ar_gid */
18707c478bd9Sstevel@tonic-gate 	uint8_t		ar_data[16];	/* Data affiliated with GID/P_Key */
18717c478bd9Sstevel@tonic-gate } ibt_ar_t;
18727c478bd9Sstevel@tonic-gate 
18737c478bd9Sstevel@tonic-gate /*
18747c478bd9Sstevel@tonic-gate  * ibt_register_ar()
18757c478bd9Sstevel@tonic-gate  * ibt_deregister_ar()
18767c478bd9Sstevel@tonic-gate  *	Register/deregister an Address Record with the SA.
18777c478bd9Sstevel@tonic-gate  * ibt_query_ar()
18787c478bd9Sstevel@tonic-gate  *	Query the SA for Address Records matching either GID/P_Key or Data.
18797c478bd9Sstevel@tonic-gate  */
18807c478bd9Sstevel@tonic-gate ibt_status_t ibt_register_ar(ibt_clnt_hdl_t ibt_hdl, ibt_ar_t *arp);
18817c478bd9Sstevel@tonic-gate 
18827c478bd9Sstevel@tonic-gate ibt_status_t ibt_deregister_ar(ibt_clnt_hdl_t ibt_hdl, ibt_ar_t *arp);
18837c478bd9Sstevel@tonic-gate 
18847c478bd9Sstevel@tonic-gate ibt_status_t ibt_query_ar(ib_gid_t *sgid, ibt_ar_t *queryp, ibt_ar_t *resultp);
18857c478bd9Sstevel@tonic-gate 
18867c478bd9Sstevel@tonic-gate 
18877c478bd9Sstevel@tonic-gate /*
18887c478bd9Sstevel@tonic-gate  * ibt_modify_system_image()
18897c478bd9Sstevel@tonic-gate  * ibt_modify_system_image_byguid()
18907c478bd9Sstevel@tonic-gate  *	Modify specified HCA's system image GUID.
18917c478bd9Sstevel@tonic-gate  */
18927c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_system_image(ibt_hca_hdl_t hca_hdl, ib_guid_t sys_guid);
18937c478bd9Sstevel@tonic-gate 
18947c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_system_image_byguid(ib_guid_t hca_guid,
18957c478bd9Sstevel@tonic-gate     ib_guid_t sys_guid);
18967c478bd9Sstevel@tonic-gate 
18977c478bd9Sstevel@tonic-gate 
18987c478bd9Sstevel@tonic-gate /*
18997c478bd9Sstevel@tonic-gate  * ibt_modify_port()
19007c478bd9Sstevel@tonic-gate  * ibt_modify_port_byguid()
19017c478bd9Sstevel@tonic-gate  *	Modify the specified port, or all ports attribute(s).
19027c478bd9Sstevel@tonic-gate  */
19037c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_port(ibt_hca_hdl_t hca_hdl, uint8_t port,
19047c478bd9Sstevel@tonic-gate     ibt_port_modify_flags_t flags, uint8_t init_type);
19057c478bd9Sstevel@tonic-gate 
19067c478bd9Sstevel@tonic-gate ibt_status_t ibt_modify_port_byguid(ib_guid_t hca_guid, uint8_t port,
19077c478bd9Sstevel@tonic-gate     ibt_port_modify_flags_t flags, uint8_t init_type);
19087c478bd9Sstevel@tonic-gate 
19097c478bd9Sstevel@tonic-gate 
19107c478bd9Sstevel@tonic-gate /*
19117c478bd9Sstevel@tonic-gate  * ibt_get_port_state()
19127c478bd9Sstevel@tonic-gate  * ibt_get_port_state_byguid()
19137c478bd9Sstevel@tonic-gate  *	Return the most commonly requested attributes of an HCA port.
19147c478bd9Sstevel@tonic-gate  *	If the link state is not IBT_PORT_ACTIVE, the other returned values
19157c478bd9Sstevel@tonic-gate  *	are undefined.
19167c478bd9Sstevel@tonic-gate  */
19177c478bd9Sstevel@tonic-gate ibt_status_t ibt_get_port_state(ibt_hca_hdl_t hca_hdl, uint8_t port,
19187c478bd9Sstevel@tonic-gate     ib_gid_t *sgid_p, ib_lid_t *base_lid_p);
19197c478bd9Sstevel@tonic-gate 
19207c478bd9Sstevel@tonic-gate ibt_status_t ibt_get_port_state_byguid(ib_guid_t hca_guid, uint8_t port,
19217c478bd9Sstevel@tonic-gate     ib_gid_t *sgid_p, ib_lid_t *base_lid_p);
19227c478bd9Sstevel@tonic-gate 
192303494a98SBill Taylor /*
192403494a98SBill Taylor  * ibt_alloc_io_mem()
192503494a98SBill Taylor  * ibt_free_io_mem()
192603494a98SBill Taylor  *	Allocate and deallocate dma-able memory.
192703494a98SBill Taylor  */
192803494a98SBill Taylor ibt_status_t ibt_alloc_io_mem(ibt_hca_hdl_t, size_t, ibt_mr_flags_t,
192903494a98SBill Taylor     caddr_t *, ibt_mem_alloc_hdl_t *);
193003494a98SBill Taylor 
193103494a98SBill Taylor ibt_status_t ibt_free_io_mem(ibt_hca_hdl_t, ibt_mem_alloc_hdl_t);
193203494a98SBill Taylor 
19331cfa752fSRamaswamy Tummala /*
19341cfa752fSRamaswamy Tummala  * Interfaces to get IB partition information.
19351cfa752fSRamaswamy Tummala  */
19361cfa752fSRamaswamy Tummala 
19371cfa752fSRamaswamy Tummala typedef struct ibt_part_attr_s {
19381cfa752fSRamaswamy Tummala 	datalink_id_t	pa_dlinkid;
19391cfa752fSRamaswamy Tummala 	datalink_id_t	pa_plinkid;
19401cfa752fSRamaswamy Tummala 	uint8_t		pa_port;
19411cfa752fSRamaswamy Tummala 	ib_guid_t	pa_hca_guid;
19421cfa752fSRamaswamy Tummala 	ib_guid_t	pa_port_guid;
19431cfa752fSRamaswamy Tummala 	ib_pkey_t	pa_pkey;
19441cfa752fSRamaswamy Tummala } ibt_part_attr_t;
19451cfa752fSRamaswamy Tummala 
19461cfa752fSRamaswamy Tummala void ibt_register_part_attr_cb(
19471cfa752fSRamaswamy Tummala     ibt_status_t (*)(datalink_id_t, ibt_part_attr_t *),
19481cfa752fSRamaswamy Tummala     ibt_status_t (*)(ibt_part_attr_t **, int *));
19491cfa752fSRamaswamy Tummala void ibt_unregister_part_attr_cb(void);
19501cfa752fSRamaswamy Tummala 
19511cfa752fSRamaswamy Tummala ibt_status_t ibt_get_part_attr(datalink_id_t, ibt_part_attr_t *);
19521cfa752fSRamaswamy Tummala ibt_status_t ibt_get_all_part_attr(ibt_part_attr_t **, int *);
19531cfa752fSRamaswamy Tummala ibt_status_t ibt_free_part_attr(ibt_part_attr_t *, int);
19541cfa752fSRamaswamy Tummala 
1955*17a2b317SBill Taylor 
1956*17a2b317SBill Taylor /*
1957*17a2b317SBill Taylor  * ibt_lid_to_node_info()
1958*17a2b317SBill Taylor  *	Retrieve node record information for the specified LID.
1959*17a2b317SBill Taylor  */
1960*17a2b317SBill Taylor ibt_status_t ibt_lid_to_node_info(ib_lid_t lid, ibt_node_info_t *node_info_p);
1961*17a2b317SBill Taylor 
1962*17a2b317SBill Taylor 
19637c478bd9Sstevel@tonic-gate #ifdef __cplusplus
19647c478bd9Sstevel@tonic-gate }
19657c478bd9Sstevel@tonic-gate #endif
19667c478bd9Sstevel@tonic-gate 
19677c478bd9Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBTI_COMMON_H */
1968