blob: 3aac99155e805f49855a9a22e0487ca8db20a3bb [file] [log] [blame]
Alex Aizman39e84792005-08-04 19:31:00 -07001/*
2 * iSCSI User/Kernel Shares (Defines, Constants, Protocol definitions, etc)
3 *
4 * Copyright (C) 2005 Dmitry Yusupov
5 * Copyright (C) 2005 Alex Aizman
6 * maintained by open-iscsi@googlegroups.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * See the file COPYING included with this distribution for more details.
19 */
20
21#ifndef ISCSI_IF_H
22#define ISCSI_IF_H
23
24#include <scsi/iscsi_proto.h>
Michael Chan43514772009-06-08 18:14:41 -070025#include <linux/in.h>
26#include <linux/in6.h>
27
28#define ISCSI_NL_GRP_ISCSID 1
29#define ISCSI_NL_GRP_UIP 2
Alex Aizman39e84792005-08-04 19:31:00 -070030
31#define UEVENT_BASE 10
32#define KEVENT_BASE 100
33#define ISCSI_ERR_BASE 1000
34
35enum iscsi_uevent_e {
36 ISCSI_UEVENT_UNKNOWN = 0,
37
38 /* down events */
39 ISCSI_UEVENT_CREATE_SESSION = UEVENT_BASE + 1,
40 ISCSI_UEVENT_DESTROY_SESSION = UEVENT_BASE + 2,
41 ISCSI_UEVENT_CREATE_CONN = UEVENT_BASE + 3,
42 ISCSI_UEVENT_DESTROY_CONN = UEVENT_BASE + 4,
43 ISCSI_UEVENT_BIND_CONN = UEVENT_BASE + 5,
44 ISCSI_UEVENT_SET_PARAM = UEVENT_BASE + 6,
45 ISCSI_UEVENT_START_CONN = UEVENT_BASE + 7,
46 ISCSI_UEVENT_STOP_CONN = UEVENT_BASE + 8,
47 ISCSI_UEVENT_SEND_PDU = UEVENT_BASE + 9,
48 ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10,
49 ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11,
50
Or Gerlitz264faaa2006-05-02 19:46:36 -050051 ISCSI_UEVENT_TRANSPORT_EP_CONNECT = UEVENT_BASE + 12,
52 ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13,
53 ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
54
Mike Christie01cb2252006-06-28 12:00:22 -050055 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
Mike Christie1d9bf132007-05-30 12:57:11 -050056 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
Mike Christie26974782007-12-13 12:43:29 -060057 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
Mike Christie10eb0f02009-05-13 17:57:38 -050058 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18,
59 ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19,
Mike Christie01cb2252006-06-28 12:00:22 -050060
Michael Chan43514772009-06-08 18:14:41 -070061 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
Mike Christie56c155b2011-07-25 13:48:37 -050062 ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21,
Michael Chan43514772009-06-08 18:14:41 -070063
Alex Aizman39e84792005-08-04 19:31:00 -070064 /* up events */
65 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
66 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
67 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
Mike Christie53cb8a12006-06-28 12:00:32 -050068 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
Mike Christie26974782007-12-13 12:43:29 -060069 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
70 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
Michael Chan43514772009-06-08 18:14:41 -070071
72 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
73 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
Manish Rangankar17fa5752011-07-25 13:48:52 -050074 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
Vikas Chaudharya11e2542012-02-13 18:30:46 +053075 ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10,
Alex Aizman39e84792005-08-04 19:31:00 -070076};
77
Mike Christie01cb2252006-06-28 12:00:22 -050078enum iscsi_tgt_dscvr {
79 ISCSI_TGT_DSCVR_SEND_TARGETS = 1,
80 ISCSI_TGT_DSCVR_ISNS = 2,
81 ISCSI_TGT_DSCVR_SLP = 3,
82};
83
Vikas Chaudharya11e2542012-02-13 18:30:46 +053084enum iscsi_host_event_code {
85 ISCSI_EVENT_LINKUP = 1,
86 ISCSI_EVENT_LINKDOWN,
87 /* must always be last */
88 ISCSI_EVENT_MAX,
89};
90
Alex Aizman39e84792005-08-04 19:31:00 -070091struct iscsi_uevent {
92 uint32_t type; /* k/u events type */
93 uint32_t iferror; /* carries interface or resource errors */
94 uint64_t transport_handle;
95
96 union {
97 /* messages u -> k */
98 struct msg_create_session {
99 uint32_t initial_cmdsn;
Mike Christie15482712007-05-30 12:57:19 -0500100 uint16_t cmds_max;
101 uint16_t queue_depth;
Alex Aizman39e84792005-08-04 19:31:00 -0700102 } c_session;
Mike Christie40753ca2008-05-21 15:53:56 -0500103 struct msg_create_bound_session {
Mike Christied82ff9be2008-05-21 15:54:13 -0500104 uint64_t ep_handle;
Mike Christie40753ca2008-05-21 15:53:56 -0500105 uint32_t initial_cmdsn;
106 uint16_t cmds_max;
107 uint16_t queue_depth;
108 } c_bound_session;
Alex Aizman39e84792005-08-04 19:31:00 -0700109 struct msg_destroy_session {
Alex Aizman39e84792005-08-04 19:31:00 -0700110 uint32_t sid;
111 } d_session;
112 struct msg_create_conn {
Alex Aizman39e84792005-08-04 19:31:00 -0700113 uint32_t sid;
Mike Christieb5c7a122006-04-06 21:13:33 -0500114 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700115 } c_conn;
116 struct msg_bind_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500117 uint32_t sid;
118 uint32_t cid;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500119 uint64_t transport_eph;
Alex Aizman39e84792005-08-04 19:31:00 -0700120 uint32_t is_leading;
121 } b_conn;
122 struct msg_destroy_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500123 uint32_t sid;
Alex Aizman39e84792005-08-04 19:31:00 -0700124 uint32_t cid;
125 } d_conn;
126 struct msg_send_pdu {
Mike Christieb5c7a122006-04-06 21:13:33 -0500127 uint32_t sid;
128 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700129 uint32_t hdr_size;
130 uint32_t data_size;
Alex Aizman39e84792005-08-04 19:31:00 -0700131 } send_pdu;
132 struct msg_set_param {
Mike Christieb5c7a122006-04-06 21:13:33 -0500133 uint32_t sid;
134 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700135 uint32_t param; /* enum iscsi_param */
Mike Christiefd7255f2006-04-06 21:13:36 -0500136 uint32_t len;
Alex Aizman39e84792005-08-04 19:31:00 -0700137 } set_param;
138 struct msg_start_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500139 uint32_t sid;
140 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700141 } start_conn;
142 struct msg_stop_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500143 uint32_t sid;
144 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700145 uint64_t conn_handle;
146 uint32_t flag;
147 } stop_conn;
148 struct msg_get_stats {
Mike Christieb5c7a122006-04-06 21:13:33 -0500149 uint32_t sid;
150 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700151 } get_stats;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500152 struct msg_transport_connect {
153 uint32_t non_blocking;
154 } ep_connect;
Mike Christie10eb0f02009-05-13 17:57:38 -0500155 struct msg_transport_connect_through_host {
156 uint32_t host_no;
157 uint32_t non_blocking;
158 } ep_connect_through_host;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500159 struct msg_transport_poll {
160 uint64_t ep_handle;
161 uint32_t timeout_ms;
162 } ep_poll;
163 struct msg_transport_disconnect {
164 uint64_t ep_handle;
165 } ep_disconnect;
Mike Christie01cb2252006-06-28 12:00:22 -0500166 struct msg_tgt_dscvr {
167 enum iscsi_tgt_dscvr type;
168 uint32_t host_no;
169 /*
170 * enable = 1 to establish a new connection
171 * with the server. enable = 0 to disconnect
172 * from the server. Used primarily to switch
173 * from one iSNS server to another.
174 */
175 uint32_t enable;
176 } tgt_dscvr;
Mike Christie1d9bf132007-05-30 12:57:11 -0500177 struct msg_set_host_param {
178 uint32_t host_no;
179 uint32_t param; /* enum iscsi_host_param */
180 uint32_t len;
181 } set_host_param;
Michael Chan43514772009-06-08 18:14:41 -0700182 struct msg_set_path {
183 uint32_t host_no;
184 } set_path;
Mike Christie56c155b2011-07-25 13:48:37 -0500185 struct msg_set_iface_params {
186 uint32_t host_no;
187 uint32_t count;
188 } set_iface_params;
Alex Aizman39e84792005-08-04 19:31:00 -0700189 } u;
190 union {
191 /* messages k -> u */
Alex Aizman39e84792005-08-04 19:31:00 -0700192 int retcode;
193 struct msg_create_session_ret {
Alex Aizman39e84792005-08-04 19:31:00 -0700194 uint32_t sid;
Mike Christieb5c7a122006-04-06 21:13:33 -0500195 uint32_t host_no;
Alex Aizman39e84792005-08-04 19:31:00 -0700196 } c_session_ret;
Mike Christieb5c7a122006-04-06 21:13:33 -0500197 struct msg_create_conn_ret {
198 uint32_t sid;
199 uint32_t cid;
200 } c_conn_ret;
Mike Christie26974782007-12-13 12:43:29 -0600201 struct msg_unbind_session {
202 uint32_t sid;
203 uint32_t host_no;
204 } unbind_session;
Alex Aizman39e84792005-08-04 19:31:00 -0700205 struct msg_recv_req {
Mike Christieb5c7a122006-04-06 21:13:33 -0500206 uint32_t sid;
207 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700208 uint64_t recv_handle;
Alex Aizman39e84792005-08-04 19:31:00 -0700209 } recv_req;
Manish Rangankar17fa5752011-07-25 13:48:52 -0500210 struct msg_conn_login {
211 uint32_t sid;
212 uint32_t cid;
213 uint32_t state; /* enum iscsi_conn_state */
214 } conn_login;
Alex Aizman39e84792005-08-04 19:31:00 -0700215 struct msg_conn_error {
Mike Christieb5c7a122006-04-06 21:13:33 -0500216 uint32_t sid;
217 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700218 uint32_t error; /* enum iscsi_err */
219 } connerror;
Mike Christie53cb8a12006-06-28 12:00:32 -0500220 struct msg_session_destroyed {
221 uint32_t host_no;
222 uint32_t sid;
223 } d_session;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500224 struct msg_transport_connect_ret {
225 uint64_t handle;
226 } ep_connect_ret;
Michael Chan43514772009-06-08 18:14:41 -0700227 struct msg_req_path {
228 uint32_t host_no;
229 } req_path;
230 struct msg_notify_if_down {
231 uint32_t host_no;
232 } notify_if_down;
Vikas Chaudharya11e2542012-02-13 18:30:46 +0530233 struct msg_host_event {
234 uint32_t host_no;
235 uint32_t data_size;
236 enum iscsi_host_event_code code;
237 } host_event;
Alex Aizman39e84792005-08-04 19:31:00 -0700238 } r;
239} __attribute__ ((aligned (sizeof(uint64_t))));
240
Mike Christie56c155b2011-07-25 13:48:37 -0500241enum iscsi_param_type {
242 ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */
243 ISCSI_HOST_PARAM, /* iscsi_host_param */
244 ISCSI_NET_PARAM, /* iscsi_net_param */
245};
246
247struct iscsi_iface_param_info {
248 uint32_t iface_num; /* iface number, 0 - n */
249 uint32_t len; /* Actual length of the param */
250 uint16_t param; /* iscsi param value */
251 uint8_t iface_type; /* IPv4 or IPv6 */
252 uint8_t param_type; /* iscsi_param_type */
253 uint8_t value[0]; /* length sized value follows */
254} __packed;
255
Alex Aizman39e84792005-08-04 19:31:00 -0700256/*
Michael Chan43514772009-06-08 18:14:41 -0700257 * To keep the struct iscsi_uevent size the same for userspace code
258 * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and
259 * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the
260 * struct iscsi_uevent in the NETLINK_ISCSI message.
261 */
262struct iscsi_path {
263 uint64_t handle;
264 uint8_t mac_addr[6];
265 uint8_t mac_addr_old[6];
266 uint32_t ip_addr_len; /* 4 or 16 */
267 union {
268 struct in_addr v4_addr;
269 struct in6_addr v6_addr;
270 } src;
271 union {
272 struct in_addr v4_addr;
273 struct in6_addr v6_addr;
274 } dst;
275 uint16_t vlan_id;
276 uint16_t pmtu;
277} __attribute__ ((aligned (sizeof(uint64_t))));
278
Mike Christie56c155b2011-07-25 13:48:37 -0500279/* iscsi iface enabled/disabled setting */
280#define ISCSI_IFACE_DISABLE 0x01
281#define ISCSI_IFACE_ENABLE 0x02
282
283/* ipv4 bootproto */
284#define ISCSI_BOOTPROTO_STATIC 0x01
285#define ISCSI_BOOTPROTO_DHCP 0x02
286
287/* ipv6 addr autoconfig type */
288#define ISCSI_IPV6_AUTOCFG_DISABLE 0x01
289#define ISCSI_IPV6_AUTOCFG_ND_ENABLE 0x02
290#define ISCSI_IPV6_AUTOCFG_DHCPV6_ENABLE 0x03
291
292/* ipv6 link local addr type */
293#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_ENABLE 0x01
294#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_DISABLE 0x02
295
296/* ipv6 router addr type */
297#define ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE 0x01
298#define ISCSI_IPV6_ROUTER_AUTOCFG_DISABLE 0x02
299
300#define ISCSI_IFACE_TYPE_IPV4 0x01
301#define ISCSI_IFACE_TYPE_IPV6 0x02
302
Mike Christie4223b9e2011-07-25 13:48:47 -0500303#define ISCSI_MAX_VLAN_ID 4095
304#define ISCSI_MAX_VLAN_PRIORITY 7
305
306/* iscsi vlan enable/disabled setting */
307#define ISCSI_VLAN_DISABLE 0x01
308#define ISCSI_VLAN_ENABLE 0x02
309
Mike Christie56c155b2011-07-25 13:48:37 -0500310/* iSCSI network params */
311enum iscsi_net_param {
312 ISCSI_NET_PARAM_IPV4_ADDR = 1,
313 ISCSI_NET_PARAM_IPV4_SUBNET = 2,
314 ISCSI_NET_PARAM_IPV4_GW = 3,
315 ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4,
316 ISCSI_NET_PARAM_MAC = 5,
317 ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6,
318 ISCSI_NET_PARAM_IPV6_ADDR = 7,
319 ISCSI_NET_PARAM_IPV6_ROUTER = 8,
320 ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9,
321 ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10,
322 ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11,
323 ISCSI_NET_PARAM_IFACE_ENABLE = 12,
324 ISCSI_NET_PARAM_VLAN_ID = 13,
Mike Christie4223b9e2011-07-25 13:48:47 -0500325 ISCSI_NET_PARAM_VLAN_PRIORITY = 14,
326 ISCSI_NET_PARAM_VLAN_ENABLED = 15,
Mike Christie2d636732011-10-11 17:55:11 -0500327 ISCSI_NET_PARAM_VLAN_TAG = 16,
328 ISCSI_NET_PARAM_IFACE_TYPE = 17,
329 ISCSI_NET_PARAM_IFACE_NAME = 18,
330 ISCSI_NET_PARAM_MTU = 19,
331 ISCSI_NET_PARAM_PORT = 20,
Mike Christie56c155b2011-07-25 13:48:37 -0500332};
333
Manish Rangankar17fa5752011-07-25 13:48:52 -0500334enum iscsi_conn_state {
335 ISCSI_CONN_STATE_FREE,
336 ISCSI_CONN_STATE_XPT_WAIT,
337 ISCSI_CONN_STATE_IN_LOGIN,
338 ISCSI_CONN_STATE_LOGGED_IN,
339 ISCSI_CONN_STATE_IN_LOGOUT,
340 ISCSI_CONN_STATE_LOGOUT_REQUESTED,
341 ISCSI_CONN_STATE_CLEANUP_WAIT,
342};
343
Michael Chan43514772009-06-08 18:14:41 -0700344/*
Alex Aizman39e84792005-08-04 19:31:00 -0700345 * Common error codes
346 */
347enum iscsi_err {
348 ISCSI_OK = 0,
349
350 ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1,
351 ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2,
352 ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3,
353 ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4,
354 ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5,
355 ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6,
356 ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7,
357 ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8,
358 ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9,
359 ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10,
360 ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11,
361 ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12,
362 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13,
363 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14,
364 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
Mike Christie7996a772006-04-06 21:13:41 -0500365 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
366 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
Mike Christiee5bd7b542008-09-24 11:46:10 -0500367 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
Mike Christie6f481e32008-09-24 11:46:13 -0500368 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
Mike Christied1af8a32009-08-20 15:11:02 -0500369 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
Mike Christiedf4da5c2010-12-31 02:22:18 -0600370 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21,
Alex Aizman39e84792005-08-04 19:31:00 -0700371};
372
373/*
374 * iSCSI Parameters (RFC3720)
375 */
376enum iscsi_param {
Mike Christiefd7255f2006-04-06 21:13:36 -0500377 /* passed in using netlink set param */
378 ISCSI_PARAM_MAX_RECV_DLENGTH,
379 ISCSI_PARAM_MAX_XMIT_DLENGTH,
380 ISCSI_PARAM_HDRDGST_EN,
381 ISCSI_PARAM_DATADGST_EN,
382 ISCSI_PARAM_INITIAL_R2T_EN,
383 ISCSI_PARAM_MAX_R2T,
384 ISCSI_PARAM_IMM_DATA_EN,
385 ISCSI_PARAM_FIRST_BURST,
386 ISCSI_PARAM_MAX_BURST,
387 ISCSI_PARAM_PDU_INORDER_EN,
388 ISCSI_PARAM_DATASEQ_INORDER_EN,
389 ISCSI_PARAM_ERL,
390 ISCSI_PARAM_IFMARKER_EN,
391 ISCSI_PARAM_OFMARKER_EN,
Mike Christie8d2860b2006-05-02 19:46:47 -0500392 ISCSI_PARAM_EXP_STATSN,
Mike Christiefd7255f2006-04-06 21:13:36 -0500393 ISCSI_PARAM_TARGET_NAME,
394 ISCSI_PARAM_TPGT,
395 ISCSI_PARAM_PERSISTENT_ADDRESS,
396 ISCSI_PARAM_PERSISTENT_PORT,
Mike Christie30a6c652006-04-06 21:13:39 -0500397 ISCSI_PARAM_SESS_RECOVERY_TMO,
Mike Christiefd7255f2006-04-06 21:13:36 -0500398
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300399 /* passed in through bind conn using transport_fd */
Mike Christiefd7255f2006-04-06 21:13:36 -0500400 ISCSI_PARAM_CONN_PORT,
401 ISCSI_PARAM_CONN_ADDRESS,
402
Mike Christieb2c64162007-05-30 12:57:16 -0500403 ISCSI_PARAM_USERNAME,
404 ISCSI_PARAM_USERNAME_IN,
405 ISCSI_PARAM_PASSWORD,
406 ISCSI_PARAM_PASSWORD_IN,
407
Mike Christie843c0a82007-12-13 12:43:20 -0600408 ISCSI_PARAM_FAST_ABORT,
Mike Christief6d51802007-12-13 12:43:30 -0600409 ISCSI_PARAM_ABORT_TMO,
410 ISCSI_PARAM_LU_RESET_TMO,
411 ISCSI_PARAM_HOST_RESET_TMO,
412
413 ISCSI_PARAM_PING_TMO,
414 ISCSI_PARAM_RECV_TMO,
Mike Christie88dfd342008-05-21 15:54:16 -0500415
416 ISCSI_PARAM_IFACE_NAME,
417 ISCSI_PARAM_ISID,
418 ISCSI_PARAM_INITIATOR_NAME,
Mike Christie3fe5ae82009-11-11 16:34:33 -0600419
420 ISCSI_PARAM_TGT_RESET_TMO,
Vikas Chaudhary3b2bef12010-07-10 14:51:30 +0530421 ISCSI_PARAM_TARGET_ALIAS,
Mike Christiefd7255f2006-04-06 21:13:36 -0500422 /* must always be last */
423 ISCSI_PARAM_MAX,
Alex Aizman39e84792005-08-04 19:31:00 -0700424};
Mike Christiefd7255f2006-04-06 21:13:36 -0500425
Mike Christie1819dc82007-05-30 12:57:08 -0500426/* iSCSI HBA params */
427enum iscsi_host_param {
428 ISCSI_HOST_PARAM_HWADDRESS,
Mike Christie8ad57812007-05-30 12:57:13 -0500429 ISCSI_HOST_PARAM_INITIATOR_NAME,
Mike Christied8196ed2007-05-30 12:57:25 -0500430 ISCSI_HOST_PARAM_NETDEV_NAME,
Mike Christie22236962007-05-30 12:57:24 -0500431 ISCSI_HOST_PARAM_IPADDRESS,
Vikas Chaudharyaeddde22012-01-19 03:06:55 -0800432 ISCSI_HOST_PARAM_PORT_STATE,
433 ISCSI_HOST_PARAM_PORT_SPEED,
Mike Christie1819dc82007-05-30 12:57:08 -0500434 ISCSI_HOST_PARAM_MAX,
435};
436
Vikas Chaudharyaeddde22012-01-19 03:06:55 -0800437/* iSCSI port Speed */
438enum iscsi_port_speed {
439 ISCSI_PORT_SPEED_UNKNOWN = 0x1,
440 ISCSI_PORT_SPEED_10MBPS = 0x2,
441 ISCSI_PORT_SPEED_100MBPS = 0x4,
442 ISCSI_PORT_SPEED_1GBPS = 0x8,
443 ISCSI_PORT_SPEED_10GBPS = 0x10,
444};
445
446/* iSCSI port state */
447enum iscsi_port_state {
448 ISCSI_PORT_STATE_DOWN = 0x1,
449 ISCSI_PORT_STATE_UP = 0x2,
450};
451
Alex Aizman39e84792005-08-04 19:31:00 -0700452#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
453#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
Alex Aizman39e84792005-08-04 19:31:00 -0700454
455/*
456 * These flags presents iSCSI Data-Path capabilities.
457 */
458#define CAP_RECOVERY_L0 0x1
459#define CAP_RECOVERY_L1 0x2
460#define CAP_RECOVERY_L2 0x4
461#define CAP_MULTI_R2T 0x8
462#define CAP_HDRDGST 0x10
463#define CAP_DATADGST 0x20
464#define CAP_MULTI_CONN 0x40
465#define CAP_TEXT_NEGO 0x80
466#define CAP_MARKERS 0x100
Mike Christie0ab823d2007-05-30 12:57:22 -0500467#define CAP_FW_DB 0x200
Mike Christie63c62f12008-12-02 00:32:04 -0600468#define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */
469#define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */
470#define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */
Mike Christie6df19a72008-12-02 00:32:16 -0600471#define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal,
472 and verification */
Manish Rangankar17fa5752011-07-25 13:48:52 -0500473#define CAP_LOGIN_OFFLOAD 0x4000 /* offload session login */
Alex Aizman39e84792005-08-04 19:31:00 -0700474
475/*
476 * These flags describes reason of stop_conn() call
477 */
478#define STOP_CONN_TERM 0x1
479#define STOP_CONN_SUSPEND 0x2
480#define STOP_CONN_RECOVER 0x3
481
482#define ISCSI_STATS_CUSTOM_MAX 32
483#define ISCSI_STATS_CUSTOM_DESC_MAX 64
484struct iscsi_stats_custom {
485 char desc[ISCSI_STATS_CUSTOM_DESC_MAX];
486 uint64_t value;
487};
488
489/*
490 * struct iscsi_stats - iSCSI Statistics (iSCSI MIB)
491 *
492 * Note: this structure contains counters collected on per-connection basis.
493 */
494struct iscsi_stats {
495 /* octets */
496 uint64_t txdata_octets;
497 uint64_t rxdata_octets;
498
499 /* xmit pdus */
500 uint32_t noptx_pdus;
501 uint32_t scsicmd_pdus;
502 uint32_t tmfcmd_pdus;
503 uint32_t login_pdus;
504 uint32_t text_pdus;
505 uint32_t dataout_pdus;
506 uint32_t logout_pdus;
507 uint32_t snack_pdus;
508
509 /* recv pdus */
510 uint32_t noprx_pdus;
511 uint32_t scsirsp_pdus;
512 uint32_t tmfrsp_pdus;
513 uint32_t textrsp_pdus;
514 uint32_t datain_pdus;
515 uint32_t logoutrsp_pdus;
516 uint32_t r2t_pdus;
517 uint32_t async_pdus;
518 uint32_t rjt_pdus;
519
520 /* errors */
521 uint32_t digest_err;
522 uint32_t timeout_err;
523
524 /*
525 * iSCSI Custom Statistics support, i.e. Transport could
526 * extend existing MIB statistics with its own specific statistics
527 * up to ISCSI_STATS_CUSTOM_MAX
528 */
529 uint32_t custom_length;
530 struct iscsi_stats_custom custom[0]
531 __attribute__ ((aligned (sizeof(uint64_t))));
532};
533
534#endif