fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
904e51f67bfac9f3ec88d9254757474c448808ebJack Meng * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/strsubr.h> /* for prototype of kstrgetmsg */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/socketvar.h> /* for struct sonode */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each of the top level structures have a version field as
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the first member. That version value will be set by the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caller. The consumer of the structure will check to see
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if the version is correct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Login parameter values are used instead of ascii text
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * between the IMA plug-in and kernel.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_DATA_SEQUENCE_IN_ORDER 0x0000 /* bool */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_IMMEDIATE_DATA 0x0001 /* bool */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_INITIAL_R2T 0x0002 /* bool */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_DATA_PDU_IN_ORDER 0x0003 /* bool */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_HEADER_DIGEST 0x0004 /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_DATA_DIGEST 0x0005 /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_RETAIN 0x0006 /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_WAIT 0x0007 /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_MAX_RECV_DATA_SEGMENT_LENGTH 0x0008 /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_FIRST_BURST_LENGTH 0x0009 /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_MAX_BURST_LENGTH 0x000A /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_MAX_CONNECTIONS 0x000B /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_OUTSTANDING_R2T 0x000C /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_LOGIN_PARAM_ERROR_RECOVERY_LEVEL 0x000D /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * number of login parameters - needs to be updated when new parameter added
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used internally by the persistent store code. Currently a bitmap is kept of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which params are currently set. This allows for quick a look up instead of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cycling through the possible entries. Using an unsigned int as the bitmap we
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * can have parameter numbers up through 31. Since the current only has 22
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * we're okay.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Special case. When this parameter value is set in iscsi_param_set_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the member s_value (type iscsi_param_set_t) is not used.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The name field contains the InitiatorName for the system which
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * should be used for all future sessions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DRIVER_DEVCTL "/devices/iscsi:" ISCSI_DEVCTL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ioctls supported by the driver.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_IOCTL (('i' << 24) | ('S' << 16) | ('C' << 8))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_TARGET_PARAM_CLEAR (ISCSI_IOCTL | 8)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_TARGET_OID_LIST_GET (ISCSI_IOCTL | 9)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_TARGET_ADDRESS_GET (ISCSI_IOCTL | 12)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DISCOVERY_ADDR_SET (ISCSI_IOCTL | 23)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DISCOVERY_ADDR_LIST_GET (ISCSI_IOCTL | 24)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DISCOVERY_ADDR_CLEAR (ISCSI_IOCTL | 25)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_CONN_OID_LIST_GET (ISCSI_IOCTL | 31)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_ISNS_SERVER_ADDR_SET (ISCSI_IOCTL | 40)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_ISNS_SERVER_ADDR_LIST_GET (ISCSI_IOCTL | 41)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_ISNS_SERVER_ADDR_CLEAR (ISCSI_IOCTL | 42)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_GET_CONFIG_SESSIONS (ISCSI_IOCTL | 44)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_SET_CONFIG_SESSIONS (ISCSI_IOCTL | 45)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_INIT_NODE_NAME_SET (ISCSI_IOCTL | 46)
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China#define ISCSI_TUNABLE_PARAM_GET (ISCSI_IOCTL | 51)
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China#define ISCSI_TUNABLE_PARAM_SET (ISCSI_IOCTL | 52)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DB_DUMP (ISCSI_IOCTL | 100) /* DBG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Misc. defines
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* digest level defines */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DIGEST_CRC32C_NONE 2 /* offer both, prefer CRC32C */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DIGEST_NONE_CRC32C 3 /* offer both, prefer None */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A last error associated with each target session is returned in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_target_t structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NoError, AuthenticationError, LoginParamError, ConnectionReset
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The values associated with each enum is based on the IMA specification.
6cefaae1e90a413ba01560575bb3998e1a3df40eJack Meng * Since there is no specification about boot discovery method,
6cefaae1e90a413ba01560575bb3998e1a3df40eJack Meng * we should leave a value gap in case of other discovery
6cefaae1e90a413ba01560575bb3998e1a3df40eJack Meng * methods added.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_ALL_DISCOVERY_METHODS (iSCSIDiscoveryMethodStatic | \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Before anything can be done to a target it must have an OID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tpgt is only 16 bits per spec. use 32 in ioctl to reduce
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * packing issue. Also -1 tpgt denotes default value. iSCSI
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * stack will detemermine tpgt during login.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_INITIATOR_OID 1 /* Other OIDs follow > 1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iSCSI Login Parameters - Reference iscsi draft for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * definitions of the below login params.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int first_burst_length; /* range: 512 - 2**24-1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int max_recv_data_seg_len; /* range: 512 - 2**24-1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int max_xmit_data_seg_len; /* range: 512 - 2**24-1 */
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China#define ISCSI_TUNABLE_PARAM_RX_TIMEOUT_VALUE 0x0001
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China#define ISCSI_TUNABLE_PARAM_CONN_LOGIN_MAX 0x0002
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China#define ISCSI_TUNABLE_PARAM_LOGIN_POLLING_DELAY 0x0004
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Once parameters have been set via ISCSI_SET_PARAM the login is initiated
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * by sending an ISCSI_LOGIN ioctl with the following structure filled in.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * e_insize indicates which of the previous structs is valid.
6cefaae1e90a413ba01560575bb3998e1a3df40eJack Meng /* e_boot should be true if a boot session is created. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used when setting or gettnig the Initiator Name or Alias.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * To indicate whether session or connection related param is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * being requested.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * All of the members of this structure are set by the user agent and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * consumed by the driver.
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China/* Data structure used for tunable object parameters */
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing Chinatypedef struct _iSCSITunableValue {
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China uint32_t v_integer;
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China boolean_t v_bool;
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China uchar_t v_name[ISCSI_MAX_NAME_LEN];
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China} iscsi_tunable_value_t;
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing Chinatypedef struct iSCSITunalbeParamObject {
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China boolean_t t_set;
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China uint32_t t_param;
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China iscsi_tunable_value_t t_value;
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China} iscsi_tunable_object_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Data in this structure is set by the user agent and consumed by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the driver.
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing China unsigned char c_user[ISCSI_MAX_C_USER_LEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Data in this structure is set by the user agent and consumed by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the driver.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Data in this structure is set by the user agent and consumed by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the driver.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * r_insize indicates which of the previous structs is valid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t r_shared_secret[MAX_RAD_SHARED_SECRET_LEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* i_insize determines which is valid in the union above */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ---- If connected == B_TRUE then lastErr has no meaning. ---- */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Target portal group tag = -1 value means default.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SCSI inquiry vendor and product identifier buffer length - these values are
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * defined by the identifier length plus 1 byte for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * null termination.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SYSCALL32 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ---- Node name, NULL terminated UTF-8 string ---- */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* iSNS Draft - section 4.1.1. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* lowered max config sessions due to ct_power_cnt >= 0 assert */
904e51f67bfac9f3ec88d9254757474c448808ebJack Meng/* iscsi re-enumeration */
6cefaae1e90a413ba01560575bb3998e1a3df40eJack Meng/* iscsi booting prop */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Event class and subclass information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ESC_ISCSI_SEND_TARGETS_START "ESC_send_targets_start"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ESC_ISCSI_SEND_TARGETS_END "ESC_send_targets_end"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ---- iscsi_utils.c ---- */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsid_open(char *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsid_close(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsid_rename(char *oldname, char *newname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern ssize_t iscsid_write(int, void *, ssize_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern ssize_t iscsid_sendto(struct sonode *, void *, size_t,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern ssize_t iscsid_recvfrom(struct sonode *, void *buffer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Function prototypes for those routines found in the common code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ---- utils.c ---- */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *prt_bitmap(int, char *, char *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *utils_map_param(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern boolean_t parse_addr_port_tpgt(char *in, char **addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _ISCSI_IF_H */