[SCSI] qla4xxx: Added support for Diagnostics MBOX command
[deliverable/linux.git] / include / scsi / iscsi_if.h
CommitLineData
39e84790
AA
1/*
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>
43514774
MC
25#include <linux/in.h>
26#include <linux/in6.h>
27
28#define ISCSI_NL_GRP_ISCSID 1
29#define ISCSI_NL_GRP_UIP 2
39e84790
AA
30
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
264faaaa
OG
51 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
01cb225d 55 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
1d9bf13a 56 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
26974789 57 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
10eb0f01
MC
58 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18,
59 ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19,
01cb225d 60
43514774 61 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
56c155b5 62 ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21,
ac20c7bf 63 ISCSI_UEVENT_PING = UEVENT_BASE + 22,
6260a5d2
NJ
64 ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23,
65 ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24,
c6a4bb2e
AC
66 ISCSI_UEVENT_SET_FLASHNODE_PARAMS = UEVENT_BASE + 25,
67 ISCSI_UEVENT_NEW_FLASHNODE = UEVENT_BASE + 26,
68 ISCSI_UEVENT_DEL_FLASHNODE = UEVENT_BASE + 27,
69 ISCSI_UEVENT_LOGIN_FLASHNODE = UEVENT_BASE + 28,
70 ISCSI_UEVENT_LOGOUT_FLASHNODE = UEVENT_BASE + 29,
71 ISCSI_UEVENT_LOGOUT_FLASHNODE_SID = UEVENT_BASE + 30,
3af142fe 72 ISCSI_UEVENT_SET_CHAP = UEVENT_BASE + 31,
43514774 73
39e84790
AA
74 /* up events */
75 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
76 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
77 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
53cb8a1f 78 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
26974789
MC
79 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
80 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
43514774
MC
81
82 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
83 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
17fa575e 84 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
a11e2545 85 ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10,
ac20c7bf 86 ISCSI_KEVENT_PING_COMP = KEVENT_BASE + 11,
39e84790
AA
87};
88
01cb225d
MC
89enum iscsi_tgt_dscvr {
90 ISCSI_TGT_DSCVR_SEND_TARGETS = 1,
91 ISCSI_TGT_DSCVR_ISNS = 2,
92 ISCSI_TGT_DSCVR_SLP = 3,
93};
94
a11e2545
VC
95enum iscsi_host_event_code {
96 ISCSI_EVENT_LINKUP = 1,
97 ISCSI_EVENT_LINKDOWN,
98 /* must always be last */
99 ISCSI_EVENT_MAX,
100};
101
39e84790
AA
102struct iscsi_uevent {
103 uint32_t type; /* k/u events type */
104 uint32_t iferror; /* carries interface or resource errors */
105 uint64_t transport_handle;
106
107 union {
108 /* messages u -> k */
109 struct msg_create_session {
110 uint32_t initial_cmdsn;
1548271e
MC
111 uint16_t cmds_max;
112 uint16_t queue_depth;
39e84790 113 } c_session;
40753caa 114 struct msg_create_bound_session {
d82ff9be 115 uint64_t ep_handle;
40753caa
MC
116 uint32_t initial_cmdsn;
117 uint16_t cmds_max;
118 uint16_t queue_depth;
119 } c_bound_session;
39e84790 120 struct msg_destroy_session {
39e84790
AA
121 uint32_t sid;
122 } d_session;
123 struct msg_create_conn {
39e84790 124 uint32_t sid;
b5c7a12d 125 uint32_t cid;
39e84790
AA
126 } c_conn;
127 struct msg_bind_conn {
b5c7a12d
MC
128 uint32_t sid;
129 uint32_t cid;
264faaaa 130 uint64_t transport_eph;
39e84790
AA
131 uint32_t is_leading;
132 } b_conn;
133 struct msg_destroy_conn {
b5c7a12d 134 uint32_t sid;
39e84790
AA
135 uint32_t cid;
136 } d_conn;
137 struct msg_send_pdu {
b5c7a12d
MC
138 uint32_t sid;
139 uint32_t cid;
39e84790
AA
140 uint32_t hdr_size;
141 uint32_t data_size;
39e84790
AA
142 } send_pdu;
143 struct msg_set_param {
b5c7a12d
MC
144 uint32_t sid;
145 uint32_t cid;
39e84790 146 uint32_t param; /* enum iscsi_param */
fd7255f5 147 uint32_t len;
39e84790
AA
148 } set_param;
149 struct msg_start_conn {
b5c7a12d
MC
150 uint32_t sid;
151 uint32_t cid;
39e84790
AA
152 } start_conn;
153 struct msg_stop_conn {
b5c7a12d
MC
154 uint32_t sid;
155 uint32_t cid;
39e84790
AA
156 uint64_t conn_handle;
157 uint32_t flag;
158 } stop_conn;
159 struct msg_get_stats {
b5c7a12d
MC
160 uint32_t sid;
161 uint32_t cid;
39e84790 162 } get_stats;
264faaaa
OG
163 struct msg_transport_connect {
164 uint32_t non_blocking;
165 } ep_connect;
10eb0f01
MC
166 struct msg_transport_connect_through_host {
167 uint32_t host_no;
168 uint32_t non_blocking;
169 } ep_connect_through_host;
264faaaa
OG
170 struct msg_transport_poll {
171 uint64_t ep_handle;
172 uint32_t timeout_ms;
173 } ep_poll;
174 struct msg_transport_disconnect {
175 uint64_t ep_handle;
176 } ep_disconnect;
01cb225d
MC
177 struct msg_tgt_dscvr {
178 enum iscsi_tgt_dscvr type;
179 uint32_t host_no;
180 /*
181 * enable = 1 to establish a new connection
182 * with the server. enable = 0 to disconnect
183 * from the server. Used primarily to switch
184 * from one iSNS server to another.
185 */
186 uint32_t enable;
187 } tgt_dscvr;
1d9bf13a
MC
188 struct msg_set_host_param {
189 uint32_t host_no;
190 uint32_t param; /* enum iscsi_host_param */
191 uint32_t len;
192 } set_host_param;
43514774
MC
193 struct msg_set_path {
194 uint32_t host_no;
195 } set_path;
56c155b5
MC
196 struct msg_set_iface_params {
197 uint32_t host_no;
198 uint32_t count;
199 } set_iface_params;
ac20c7bf
VC
200 struct msg_iscsi_ping {
201 uint32_t host_no;
202 uint32_t iface_num;
203 uint32_t iface_type;
204 uint32_t payload_size;
205 uint32_t pid; /* unique ping id associated
206 with each ping request */
207 } iscsi_ping;
6260a5d2
NJ
208 struct msg_get_chap {
209 uint32_t host_no;
210 uint32_t num_entries; /* number of CHAP entries
211 * on request, number of
212 * valid CHAP entries on
213 * response */
214 uint16_t chap_tbl_idx;
215 } get_chap;
216 struct msg_delete_chap {
217 uint32_t host_no;
218 uint16_t chap_tbl_idx;
219 } delete_chap;
c6a4bb2e
AC
220 struct msg_set_flashnode_param {
221 uint32_t host_no;
222 uint32_t flashnode_idx;
223 uint32_t count;
224 } set_flashnode;
225 struct msg_new_flashnode {
226 uint32_t host_no;
227 uint32_t len;
228 } new_flashnode;
229 struct msg_del_flashnode {
230 uint32_t host_no;
231 uint32_t flashnode_idx;
232 } del_flashnode;
233 struct msg_login_flashnode {
234 uint32_t host_no;
235 uint32_t flashnode_idx;
236 } login_flashnode;
237 struct msg_logout_flashnode {
238 uint32_t host_no;
239 uint32_t flashnode_idx;
240 } logout_flashnode;
241 struct msg_logout_flashnode_sid {
242 uint32_t host_no;
243 uint32_t sid;
244 } logout_flashnode_sid;
39e84790
AA
245 } u;
246 union {
247 /* messages k -> u */
39e84790
AA
248 int retcode;
249 struct msg_create_session_ret {
39e84790 250 uint32_t sid;
b5c7a12d 251 uint32_t host_no;
39e84790 252 } c_session_ret;
b5c7a12d
MC
253 struct msg_create_conn_ret {
254 uint32_t sid;
255 uint32_t cid;
256 } c_conn_ret;
26974789
MC
257 struct msg_unbind_session {
258 uint32_t sid;
259 uint32_t host_no;
260 } unbind_session;
39e84790 261 struct msg_recv_req {
b5c7a12d
MC
262 uint32_t sid;
263 uint32_t cid;
39e84790 264 uint64_t recv_handle;
39e84790 265 } recv_req;
17fa575e
MR
266 struct msg_conn_login {
267 uint32_t sid;
268 uint32_t cid;
269 uint32_t state; /* enum iscsi_conn_state */
270 } conn_login;
39e84790 271 struct msg_conn_error {
b5c7a12d
MC
272 uint32_t sid;
273 uint32_t cid;
39e84790
AA
274 uint32_t error; /* enum iscsi_err */
275 } connerror;
53cb8a1f
MC
276 struct msg_session_destroyed {
277 uint32_t host_no;
278 uint32_t sid;
279 } d_session;
264faaaa
OG
280 struct msg_transport_connect_ret {
281 uint64_t handle;
282 } ep_connect_ret;
43514774
MC
283 struct msg_req_path {
284 uint32_t host_no;
285 } req_path;
286 struct msg_notify_if_down {
287 uint32_t host_no;
288 } notify_if_down;
a11e2545
VC
289 struct msg_host_event {
290 uint32_t host_no;
291 uint32_t data_size;
292 enum iscsi_host_event_code code;
293 } host_event;
ac20c7bf
VC
294 struct msg_ping_comp {
295 uint32_t host_no;
1a590cab
VC
296 uint32_t status; /* enum
297 * iscsi_ping_status_code */
ac20c7bf
VC
298 uint32_t pid; /* unique ping id associated
299 with each ping request */
300 uint32_t data_size;
301 } ping_comp;
c6a4bb2e
AC
302 struct msg_new_flashnode_ret {
303 uint32_t flashnode_idx;
304 } new_flashnode_ret;
39e84790
AA
305 } r;
306} __attribute__ ((aligned (sizeof(uint64_t))));
307
56c155b5
MC
308enum iscsi_param_type {
309 ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */
310 ISCSI_HOST_PARAM, /* iscsi_host_param */
311 ISCSI_NET_PARAM, /* iscsi_net_param */
c6a4bb2e 312 ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */
3af142fe 313 ISCSI_CHAP_PARAM, /* iscsi_chap_param */
3e0f65b3 314 ISCSI_IFACE_PARAM, /* iscsi_iface_param */
56c155b5
MC
315};
316
3af142fe
AC
317/* structure for minimalist usecase */
318struct iscsi_param_info {
319 uint32_t len; /* Actual length of the param value */
320 uint16_t param; /* iscsi param */
321 uint8_t value[0]; /* length sized value follows */
322} __packed;
323
56c155b5
MC
324struct iscsi_iface_param_info {
325 uint32_t iface_num; /* iface number, 0 - n */
326 uint32_t len; /* Actual length of the param */
327 uint16_t param; /* iscsi param value */
328 uint8_t iface_type; /* IPv4 or IPv6 */
329 uint8_t param_type; /* iscsi_param_type */
330 uint8_t value[0]; /* length sized value follows */
331} __packed;
332
43514774
MC
333/*
334 * To keep the struct iscsi_uevent size the same for userspace code
335 * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and
336 * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the
337 * struct iscsi_uevent in the NETLINK_ISCSI message.
338 */
339struct iscsi_path {
340 uint64_t handle;
341 uint8_t mac_addr[6];
342 uint8_t mac_addr_old[6];
343 uint32_t ip_addr_len; /* 4 or 16 */
344 union {
345 struct in_addr v4_addr;
346 struct in6_addr v6_addr;
347 } src;
348 union {
349 struct in_addr v4_addr;
350 struct in6_addr v6_addr;
351 } dst;
352 uint16_t vlan_id;
353 uint16_t pmtu;
354} __attribute__ ((aligned (sizeof(uint64_t))));
355
56c155b5
MC
356/* iscsi iface enabled/disabled setting */
357#define ISCSI_IFACE_DISABLE 0x01
358#define ISCSI_IFACE_ENABLE 0x02
359
360/* ipv4 bootproto */
361#define ISCSI_BOOTPROTO_STATIC 0x01
362#define ISCSI_BOOTPROTO_DHCP 0x02
363
364/* ipv6 addr autoconfig type */
365#define ISCSI_IPV6_AUTOCFG_DISABLE 0x01
366#define ISCSI_IPV6_AUTOCFG_ND_ENABLE 0x02
367#define ISCSI_IPV6_AUTOCFG_DHCPV6_ENABLE 0x03
368
369/* ipv6 link local addr type */
370#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_ENABLE 0x01
371#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_DISABLE 0x02
372
373/* ipv6 router addr type */
374#define ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE 0x01
375#define ISCSI_IPV6_ROUTER_AUTOCFG_DISABLE 0x02
376
377#define ISCSI_IFACE_TYPE_IPV4 0x01
378#define ISCSI_IFACE_TYPE_IPV6 0x02
379
4223b9e9
MC
380#define ISCSI_MAX_VLAN_ID 4095
381#define ISCSI_MAX_VLAN_PRIORITY 7
382
383/* iscsi vlan enable/disabled setting */
384#define ISCSI_VLAN_DISABLE 0x01
385#define ISCSI_VLAN_ENABLE 0x02
386
3e0f65b3
HZ
387/* iscsi generic enable/disabled setting for various features */
388#define ISCSI_NET_PARAM_DISABLE 0x01
389#define ISCSI_NET_PARAM_ENABLE 0x02
390
56c155b5
MC
391/* iSCSI network params */
392enum iscsi_net_param {
393 ISCSI_NET_PARAM_IPV4_ADDR = 1,
b867cda4
HZ
394 ISCSI_NET_PARAM_IPV4_SUBNET,
395 ISCSI_NET_PARAM_IPV4_GW,
396 ISCSI_NET_PARAM_IPV4_BOOTPROTO,
397 ISCSI_NET_PARAM_MAC,
398 ISCSI_NET_PARAM_IPV6_LINKLOCAL,
399 ISCSI_NET_PARAM_IPV6_ADDR,
400 ISCSI_NET_PARAM_IPV6_ROUTER,
401 ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG,
402 ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG,
403 ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG,
404 ISCSI_NET_PARAM_IFACE_ENABLE,
405 ISCSI_NET_PARAM_VLAN_ID,
406 ISCSI_NET_PARAM_VLAN_PRIORITY,
407 ISCSI_NET_PARAM_VLAN_ENABLED,
408 ISCSI_NET_PARAM_VLAN_TAG,
409 ISCSI_NET_PARAM_IFACE_TYPE,
410 ISCSI_NET_PARAM_IFACE_NAME,
411 ISCSI_NET_PARAM_MTU,
412 ISCSI_NET_PARAM_PORT,
3e0f65b3
HZ
413 ISCSI_NET_PARAM_IPADDR_STATE,
414 ISCSI_NET_PARAM_IPV6_LINKLOCAL_STATE,
415 ISCSI_NET_PARAM_IPV6_ROUTER_STATE,
416 ISCSI_NET_PARAM_DELAYED_ACK_EN,
417 ISCSI_NET_PARAM_TCP_NAGLE_DISABLE,
418 ISCSI_NET_PARAM_TCP_WSF_DISABLE,
419 ISCSI_NET_PARAM_TCP_WSF,
420 ISCSI_NET_PARAM_TCP_TIMER_SCALE,
421 ISCSI_NET_PARAM_TCP_TIMESTAMP_EN,
422 ISCSI_NET_PARAM_CACHE_ID,
423 ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN,
424 ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN,
425 ISCSI_NET_PARAM_IPV4_TOS_EN,
426 ISCSI_NET_PARAM_IPV4_TOS,
427 ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN,
428 ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN,
429 ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID,
430 ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN,
431 ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN,
432 ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID,
433 ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN,
434 ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE,
435 ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN,
436 ISCSI_NET_PARAM_IPV4_TTL,
437 ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN,
438 ISCSI_NET_PARAM_IPV6_MLD_EN,
439 ISCSI_NET_PARAM_IPV6_FLOW_LABEL,
440 ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS,
441 ISCSI_NET_PARAM_IPV6_HOP_LIMIT,
442 ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO,
443 ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME,
444 ISCSI_NET_PARAM_IPV6_ND_STALE_TMO,
445 ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT,
446 ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU,
447 ISCSI_NET_PARAM_REDIRECT_EN,
448};
449
450enum iscsi_ipaddress_state {
451 ISCSI_IPDDRESS_STATE_UNCONFIGURED,
452 ISCSI_IPDDRESS_STATE_ACQUIRING,
453 ISCSI_IPDDRESS_STATE_TENTATIVE,
454 ISCSI_IPDDRESS_STATE_VALID,
455 ISCSI_IPDDRESS_STATE_DISABLING,
456 ISCSI_IPDDRESS_STATE_INVALID,
457 ISCSI_IPDDRESS_STATE_DEPRECATED,
458};
459
460enum iscsi_router_state {
461 ISCSI_ROUTER_STATE_UNKNOWN,
462 ISCSI_ROUTER_STATE_ADVERTISED,
463 ISCSI_ROUTER_STATE_MANUAL,
464 ISCSI_ROUTER_STATE_STALE,
465};
466
467/* iSCSI specific settings params for iface */
468enum iscsi_iface_param {
469 ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO,
470 ISCSI_IFACE_PARAM_HDRDGST_EN,
471 ISCSI_IFACE_PARAM_DATADGST_EN,
472 ISCSI_IFACE_PARAM_IMM_DATA_EN,
473 ISCSI_IFACE_PARAM_INITIAL_R2T_EN,
474 ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN,
475 ISCSI_IFACE_PARAM_PDU_INORDER_EN,
476 ISCSI_IFACE_PARAM_ERL,
477 ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH,
478 ISCSI_IFACE_PARAM_FIRST_BURST,
479 ISCSI_IFACE_PARAM_MAX_R2T,
480 ISCSI_IFACE_PARAM_MAX_BURST,
481 ISCSI_IFACE_PARAM_CHAP_AUTH_EN,
482 ISCSI_IFACE_PARAM_BIDI_CHAP_EN,
483 ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL,
484 ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN,
485 ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN,
486 ISCSI_IFACE_PARAM_INITIATOR_NAME,
56c155b5
MC
487};
488
17fa575e
MR
489enum iscsi_conn_state {
490 ISCSI_CONN_STATE_FREE,
491 ISCSI_CONN_STATE_XPT_WAIT,
492 ISCSI_CONN_STATE_IN_LOGIN,
493 ISCSI_CONN_STATE_LOGGED_IN,
494 ISCSI_CONN_STATE_IN_LOGOUT,
495 ISCSI_CONN_STATE_LOGOUT_REQUESTED,
496 ISCSI_CONN_STATE_CLEANUP_WAIT,
497};
498
39e84790
AA
499/*
500 * Common error codes
501 */
502enum iscsi_err {
503 ISCSI_OK = 0,
504
505 ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1,
506 ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2,
507 ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3,
508 ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4,
509 ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5,
510 ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6,
511 ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7,
512 ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8,
513 ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9,
514 ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10,
515 ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11,
516 ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12,
517 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13,
518 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14,
519 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
7996a778
MC
520 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
521 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
e5bd7b54 522 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
6f481e3c 523 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
d1af8a32 524 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
df4da5cd 525 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21,
39e84790
AA
526};
527
528/*
529 * iSCSI Parameters (RFC3720)
530 */
531enum iscsi_param {
fd7255f5
MC
532 /* passed in using netlink set param */
533 ISCSI_PARAM_MAX_RECV_DLENGTH,
534 ISCSI_PARAM_MAX_XMIT_DLENGTH,
535 ISCSI_PARAM_HDRDGST_EN,
536 ISCSI_PARAM_DATADGST_EN,
537 ISCSI_PARAM_INITIAL_R2T_EN,
538 ISCSI_PARAM_MAX_R2T,
539 ISCSI_PARAM_IMM_DATA_EN,
540 ISCSI_PARAM_FIRST_BURST,
541 ISCSI_PARAM_MAX_BURST,
542 ISCSI_PARAM_PDU_INORDER_EN,
543 ISCSI_PARAM_DATASEQ_INORDER_EN,
544 ISCSI_PARAM_ERL,
545 ISCSI_PARAM_IFMARKER_EN,
546 ISCSI_PARAM_OFMARKER_EN,
8d2860b3 547 ISCSI_PARAM_EXP_STATSN,
fd7255f5
MC
548 ISCSI_PARAM_TARGET_NAME,
549 ISCSI_PARAM_TPGT,
550 ISCSI_PARAM_PERSISTENT_ADDRESS,
551 ISCSI_PARAM_PERSISTENT_PORT,
30a6c652 552 ISCSI_PARAM_SESS_RECOVERY_TMO,
fd7255f5 553
25985edc 554 /* passed in through bind conn using transport_fd */
fd7255f5
MC
555 ISCSI_PARAM_CONN_PORT,
556 ISCSI_PARAM_CONN_ADDRESS,
557
b2c64167
MC
558 ISCSI_PARAM_USERNAME,
559 ISCSI_PARAM_USERNAME_IN,
560 ISCSI_PARAM_PASSWORD,
561 ISCSI_PARAM_PASSWORD_IN,
562
843c0a8a 563 ISCSI_PARAM_FAST_ABORT,
f6d5180c
MC
564 ISCSI_PARAM_ABORT_TMO,
565 ISCSI_PARAM_LU_RESET_TMO,
566 ISCSI_PARAM_HOST_RESET_TMO,
567
568 ISCSI_PARAM_PING_TMO,
569 ISCSI_PARAM_RECV_TMO,
88dfd340
MC
570
571 ISCSI_PARAM_IFACE_NAME,
572 ISCSI_PARAM_ISID,
573 ISCSI_PARAM_INITIATOR_NAME,
3fe5ae8b
MC
574
575 ISCSI_PARAM_TGT_RESET_TMO,
3b2bef1f 576 ISCSI_PARAM_TARGET_ALIAS,
30534952
MC
577
578 ISCSI_PARAM_CHAP_IN_IDX,
579 ISCSI_PARAM_CHAP_OUT_IDX,
3b9373e9
EW
580
581 ISCSI_PARAM_BOOT_ROOT,
582 ISCSI_PARAM_BOOT_NIC,
583 ISCSI_PARAM_BOOT_TARGET,
584
ae542edb
AC
585 ISCSI_PARAM_AUTO_SND_TGT_DISABLE,
586 ISCSI_PARAM_DISCOVERY_SESS,
587 ISCSI_PARAM_PORTAL_TYPE,
588 ISCSI_PARAM_CHAP_AUTH_EN,
589 ISCSI_PARAM_DISCOVERY_LOGOUT_EN,
590 ISCSI_PARAM_BIDI_CHAP_EN,
591 ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL,
592
593 ISCSI_PARAM_DEF_TIME2WAIT,
594 ISCSI_PARAM_DEF_TIME2RETAIN,
595 ISCSI_PARAM_MAX_SEGMENT_SIZE,
596 ISCSI_PARAM_STATSN,
597 ISCSI_PARAM_KEEPALIVE_TMO,
598 ISCSI_PARAM_LOCAL_PORT,
599 ISCSI_PARAM_TSID,
600 ISCSI_PARAM_DEF_TASKMGMT_TMO,
601
602 ISCSI_PARAM_TCP_TIMESTAMP_STAT,
603 ISCSI_PARAM_TCP_WSF_DISABLE,
604 ISCSI_PARAM_TCP_NAGLE_DISABLE,
605 ISCSI_PARAM_TCP_TIMER_SCALE,
606 ISCSI_PARAM_TCP_TIMESTAMP_EN,
607 ISCSI_PARAM_TCP_XMIT_WSF,
608 ISCSI_PARAM_TCP_RECV_WSF,
609 ISCSI_PARAM_IP_FRAGMENT_DISABLE,
610 ISCSI_PARAM_IPV4_TOS,
611 ISCSI_PARAM_IPV6_TC,
612 ISCSI_PARAM_IPV6_FLOW_LABEL,
613 ISCSI_PARAM_IS_FW_ASSIGNED_IPV6,
614
615 ISCSI_PARAM_DISCOVERY_PARENT_IDX,
616 ISCSI_PARAM_DISCOVERY_PARENT_TYPE,
fd7255f5
MC
617 /* must always be last */
618 ISCSI_PARAM_MAX,
39e84790 619};
fd7255f5 620
1819dc81
MC
621/* iSCSI HBA params */
622enum iscsi_host_param {
623 ISCSI_HOST_PARAM_HWADDRESS,
8ad5781a 624 ISCSI_HOST_PARAM_INITIATOR_NAME,
d8196ed2 625 ISCSI_HOST_PARAM_NETDEV_NAME,
22236961 626 ISCSI_HOST_PARAM_IPADDRESS,
aeddde29
VC
627 ISCSI_HOST_PARAM_PORT_STATE,
628 ISCSI_HOST_PARAM_PORT_SPEED,
1819dc81
MC
629 ISCSI_HOST_PARAM_MAX,
630};
631
2902eb49
AC
632/* portal type */
633#define PORTAL_TYPE_IPV4 "ipv4"
634#define PORTAL_TYPE_IPV6 "ipv6"
635
c6a4bb2e
AC
636/* iSCSI Flash Target params */
637enum iscsi_flashnode_param {
638 ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6,
639 ISCSI_FLASHNODE_PORTAL_TYPE,
640 ISCSI_FLASHNODE_AUTO_SND_TGT_DISABLE,
641 ISCSI_FLASHNODE_DISCOVERY_SESS,
642 ISCSI_FLASHNODE_ENTRY_EN,
643 ISCSI_FLASHNODE_HDR_DGST_EN,
644 ISCSI_FLASHNODE_DATA_DGST_EN,
645 ISCSI_FLASHNODE_IMM_DATA_EN,
646 ISCSI_FLASHNODE_INITIAL_R2T_EN,
647 ISCSI_FLASHNODE_DATASEQ_INORDER,
648 ISCSI_FLASHNODE_PDU_INORDER,
649 ISCSI_FLASHNODE_CHAP_AUTH_EN,
650 ISCSI_FLASHNODE_SNACK_REQ_EN,
651 ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN,
652 ISCSI_FLASHNODE_BIDI_CHAP_EN,
653 /* make authentication for discovery sessions optional */
654 ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL,
655 ISCSI_FLASHNODE_ERL,
656 ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT,
657 ISCSI_FLASHNODE_TCP_NAGLE_DISABLE,
658 ISCSI_FLASHNODE_TCP_WSF_DISABLE,
659 ISCSI_FLASHNODE_TCP_TIMER_SCALE,
660 ISCSI_FLASHNODE_TCP_TIMESTAMP_EN,
661 ISCSI_FLASHNODE_IP_FRAG_DISABLE,
662 ISCSI_FLASHNODE_MAX_RECV_DLENGTH,
663 ISCSI_FLASHNODE_MAX_XMIT_DLENGTH,
664 ISCSI_FLASHNODE_FIRST_BURST,
665 ISCSI_FLASHNODE_DEF_TIME2WAIT,
666 ISCSI_FLASHNODE_DEF_TIME2RETAIN,
667 ISCSI_FLASHNODE_MAX_R2T,
668 ISCSI_FLASHNODE_KEEPALIVE_TMO,
669 ISCSI_FLASHNODE_ISID,
670 ISCSI_FLASHNODE_TSID,
671 ISCSI_FLASHNODE_PORT,
672 ISCSI_FLASHNODE_MAX_BURST,
673 ISCSI_FLASHNODE_DEF_TASKMGMT_TMO,
674 ISCSI_FLASHNODE_IPADDR,
675 ISCSI_FLASHNODE_ALIAS,
676 ISCSI_FLASHNODE_REDIRECT_IPADDR,
677 ISCSI_FLASHNODE_MAX_SEGMENT_SIZE,
678 ISCSI_FLASHNODE_LOCAL_PORT,
679 ISCSI_FLASHNODE_IPV4_TOS,
680 ISCSI_FLASHNODE_IPV6_TC,
681 ISCSI_FLASHNODE_IPV6_FLOW_LABEL,
682 ISCSI_FLASHNODE_NAME,
683 ISCSI_FLASHNODE_TPGT,
684 ISCSI_FLASHNODE_LINK_LOCAL_IPV6,
685 ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX,
686 ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE,
687 ISCSI_FLASHNODE_TCP_XMIT_WSF,
688 ISCSI_FLASHNODE_TCP_RECV_WSF,
689 ISCSI_FLASHNODE_CHAP_IN_IDX,
690 ISCSI_FLASHNODE_CHAP_OUT_IDX,
691 ISCSI_FLASHNODE_USERNAME,
692 ISCSI_FLASHNODE_USERNAME_IN,
693 ISCSI_FLASHNODE_PASSWORD,
694 ISCSI_FLASHNODE_PASSWORD_IN,
695 ISCSI_FLASHNODE_STATSN,
696 ISCSI_FLASHNODE_EXP_STATSN,
697 ISCSI_FLASHNODE_IS_BOOT_TGT,
698
699 ISCSI_FLASHNODE_MAX,
700};
701
702struct iscsi_flashnode_param_info {
703 uint32_t len; /* Actual length of the param */
704 uint16_t param; /* iscsi param value */
705 uint8_t value[0]; /* length sized value follows */
706} __packed;
707
708enum iscsi_discovery_parent_type {
709 ISCSI_DISC_PARENT_UNKNOWN = 0x1,
710 ISCSI_DISC_PARENT_SENDTGT = 0x2,
711 ISCSI_DISC_PARENT_ISNS = 0x3,
712};
713
aeddde29
VC
714/* iSCSI port Speed */
715enum iscsi_port_speed {
716 ISCSI_PORT_SPEED_UNKNOWN = 0x1,
717 ISCSI_PORT_SPEED_10MBPS = 0x2,
718 ISCSI_PORT_SPEED_100MBPS = 0x4,
719 ISCSI_PORT_SPEED_1GBPS = 0x8,
720 ISCSI_PORT_SPEED_10GBPS = 0x10,
721};
722
723/* iSCSI port state */
724enum iscsi_port_state {
725 ISCSI_PORT_STATE_DOWN = 0x1,
726 ISCSI_PORT_STATE_UP = 0x2,
727};
728
1a590cab
VC
729/* iSCSI PING status/error code */
730enum iscsi_ping_status_code {
731 ISCSI_PING_SUCCESS = 0,
732 ISCSI_PING_FW_DISABLED = 0x1,
733 ISCSI_PING_IPADDR_INVALID = 0x2,
734 ISCSI_PING_LINKLOCAL_IPV6_ADDR_INVALID = 0x3,
735 ISCSI_PING_TIMEOUT = 0x4,
736 ISCSI_PING_INVALID_DEST_ADDR = 0x5,
737 ISCSI_PING_OVERSIZE_PACKET = 0x6,
738 ISCSI_PING_ICMP_ERROR = 0x7,
739 ISCSI_PING_MAX_REQ_EXCEEDED = 0x8,
740 ISCSI_PING_NO_ARP_RECEIVED = 0x9,
741};
742
39e84790
AA
743#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
744#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
39e84790
AA
745
746/*
747 * These flags presents iSCSI Data-Path capabilities.
748 */
749#define CAP_RECOVERY_L0 0x1
750#define CAP_RECOVERY_L1 0x2
751#define CAP_RECOVERY_L2 0x4
752#define CAP_MULTI_R2T 0x8
753#define CAP_HDRDGST 0x10
754#define CAP_DATADGST 0x20
755#define CAP_MULTI_CONN 0x40
756#define CAP_TEXT_NEGO 0x80
757#define CAP_MARKERS 0x100
0ab823db 758#define CAP_FW_DB 0x200
63c62f1c
MC
759#define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */
760#define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */
761#define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */
6df19a79
MC
762#define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal,
763 and verification */
17fa575e 764#define CAP_LOGIN_OFFLOAD 0x4000 /* offload session login */
39e84790
AA
765
766/*
767 * These flags describes reason of stop_conn() call
768 */
769#define STOP_CONN_TERM 0x1
770#define STOP_CONN_SUSPEND 0x2
771#define STOP_CONN_RECOVER 0x3
772
773#define ISCSI_STATS_CUSTOM_MAX 32
774#define ISCSI_STATS_CUSTOM_DESC_MAX 64
775struct iscsi_stats_custom {
776 char desc[ISCSI_STATS_CUSTOM_DESC_MAX];
777 uint64_t value;
778};
779
780/*
781 * struct iscsi_stats - iSCSI Statistics (iSCSI MIB)
782 *
783 * Note: this structure contains counters collected on per-connection basis.
784 */
785struct iscsi_stats {
786 /* octets */
787 uint64_t txdata_octets;
788 uint64_t rxdata_octets;
789
790 /* xmit pdus */
791 uint32_t noptx_pdus;
792 uint32_t scsicmd_pdus;
793 uint32_t tmfcmd_pdus;
794 uint32_t login_pdus;
795 uint32_t text_pdus;
796 uint32_t dataout_pdus;
797 uint32_t logout_pdus;
798 uint32_t snack_pdus;
799
800 /* recv pdus */
801 uint32_t noprx_pdus;
802 uint32_t scsirsp_pdus;
803 uint32_t tmfrsp_pdus;
804 uint32_t textrsp_pdus;
805 uint32_t datain_pdus;
806 uint32_t logoutrsp_pdus;
807 uint32_t r2t_pdus;
808 uint32_t async_pdus;
809 uint32_t rjt_pdus;
810
811 /* errors */
812 uint32_t digest_err;
813 uint32_t timeout_err;
814
815 /*
816 * iSCSI Custom Statistics support, i.e. Transport could
817 * extend existing MIB statistics with its own specific statistics
818 * up to ISCSI_STATS_CUSTOM_MAX
819 */
820 uint32_t custom_length;
821 struct iscsi_stats_custom custom[0]
822 __attribute__ ((aligned (sizeof(uint64_t))));
823};
824
6260a5d2
NJ
825enum chap_type_e {
826 CHAP_TYPE_OUT,
827 CHAP_TYPE_IN,
828};
829
3af142fe
AC
830enum iscsi_chap_param {
831 ISCSI_CHAP_PARAM_INDEX,
832 ISCSI_CHAP_PARAM_CHAP_TYPE,
833 ISCSI_CHAP_PARAM_USERNAME,
834 ISCSI_CHAP_PARAM_PASSWORD,
835 ISCSI_CHAP_PARAM_PASSWORD_LEN
836};
837
6260a5d2
NJ
838#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256
839#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256
840struct iscsi_chap_rec {
841 uint16_t chap_tbl_idx;
842 enum chap_type_e chap_type;
843 char username[ISCSI_CHAP_AUTH_NAME_MAX_LEN];
844 uint8_t password[ISCSI_CHAP_AUTH_SECRET_MAX_LEN];
845 uint8_t password_length;
5a5a15f2 846};
6260a5d2 847
39e84790 848#endif
This page took 0.659838 seconds and 5 git commands to generate.