xref: /onnv-gate/usr/src/uts/common/sys/scsi/adapters/iscsi_if.h (revision 12546:b9d61378e1b8)
17836SJohn.Forte@Sun.COM /*
27836SJohn.Forte@Sun.COM  * CDDL HEADER START
37836SJohn.Forte@Sun.COM  *
47836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
57836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
67836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
77836SJohn.Forte@Sun.COM  *
87836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
107836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
117836SJohn.Forte@Sun.COM  * and limitations under the License.
127836SJohn.Forte@Sun.COM  *
137836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
147836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
167836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
177836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
187836SJohn.Forte@Sun.COM  *
197836SJohn.Forte@Sun.COM  * CDDL HEADER END
207836SJohn.Forte@Sun.COM  */
217836SJohn.Forte@Sun.COM /*
2212161SJack.Meng@Sun.COM  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
237836SJohn.Forte@Sun.COM  */
247836SJohn.Forte@Sun.COM 
257836SJohn.Forte@Sun.COM #ifndef _ISCSI_IF_H
267836SJohn.Forte@Sun.COM #define	_ISCSI_IF_H
277836SJohn.Forte@Sun.COM 
287836SJohn.Forte@Sun.COM #ifdef __cplusplus
297836SJohn.Forte@Sun.COM extern "C" {
307836SJohn.Forte@Sun.COM #endif
317836SJohn.Forte@Sun.COM 
327836SJohn.Forte@Sun.COM #ifdef _KERNEL
337836SJohn.Forte@Sun.COM #include <sys/types.h>
347836SJohn.Forte@Sun.COM #include <sys/strsubr.h>	/* for prototype of kstrgetmsg */
357836SJohn.Forte@Sun.COM #include <sys/socket.h>
367836SJohn.Forte@Sun.COM #include <sys/socketvar.h>	/* for struct sonode */
377836SJohn.Forte@Sun.COM #endif
387836SJohn.Forte@Sun.COM #include <netinet/in.h>
397836SJohn.Forte@Sun.COM #include <sys/scsi/impl/uscsi.h>
408656SPeter.Dunlap@Sun.COM #include <sys/iscsi_protocol.h>
417836SJohn.Forte@Sun.COM 
427836SJohn.Forte@Sun.COM /*
437836SJohn.Forte@Sun.COM  * Each of the top level structures have a version field as
447836SJohn.Forte@Sun.COM  * the first member. That version value will be set by the
457836SJohn.Forte@Sun.COM  * caller. The consumer of the structure will check to see
467836SJohn.Forte@Sun.COM  * if the version is correct.
477836SJohn.Forte@Sun.COM  */
487836SJohn.Forte@Sun.COM #define	ISCSI_INTERFACE_VERSION			3
497836SJohn.Forte@Sun.COM 
507836SJohn.Forte@Sun.COM /*
517836SJohn.Forte@Sun.COM  * Login parameter values are used instead of ascii text
527836SJohn.Forte@Sun.COM  * between the IMA plug-in and kernel.
537836SJohn.Forte@Sun.COM  */
547836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_DATA_SEQUENCE_IN_ORDER	0x0000  /* bool */
557836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_IMMEDIATE_DATA		0x0001  /* bool */
567836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_INITIAL_R2T			0x0002  /* bool */
577836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_DATA_PDU_IN_ORDER		0x0003  /* bool */
587836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_HEADER_DIGEST			0x0004	/* int */
597836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_DATA_DIGEST			0x0005	/* int */
607836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_RETAIN		0x0006  /* int */
617836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_WAIT		0x0007  /* int */
627836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_MAX_RECV_DATA_SEGMENT_LENGTH	0x0008  /* int */
637836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_FIRST_BURST_LENGTH		0x0009  /* int */
647836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_MAX_BURST_LENGTH		0x000A  /* int */
657836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_MAX_CONNECTIONS		0x000B  /* int */
667836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_OUTSTANDING_R2T		0x000C  /* int */
677836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_ERROR_RECOVERY_LEVEL		0x000D  /* int */
687836SJohn.Forte@Sun.COM /*
697836SJohn.Forte@Sun.COM  * number of login parameters - needs to be updated when new parameter added
707836SJohn.Forte@Sun.COM  */
717836SJohn.Forte@Sun.COM #define	ISCSI_NUM_LOGIN_PARAM				0x000E
727836SJohn.Forte@Sun.COM 
737836SJohn.Forte@Sun.COM /*
747836SJohn.Forte@Sun.COM  * Used internally by the persistent store code. Currently a bitmap is kept of
757836SJohn.Forte@Sun.COM  * which params are currently set. This allows for quick a look up instead of
767836SJohn.Forte@Sun.COM  * cycling through the possible entries. Using an unsigned int as the bitmap we
777836SJohn.Forte@Sun.COM  * can have parameter numbers up through 31. Since the current only has 22
787836SJohn.Forte@Sun.COM  * we're okay.
797836SJohn.Forte@Sun.COM  */
807836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_DB_ENTRY			0x0020
817836SJohn.Forte@Sun.COM /*
827836SJohn.Forte@Sun.COM  * Special case. When this parameter value is set in iscsi_param_set_t
837836SJohn.Forte@Sun.COM  * the member s_value (type iscsi_param_set_t) is not used.
847836SJohn.Forte@Sun.COM  * The name field contains the InitiatorName for the system which
857836SJohn.Forte@Sun.COM  * should be used for all future sessions.
867836SJohn.Forte@Sun.COM  */
877836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_INITIATOR_NAME		0x0021
887836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN_PARAM_INITIATOR_ALIAS		0x0022
897836SJohn.Forte@Sun.COM 
907836SJohn.Forte@Sun.COM #define	ISCSI_DEVCTL		"devctl"
917836SJohn.Forte@Sun.COM #define	ISCSI_DRIVER_DEVCTL	"/devices/iscsi:" ISCSI_DEVCTL
927836SJohn.Forte@Sun.COM 
937836SJohn.Forte@Sun.COM /*
947836SJohn.Forte@Sun.COM  * ioctls supported by the driver.
957836SJohn.Forte@Sun.COM  */
967836SJohn.Forte@Sun.COM #define	ISCSI_IOCTL		(('i' << 24) | ('S' << 16) | ('C' << 8))
977836SJohn.Forte@Sun.COM #define	ISCSI_CREATE_OID		(ISCSI_IOCTL | 2)
987836SJohn.Forte@Sun.COM #define	ISCSI_LOGIN			(ISCSI_IOCTL | 3)
997836SJohn.Forte@Sun.COM #define	ISCSI_LOGOUT			(ISCSI_IOCTL | 4)
1007836SJohn.Forte@Sun.COM #define	ISCSI_PARAM_GET			(ISCSI_IOCTL | 5)
1017836SJohn.Forte@Sun.COM #define	ISCSI_PARAM_SET			(ISCSI_IOCTL | 6)
1027836SJohn.Forte@Sun.COM #define	ISCSI_TARGET_PARAM_CLEAR	(ISCSI_IOCTL | 8)
1037836SJohn.Forte@Sun.COM #define	ISCSI_TARGET_OID_LIST_GET	(ISCSI_IOCTL | 9)
1047836SJohn.Forte@Sun.COM #define	ISCSI_TARGET_PROPS_GET		(ISCSI_IOCTL | 10)
1057836SJohn.Forte@Sun.COM #define	ISCSI_TARGET_PROPS_SET		(ISCSI_IOCTL | 11)
1067836SJohn.Forte@Sun.COM #define	ISCSI_TARGET_ADDRESS_GET	(ISCSI_IOCTL | 12)
1077836SJohn.Forte@Sun.COM #define	ISCSI_CHAP_SET			(ISCSI_IOCTL | 13)
1087836SJohn.Forte@Sun.COM #define	ISCSI_CHAP_GET			(ISCSI_IOCTL | 14)
1097836SJohn.Forte@Sun.COM #define	ISCSI_CHAP_CLEAR		(ISCSI_IOCTL | 15)
1107836SJohn.Forte@Sun.COM #define	ISCSI_STATIC_GET		(ISCSI_IOCTL | 16)
1117836SJohn.Forte@Sun.COM #define	ISCSI_STATIC_SET		(ISCSI_IOCTL | 17)
1127836SJohn.Forte@Sun.COM #define	ISCSI_STATIC_CLEAR		(ISCSI_IOCTL | 18)
1137836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_SET		(ISCSI_IOCTL | 19)
1147836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_GET		(ISCSI_IOCTL | 20)
1157836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_CLEAR		(ISCSI_IOCTL | 21)
1167836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_PROPS		(ISCSI_IOCTL | 22)
1177836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_ADDR_SET	(ISCSI_IOCTL | 23)
1187836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_ADDR_LIST_GET	(ISCSI_IOCTL | 24)
1197836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_ADDR_CLEAR	(ISCSI_IOCTL | 25)
1207836SJohn.Forte@Sun.COM #define	ISCSI_RADIUS_SET		(ISCSI_IOCTL | 26)
1217836SJohn.Forte@Sun.COM #define	ISCSI_RADIUS_GET		(ISCSI_IOCTL | 27)
1227836SJohn.Forte@Sun.COM #define	ISCSI_LUN_OID_LIST_GET		(ISCSI_IOCTL | 29)
1237836SJohn.Forte@Sun.COM #define	ISCSI_LUN_PROPS_GET		(ISCSI_IOCTL | 30)
1247836SJohn.Forte@Sun.COM #define	ISCSI_CONN_OID_LIST_GET		(ISCSI_IOCTL | 31)
1257836SJohn.Forte@Sun.COM #define	ISCSI_CONN_PROPS_GET		(ISCSI_IOCTL | 32)
1267836SJohn.Forte@Sun.COM #define	ISCSI_USCSI			(ISCSI_IOCTL | 33)
1279201SJack.Meng@Sun.COM #define	ISCSI_SMF_ONLINE		(ISCSI_IOCTL | 34)
1287836SJohn.Forte@Sun.COM #define	ISCSI_DISCOVERY_EVENTS		(ISCSI_IOCTL | 35)
1297836SJohn.Forte@Sun.COM #define	ISCSI_AUTH_SET			(ISCSI_IOCTL | 36)
1307836SJohn.Forte@Sun.COM #define	ISCSI_AUTH_GET			(ISCSI_IOCTL | 37)
1317836SJohn.Forte@Sun.COM #define	ISCSI_AUTH_CLEAR		(ISCSI_IOCTL | 38)
1327836SJohn.Forte@Sun.COM #define	ISCSI_SENDTGTS_GET		(ISCSI_IOCTL | 39)
1337836SJohn.Forte@Sun.COM #define	ISCSI_ISNS_SERVER_ADDR_SET	(ISCSI_IOCTL | 40)
1347836SJohn.Forte@Sun.COM #define	ISCSI_ISNS_SERVER_ADDR_LIST_GET	(ISCSI_IOCTL | 41)
1357836SJohn.Forte@Sun.COM #define	ISCSI_ISNS_SERVER_ADDR_CLEAR	(ISCSI_IOCTL | 42)
1367836SJohn.Forte@Sun.COM #define	ISCSI_ISNS_SERVER_GET		(ISCSI_IOCTL | 43)
1377836SJohn.Forte@Sun.COM #define	ISCSI_GET_CONFIG_SESSIONS	(ISCSI_IOCTL | 44)
1387836SJohn.Forte@Sun.COM #define	ISCSI_SET_CONFIG_SESSIONS	(ISCSI_IOCTL | 45)
1397836SJohn.Forte@Sun.COM #define	ISCSI_INIT_NODE_NAME_SET	(ISCSI_IOCTL | 46)
1408194SJack.Meng@Sun.COM #define	ISCSI_IS_ACTIVE			(ISCSI_IOCTL | 47)
1418194SJack.Meng@Sun.COM #define	ISCSI_BOOTPROP_GET		(ISCSI_IOCTL | 48)
1429201SJack.Meng@Sun.COM #define	ISCSI_SMF_OFFLINE		(ISCSI_IOCTL | 49)
1439201SJack.Meng@Sun.COM #define	ISCSI_SMF_GET			(ISCSI_IOCTL | 50)
14410156SZhang.Yi@Sun.COM #define	ISCSI_TUNABLE_PARAM_GET		(ISCSI_IOCTL | 51)
14510156SZhang.Yi@Sun.COM #define	ISCSI_TUNABLE_PARAM_SET		(ISCSI_IOCTL | 52)
14612161SJack.Meng@Sun.COM #define	ISCSI_TARGET_REENUM		(ISCSI_IOCTL | 53)
1477836SJohn.Forte@Sun.COM #define	ISCSI_DB_DUMP			(ISCSI_IOCTL | 100) /* DBG */
1487836SJohn.Forte@Sun.COM 
1497836SJohn.Forte@Sun.COM /*
1507836SJohn.Forte@Sun.COM  * Misc. defines
1517836SJohn.Forte@Sun.COM  */
1527836SJohn.Forte@Sun.COM #define	ISCSI_CHAP_NAME_LEN			512
1537836SJohn.Forte@Sun.COM #define	ISCSI_CHAP_SECRET_LEN			16
1547836SJohn.Forte@Sun.COM #define	ISCSI_TGT_OID_LIST			0x0001
1557836SJohn.Forte@Sun.COM #define	ISCSI_STATIC_TGT_OID_LIST		0x0002
1567836SJohn.Forte@Sun.COM #define	ISCSI_TGT_PARAM_OID_LIST		0x0004
1577836SJohn.Forte@Sun.COM #define	ISCSI_SESS_PARAM			0x0001
1587836SJohn.Forte@Sun.COM #define	ISCSI_CONN_PARAM			0x0002
1597836SJohn.Forte@Sun.COM 
1607836SJohn.Forte@Sun.COM /* digest level defines */
1617836SJohn.Forte@Sun.COM #define	ISCSI_DIGEST_NONE		0
1627836SJohn.Forte@Sun.COM #define	ISCSI_DIGEST_CRC32C		1
1637836SJohn.Forte@Sun.COM #define	ISCSI_DIGEST_CRC32C_NONE	2 /* offer both, prefer CRC32C */
1647836SJohn.Forte@Sun.COM #define	ISCSI_DIGEST_NONE_CRC32C	3 /* offer both, prefer None */
1657836SJohn.Forte@Sun.COM 
1667836SJohn.Forte@Sun.COM /*
1677836SJohn.Forte@Sun.COM  * A last error associated with each target session is returned in the
1687836SJohn.Forte@Sun.COM  * iscsi_target_t structure.
1697836SJohn.Forte@Sun.COM  */
1707836SJohn.Forte@Sun.COM typedef enum iscsi_error {
1717836SJohn.Forte@Sun.COM 	NoError, AuthenticationError, LoginParamError, ConnectionReset
1727836SJohn.Forte@Sun.COM } iscsi_error_t;
1737836SJohn.Forte@Sun.COM 
1747836SJohn.Forte@Sun.COM /*
1757836SJohn.Forte@Sun.COM  * The values associated with each enum is based on the IMA specification.
1767836SJohn.Forte@Sun.COM  */
1777836SJohn.Forte@Sun.COM typedef enum	iSCSIDiscoveryMethod {
1787836SJohn.Forte@Sun.COM 	iSCSIDiscoveryMethodUnknown	= 0,
1797836SJohn.Forte@Sun.COM 	iSCSIDiscoveryMethodStatic	= 1,
1807836SJohn.Forte@Sun.COM 	iSCSIDiscoveryMethodSLP		= 2,
1817836SJohn.Forte@Sun.COM 	iSCSIDiscoveryMethodISNS	= 4,
1828194SJack.Meng@Sun.COM 	iSCSIDiscoveryMethodSendTargets	= 8,
1838194SJack.Meng@Sun.COM 	/*
1848194SJack.Meng@Sun.COM 	 * Since there is no specification about boot discovery method,
1858194SJack.Meng@Sun.COM 	 * we should leave a value gap in case of other discovery
1868194SJack.Meng@Sun.COM 	 * methods added.
1878194SJack.Meng@Sun.COM 	 */
1888194SJack.Meng@Sun.COM 	iSCSIDiscoveryMethodBoot	= 128
1897836SJohn.Forte@Sun.COM } iSCSIDiscoveryMethod_t;
1907836SJohn.Forte@Sun.COM #define	ISCSI_ALL_DISCOVERY_METHODS	(iSCSIDiscoveryMethodStatic |	\
1917836SJohn.Forte@Sun.COM 					iSCSIDiscoveryMethodSLP |	\
1927836SJohn.Forte@Sun.COM 					iSCSIDiscoveryMethodISNS |	\
1937836SJohn.Forte@Sun.COM 					iSCSIDiscoveryMethodSendTargets)
1947836SJohn.Forte@Sun.COM 
1957836SJohn.Forte@Sun.COM /*
1967836SJohn.Forte@Sun.COM  * Before anything can be done to a target it must have an OID.
1977836SJohn.Forte@Sun.COM  */
1987836SJohn.Forte@Sun.COM typedef struct iscsi_oid {
1997836SJohn.Forte@Sun.COM 	uint32_t		o_vers;				/* In */
2007836SJohn.Forte@Sun.COM 	uchar_t			o_name[ISCSI_MAX_NAME_LEN];	/* In */
2017836SJohn.Forte@Sun.COM 	/*
2027836SJohn.Forte@Sun.COM 	 * tpgt is only 16 bits per spec.  use 32 in ioctl to reduce
2037836SJohn.Forte@Sun.COM 	 * packing issue.  Also -1 tpgt denotes default value.  iSCSI
2047836SJohn.Forte@Sun.COM 	 * stack will detemermine tpgt during login.
2057836SJohn.Forte@Sun.COM 	 */
2067836SJohn.Forte@Sun.COM 	int			o_tpgt;				/* In */
2077836SJohn.Forte@Sun.COM 	uint32_t		o_oid;				/* Out */
2087836SJohn.Forte@Sun.COM } iscsi_oid_t;
2097836SJohn.Forte@Sun.COM #define	ISCSI_OID_NOTSET	0
2107836SJohn.Forte@Sun.COM #define	ISCSI_INITIATOR_OID	1	/* Other OIDs follow > 1 */
2117836SJohn.Forte@Sun.COM #define	ISCSI_DEFAULT_TPGT	-1
2127836SJohn.Forte@Sun.COM 
2137836SJohn.Forte@Sun.COM /*
2147836SJohn.Forte@Sun.COM  * iSCSI Login Parameters - Reference iscsi draft for
2157836SJohn.Forte@Sun.COM  * definitions of the below login params.
2167836SJohn.Forte@Sun.COM  */
2177836SJohn.Forte@Sun.COM typedef struct iscsi_login_params {
2187836SJohn.Forte@Sun.COM 	boolean_t	immediate_data;
2197836SJohn.Forte@Sun.COM 	boolean_t	initial_r2t;
2207836SJohn.Forte@Sun.COM 	int		first_burst_length;	/* range: 512 - 2**24-1 */
2217836SJohn.Forte@Sun.COM 	int		max_burst_length;	/* range: 512 - 2**24-1 */
2227836SJohn.Forte@Sun.COM 	boolean_t	data_pdu_in_order;
2237836SJohn.Forte@Sun.COM 	boolean_t	data_sequence_in_order;
2247836SJohn.Forte@Sun.COM 	int		default_time_to_wait;
2257836SJohn.Forte@Sun.COM 	int		default_time_to_retain;
2267836SJohn.Forte@Sun.COM 	int		header_digest;
2277836SJohn.Forte@Sun.COM 	int		data_digest;
2287836SJohn.Forte@Sun.COM 	int		max_recv_data_seg_len;	/* range: 512 - 2**24-1 */
2297836SJohn.Forte@Sun.COM 	int		max_xmit_data_seg_len;	/* range: 512 - 2**24-1 */
2307836SJohn.Forte@Sun.COM 	int		max_connections;
2317836SJohn.Forte@Sun.COM 	int		max_outstanding_r2t;
2327836SJohn.Forte@Sun.COM 	int		error_recovery_level;
2337836SJohn.Forte@Sun.COM 	boolean_t	ifmarker;
2347836SJohn.Forte@Sun.COM 	boolean_t	ofmarker;
2357836SJohn.Forte@Sun.COM } iscsi_login_params_t;
2367836SJohn.Forte@Sun.COM 
23710156SZhang.Yi@Sun.COM #define		ISCSI_TUNABLE_PARAM_RX_TIMEOUT_VALUE		0x0001
23810156SZhang.Yi@Sun.COM #define		ISCSI_TUNABLE_PARAM_CONN_LOGIN_MAX		0x0002
23910156SZhang.Yi@Sun.COM #define		ISCSI_TUNABLE_PARAM_LOGIN_POLLING_DELAY		0x0004
24010156SZhang.Yi@Sun.COM 
2417836SJohn.Forte@Sun.COM /*
2427836SJohn.Forte@Sun.COM  * Once parameters have been set via ISCSI_SET_PARAM the login is initiated
2437836SJohn.Forte@Sun.COM  * by sending an ISCSI_LOGIN ioctl with the following structure filled in.
2447836SJohn.Forte@Sun.COM  */
2457836SJohn.Forte@Sun.COM typedef struct entry {
2467836SJohn.Forte@Sun.COM 	int			e_vers;
2477836SJohn.Forte@Sun.COM 	uint32_t		e_oid;
2487836SJohn.Forte@Sun.COM 	union {
2497836SJohn.Forte@Sun.COM 		struct in_addr		u_in4;
2507836SJohn.Forte@Sun.COM 		struct in6_addr		u_in6;
2517836SJohn.Forte@Sun.COM 	} e_u;
2527836SJohn.Forte@Sun.COM 	/*
2537836SJohn.Forte@Sun.COM 	 * e_insize indicates which of the previous structs is valid.
2547836SJohn.Forte@Sun.COM 	 */
2557836SJohn.Forte@Sun.COM 	int			e_insize;
2567836SJohn.Forte@Sun.COM 	int			e_port;
2577836SJohn.Forte@Sun.COM 	int			e_tpgt;
2588194SJack.Meng@Sun.COM 	/* e_boot should be true if a boot session is created. */
2598194SJack.Meng@Sun.COM 	boolean_t		e_boot;
2607836SJohn.Forte@Sun.COM } entry_t;
2617836SJohn.Forte@Sun.COM 
2627836SJohn.Forte@Sun.COM /*
2637836SJohn.Forte@Sun.COM  * Used when setting or gettnig the Initiator Name or Alias.
2647836SJohn.Forte@Sun.COM  */
2657836SJohn.Forte@Sun.COM typedef struct node_name {
2667836SJohn.Forte@Sun.COM 	unsigned char		n_name[ISCSI_MAX_NAME_LEN];
2677836SJohn.Forte@Sun.COM 	int			n_len;
2687836SJohn.Forte@Sun.COM } node_name_t;
2697836SJohn.Forte@Sun.COM 
2707836SJohn.Forte@Sun.COM typedef struct	_iSCSIMinMaxValue {
2717836SJohn.Forte@Sun.COM 	uint32_t		i_current,
2727836SJohn.Forte@Sun.COM 				i_default,
2737836SJohn.Forte@Sun.COM 				i_min,
2747836SJohn.Forte@Sun.COM 				i_max,
2757836SJohn.Forte@Sun.COM 				i_incr;
2767836SJohn.Forte@Sun.COM } iscsi_int_info_t;
2777836SJohn.Forte@Sun.COM 
2787836SJohn.Forte@Sun.COM typedef struct	_iSCSIBoolValue {
2797836SJohn.Forte@Sun.COM 	boolean_t		b_current,
2807836SJohn.Forte@Sun.COM 				b_default;
2817836SJohn.Forte@Sun.COM } iscsi_bool_info_t;
2827836SJohn.Forte@Sun.COM 
2837836SJohn.Forte@Sun.COM typedef struct	_iSCSIParamValueGet {
2847836SJohn.Forte@Sun.COM 	boolean_t		v_valid,
2857836SJohn.Forte@Sun.COM 				v_settable;
2867836SJohn.Forte@Sun.COM 	iscsi_int_info_t	v_integer;
2877836SJohn.Forte@Sun.COM 	iscsi_bool_info_t	v_bool;
2887836SJohn.Forte@Sun.COM 	uchar_t			v_name[ISCSI_MAX_NAME_LEN];
2897836SJohn.Forte@Sun.COM } iscsi_get_value_t;
2907836SJohn.Forte@Sun.COM 
2917836SJohn.Forte@Sun.COM typedef struct	_iSCSILoginParamGet {
2927836SJohn.Forte@Sun.COM 	uint32_t		g_vers;				/* In */
2937836SJohn.Forte@Sun.COM 	uint32_t		g_oid;				/* In */
2947836SJohn.Forte@Sun.COM 	uint32_t		g_param;			/* Out */
2957836SJohn.Forte@Sun.COM 	iscsi_get_value_t	g_value;			/* Out */
2967836SJohn.Forte@Sun.COM 	uint32_t		g_conn_cid;			/* In */
2977836SJohn.Forte@Sun.COM 
2987836SJohn.Forte@Sun.COM 	/*
2997836SJohn.Forte@Sun.COM 	 * To indicate whether session or connection related param is
3007836SJohn.Forte@Sun.COM 	 * being requested.
3017836SJohn.Forte@Sun.COM 	 */
3027836SJohn.Forte@Sun.COM 	uint32_t		g_param_type;			/* In */
3037836SJohn.Forte@Sun.COM } iscsi_param_get_t;
3047836SJohn.Forte@Sun.COM 
3057836SJohn.Forte@Sun.COM typedef struct	iscsi_set_value {
3067836SJohn.Forte@Sun.COM 	uint32_t		v_integer;
3077836SJohn.Forte@Sun.COM 	boolean_t		v_bool;
3087836SJohn.Forte@Sun.COM 	uchar_t			v_name[ISCSI_MAX_NAME_LEN];
3097836SJohn.Forte@Sun.COM } iscsi_set_value_t;
3107836SJohn.Forte@Sun.COM 
3117836SJohn.Forte@Sun.COM /*
3127836SJohn.Forte@Sun.COM  * All of the members of this structure are set by the user agent and
3137836SJohn.Forte@Sun.COM  * consumed by the driver.
3147836SJohn.Forte@Sun.COM  */
3157836SJohn.Forte@Sun.COM typedef struct	iSCSILoginParamSet {
3167836SJohn.Forte@Sun.COM 	uint32_t		s_vers,
3177836SJohn.Forte@Sun.COM 				s_oid;
3187836SJohn.Forte@Sun.COM 	uint32_t		s_param;
3197836SJohn.Forte@Sun.COM 	iscsi_set_value_t	s_value;
3207836SJohn.Forte@Sun.COM } iscsi_param_set_t;
3217836SJohn.Forte@Sun.COM 
32210156SZhang.Yi@Sun.COM /* Data structure used for tunable object parameters */
32310156SZhang.Yi@Sun.COM typedef struct _iSCSITunableValue {
32410156SZhang.Yi@Sun.COM 	uint32_t	v_integer;
32510156SZhang.Yi@Sun.COM 	boolean_t	v_bool;
32610156SZhang.Yi@Sun.COM 	uchar_t		v_name[ISCSI_MAX_NAME_LEN];
32710156SZhang.Yi@Sun.COM } iscsi_tunable_value_t;
32810156SZhang.Yi@Sun.COM 
32910156SZhang.Yi@Sun.COM typedef struct iSCSITunalbeParamObject {
33010156SZhang.Yi@Sun.COM 	boolean_t		t_set;
33110156SZhang.Yi@Sun.COM 	uint32_t		t_oid;
33210156SZhang.Yi@Sun.COM 	uint32_t		t_param;
33310156SZhang.Yi@Sun.COM 	iscsi_tunable_value_t	t_value;
33410156SZhang.Yi@Sun.COM } iscsi_tunable_object_t;
33510156SZhang.Yi@Sun.COM 
3367836SJohn.Forte@Sun.COM /*
3377836SJohn.Forte@Sun.COM  * Data in this structure is set by the user agent and consumed by
3387836SJohn.Forte@Sun.COM  * the driver.
3397836SJohn.Forte@Sun.COM  */
3407836SJohn.Forte@Sun.COM typedef struct chap_props {
3417836SJohn.Forte@Sun.COM 	uint32_t		c_vers,
3427836SJohn.Forte@Sun.COM 				c_retries,
3437836SJohn.Forte@Sun.COM 				c_oid;
344*12546SBing.Zhao@Sun.COM 	unsigned char		c_user[ISCSI_MAX_C_USER_LEN];
3457836SJohn.Forte@Sun.COM 	uint32_t		c_user_len;
3467836SJohn.Forte@Sun.COM 	unsigned char		c_secret[16];
3477836SJohn.Forte@Sun.COM 	uint32_t		c_secret_len;
3487836SJohn.Forte@Sun.COM } iscsi_chap_props_t;
3497836SJohn.Forte@Sun.COM 
3507836SJohn.Forte@Sun.COM typedef enum	authMethod {
3517836SJohn.Forte@Sun.COM 	authMethodNone  = 0x00,
3527836SJohn.Forte@Sun.COM 	authMethodCHAP  = 0x01,
3537836SJohn.Forte@Sun.COM 	authMethodSRP   = 0x02,
3547836SJohn.Forte@Sun.COM 	authMethodKRB5  = 0x04,
3557836SJohn.Forte@Sun.COM 	authMethodSPKM1 = 0x08,
3567836SJohn.Forte@Sun.COM 	authMethodSPKM2 = 0x10
3577836SJohn.Forte@Sun.COM } authMethod_t;
3587836SJohn.Forte@Sun.COM 
3597836SJohn.Forte@Sun.COM /*
3607836SJohn.Forte@Sun.COM  * Data in this structure is set by the user agent and consumed by
3617836SJohn.Forte@Sun.COM  * the driver.
3627836SJohn.Forte@Sun.COM  */
3637836SJohn.Forte@Sun.COM typedef struct auth_props {
3647836SJohn.Forte@Sun.COM 	uint32_t a_vers;
3657836SJohn.Forte@Sun.COM 	uint32_t a_oid;
3667836SJohn.Forte@Sun.COM 	boolean_t a_bi_auth;
3677836SJohn.Forte@Sun.COM 	authMethod_t a_auth_method;
3687836SJohn.Forte@Sun.COM } iscsi_auth_props_t;
3697836SJohn.Forte@Sun.COM 
3707836SJohn.Forte@Sun.COM /*
3717836SJohn.Forte@Sun.COM  * Data in this structure is set by the user agent and consumed by
3727836SJohn.Forte@Sun.COM  * the driver.
3737836SJohn.Forte@Sun.COM  */
3747836SJohn.Forte@Sun.COM #define	MAX_RAD_SHARED_SECRET_LEN 128
3757836SJohn.Forte@Sun.COM typedef struct radius_props {
3767836SJohn.Forte@Sun.COM 	uint32_t		r_vers;
3777836SJohn.Forte@Sun.COM 	uint32_t		r_oid;
3787836SJohn.Forte@Sun.COM 	union {
3797836SJohn.Forte@Sun.COM 		struct in_addr		u_in4;
3807836SJohn.Forte@Sun.COM 		struct in6_addr		u_in6;
3817836SJohn.Forte@Sun.COM 	} r_addr;
3827836SJohn.Forte@Sun.COM 	/*
3837836SJohn.Forte@Sun.COM 	 * r_insize indicates which of the previous structs is valid.
3847836SJohn.Forte@Sun.COM 	 */
3857836SJohn.Forte@Sun.COM 	int			r_insize;
3867836SJohn.Forte@Sun.COM 
3877836SJohn.Forte@Sun.COM 	uint32_t		r_port;
3887836SJohn.Forte@Sun.COM 	uint8_t			r_shared_secret[MAX_RAD_SHARED_SECRET_LEN];
3897836SJohn.Forte@Sun.COM 	boolean_t		r_radius_access;
3907836SJohn.Forte@Sun.COM 	boolean_t		r_radius_config_valid;
3917836SJohn.Forte@Sun.COM 	uint32_t		r_shared_secret_len;
3927836SJohn.Forte@Sun.COM } iscsi_radius_props_t;
3937836SJohn.Forte@Sun.COM 
3947836SJohn.Forte@Sun.COM typedef struct	_IPAddress {
3957836SJohn.Forte@Sun.COM 	union {
3967836SJohn.Forte@Sun.COM 		struct in_addr	in4;
3977836SJohn.Forte@Sun.COM 		struct in6_addr	in6;
3987836SJohn.Forte@Sun.COM 	} i_addr;
3997836SJohn.Forte@Sun.COM 	/* i_insize determines which is valid in the union above */
4007836SJohn.Forte@Sun.COM 	int			i_insize;
4017836SJohn.Forte@Sun.COM } iscsi_ipaddr_t;
4027836SJohn.Forte@Sun.COM 
4037836SJohn.Forte@Sun.COM typedef struct	_iSCSITargetAddressKey {
4047836SJohn.Forte@Sun.COM 	iscsi_ipaddr_t		a_addr;
4057836SJohn.Forte@Sun.COM 	uint32_t		a_port,
4067836SJohn.Forte@Sun.COM 				a_oid;
4077836SJohn.Forte@Sun.COM } iscsi_addr_t;
4087836SJohn.Forte@Sun.COM 
4097836SJohn.Forte@Sun.COM typedef struct	_iSCSITargetAddressKeyProperties {
4107836SJohn.Forte@Sun.COM 	uint32_t		al_vers,			/* In */
4117836SJohn.Forte@Sun.COM 				al_oid;				/* In */
4127836SJohn.Forte@Sun.COM 	uint32_t		al_in_cnt;			/* In */
4137836SJohn.Forte@Sun.COM 	uint32_t		al_out_cnt;			/* Out */
4147836SJohn.Forte@Sun.COM 	uint32_t		al_tpgt;			/* Out */
4157836SJohn.Forte@Sun.COM 	iscsi_addr_t		al_addrs[1];			/* Out */
4167836SJohn.Forte@Sun.COM } iscsi_addr_list_t;
4177836SJohn.Forte@Sun.COM 
4187836SJohn.Forte@Sun.COM typedef struct	_iSCSITargetProperties {
4197836SJohn.Forte@Sun.COM 	uint32_t		p_vers,				/* In */
4207836SJohn.Forte@Sun.COM 				p_oid;				/* In */
4217836SJohn.Forte@Sun.COM 	uchar_t			p_name[ISCSI_MAX_NAME_LEN];	/* Out */
4227836SJohn.Forte@Sun.COM 	uint_t			p_name_len;			/* Out */
4237836SJohn.Forte@Sun.COM 	uchar_t			p_alias[ISCSI_MAX_NAME_LEN];	/* Out */
4247836SJohn.Forte@Sun.COM 	uint_t			p_alias_len;			/* Out */
4257836SJohn.Forte@Sun.COM 	iSCSIDiscoveryMethod_t	p_discovery;			/* Out */
4267836SJohn.Forte@Sun.COM 	boolean_t		p_connected;			/* Out */
4277836SJohn.Forte@Sun.COM 	uint32_t		p_num_of_connections;		/* Out */
4287836SJohn.Forte@Sun.COM 	/* ---- If connected == B_TRUE then lastErr has no meaning. ---- */
4297836SJohn.Forte@Sun.COM 	iscsi_error_t		p_last_err;			/* Out */
4307836SJohn.Forte@Sun.COM 	/*
4317836SJohn.Forte@Sun.COM 	 * Target portal group tag = -1 value means default.
4327836SJohn.Forte@Sun.COM 	 */
4337836SJohn.Forte@Sun.COM 	int			p_tpgt_conf;			/* Out */
4347836SJohn.Forte@Sun.COM 	int			p_tpgt_nego;			/* Out */
4357836SJohn.Forte@Sun.COM 	uchar_t			p_isid[ISCSI_ISID_LEN];		/* Out */
4367836SJohn.Forte@Sun.COM 	uchar_t			p_reserved[128];
4377836SJohn.Forte@Sun.COM } iscsi_property_t;
4387836SJohn.Forte@Sun.COM 
4397836SJohn.Forte@Sun.COM typedef struct	_iSCSITargetDeviceList {
4407836SJohn.Forte@Sun.COM 	uint32_t		tl_vers,			/* In */
4417836SJohn.Forte@Sun.COM 				tl_in_cnt,			/* In */
4427836SJohn.Forte@Sun.COM 				tl_tgt_list_type,		/* In */
4437836SJohn.Forte@Sun.COM 				tl_out_cnt,			/* Out */
4447836SJohn.Forte@Sun.COM 				tl_oid_list[1];			/* Out */
4457836SJohn.Forte@Sun.COM } iscsi_target_list_t;
4467836SJohn.Forte@Sun.COM 
4477836SJohn.Forte@Sun.COM typedef struct	_iSCSIStaticTargetProperties {
4487836SJohn.Forte@Sun.COM 	uint32_t		p_vers,				/* In */
4497836SJohn.Forte@Sun.COM 				p_oid;				/* In */
4507836SJohn.Forte@Sun.COM 	uchar_t			p_name[ISCSI_MAX_NAME_LEN];	/* Out */
4517836SJohn.Forte@Sun.COM 	uint_t			p_name_len;			/* Out */
4527836SJohn.Forte@Sun.COM 	iscsi_addr_list_t	p_addr_list;			/* Out */
4537836SJohn.Forte@Sun.COM } iscsi_static_property_t;
4547836SJohn.Forte@Sun.COM 
4557836SJohn.Forte@Sun.COM typedef enum iscsi_lun_status {
4567836SJohn.Forte@Sun.COM 	LunValid, LunDoesNotExist
4577836SJohn.Forte@Sun.COM } iscsi_lun_status_t;
4587836SJohn.Forte@Sun.COM 
4597836SJohn.Forte@Sun.COM /*
4607836SJohn.Forte@Sun.COM  * SCSI inquiry vendor and product identifier buffer length - these values are
4617836SJohn.Forte@Sun.COM  * defined by the identifier length plus 1 byte for the
4627836SJohn.Forte@Sun.COM  * null termination.
4637836SJohn.Forte@Sun.COM  */
4647836SJohn.Forte@Sun.COM #define	ISCSI_INQ_VID_BUF_LEN		9	/* 8 byte ID */
4657836SJohn.Forte@Sun.COM #define	ISCSI_INQ_PID_BUF_LEN		17	/* 16 byte ID */
4667836SJohn.Forte@Sun.COM 
4677836SJohn.Forte@Sun.COM typedef struct iscsi_lun_props {
4687836SJohn.Forte@Sun.COM 	uint32_t		lp_vers,			/* In */
4697836SJohn.Forte@Sun.COM 				lp_tgt_oid,			/* In */
4707836SJohn.Forte@Sun.COM 				lp_oid,				/* In */
4717836SJohn.Forte@Sun.COM 				lp_num,				/* Out */
4727836SJohn.Forte@Sun.COM 				lp_status;			/* Out */
4737836SJohn.Forte@Sun.COM 	char			lp_pathname[MAXPATHLEN],	/* Out */
4747836SJohn.Forte@Sun.COM 				lp_vid[ISCSI_INQ_VID_BUF_LEN],	/* Out */
4757836SJohn.Forte@Sun.COM 				lp_pid[ISCSI_INQ_PID_BUF_LEN];	/* Out */
4767836SJohn.Forte@Sun.COM 	time_t			lp_time_online;			/* Out */
4777836SJohn.Forte@Sun.COM } iscsi_lun_props_t;
4787836SJohn.Forte@Sun.COM 
4797836SJohn.Forte@Sun.COM typedef struct iscsi_if_lun {
4807836SJohn.Forte@Sun.COM 	uint32_t		l_tgt_oid,
4817836SJohn.Forte@Sun.COM 				l_oid,
4827836SJohn.Forte@Sun.COM 				l_num;
4837836SJohn.Forte@Sun.COM } iscsi_if_lun_t;
4847836SJohn.Forte@Sun.COM 
4857836SJohn.Forte@Sun.COM typedef struct iscsi_lun_list {
4867836SJohn.Forte@Sun.COM 	uint32_t		ll_vers;			/* In */
4877836SJohn.Forte@Sun.COM 	boolean_t		ll_all_tgts;			/* In */
4887836SJohn.Forte@Sun.COM 	uint32_t		ll_tgt_oid,			/* In */
4897836SJohn.Forte@Sun.COM 				ll_in_cnt,			/* In */
4907836SJohn.Forte@Sun.COM 				ll_out_cnt;			/* Out */
4917836SJohn.Forte@Sun.COM 	iscsi_if_lun_t		ll_luns[1];			/* Out */
4927836SJohn.Forte@Sun.COM } iscsi_lun_list_t;
4937836SJohn.Forte@Sun.COM 
4947836SJohn.Forte@Sun.COM typedef struct iscsi_conn_props {
4957836SJohn.Forte@Sun.COM 	uint32_t		cp_vers,			/* In */
4967836SJohn.Forte@Sun.COM 				cp_oid,				/* In */
4977836SJohn.Forte@Sun.COM 				cp_cid,				/* In */
4987836SJohn.Forte@Sun.COM 				cp_sess_oid;			/* In */
4997836SJohn.Forte@Sun.COM 	union {
5007836SJohn.Forte@Sun.COM 		struct	sockaddr_in	soa4;
5017836SJohn.Forte@Sun.COM 		struct	sockaddr_in6	soa6;
5027836SJohn.Forte@Sun.COM 	} cp_local;						/* Out */
5037836SJohn.Forte@Sun.COM 	union {
5047836SJohn.Forte@Sun.COM 		struct	sockaddr_in	soa4;
5057836SJohn.Forte@Sun.COM 		struct	sockaddr_in6	soa6;
5067836SJohn.Forte@Sun.COM 	} cp_peer;						/* Out */
5077836SJohn.Forte@Sun.COM 
5087836SJohn.Forte@Sun.COM 
5097836SJohn.Forte@Sun.COM 	iscsi_login_params_t 	cp_params;
5107836SJohn.Forte@Sun.COM 	boolean_t 		cp_params_valid;
5117836SJohn.Forte@Sun.COM 
5127836SJohn.Forte@Sun.COM } iscsi_conn_props_t;
5137836SJohn.Forte@Sun.COM 
5147836SJohn.Forte@Sun.COM typedef struct iscsi_if_conn {
5157836SJohn.Forte@Sun.COM 	uint32_t		c_sess_oid,
5167836SJohn.Forte@Sun.COM 				c_oid,
5177836SJohn.Forte@Sun.COM 				c_cid;
5187836SJohn.Forte@Sun.COM } iscsi_if_conn_t;
5197836SJohn.Forte@Sun.COM 
5207836SJohn.Forte@Sun.COM typedef struct iscsi_conn_list {
5217836SJohn.Forte@Sun.COM 	uint32_t		cl_vers;			/* In */
5227836SJohn.Forte@Sun.COM 	boolean_t		cl_all_sess;			/* In */
5237836SJohn.Forte@Sun.COM 	uint32_t		cl_sess_oid,			/* In */
5247836SJohn.Forte@Sun.COM 				cl_in_cnt,			/* In */
5257836SJohn.Forte@Sun.COM 				cl_out_cnt;			/* Out */
5267836SJohn.Forte@Sun.COM 	iscsi_if_conn_t		cl_list[1];			/* Out */
5277836SJohn.Forte@Sun.COM } iscsi_conn_list_t;
5287836SJohn.Forte@Sun.COM 
5297836SJohn.Forte@Sun.COM typedef enum iSNSDiscoveryMethod {
5307836SJohn.Forte@Sun.COM 	iSNSDiscoveryMethodStatic	= 0,
5317836SJohn.Forte@Sun.COM 	iSNSDiscoveryMethodDHCP		= 1,
5327836SJohn.Forte@Sun.COM 	iSNSDiscoveryMethodSLP		= 2
5337836SJohn.Forte@Sun.COM } isns_method_t;
5347836SJohn.Forte@Sun.COM 
5357836SJohn.Forte@Sun.COM typedef struct iSCSIDiscoveryProperties {
5367836SJohn.Forte@Sun.COM 	uint32_t		vers;
5377836SJohn.Forte@Sun.COM 	boolean_t		iSNSDiscoverySettable;
5387836SJohn.Forte@Sun.COM 	boolean_t		iSNSDiscoveryEnabled;
5397836SJohn.Forte@Sun.COM 	isns_method_t		iSNSDiscoveryMethod;
5407836SJohn.Forte@Sun.COM 	unsigned char		iSNSDomainName[256];
5417836SJohn.Forte@Sun.COM 	boolean_t		SLPDiscoverySettable;
5427836SJohn.Forte@Sun.COM 	boolean_t		SLPDiscoveryEnabled;
5437836SJohn.Forte@Sun.COM 	boolean_t		StaticDiscoverySettable;
5447836SJohn.Forte@Sun.COM 	boolean_t		StaticDiscoveryEnabled;
5457836SJohn.Forte@Sun.COM 	boolean_t		SendTargetsDiscoverySettable;
5467836SJohn.Forte@Sun.COM 	boolean_t		SendTargetsDiscoveryEnabled;
5477836SJohn.Forte@Sun.COM } iSCSIDiscoveryProperties_t;
5487836SJohn.Forte@Sun.COM 
5497836SJohn.Forte@Sun.COM typedef struct iscsi_uscsi {
5507836SJohn.Forte@Sun.COM 	uint32_t		iu_vers;
5517836SJohn.Forte@Sun.COM 	uint32_t		iu_oid;
5527836SJohn.Forte@Sun.COM 	int			iu_tpgt;
5537836SJohn.Forte@Sun.COM 	uint32_t		iu_len;
5547836SJohn.Forte@Sun.COM 	uint32_t		iu_lun;
5557836SJohn.Forte@Sun.COM 	struct uscsi_cmd	iu_ucmd;
5567836SJohn.Forte@Sun.COM } iscsi_uscsi_t;
5577836SJohn.Forte@Sun.COM 
5587836SJohn.Forte@Sun.COM #if defined(_SYSCALL32)
5597836SJohn.Forte@Sun.COM typedef struct iscsi_uscsi32 {
5607836SJohn.Forte@Sun.COM 	uint32_t		iu_vers;
5617836SJohn.Forte@Sun.COM 	uint32_t		iu_oid;
5627836SJohn.Forte@Sun.COM 	int			iu_tpgt;
5637836SJohn.Forte@Sun.COM 	uint32_t		iu_len;
5647836SJohn.Forte@Sun.COM 	uint32_t		iu_lun;
5657836SJohn.Forte@Sun.COM 	struct uscsi_cmd32	iu_ucmd;
5667836SJohn.Forte@Sun.COM } iscsi_uscsi32_t;
5677836SJohn.Forte@Sun.COM #endif /* _SYSCALL32 */
5687836SJohn.Forte@Sun.COM 
5697836SJohn.Forte@Sun.COM typedef struct iscsi_sendtgts_entry {
5707836SJohn.Forte@Sun.COM 	/* ---- Node name, NULL terminated UTF-8 string ---- */
5717836SJohn.Forte@Sun.COM 	uchar_t			ste_name[ISCSI_MAX_NAME_LEN];
5727836SJohn.Forte@Sun.COM 
5737836SJohn.Forte@Sun.COM 	iscsi_addr_t		ste_ipaddr;
5747836SJohn.Forte@Sun.COM 	int			ste_tpgt;
5757836SJohn.Forte@Sun.COM } iscsi_sendtgts_entry_t;
5767836SJohn.Forte@Sun.COM 
5777836SJohn.Forte@Sun.COM typedef struct iscsi_sendtgts_list {
5787836SJohn.Forte@Sun.COM 	entry_t			stl_entry;			/* In */
5797836SJohn.Forte@Sun.COM 	uint32_t		stl_in_cnt,			/* In */
5807836SJohn.Forte@Sun.COM 				stl_out_cnt;			/* Out */
5817836SJohn.Forte@Sun.COM 	iscsi_sendtgts_entry_t	stl_list[1];			/* Out */
5827836SJohn.Forte@Sun.COM } iscsi_sendtgts_list_t;
5837836SJohn.Forte@Sun.COM 
5847836SJohn.Forte@Sun.COM typedef struct iscsi_statictgt_entry {
5857836SJohn.Forte@Sun.COM 	entry_t			te_entry;			/* In */
5867836SJohn.Forte@Sun.COM 	uchar_t			te_name[ISCSI_MAX_NAME_LEN];	/* In */
5877836SJohn.Forte@Sun.COM } iscsi_target_entry_t;
5887836SJohn.Forte@Sun.COM 
5897836SJohn.Forte@Sun.COM /* iSNS Draft - section 4.1.1. */
5907836SJohn.Forte@Sun.COM typedef struct isns_portal_group {
5917836SJohn.Forte@Sun.COM 	uint8_t pg_iscsi_name[ISCSI_MAX_NAME_LEN];
5927836SJohn.Forte@Sun.COM 	union {
5937836SJohn.Forte@Sun.COM 		in_addr_t	u_ip4;
5947836SJohn.Forte@Sun.COM 		in6_addr_t	u_ip6;
5957836SJohn.Forte@Sun.COM 	} pg_ip_addr;
5967836SJohn.Forte@Sun.COM 	int	insize;
5977836SJohn.Forte@Sun.COM 
5987836SJohn.Forte@Sun.COM 	in_port_t pg_port;
5997836SJohn.Forte@Sun.COM 	uint16_t pg_tag;
6007836SJohn.Forte@Sun.COM 
6017836SJohn.Forte@Sun.COM 	iscsi_ipaddr_t	isns_server_ip;
6027836SJohn.Forte@Sun.COM 	uint32_t	isns_server_port;
6037836SJohn.Forte@Sun.COM } isns_portal_group_t;
6047836SJohn.Forte@Sun.COM 
6057836SJohn.Forte@Sun.COM typedef struct isns_portal_group_list {
6067836SJohn.Forte@Sun.COM 	uint32_t		pg_in_cnt,
6077836SJohn.Forte@Sun.COM 				pg_out_cnt;
6087836SJohn.Forte@Sun.COM 	isns_portal_group_t	pg_list[1];
6097836SJohn.Forte@Sun.COM } isns_portal_group_list_t;
6107836SJohn.Forte@Sun.COM 
6117836SJohn.Forte@Sun.COM typedef struct isns_server_portal_group_list {
6127836SJohn.Forte@Sun.COM 	iscsi_addr_t		    addr;
6137836SJohn.Forte@Sun.COM 	isns_portal_group_list_t    addr_port_list;
6147836SJohn.Forte@Sun.COM } isns_server_portal_group_list_t;
6157836SJohn.Forte@Sun.COM 
6167836SJohn.Forte@Sun.COM #define	ISCSI_MIN_CONFIG_SESSIONS	1
6177836SJohn.Forte@Sun.COM /* lowered max config sessions due to ct_power_cnt >= 0 assert */
6187836SJohn.Forte@Sun.COM #define	ISCSI_MAX_CONFIG_SESSIONS	4
6197836SJohn.Forte@Sun.COM 
6207836SJohn.Forte@Sun.COM typedef struct iscsi_config_sess {
6217836SJohn.Forte@Sun.COM 	uint32_t	ics_ver;
6227836SJohn.Forte@Sun.COM 	uint32_t	ics_oid;
6237836SJohn.Forte@Sun.COM 	boolean_t	ics_bound;
6247836SJohn.Forte@Sun.COM 	uint_t		ics_in;
6257836SJohn.Forte@Sun.COM 	uint_t		ics_out;
6267836SJohn.Forte@Sun.COM 	iscsi_ipaddr_t	ics_bindings[1];
6277836SJohn.Forte@Sun.COM } iscsi_config_sess_t;
6287836SJohn.Forte@Sun.COM 
62912161SJack.Meng@Sun.COM /* iscsi re-enumeration */
63012161SJack.Meng@Sun.COM typedef struct iscsi_reen {
63112161SJack.Meng@Sun.COM 	uint32_t	re_ver;
63212161SJack.Meng@Sun.COM 	uint32_t	re_oid;
63312161SJack.Meng@Sun.COM } iscsi_reen_t;
63412161SJack.Meng@Sun.COM 
6358194SJack.Meng@Sun.COM /* iscsi booting prop */
63612161SJack.Meng@Sun.COM typedef struct iscsi_boot_property {
6378194SJack.Meng@Sun.COM 	node_name_t	ini_name;
6388194SJack.Meng@Sun.COM 	node_name_t	tgt_name;
6398194SJack.Meng@Sun.COM 	iscsi_auth_props_t	auth;
6408194SJack.Meng@Sun.COM 	iscsi_chap_props_t	ini_chap;
6418194SJack.Meng@Sun.COM 	iscsi_chap_props_t	tgt_chap;
6428194SJack.Meng@Sun.COM 	int iscsiboot;
6438194SJack.Meng@Sun.COM 	boolean_t hba_mpxio_enabled;
6448194SJack.Meng@Sun.COM } iscsi_boot_property_t;
6458194SJack.Meng@Sun.COM 
6467836SJohn.Forte@Sun.COM #define	ISCSI_SESSION_CONFIG_SIZE(SIZE)		\
6477836SJohn.Forte@Sun.COM 	(sizeof (iscsi_config_sess_t) +		\
6487836SJohn.Forte@Sun.COM 	((SIZE - 1) * sizeof (iscsi_ipaddr_t)))
6497836SJohn.Forte@Sun.COM 
6507836SJohn.Forte@Sun.COM /*
6517836SJohn.Forte@Sun.COM  * Event class and subclass information
6527836SJohn.Forte@Sun.COM  */
6537836SJohn.Forte@Sun.COM #define	EC_ISCSI			"EC_iSCSI"
6547836SJohn.Forte@Sun.COM #define	ESC_ISCSI_STATIC_START		"ESC_static_start"
6557836SJohn.Forte@Sun.COM #define	ESC_ISCSI_STATIC_END		"ESC_static_end"
6567836SJohn.Forte@Sun.COM #define	ESC_ISCSI_SEND_TARGETS_START	"ESC_send_targets_start"
6577836SJohn.Forte@Sun.COM #define	ESC_ISCSI_SEND_TARGETS_END	"ESC_send_targets_end"
6587836SJohn.Forte@Sun.COM #define	ESC_ISCSI_SLP_START		"ESC_slp_start"
6597836SJohn.Forte@Sun.COM #define	ESC_ISCSI_SLP_END		"ESC_slp_end"
6607836SJohn.Forte@Sun.COM #define	ESC_ISCSI_ISNS_START		"ESC_isns_start"
6617836SJohn.Forte@Sun.COM #define	ESC_ISCSI_ISNS_END		"ESC_isns_end"
6627836SJohn.Forte@Sun.COM #define	ESC_ISCSI_PROP_CHANGE		"ESC_prop_change"
6637836SJohn.Forte@Sun.COM 
6647836SJohn.Forte@Sun.COM #ifdef _KERNEL
6657836SJohn.Forte@Sun.COM /* ---- iscsi_utils.c ---- */
6667836SJohn.Forte@Sun.COM extern int		iscsid_open(char *, int, int);
6677836SJohn.Forte@Sun.COM extern int		iscsid_close(int);
6687836SJohn.Forte@Sun.COM extern int		iscsid_remove(char *filename);
6697836SJohn.Forte@Sun.COM extern int		iscsid_rename(char *oldname, char *newname);
6707836SJohn.Forte@Sun.COM extern ssize_t		iscsid_write(int, void *, ssize_t);
6717836SJohn.Forte@Sun.COM extern ssize_t		iscsid_read(int, void *, ssize_t);
6727836SJohn.Forte@Sun.COM extern ssize_t		iscsid_sendto(struct sonode *, void *, size_t,
6737836SJohn.Forte@Sun.COM     struct sockaddr *, socklen_t);
6747836SJohn.Forte@Sun.COM extern ssize_t		iscsid_recvfrom(struct sonode *, void *buffer,
6757836SJohn.Forte@Sun.COM     size_t len);
6767836SJohn.Forte@Sun.COM extern int		iscsid_errno;
6777836SJohn.Forte@Sun.COM #endif
6787836SJohn.Forte@Sun.COM 
6797836SJohn.Forte@Sun.COM /*
6807836SJohn.Forte@Sun.COM  * Function prototypes for those routines found in the common code
6817836SJohn.Forte@Sun.COM  */
6827836SJohn.Forte@Sun.COM /* ---- utils.c ---- */
6837836SJohn.Forte@Sun.COM extern boolean_t	utils_iqn_create(char *, int);
6847836SJohn.Forte@Sun.COM extern char		*prt_bitmap(int, char *, char *, int);
6857836SJohn.Forte@Sun.COM extern char		*utils_map_param(int);
6867836SJohn.Forte@Sun.COM extern boolean_t	parse_addr_port_tpgt(char *in, char **addr,
6877836SJohn.Forte@Sun.COM 			    int *type, char **port, char **tpgt);
6887836SJohn.Forte@Sun.COM 
6897836SJohn.Forte@Sun.COM #ifdef __cplusplus
6907836SJohn.Forte@Sun.COM }
6917836SJohn.Forte@Sun.COM #endif
6927836SJohn.Forte@Sun.COM 
6937836SJohn.Forte@Sun.COM #endif /* _ISCSI_IF_H */
694