blob: 7ff9678b7e79ac4c8e58832967f594dba21798e7 [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,
Vikas Chaudharyac20c7b2012-02-13 18:30:48 +053063 ISCSI_UEVENT_PING = UEVENT_BASE + 22,
Michael Chan43514772009-06-08 18:14:41 -070064
Alex Aizman39e84792005-08-04 19:31:00 -070065 /* up events */
66 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
67 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
68 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
Mike Christie53cb8a12006-06-28 12:00:32 -050069 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
Mike Christie26974782007-12-13 12:43:29 -060070 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
71 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
Michael Chan43514772009-06-08 18:14:41 -070072
73 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
74 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
Manish Rangankar17fa5752011-07-25 13:48:52 -050075 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
Vikas Chaudharya11e2542012-02-13 18:30:46 +053076 ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10,
Vikas Chaudharyac20c7b2012-02-13 18:30:48 +053077 ISCSI_KEVENT_PING_COMP = KEVENT_BASE + 11,
Alex Aizman39e84792005-08-04 19:31:00 -070078};
79
Mike Christie01cb2252006-06-28 12:00:22 -050080enum iscsi_tgt_dscvr {
81 ISCSI_TGT_DSCVR_SEND_TARGETS = 1,
82 ISCSI_TGT_DSCVR_ISNS = 2,
83 ISCSI_TGT_DSCVR_SLP = 3,
84};
85
Vikas Chaudharya11e2542012-02-13 18:30:46 +053086enum iscsi_host_event_code {
87 ISCSI_EVENT_LINKUP = 1,
88 ISCSI_EVENT_LINKDOWN,
89 /* must always be last */
90 ISCSI_EVENT_MAX,
91};
92
Alex Aizman39e84792005-08-04 19:31:00 -070093struct iscsi_uevent {
94 uint32_t type; /* k/u events type */
95 uint32_t iferror; /* carries interface or resource errors */
96 uint64_t transport_handle;
97
98 union {
99 /* messages u -> k */
100 struct msg_create_session {
101 uint32_t initial_cmdsn;
Mike Christie15482712007-05-30 12:57:19 -0500102 uint16_t cmds_max;
103 uint16_t queue_depth;
Alex Aizman39e84792005-08-04 19:31:00 -0700104 } c_session;
Mike Christie40753ca2008-05-21 15:53:56 -0500105 struct msg_create_bound_session {
Mike Christied82ff9be2008-05-21 15:54:13 -0500106 uint64_t ep_handle;
Mike Christie40753ca2008-05-21 15:53:56 -0500107 uint32_t initial_cmdsn;
108 uint16_t cmds_max;
109 uint16_t queue_depth;
110 } c_bound_session;
Alex Aizman39e84792005-08-04 19:31:00 -0700111 struct msg_destroy_session {
Alex Aizman39e84792005-08-04 19:31:00 -0700112 uint32_t sid;
113 } d_session;
114 struct msg_create_conn {
Alex Aizman39e84792005-08-04 19:31:00 -0700115 uint32_t sid;
Mike Christieb5c7a122006-04-06 21:13:33 -0500116 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700117 } c_conn;
118 struct msg_bind_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500119 uint32_t sid;
120 uint32_t cid;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500121 uint64_t transport_eph;
Alex Aizman39e84792005-08-04 19:31:00 -0700122 uint32_t is_leading;
123 } b_conn;
124 struct msg_destroy_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500125 uint32_t sid;
Alex Aizman39e84792005-08-04 19:31:00 -0700126 uint32_t cid;
127 } d_conn;
128 struct msg_send_pdu {
Mike Christieb5c7a122006-04-06 21:13:33 -0500129 uint32_t sid;
130 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700131 uint32_t hdr_size;
132 uint32_t data_size;
Alex Aizman39e84792005-08-04 19:31:00 -0700133 } send_pdu;
134 struct msg_set_param {
Mike Christieb5c7a122006-04-06 21:13:33 -0500135 uint32_t sid;
136 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700137 uint32_t param; /* enum iscsi_param */
Mike Christiefd7255f2006-04-06 21:13:36 -0500138 uint32_t len;
Alex Aizman39e84792005-08-04 19:31:00 -0700139 } set_param;
140 struct msg_start_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500141 uint32_t sid;
142 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700143 } start_conn;
144 struct msg_stop_conn {
Mike Christieb5c7a122006-04-06 21:13:33 -0500145 uint32_t sid;
146 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700147 uint64_t conn_handle;
148 uint32_t flag;
149 } stop_conn;
150 struct msg_get_stats {
Mike Christieb5c7a122006-04-06 21:13:33 -0500151 uint32_t sid;
152 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700153 } get_stats;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500154 struct msg_transport_connect {
155 uint32_t non_blocking;
156 } ep_connect;
Mike Christie10eb0f02009-05-13 17:57:38 -0500157 struct msg_transport_connect_through_host {
158 uint32_t host_no;
159 uint32_t non_blocking;
160 } ep_connect_through_host;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500161 struct msg_transport_poll {
162 uint64_t ep_handle;
163 uint32_t timeout_ms;
164 } ep_poll;
165 struct msg_transport_disconnect {
166 uint64_t ep_handle;
167 } ep_disconnect;
Mike Christie01cb2252006-06-28 12:00:22 -0500168 struct msg_tgt_dscvr {
169 enum iscsi_tgt_dscvr type;
170 uint32_t host_no;
171 /*
172 * enable = 1 to establish a new connection
173 * with the server. enable = 0 to disconnect
174 * from the server. Used primarily to switch
175 * from one iSNS server to another.
176 */
177 uint32_t enable;
178 } tgt_dscvr;
Mike Christie1d9bf132007-05-30 12:57:11 -0500179 struct msg_set_host_param {
180 uint32_t host_no;
181 uint32_t param; /* enum iscsi_host_param */
182 uint32_t len;
183 } set_host_param;
Michael Chan43514772009-06-08 18:14:41 -0700184 struct msg_set_path {
185 uint32_t host_no;
186 } set_path;
Mike Christie56c155b2011-07-25 13:48:37 -0500187 struct msg_set_iface_params {
188 uint32_t host_no;
189 uint32_t count;
190 } set_iface_params;
Vikas Chaudharyac20c7b2012-02-13 18:30:48 +0530191 struct msg_iscsi_ping {
192 uint32_t host_no;
193 uint32_t iface_num;
194 uint32_t iface_type;
195 uint32_t payload_size;
196 uint32_t pid; /* unique ping id associated
197 with each ping request */
198 } iscsi_ping;
Alex Aizman39e84792005-08-04 19:31:00 -0700199 } u;
200 union {
201 /* messages k -> u */
Alex Aizman39e84792005-08-04 19:31:00 -0700202 int retcode;
203 struct msg_create_session_ret {
Alex Aizman39e84792005-08-04 19:31:00 -0700204 uint32_t sid;
Mike Christieb5c7a122006-04-06 21:13:33 -0500205 uint32_t host_no;
Alex Aizman39e84792005-08-04 19:31:00 -0700206 } c_session_ret;
Mike Christieb5c7a122006-04-06 21:13:33 -0500207 struct msg_create_conn_ret {
208 uint32_t sid;
209 uint32_t cid;
210 } c_conn_ret;
Mike Christie26974782007-12-13 12:43:29 -0600211 struct msg_unbind_session {
212 uint32_t sid;
213 uint32_t host_no;
214 } unbind_session;
Alex Aizman39e84792005-08-04 19:31:00 -0700215 struct msg_recv_req {
Mike Christieb5c7a122006-04-06 21:13:33 -0500216 uint32_t sid;
217 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700218 uint64_t recv_handle;
Alex Aizman39e84792005-08-04 19:31:00 -0700219 } recv_req;
Manish Rangankar17fa5752011-07-25 13:48:52 -0500220 struct msg_conn_login {
221 uint32_t sid;
222 uint32_t cid;
223 uint32_t state; /* enum iscsi_conn_state */
224 } conn_login;
Alex Aizman39e84792005-08-04 19:31:00 -0700225 struct msg_conn_error {
Mike Christieb5c7a122006-04-06 21:13:33 -0500226 uint32_t sid;
227 uint32_t cid;
Alex Aizman39e84792005-08-04 19:31:00 -0700228 uint32_t error; /* enum iscsi_err */
229 } connerror;
Mike Christie53cb8a12006-06-28 12:00:32 -0500230 struct msg_session_destroyed {
231 uint32_t host_no;
232 uint32_t sid;
233 } d_session;
Or Gerlitz264faaa2006-05-02 19:46:36 -0500234 struct msg_transport_connect_ret {
235 uint64_t handle;
236 } ep_connect_ret;
Michael Chan43514772009-06-08 18:14:41 -0700237 struct msg_req_path {
238 uint32_t host_no;
239 } req_path;
240 struct msg_notify_if_down {
241 uint32_t host_no;
242 } notify_if_down;
Vikas Chaudharya11e2542012-02-13 18:30:46 +0530243 struct msg_host_event {
244 uint32_t host_no;
245 uint32_t data_size;
246 enum iscsi_host_event_code code;
247 } host_event;
Vikas Chaudharyac20c7b2012-02-13 18:30:48 +0530248 struct msg_ping_comp {
249 uint32_t host_no;
250 uint32_t status;
251 uint32_t pid; /* unique ping id associated
252 with each ping request */
253 uint32_t data_size;
254 } ping_comp;
Alex Aizman39e84792005-08-04 19:31:00 -0700255 } r;
256} __attribute__ ((aligned (sizeof(uint64_t))));
257
Mike Christie56c155b2011-07-25 13:48:37 -0500258enum iscsi_param_type {
259 ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */
260 ISCSI_HOST_PARAM, /* iscsi_host_param */
261 ISCSI_NET_PARAM, /* iscsi_net_param */
262};
263
264struct iscsi_iface_param_info {
265 uint32_t iface_num; /* iface number, 0 - n */
266 uint32_t len; /* Actual length of the param */
267 uint16_t param; /* iscsi param value */
268 uint8_t iface_type; /* IPv4 or IPv6 */
269 uint8_t param_type; /* iscsi_param_type */
270 uint8_t value[0]; /* length sized value follows */
271} __packed;
272
Alex Aizman39e84792005-08-04 19:31:00 -0700273/*
Michael Chan43514772009-06-08 18:14:41 -0700274 * To keep the struct iscsi_uevent size the same for userspace code
275 * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and
276 * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the
277 * struct iscsi_uevent in the NETLINK_ISCSI message.
278 */
279struct iscsi_path {
280 uint64_t handle;
281 uint8_t mac_addr[6];
282 uint8_t mac_addr_old[6];
283 uint32_t ip_addr_len; /* 4 or 16 */
284 union {
285 struct in_addr v4_addr;
286 struct in6_addr v6_addr;
287 } src;
288 union {
289 struct in_addr v4_addr;
290 struct in6_addr v6_addr;
291 } dst;
292 uint16_t vlan_id;
293 uint16_t pmtu;
294} __attribute__ ((aligned (sizeof(uint64_t))));
295
Mike Christie56c155b2011-07-25 13:48:37 -0500296/* iscsi iface enabled/disabled setting */
297#define ISCSI_IFACE_DISABLE 0x01
298#define ISCSI_IFACE_ENABLE 0x02
299
300/* ipv4 bootproto */
301#define ISCSI_BOOTPROTO_STATIC 0x01
302#define ISCSI_BOOTPROTO_DHCP 0x02
303
304/* ipv6 addr autoconfig type */
305#define ISCSI_IPV6_AUTOCFG_DISABLE 0x01
306#define ISCSI_IPV6_AUTOCFG_ND_ENABLE 0x02
307#define ISCSI_IPV6_AUTOCFG_DHCPV6_ENABLE 0x03
308
309/* ipv6 link local addr type */
310#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_ENABLE 0x01
311#define ISCSI_IPV6_LINKLOCAL_AUTOCFG_DISABLE 0x02
312
313/* ipv6 router addr type */
314#define ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE 0x01
315#define ISCSI_IPV6_ROUTER_AUTOCFG_DISABLE 0x02
316
317#define ISCSI_IFACE_TYPE_IPV4 0x01
318#define ISCSI_IFACE_TYPE_IPV6 0x02
319
Mike Christie4223b9e2011-07-25 13:48:47 -0500320#define ISCSI_MAX_VLAN_ID 4095
321#define ISCSI_MAX_VLAN_PRIORITY 7
322
323/* iscsi vlan enable/disabled setting */
324#define ISCSI_VLAN_DISABLE 0x01
325#define ISCSI_VLAN_ENABLE 0x02
326
Mike Christie56c155b2011-07-25 13:48:37 -0500327/* iSCSI network params */
328enum iscsi_net_param {
329 ISCSI_NET_PARAM_IPV4_ADDR = 1,
330 ISCSI_NET_PARAM_IPV4_SUBNET = 2,
331 ISCSI_NET_PARAM_IPV4_GW = 3,
332 ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4,
333 ISCSI_NET_PARAM_MAC = 5,
334 ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6,
335 ISCSI_NET_PARAM_IPV6_ADDR = 7,
336 ISCSI_NET_PARAM_IPV6_ROUTER = 8,
337 ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9,
338 ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10,
339 ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11,
340 ISCSI_NET_PARAM_IFACE_ENABLE = 12,
341 ISCSI_NET_PARAM_VLAN_ID = 13,
Mike Christie4223b9e2011-07-25 13:48:47 -0500342 ISCSI_NET_PARAM_VLAN_PRIORITY = 14,
343 ISCSI_NET_PARAM_VLAN_ENABLED = 15,
Mike Christie2d636732011-10-11 17:55:11 -0500344 ISCSI_NET_PARAM_VLAN_TAG = 16,
345 ISCSI_NET_PARAM_IFACE_TYPE = 17,
346 ISCSI_NET_PARAM_IFACE_NAME = 18,
347 ISCSI_NET_PARAM_MTU = 19,
348 ISCSI_NET_PARAM_PORT = 20,
Mike Christie56c155b2011-07-25 13:48:37 -0500349};
350
Manish Rangankar17fa5752011-07-25 13:48:52 -0500351enum iscsi_conn_state {
352 ISCSI_CONN_STATE_FREE,
353 ISCSI_CONN_STATE_XPT_WAIT,
354 ISCSI_CONN_STATE_IN_LOGIN,
355 ISCSI_CONN_STATE_LOGGED_IN,
356 ISCSI_CONN_STATE_IN_LOGOUT,
357 ISCSI_CONN_STATE_LOGOUT_REQUESTED,
358 ISCSI_CONN_STATE_CLEANUP_WAIT,
359};
360
Michael Chan43514772009-06-08 18:14:41 -0700361/*
Alex Aizman39e84792005-08-04 19:31:00 -0700362 * Common error codes
363 */
364enum iscsi_err {
365 ISCSI_OK = 0,
366
367 ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1,
368 ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2,
369 ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3,
370 ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4,
371 ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5,
372 ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6,
373 ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7,
374 ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8,
375 ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9,
376 ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10,
377 ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11,
378 ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12,
379 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13,
380 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14,
381 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
Mike Christie7996a772006-04-06 21:13:41 -0500382 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
383 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
Mike Christiee5bd7b52008-09-24 11:46:10 -0500384 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
Mike Christie6f481e32008-09-24 11:46:13 -0500385 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
Mike Christied1af8a32009-08-20 15:11:02 -0500386 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
Mike Christiedf4da5c2010-12-31 02:22:18 -0600387 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21,
Alex Aizman39e84792005-08-04 19:31:00 -0700388};
389
390/*
391 * iSCSI Parameters (RFC3720)
392 */
393enum iscsi_param {
Mike Christiefd7255f2006-04-06 21:13:36 -0500394 /* passed in using netlink set param */
395 ISCSI_PARAM_MAX_RECV_DLENGTH,
396 ISCSI_PARAM_MAX_XMIT_DLENGTH,
397 ISCSI_PARAM_HDRDGST_EN,
398 ISCSI_PARAM_DATADGST_EN,
399 ISCSI_PARAM_INITIAL_R2T_EN,
400 ISCSI_PARAM_MAX_R2T,
401 ISCSI_PARAM_IMM_DATA_EN,
402 ISCSI_PARAM_FIRST_BURST,
403 ISCSI_PARAM_MAX_BURST,
404 ISCSI_PARAM_PDU_INORDER_EN,
405 ISCSI_PARAM_DATASEQ_INORDER_EN,
406 ISCSI_PARAM_ERL,
407 ISCSI_PARAM_IFMARKER_EN,
408 ISCSI_PARAM_OFMARKER_EN,
Mike Christie8d2860b2006-05-02 19:46:47 -0500409 ISCSI_PARAM_EXP_STATSN,
Mike Christiefd7255f2006-04-06 21:13:36 -0500410 ISCSI_PARAM_TARGET_NAME,
411 ISCSI_PARAM_TPGT,
412 ISCSI_PARAM_PERSISTENT_ADDRESS,
413 ISCSI_PARAM_PERSISTENT_PORT,
Mike Christie30a6c652006-04-06 21:13:39 -0500414 ISCSI_PARAM_SESS_RECOVERY_TMO,
Mike Christiefd7255f2006-04-06 21:13:36 -0500415
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300416 /* passed in through bind conn using transport_fd */
Mike Christiefd7255f2006-04-06 21:13:36 -0500417 ISCSI_PARAM_CONN_PORT,
418 ISCSI_PARAM_CONN_ADDRESS,
419
Mike Christieb2c64162007-05-30 12:57:16 -0500420 ISCSI_PARAM_USERNAME,
421 ISCSI_PARAM_USERNAME_IN,
422 ISCSI_PARAM_PASSWORD,
423 ISCSI_PARAM_PASSWORD_IN,
424
Mike Christie843c0a82007-12-13 12:43:20 -0600425 ISCSI_PARAM_FAST_ABORT,
Mike Christief6d51802007-12-13 12:43:30 -0600426 ISCSI_PARAM_ABORT_TMO,
427 ISCSI_PARAM_LU_RESET_TMO,
428 ISCSI_PARAM_HOST_RESET_TMO,
429
430 ISCSI_PARAM_PING_TMO,
431 ISCSI_PARAM_RECV_TMO,
Mike Christie88dfd342008-05-21 15:54:16 -0500432
433 ISCSI_PARAM_IFACE_NAME,
434 ISCSI_PARAM_ISID,
435 ISCSI_PARAM_INITIATOR_NAME,
Mike Christie3fe5ae82009-11-11 16:34:33 -0600436
437 ISCSI_PARAM_TGT_RESET_TMO,
Vikas Chaudhary3b2bef12010-07-10 14:51:30 +0530438 ISCSI_PARAM_TARGET_ALIAS,
Mike Christiefd7255f2006-04-06 21:13:36 -0500439 /* must always be last */
440 ISCSI_PARAM_MAX,
Alex Aizman39e84792005-08-04 19:31:00 -0700441};
Mike Christiefd7255f2006-04-06 21:13:36 -0500442
Mike Christie1819dc82007-05-30 12:57:08 -0500443/* iSCSI HBA params */
444enum iscsi_host_param {
445 ISCSI_HOST_PARAM_HWADDRESS,
Mike Christie8ad57812007-05-30 12:57:13 -0500446 ISCSI_HOST_PARAM_INITIATOR_NAME,
Mike Christied8196ed2007-05-30 12:57:25 -0500447 ISCSI_HOST_PARAM_NETDEV_NAME,
Mike Christie22236962007-05-30 12:57:24 -0500448 ISCSI_HOST_PARAM_IPADDRESS,
Vikas Chaudharyaeddde22012-01-19 03:06:55 -0800449 ISCSI_HOST_PARAM_PORT_STATE,
450 ISCSI_HOST_PARAM_PORT_SPEED,
Mike Christie1819dc82007-05-30 12:57:08 -0500451 ISCSI_HOST_PARAM_MAX,
452};
453
Vikas Chaudharyaeddde22012-01-19 03:06:55 -0800454/* iSCSI port Speed */
455enum iscsi_port_speed {
456 ISCSI_PORT_SPEED_UNKNOWN = 0x1,
457 ISCSI_PORT_SPEED_10MBPS = 0x2,
458 ISCSI_PORT_SPEED_100MBPS = 0x4,
459 ISCSI_PORT_SPEED_1GBPS = 0x8,
460 ISCSI_PORT_SPEED_10GBPS = 0x10,
461};
462
463/* iSCSI port state */
464enum iscsi_port_state {
465 ISCSI_PORT_STATE_DOWN = 0x1,
466 ISCSI_PORT_STATE_UP = 0x2,
467};
468
Alex Aizman39e84792005-08-04 19:31:00 -0700469#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
470#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
Alex Aizman39e84792005-08-04 19:31:00 -0700471
472/*
473 * These flags presents iSCSI Data-Path capabilities.
474 */
475#define CAP_RECOVERY_L0 0x1
476#define CAP_RECOVERY_L1 0x2
477#define CAP_RECOVERY_L2 0x4
478#define CAP_MULTI_R2T 0x8
479#define CAP_HDRDGST 0x10
480#define CAP_DATADGST 0x20
481#define CAP_MULTI_CONN 0x40
482#define CAP_TEXT_NEGO 0x80
483#define CAP_MARKERS 0x100
Mike Christie0ab823d2007-05-30 12:57:22 -0500484#define CAP_FW_DB 0x200
Mike Christie63c62f12008-12-02 00:32:04 -0600485#define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */
486#define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */
487#define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */
Mike Christie6df19a72008-12-02 00:32:16 -0600488#define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal,
489 and verification */
Manish Rangankar17fa5752011-07-25 13:48:52 -0500490#define CAP_LOGIN_OFFLOAD 0x4000 /* offload session login */
Alex Aizman39e84792005-08-04 19:31:00 -0700491
492/*
493 * These flags describes reason of stop_conn() call
494 */
495#define STOP_CONN_TERM 0x1
496#define STOP_CONN_SUSPEND 0x2
497#define STOP_CONN_RECOVER 0x3
498
499#define ISCSI_STATS_CUSTOM_MAX 32
500#define ISCSI_STATS_CUSTOM_DESC_MAX 64
501struct iscsi_stats_custom {
502 char desc[ISCSI_STATS_CUSTOM_DESC_MAX];
503 uint64_t value;
504};
505
506/*
507 * struct iscsi_stats - iSCSI Statistics (iSCSI MIB)
508 *
509 * Note: this structure contains counters collected on per-connection basis.
510 */
511struct iscsi_stats {
512 /* octets */
513 uint64_t txdata_octets;
514 uint64_t rxdata_octets;
515
516 /* xmit pdus */
517 uint32_t noptx_pdus;
518 uint32_t scsicmd_pdus;
519 uint32_t tmfcmd_pdus;
520 uint32_t login_pdus;
521 uint32_t text_pdus;
522 uint32_t dataout_pdus;
523 uint32_t logout_pdus;
524 uint32_t snack_pdus;
525
526 /* recv pdus */
527 uint32_t noprx_pdus;
528 uint32_t scsirsp_pdus;
529 uint32_t tmfrsp_pdus;
530 uint32_t textrsp_pdus;
531 uint32_t datain_pdus;
532 uint32_t logoutrsp_pdus;
533 uint32_t r2t_pdus;
534 uint32_t async_pdus;
535 uint32_t rjt_pdus;
536
537 /* errors */
538 uint32_t digest_err;
539 uint32_t timeout_err;
540
541 /*
542 * iSCSI Custom Statistics support, i.e. Transport could
543 * extend existing MIB statistics with its own specific statistics
544 * up to ISCSI_STATS_CUSTOM_MAX
545 */
546 uint32_t custom_length;
547 struct iscsi_stats_custom custom[0]
548 __attribute__ ((aligned (sizeof(uint64_t))));
549};
550
551#endif