iscsi tools: manage qla4xxx iscsi sessions with iscsiadm
[open-iscsi.git] / include / iscsi_if.h
blob0a960804f786cfdb0449a8d72105369bcabda403
1 /*
2 * iSCSI User/Kernel Shares (Defines, Constants, Protocol definitions, etc)
4 * Copyright (C) 2005 Dmitry Yusupov
5 * Copyright (C) 2005 Alex Aizman
6 * maintained by open-iscsi@googlegroups.com
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.
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.
18 * See the file COPYING included with this distribution for more details.
21 #ifndef ISCSI_IF_H
22 #define ISCSI_IF_H
24 #ifdef __KERNEL__
25 #include <linux/in.h>
26 #include <linux/in6.h>
27 #else
28 #include <netinet/in.h>
29 #endif
31 #include "iscsi_proto.h"
33 #define ISCSI_NL_GRP_ISCSID 1
34 #define ISCSI_NL_GRP_UIP 2
36 #define UEVENT_BASE 10
37 #define KEVENT_BASE 100
38 #define ISCSI_ERR_BASE 1000
40 enum iscsi_uevent_e {
41 ISCSI_UEVENT_UNKNOWN = 0,
43 /* down events */
44 ISCSI_UEVENT_CREATE_SESSION = UEVENT_BASE + 1,
45 ISCSI_UEVENT_DESTROY_SESSION = UEVENT_BASE + 2,
46 ISCSI_UEVENT_CREATE_CONN = UEVENT_BASE + 3,
47 ISCSI_UEVENT_DESTROY_CONN = UEVENT_BASE + 4,
48 ISCSI_UEVENT_BIND_CONN = UEVENT_BASE + 5,
49 ISCSI_UEVENT_SET_PARAM = UEVENT_BASE + 6,
50 ISCSI_UEVENT_START_CONN = UEVENT_BASE + 7,
51 ISCSI_UEVENT_STOP_CONN = UEVENT_BASE + 8,
52 ISCSI_UEVENT_SEND_PDU = UEVENT_BASE + 9,
53 ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10,
54 ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11,
56 ISCSI_UEVENT_TRANSPORT_EP_CONNECT = UEVENT_BASE + 12,
57 ISCSI_UEVENT_TRANSPORT_EP_POLL = UEVENT_BASE + 13,
58 ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
60 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
61 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
62 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
63 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18,
64 ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19,
66 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
67 ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21,
69 ISCSI_UEVENT_MAX = ISCSI_UEVENT_SET_IFACE_PARAMS,
71 /* up events */
72 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
73 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
74 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
75 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
76 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
77 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
79 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
80 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
81 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
83 ISCSI_KEVENT_MAX = ISCSI_KEVENT_CONN_LOGIN_STATE,
86 enum iscsi_tgt_dscvr {
87 ISCSI_TGT_DSCVR_SEND_TARGETS = 1,
88 ISCSI_TGT_DSCVR_ISNS = 2,
89 ISCSI_TGT_DSCVR_SLP = 3,
92 struct iscsi_uevent {
93 uint32_t type; /* k/u events type */
94 uint32_t iferror; /* carries interface or resource errors */
95 uint64_t transport_handle;
97 union {
98 /* messages u -> k */
99 struct msg_create_session {
100 uint32_t initial_cmdsn;
101 uint16_t cmds_max;
102 uint16_t queue_depth;
103 } c_session;
104 struct msg_create_bound_session {
105 uint64_t ep_handle;
106 uint32_t initial_cmdsn;
107 uint16_t cmds_max;
108 uint16_t queue_depth;
109 } c_bound_session;
110 struct msg_destroy_session {
111 uint32_t sid;
112 } d_session;
113 struct msg_create_conn {
114 uint32_t sid;
115 uint32_t cid;
116 } c_conn;
117 struct msg_bind_conn {
118 uint32_t sid;
119 uint32_t cid;
120 uint64_t transport_eph;
121 uint32_t is_leading;
122 } b_conn;
123 struct msg_destroy_conn {
124 uint32_t sid;
125 uint32_t cid;
126 } d_conn;
127 struct msg_send_pdu {
128 uint32_t sid;
129 uint32_t cid;
130 uint32_t hdr_size;
131 uint32_t data_size;
132 } send_pdu;
133 struct msg_set_param {
134 uint32_t sid;
135 uint32_t cid;
136 uint32_t param; /* enum iscsi_param */
137 uint32_t len;
138 } set_param;
139 struct msg_start_conn {
140 uint32_t sid;
141 uint32_t cid;
142 } start_conn;
143 struct msg_stop_conn {
144 uint32_t sid;
145 uint32_t cid;
146 uint64_t conn_handle;
147 uint32_t flag;
148 } stop_conn;
149 struct msg_get_stats {
150 uint32_t sid;
151 uint32_t cid;
152 } get_stats;
153 struct msg_transport_connect {
154 uint32_t non_blocking;
155 } ep_connect;
156 struct msg_transport_connect_through_host {
157 uint32_t host_no;
158 uint32_t non_blocking;
159 } ep_connect_through_host;
160 struct msg_transport_poll {
161 uint64_t ep_handle;
162 uint32_t timeout_ms;
163 } ep_poll;
164 struct msg_transport_disconnect {
165 uint64_t ep_handle;
166 } ep_disconnect;
167 struct msg_tgt_dscvr {
168 enum iscsi_tgt_dscvr type;
169 uint32_t host_no;
171 * enable = 1 to establish a new connection
172 * with the server. enable = 0 to disconnect
173 * from the server. Used primarily to switch
174 * from one iSNS server to another.
176 uint32_t enable;
177 } tgt_dscvr;
178 struct msg_set_host_param {
179 uint32_t host_no;
180 uint32_t param; /* enum iscsi_host_param */
181 uint32_t len;
182 } set_host_param;
183 struct msg_set_path {
184 uint32_t host_no;
185 } set_path;
186 struct msg_set_iface_params {
187 uint32_t host_no;
188 uint32_t count;
189 } set_iface_params;
190 } u;
191 union {
192 /* messages k -> u */
193 int retcode;
194 struct msg_create_session_ret {
195 uint32_t sid;
196 uint32_t host_no;
197 } c_session_ret;
198 struct msg_create_conn_ret {
199 uint32_t sid;
200 uint32_t cid;
201 } c_conn_ret;
202 struct msg_unbind_session {
203 uint32_t sid;
204 uint32_t host_no;
205 } unbind_session;
206 struct msg_recv_req {
207 uint32_t sid;
208 uint32_t cid;
209 uint64_t recv_handle;
210 } recv_req;
211 struct msg_conn_login {
212 uint32_t sid;
213 uint32_t cid;
214 uint32_t state; /* enum iscsi_conn_state */
215 } conn_login;
216 struct msg_conn_error {
217 uint32_t sid;
218 uint32_t cid;
219 uint32_t error; /* enum iscsi_err */
220 } connerror;
221 struct msg_session_destroyed {
222 uint32_t host_no;
223 uint32_t sid;
224 } d_session;
225 struct msg_transport_connect_ret {
226 uint64_t handle;
227 } ep_connect_ret;
228 struct msg_req_path {
229 uint32_t host_no;
230 } req_path;
231 struct msg_notify_if_down {
232 uint32_t host_no;
233 } notify_if_down;
234 } r;
235 } __attribute__ ((aligned (sizeof(uint64_t))));
237 enum iscsi_param_type {
238 ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */
239 ISCSI_HOST_PARAM, /* iscsi_host_param */
240 ISCSI_NET_PARAM, /* iscsi_net_param */
243 struct iscsi_iface_param_info {
244 uint32_t iface_num; /* iface number, 0 - n */
245 uint32_t len; /* Actual length of the param */
246 uint16_t param; /* iscsi param value */
247 uint8_t iface_type; /* IPv4 or IPv6 */
248 uint8_t param_type; /* iscsi_param_type */
249 uint8_t value[0]; /* length sized value follows */
250 } __packed;
253 * To keep the struct iscsi_uevent size the same for userspace code
254 * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and
255 * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the
256 * struct iscsi_uevent in the NETLINK_ISCSI message.
258 struct iscsi_path {
259 uint64_t handle;
260 uint8_t mac_addr[6];
261 uint8_t mac_addr_old[6];
262 uint32_t ip_addr_len; /* 4 or 16 */
263 union {
264 struct in_addr v4_addr;
265 struct in6_addr v6_addr;
266 } src;
267 union {
268 struct in_addr v4_addr;
269 struct in6_addr v6_addr;
270 } dst;
271 uint16_t vlan_id;
272 uint16_t pmtu;
273 } __attribute__ ((aligned (sizeof(uint64_t))));
275 /* iscsi iface enabled/disabled setting */
276 #define ISCSI_IFACE_DISABLE 0x01
277 #define ISCSI_IFACE_ENABLE 0x02
279 /* ipv4 bootproto */
280 #define ISCSI_BOOTPROTO_STATIC 0x01
281 #define ISCSI_BOOTPROTO_DHCP 0x02
283 /* ipv6 addr autoconfig type */
284 #define ISCSI_IPV6_AUTOCFG_DISABLE 0x01
285 #define ISCSI_IPV6_AUTOCFG_ND_ENABLE 0x02
286 #define ISCSI_IPV6_AUTOCFG_DHCPV6_ENABLE 0x03
288 /* ipv6 link local addr type */
289 #define ISCSI_IPV6_LINKLOCAL_AUTOCFG_ENABLE 0x01
290 #define ISCSI_IPV6_LINKLOCAL_AUTOCFG_DISABLE 0x02
292 /* ipv6 router addr type */
293 #define ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE 0x01
294 #define ISCSI_IPV6_ROUTER_AUTOCFG_DISABLE 0x02
296 #define ISCSI_IFACE_TYPE_IPV4 0x01
297 #define ISCSI_IFACE_TYPE_IPV6 0x02
299 #define ISCSI_MAX_VLAN_ID 4095
300 #define ISCSI_MAX_VLAN_PRIORITY 7
302 /* iscsi vlan enable/disabled setting */
303 #define ISCSI_VLAN_DISABLE 0x01
304 #define ISCSI_VLAN_ENABLE 0x02
306 /* iSCSI network params */
307 enum iscsi_net_param {
308 ISCSI_NET_PARAM_IPV4_ADDR = 1,
309 ISCSI_NET_PARAM_IPV4_SUBNET = 2,
310 ISCSI_NET_PARAM_IPV4_GW = 3,
311 ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4,
312 ISCSI_NET_PARAM_MAC = 5,
313 ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6,
314 ISCSI_NET_PARAM_IPV6_ADDR = 7,
315 ISCSI_NET_PARAM_IPV6_ROUTER = 8,
316 ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9,
317 ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10,
318 ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11,
319 ISCSI_NET_PARAM_IFACE_ENABLE = 12,
320 ISCSI_NET_PARAM_VLAN_ID = 13,
321 ISCSI_NET_PARAM_VLAN_PRIORITY = 14,
322 ISCSI_NET_PARAM_VLAN_ENABLED = 15,
323 ISCSI_NET_PARAM_IFACE_TYPE = 16,
324 ISCSI_NET_PARAM_IFACE_NAME = 17,
325 ISCSI_NET_PARAM_MTU = 18,
326 ISCSI_NET_PARAM_PORT = 19,
329 enum iscsi_conn_state {
330 ISCSI_CONN_STATE_FREE,
331 ISCSI_CONN_STATE_XPT_WAIT,
332 ISCSI_CONN_STATE_IN_LOGIN,
333 ISCSI_CONN_STATE_LOGGED_IN,
334 ISCSI_CONN_STATE_IN_LOGOUT,
335 ISCSI_CONN_STATE_LOGOUT_REQUESTED,
336 ISCSI_CONN_STATE_CLEANUP_WAIT,
340 * Common error codes
342 enum iscsi_err {
343 ISCSI_OK = 0,
345 ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1,
346 ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2,
347 ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3,
348 ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4,
349 ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5,
350 ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6,
351 ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7,
352 ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8,
353 ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9,
354 ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10,
355 ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11,
356 ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12,
357 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13,
358 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14,
359 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
360 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
361 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
362 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
363 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
364 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
365 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21,
369 * iSCSI Parameters (RFC3720)
371 enum iscsi_param {
372 /* passed in using netlink set param */
373 ISCSI_PARAM_MAX_RECV_DLENGTH,
374 ISCSI_PARAM_MAX_XMIT_DLENGTH,
375 ISCSI_PARAM_HDRDGST_EN,
376 ISCSI_PARAM_DATADGST_EN,
377 ISCSI_PARAM_INITIAL_R2T_EN,
378 ISCSI_PARAM_MAX_R2T,
379 ISCSI_PARAM_IMM_DATA_EN,
380 ISCSI_PARAM_FIRST_BURST,
381 ISCSI_PARAM_MAX_BURST,
382 ISCSI_PARAM_PDU_INORDER_EN,
383 ISCSI_PARAM_DATASEQ_INORDER_EN,
384 ISCSI_PARAM_ERL,
385 ISCSI_PARAM_IFMARKER_EN,
386 ISCSI_PARAM_OFMARKER_EN,
387 ISCSI_PARAM_EXP_STATSN,
388 ISCSI_PARAM_TARGET_NAME,
389 ISCSI_PARAM_TPGT,
390 ISCSI_PARAM_PERSISTENT_ADDRESS,
391 ISCSI_PARAM_PERSISTENT_PORT,
392 ISCSI_PARAM_SESS_RECOVERY_TMO,
394 /* passed in through bind conn using transport_fd */
395 ISCSI_PARAM_CONN_PORT,
396 ISCSI_PARAM_CONN_ADDRESS,
398 ISCSI_PARAM_USERNAME,
399 ISCSI_PARAM_USERNAME_IN,
400 ISCSI_PARAM_PASSWORD,
401 ISCSI_PARAM_PASSWORD_IN,
403 ISCSI_PARAM_FAST_ABORT,
404 ISCSI_PARAM_ABORT_TMO,
405 ISCSI_PARAM_LU_RESET_TMO,
406 ISCSI_PARAM_HOST_RESET_TMO,
408 ISCSI_PARAM_PING_TMO,
409 ISCSI_PARAM_RECV_TMO,
411 ISCSI_PARAM_IFACE_NAME,
412 ISCSI_PARAM_ISID,
413 ISCSI_PARAM_INITIATOR_NAME,
415 ISCSI_PARAM_TGT_RESET_TMO,
416 ISCSI_PARAM_TARGET_ALIAS,
417 /* must always be last */
418 ISCSI_PARAM_MAX,
421 #define ISCSI_MAX_RECV_DLENGTH (1ULL << ISCSI_PARAM_MAX_RECV_DLENGTH)
422 #define ISCSI_MAX_XMIT_DLENGTH (1ULL << ISCSI_PARAM_MAX_XMIT_DLENGTH)
423 #define ISCSI_HDRDGST_EN (1ULL << ISCSI_PARAM_HDRDGST_EN)
424 #define ISCSI_DATADGST_EN (1ULL << ISCSI_PARAM_DATADGST_EN)
425 #define ISCSI_INITIAL_R2T_EN (1ULL << ISCSI_PARAM_INITIAL_R2T_EN)
426 #define ISCSI_MAX_R2T (1ULL << ISCSI_PARAM_MAX_R2T)
427 #define ISCSI_IMM_DATA_EN (1ULL << ISCSI_PARAM_IMM_DATA_EN)
428 #define ISCSI_FIRST_BURST (1ULL << ISCSI_PARAM_FIRST_BURST)
429 #define ISCSI_MAX_BURST (1ULL << ISCSI_PARAM_MAX_BURST)
430 #define ISCSI_PDU_INORDER_EN (1ULL << ISCSI_PARAM_PDU_INORDER_EN)
431 #define ISCSI_DATASEQ_INORDER_EN (1ULL << ISCSI_PARAM_DATASEQ_INORDER_EN)
432 #define ISCSI_ERL (1ULL << ISCSI_PARAM_ERL)
433 #define ISCSI_IFMARKER_EN (1ULL << ISCSI_PARAM_IFMARKER_EN)
434 #define ISCSI_OFMARKER_EN (1ULL << ISCSI_PARAM_OFMARKER_EN)
435 #define ISCSI_EXP_STATSN (1ULL << ISCSI_PARAM_EXP_STATSN)
436 #define ISCSI_TARGET_NAME (1ULL << ISCSI_PARAM_TARGET_NAME)
437 #define ISCSI_TPGT (1ULL << ISCSI_PARAM_TPGT)
438 #define ISCSI_PERSISTENT_ADDRESS (1ULL << ISCSI_PARAM_PERSISTENT_ADDRESS)
439 #define ISCSI_PERSISTENT_PORT (1ULL << ISCSI_PARAM_PERSISTENT_PORT)
440 #define ISCSI_SESS_RECOVERY_TMO (1ULL << ISCSI_PARAM_SESS_RECOVERY_TMO)
441 #define ISCSI_CONN_PORT (1ULL << ISCSI_PARAM_CONN_PORT)
442 #define ISCSI_CONN_ADDRESS (1ULL << ISCSI_PARAM_CONN_ADDRESS)
443 #define ISCSI_USERNAME (1ULL << ISCSI_PARAM_USERNAME)
444 #define ISCSI_USERNAME_IN (1ULL << ISCSI_PARAM_USERNAME_IN)
445 #define ISCSI_PASSWORD (1ULL << ISCSI_PARAM_PASSWORD)
446 #define ISCSI_PASSWORD_IN (1ULL << ISCSI_PARAM_PASSWORD_IN)
447 #define ISCSI_FAST_ABORT (1ULL << ISCSI_PARAM_FAST_ABORT)
448 #define ISCSI_ABORT_TMO (1ULL << ISCSI_PARAM_ABORT_TMO)
449 #define ISCSI_LU_RESET_TMO (1ULL << ISCSI_PARAM_LU_RESET_TMO)
450 #define ISCSI_HOST_RESET_TMO (1ULL << ISCSI_PARAM_HOST_RESET_TMO)
451 #define ISCSI_PING_TMO (1ULL << ISCSI_PARAM_PING_TMO)
452 #define ISCSI_RECV_TMO (1ULL << ISCSI_PARAM_RECV_TMO)
453 #define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME)
454 #define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
455 #define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
456 #define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
457 #define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS)
459 /* iSCSI HBA params */
460 enum iscsi_host_param {
461 ISCSI_HOST_PARAM_HWADDRESS,
462 ISCSI_HOST_PARAM_INITIATOR_NAME,
463 ISCSI_HOST_PARAM_NETDEV_NAME,
464 ISCSI_HOST_PARAM_IPADDRESS,
465 ISCSI_HOST_PARAM_MAX,
468 #define ISCSI_HOST_HWADDRESS (1ULL << ISCSI_HOST_PARAM_HWADDRESS)
469 #define ISCSI_HOST_INITIATOR_NAME (1ULL << ISCSI_HOST_PARAM_INITIATOR_NAME)
470 #define ISCSI_HOST_NETDEV_NAME (1ULL << ISCSI_HOST_PARAM_NETDEV_NAME)
471 #define ISCSI_HOST_IPADDRESS (1ULL << ISCSI_HOST_PARAM_IPADDRESS)
473 #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
474 #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
477 * These flags presents iSCSI Data-Path capabilities.
479 #define CAP_RECOVERY_L0 0x1
480 #define CAP_RECOVERY_L1 0x2
481 #define CAP_RECOVERY_L2 0x4
482 #define CAP_MULTI_R2T 0x8
483 #define CAP_HDRDGST 0x10
484 #define CAP_DATADGST 0x20
485 #define CAP_MULTI_CONN 0x40
486 #define CAP_TEXT_NEGO 0x80
487 #define CAP_MARKERS 0x100
488 #define CAP_FW_DB 0x200
489 #define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */
490 #define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */
491 #define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */
492 #define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal,
493 and verification */
494 #define CAP_LOGIN_OFFLOAD 0x4000 /* offload normal session login */
497 * These flags describes reason of stop_conn() call
499 #define STOP_CONN_TERM 0x1
500 #define STOP_CONN_SUSPEND 0x2
501 #define STOP_CONN_RECOVER 0x3
503 #define ISCSI_STATS_CUSTOM_MAX 32
504 #define ISCSI_STATS_CUSTOM_DESC_MAX 64
505 struct iscsi_stats_custom {
506 char desc[ISCSI_STATS_CUSTOM_DESC_MAX];
507 uint64_t value;
511 * struct iscsi_stats - iSCSI Statistics (iSCSI MIB)
513 * Note: this structure contains counters collected on per-connection basis.
515 struct iscsi_stats {
516 /* octets */
517 uint64_t txdata_octets;
518 uint64_t rxdata_octets;
520 /* xmit pdus */
521 uint32_t noptx_pdus;
522 uint32_t scsicmd_pdus;
523 uint32_t tmfcmd_pdus;
524 uint32_t login_pdus;
525 uint32_t text_pdus;
526 uint32_t dataout_pdus;
527 uint32_t logout_pdus;
528 uint32_t snack_pdus;
530 /* recv pdus */
531 uint32_t noprx_pdus;
532 uint32_t scsirsp_pdus;
533 uint32_t tmfrsp_pdus;
534 uint32_t textrsp_pdus;
535 uint32_t datain_pdus;
536 uint32_t logoutrsp_pdus;
537 uint32_t r2t_pdus;
538 uint32_t async_pdus;
539 uint32_t rjt_pdus;
541 /* errors */
542 uint32_t digest_err;
543 uint32_t timeout_err;
546 * iSCSI Custom Statistics support, i.e. Transport could
547 * extend existing MIB statistics with its own specific statistics
548 * up to ISCSI_STATS_CUSTOM_MAX
550 uint32_t custom_length;
551 struct iscsi_stats_custom custom[0]
552 __attribute__ ((aligned (sizeof(uint64_t))));
555 #endif