/*
* iSCSI User/Kernel Shares (Defines, Constants, Protocol definitions, etc)
*
* Copyright (C) 2005 Dmitry Yusupov
* Copyright (C) 2005 Alex Aizman
* maintained by open-iscsi@googlegroups.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* See the file COPYING included with this distribution for more details.
*/
#ifndef ISCSI_IF_H
#define ISCSI_IF_H
#include <scsi/iscsi_proto.h>
#include <linux/in.h>
#include <linux/in6.h>
#define ISCSI_NL_GRP_ISCSID 1
#define ISCSI_NL_GRP_UIP 2
#define UEVENT_BASE 10
#define KEVENT_BASE 100
#define ISCSI_ERR_BASE 1000
enum iscsi_uevent_e {
ISCSI_UEVENT_UNKNOWN = 0,
/* down events */
ISCSI_UEVENT_CREATE_SESSION = UEVENT_BASE + 1,
ISCSI_UEVENT_DESTROY_SESSION = UEVENT_BASE + 2,
ISCSI_UEVENT_CREATE_CONN = UEVENT_BASE + 3,
ISCSI_UEVENT_DESTROY_CONN = UEVENT_BASE + 4,
ISCSI_UEVENT_BIND_CONN = UEVENT_BASE + 5,
ISCSI_UEVENT_SET_PARAM = UEVENT_BASE + 6,
ISCSI_UEVENT_START_CONN = UEVENT_BASE + 7,
ISCSI_UEVENT_STOP_CONN = UEVENT_BASE + 8,
ISCSI_UEVENT_SEND_PDU = UEVENT_BASE + 9,
ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10,
ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11,
ISCSI_UEVENT_TRANSPORT_EP_CONNECT = UEVENT_BASE + 12,
ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13,
ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18,
ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19,
ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21,
ISCSI_UEVENT_PING = UEVENT_BASE + 22,
ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23,
ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24,
ISCSI_UEVENT_SET_FLASHNODE_PARAMS = UEVENT_BASE + 25,
ISCSI_UEVENT_NEW_FLASHNODE = UEVENT_BASE + 26,
ISCSI_UEVENT_DEL_FLASHNODE = UEVENT_BASE + 27,
ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28,
ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29,
ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30,
ISCSI_UEVENT_SET_CHAP = UEVENT_BASE + 31,
ISCSI_UEVENT_GET_HOST_STATS = UEVENT_BASE + 32,
/* up events */
ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10,
ISCSI_KEVENT_PING_COMP = KEVENT_BASE + 11,
};
enum iscsi_tgt_dscvr {
ISCSI_TGT_DSCVR_SEND_TARGETS = 1,
ISCSI_TGT_DSCVR_ISNS = 2,
ISCSI_TGT_DSCVR_SLP = 3,
};
enum iscsi_host_event_code {
ISCSI_EVENT_LINKUP = 1,
ISCSI_EVENT_LINKDOWN,
/* must always be last */
ISCSI_EVENT_MAX,
};
struct iscsi_uevent {
uint32_t type; /* k/u events type */
uint32_t iferror; /* carries interface or resource errors */
uint64_t transport_handle;
union {
/* messages u -> k */
struct msg_create_session {
uint32_t initial_cmdsn;
uint16_t cmds_max;
uint16_t queue_depth;
} c_session;
struct msg_create_bound_session {
uint64_t ep_handle;
uint32_t initial_cmdsn;
uint16_t cmds_max;
uint16_t queue_depth;
} c_bound_session;
struct msg_destroy_session {
uint32_t sid;
} d_session;
struct msg_create_conn {
uint32_t sid;
uint32_t cid;
} c_conn;
struct msg_bind_conn {
uint32_t sid;
uint32_t cid;
uint64_t transport_eph;
uint32_t is_leading;
} b_conn;
struct msg_destroy_conn {
uint32_t sid;
uint32_t cid;
} d_conn;
struct msg_send_pdu {
uint32_t sid;
uint32_t cid;
uint32_t hdr_size;
uint32_t data_size;
} send_pdu;
struct msg_set_param {
uint32_t sid;
uint32_t cid;
uint32_t param; /* enum iscsi_param */
uint32_t len;
} set_param;
struct msg_start_conn {
uint32_t sid;
uint32_t cid;
} start_conn;
struct msg_stop_conn {
uint32_t sid;
uint32_t cid;
uint64_t