Commit | Line | Data |
---|---|---|
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 | ||
35 | enum 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, |
43514774 | 63 | |
39e84790 AA |
64 | /* 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, | |
53cb8a1f | 68 | ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4, |
26974789 MC |
69 | ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5, |
70 | ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6, | |
43514774 MC |
71 | |
72 | ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7, | |
73 | ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8, | |
39e84790 AA |
74 | }; |
75 | ||
01cb225d MC |
76 | enum iscsi_tgt_dscvr { |
77 | ISCSI_TGT_DSCVR_SEND_TARGETS = 1, | |
78 | ISCSI_TGT_DSCVR_ISNS = 2, | |
79 | ISCSI_TGT_DSCVR_SLP = 3, | |
80 | }; | |
81 | ||
39e84790 AA |
82 | struct iscsi_uevent { |
83 | uint32_t type; /* k/u events type */ | |
84 | uint32_t iferror; /* carries interface or resource errors */ | |
85 | uint64_t transport_handle; | |
86 | ||
87 | union { | |
88 | /* messages u -> k */ | |
89 | struct msg_create_session { | |
90 | uint32_t initial_cmdsn; | |
1548271e MC |
91 | uint16_t cmds_max; |
92 | uint16_t queue_depth; | |
39e84790 | 93 | } c_session; |
40753caa | 94 | struct msg_create_bound_session { |
d82ff9be | 95 | uint64_t ep_handle; |
40753caa MC |
96 | uint32_t initial_cmdsn; |
97 | uint16_t cmds_max; | |
98 | uint16_t queue_depth; | |
99 | } c_bound_session; | |
39e84790 | 100 | struct msg_destroy_session { |
39e84790 AA |
101 | uint32_t sid; |
102 | } d_session; | |
103 | struct msg_create_conn { | |
39e84790 | 104 | uint32_t sid; |
b5c7a12d | 105 | uint32_t cid; |
39e84790 AA |
106 | } c_conn; |
107 | struct msg_bind_conn { | |
b5c7a12d MC |
108 | uint32_t sid; |
109 | uint32_t cid; | |
264faaaa | 110 | uint64_t transport_eph; |
39e84790 AA |
111 | uint32_t is_leading; |
112 | } b_conn; | |
113 | struct msg_destroy_conn { | |
b5c7a12d | 114 | uint32_t sid; |
39e84790 AA |
115 | uint32_t cid; |
116 | } d_conn; | |
117 | struct msg_send_pdu { | |
b5c7a12d MC |
118 | uint32_t sid; |
119 | uint32_t cid; | |
39e84790 AA |
120 | uint32_t hdr_size; |
121 | uint32_t data_size; | |
39e84790 AA |
122 | } send_pdu; |
123 | struct msg_set_param { | |
b5c7a12d MC |
124 | uint32_t sid; |
125 | uint32_t cid; | |
39e84790 | 126 | uint32_t param; /* enum iscsi_param */ |
fd7255f5 | 127 | uint32_t len; |
39e84790 AA |
128 | } set_param; |
129 | struct msg_start_conn { | |
b5c7a12d MC |
130 | uint32_t sid; |
131 | uint32_t cid; | |
39e84790 AA |
132 | } start_conn; |
133 | struct msg_stop_conn { | |
b5c7a12d MC |
134 | uint32_t sid; |
135 | uint32_t cid; | |
39e84790 AA |
136 | uint64_t conn_handle; |
137 | uint32_t flag; | |
138 | } stop_conn; | |
139 | struct msg_get_stats { | |
b5c7a12d MC |
140 | uint32_t sid; |
141 | uint32_t cid; | |
39e84790 | 142 | } get_stats; |
264faaaa OG |
143 | struct msg_transport_connect { |
144 | uint32_t non_blocking; | |
145 | } ep_connect; | |
10eb0f01 MC |
146 | struct msg_transport_connect_through_host { |
147 | uint32_t host_no; | |
148 | uint32_t non_blocking; | |
149 | } ep_connect_through_host; | |
264faaaa OG |
150 | struct msg_transport_poll { |
151 | uint64_t ep_handle; | |
152 | uint32_t timeout_ms; | |
153 | } ep_poll; | |
154 | struct msg_transport_disconnect { | |
155 | uint64_t ep_handle; | |
156 | } ep_disconnect; | |
01cb225d MC |
157 | struct msg_tgt_dscvr { |
158 | enum iscsi_tgt_dscvr type; | |
159 | uint32_t host_no; | |
160 | /* | |
161 | * enable = 1 to establish a new connection | |
162 | * with the server. enable = 0 to disconnect | |
163 | * from the server. Used primarily to switch | |
164 | * from one iSNS server to another. | |
165 | */ | |
166 | uint32_t enable; | |
167 | } tgt_dscvr; | |
1d9bf13a MC |
168 | struct msg_set_host_param { |
169 | uint32_t host_no; | |
170 | uint32_t param; /* enum iscsi_host_param */ | |
171 | uint32_t len; | |
172 | } set_host_param; | |
43514774 MC |
173 | struct msg_set_path { |
174 | uint32_t host_no; | |
175 | } set_path; | |
56c155b5 MC |
176 | struct msg_set_iface_params { |
177 | uint32_t host_no; | |
178 | uint32_t count; | |
179 | } set_iface_params; | |
39e84790 AA |
180 | } u; |
181 | union { | |
182 | /* messages k -> u */ | |
39e84790 AA |
183 | int retcode; |
184 | struct msg_create_session_ret { | |
39e84790 | 185 | uint32_t sid; |
b5c7a12d | 186 | uint32_t host_no; |
39e84790 | 187 | } c_session_ret; |
b5c7a12d MC |
188 | struct msg_create_conn_ret { |
189 | uint32_t sid; | |
190 | uint32_t cid; | |
191 | } c_conn_ret; | |
26974789 MC |
192 | struct msg_unbind_session { |
193 | uint32_t sid; | |
194 | uint32_t host_no; | |
195 | } unbind_session; | |
39e84790 | 196 | struct msg_recv_req { |
b5c7a12d MC |
197 | uint32_t sid; |
198 | uint32_t cid; | |
39e84790 | 199 | uint64_t recv_handle; |
39e84790 AA |
200 | } recv_req; |
201 | struct msg_conn_error { | |
b5c7a12d MC |
202 | uint32_t sid; |
203 | uint32_t cid; | |
39e84790 AA |
204 | uint32_t error; /* enum iscsi_err */ |
205 | } connerror; | |
53cb8a1f MC |
206 | struct msg_session_destroyed { |
207 | uint32_t host_no; | |
208 | uint32_t sid; | |
209 | } d_session; | |
264faaaa OG |
210 | struct msg_transport_connect_ret { |
211 | uint64_t handle; | |
212 | } ep_connect_ret; | |
43514774 MC |
213 | struct msg_req_path { |
214 | uint32_t host_no; | |
215 | } req_path; | |
216 | struct msg_notify_if_down { | |
217 | uint32_t host_no; | |
218 | } notify_if_down; | |
39e84790 AA |
219 | } r; |
220 | } __attribute__ ((aligned (sizeof(uint64_t)))); | |
221 | ||
56c155b5 MC |
222 | enum iscsi_param_type { |
223 | ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */ | |
224 | ISCSI_HOST_PARAM, /* iscsi_host_param */ | |
225 | ISCSI_NET_PARAM, /* iscsi_net_param */ | |
226 | }; | |
227 | ||
228 | struct iscsi_iface_param_info { | |
229 | uint32_t iface_num; /* iface number, 0 - n */ | |
230 | uint32_t len; /* Actual length of the param */ | |
231 | uint16_t param; /* iscsi param value */ | |
232 | uint8_t iface_type; /* IPv4 or IPv6 */ | |
233 | uint8_t param_type; /* iscsi_param_type */ | |
234 | uint8_t value[0]; /* length sized value follows */ | |
235 | } __packed; | |
236 | ||
43514774 MC |
237 | /* |
238 | * To keep the struct iscsi_uevent size the same for userspace code | |
239 | * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and | |
240 | * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the | |
241 | * struct iscsi_uevent in the NETLINK_ISCSI message. | |
242 | */ | |
243 | struct iscsi_path { | |
244 | uint64_t handle; | |
245 | uint8_t mac_addr[6]; | |
246 | uint8_t mac_addr_old[6]; | |
247 | uint32_t ip_addr_len; /* 4 or 16 */ | |
248 | union { | |
249 | struct in_addr v4_addr; | |
250 | struct in6_addr v6_addr; | |
251 | } src; | |
252 | union { | |
253 | struct in_addr v4_addr; | |
254 | struct in6_addr v6_addr; | |
255 | } dst; | |
256 | uint16_t vlan_id; | |
257 | uint16_t pmtu; | |
258 | } __attribute__ ((aligned (sizeof(uint64_t)))); | |
259 | ||
56c155b5 MC |
260 | /* iscsi iface enabled/disabled setting */ |
261 | #define ISCSI_IFACE_DISABLE 0x01 | |
262 | #define ISCSI_IFACE_ENABLE 0x02 | |
263 | ||
264 | /* ipv4 bootproto */ | |
265 | #define ISCSI_BOOTPROTO_STATIC 0x01 | |
266 | #define ISCSI_BOOTPROTO_DHCP 0x02 | |
267 | ||
268 | /* ipv6 addr autoconfig type */ | |
269 | #define ISCSI_IPV6_AUTOCFG_DISABLE 0x01 | |
270 | #define ISCSI_IPV6_AUTOCFG_ND_ENABLE 0x02 | |
271 | #define ISCSI_IPV6_AUTOCFG_DHCPV6_ENABLE 0x03 | |
272 | ||
273 | /* ipv6 link local addr type */ | |
274 | #define ISCSI_IPV6_LINKLOCAL_AUTOCFG_ENABLE 0x01 | |
275 | #define ISCSI_IPV6_LINKLOCAL_AUTOCFG_DISABLE 0x02 | |
276 | ||
277 | /* ipv6 router addr type */ | |
278 | #define ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE 0x01 | |
279 | #define ISCSI_IPV6_ROUTER_AUTOCFG_DISABLE 0x02 | |
280 | ||
281 | #define ISCSI_IFACE_TYPE_IPV4 0x01 | |
282 | #define ISCSI_IFACE_TYPE_IPV6 0x02 | |
283 | ||
284 | /* iSCSI network params */ | |
285 | enum iscsi_net_param { | |
286 | ISCSI_NET_PARAM_IPV4_ADDR = 1, | |
287 | ISCSI_NET_PARAM_IPV4_SUBNET = 2, | |
288 | ISCSI_NET_PARAM_IPV4_GW = 3, | |
289 | ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4, | |
290 | ISCSI_NET_PARAM_MAC = 5, | |
291 | ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6, | |
292 | ISCSI_NET_PARAM_IPV6_ADDR = 7, | |
293 | ISCSI_NET_PARAM_IPV6_ROUTER = 8, | |
294 | ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9, | |
295 | ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10, | |
296 | ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11, | |
297 | ISCSI_NET_PARAM_IFACE_ENABLE = 12, | |
298 | ISCSI_NET_PARAM_VLAN_ID = 13, | |
8d07913d MC |
299 | ISCSI_NET_PARAM_IFACE_TYPE = 14, |
300 | ISCSI_NET_PARAM_IFACE_NAME = 15, | |
56c155b5 MC |
301 | }; |
302 | ||
8d07913d MC |
303 | #define ISCSI_NET_IPV4_ADDR (1ULL << ISCSI_NET_PARAM_IPV4_ADDR) |
304 | #define ISCSI_NET_IPV4_SUBNET (1ULL << ISCSI_NET_PARAM_IPV4_SUBNET) | |
305 | #define ISCSI_NET_IPV4_GW (1ULL << ISCSI_NET_PARAM_IPV4_GW) | |
306 | #define ISCSI_NET_IPV4_BOOTPROTO (1ULL << ISCSI_NET_PARAM_IPV4_BOOTPROTO) | |
307 | #define ISCSI_NET_MAC (1ULL << ISCSI_NET_PARAM_MAC) | |
308 | #define ISCSI_NET_IPV6_LINKLOCAL (1ULL << ISCSI_NET_PARAM_IPV6_LINKLOCAL) | |
309 | #define ISCSI_NET_IPV6_ADDR (1ULL << ISCSI_NET_PARAM_IPV6_ADDR) | |
310 | #define ISCSI_NET_IPV6_ROUTER (1ULL << ISCSI_NET_PARAM_IPV6_ROUTER) | |
311 | #define ISCSI_NET_IPV6_ADDR_AUTOCFG \ | |
312 | (1ULL << ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG) | |
313 | #define ISCSI_NET_IPV6_LINKLOCAL_AUTOCFG \ | |
314 | (1ULL << ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG) | |
315 | #define ISCSI_NET_IPV6_ROUTER_AUTOCFG \ | |
316 | (1ULL << ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG) | |
317 | #define ISCSI_NET_IFACE_ENABLE (1ULL << ISCSI_NET_PARAM_IFACE_ENABLE) | |
318 | #define ISCSI_NET_VLAN_ID (1ULL << ISCSI_NET_PARAM_VLAN_ID) | |
319 | ||
39e84790 AA |
320 | /* |
321 | * Common error codes | |
322 | */ | |
323 | enum iscsi_err { | |
324 | ISCSI_OK = 0, | |
325 | ||
326 | ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1, | |
327 | ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2, | |
328 | ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3, | |
329 | ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4, | |
330 | ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5, | |
331 | ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6, | |
332 | ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7, | |
333 | ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8, | |
334 | ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9, | |
335 | ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10, | |
336 | ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11, | |
337 | ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12, | |
338 | ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13, | |
339 | ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14, | |
340 | ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, | |
7996a778 MC |
341 | ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, |
342 | ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, | |
e5bd7b54 | 343 | ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18, |
6f481e3c | 344 | ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, |
d1af8a32 | 345 | ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20, |
df4da5cd | 346 | ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21, |
39e84790 AA |
347 | }; |
348 | ||
349 | /* | |
350 | * iSCSI Parameters (RFC3720) | |
351 | */ | |
352 | enum iscsi_param { | |
fd7255f5 MC |
353 | /* passed in using netlink set param */ |
354 | ISCSI_PARAM_MAX_RECV_DLENGTH, | |
355 | ISCSI_PARAM_MAX_XMIT_DLENGTH, | |
356 | ISCSI_PARAM_HDRDGST_EN, | |
357 | ISCSI_PARAM_DATADGST_EN, | |
358 | ISCSI_PARAM_INITIAL_R2T_EN, | |
359 | ISCSI_PARAM_MAX_R2T, | |
360 | ISCSI_PARAM_IMM_DATA_EN, | |
361 | ISCSI_PARAM_FIRST_BURST, | |
362 | ISCSI_PARAM_MAX_BURST, | |
363 | ISCSI_PARAM_PDU_INORDER_EN, | |
364 | ISCSI_PARAM_DATASEQ_INORDER_EN, | |
365 | ISCSI_PARAM_ERL, | |
366 | ISCSI_PARAM_IFMARKER_EN, | |
367 | ISCSI_PARAM_OFMARKER_EN, | |
8d2860b3 | 368 | ISCSI_PARAM_EXP_STATSN, |
fd7255f5 MC |
369 | ISCSI_PARAM_TARGET_NAME, |
370 | ISCSI_PARAM_TPGT, | |
371 | ISCSI_PARAM_PERSISTENT_ADDRESS, | |
372 | ISCSI_PARAM_PERSISTENT_PORT, | |
30a6c652 | 373 | ISCSI_PARAM_SESS_RECOVERY_TMO, |
fd7255f5 | 374 | |
25985edc | 375 | /* passed in through bind conn using transport_fd */ |
fd7255f5 MC |
376 | ISCSI_PARAM_CONN_PORT, |
377 | ISCSI_PARAM_CONN_ADDRESS, | |
378 | ||
b2c64167 MC |
379 | ISCSI_PARAM_USERNAME, |
380 | ISCSI_PARAM_USERNAME_IN, | |
381 | ISCSI_PARAM_PASSWORD, | |
382 | ISCSI_PARAM_PASSWORD_IN, | |
383 | ||
843c0a8a | 384 | ISCSI_PARAM_FAST_ABORT, |
f6d5180c MC |
385 | ISCSI_PARAM_ABORT_TMO, |
386 | ISCSI_PARAM_LU_RESET_TMO, | |
387 | ISCSI_PARAM_HOST_RESET_TMO, | |
388 | ||
389 | ISCSI_PARAM_PING_TMO, | |
390 | ISCSI_PARAM_RECV_TMO, | |
88dfd340 MC |
391 | |
392 | ISCSI_PARAM_IFACE_NAME, | |
393 | ISCSI_PARAM_ISID, | |
394 | ISCSI_PARAM_INITIATOR_NAME, | |
3fe5ae8b MC |
395 | |
396 | ISCSI_PARAM_TGT_RESET_TMO, | |
3b2bef1f | 397 | ISCSI_PARAM_TARGET_ALIAS, |
fd7255f5 MC |
398 | /* must always be last */ |
399 | ISCSI_PARAM_MAX, | |
39e84790 | 400 | }; |
fd7255f5 | 401 | |
1819dc81 MC |
402 | /* iSCSI HBA params */ |
403 | enum iscsi_host_param { | |
404 | ISCSI_HOST_PARAM_HWADDRESS, | |
8ad5781a | 405 | ISCSI_HOST_PARAM_INITIATOR_NAME, |
d8196ed2 | 406 | ISCSI_HOST_PARAM_NETDEV_NAME, |
22236961 | 407 | ISCSI_HOST_PARAM_IPADDRESS, |
1819dc81 MC |
408 | ISCSI_HOST_PARAM_MAX, |
409 | }; | |
410 | ||
88dfd340 MC |
411 | #define ISCSI_HOST_HWADDRESS (1ULL << ISCSI_HOST_PARAM_HWADDRESS) |
412 | #define ISCSI_HOST_INITIATOR_NAME (1ULL << ISCSI_HOST_PARAM_INITIATOR_NAME) | |
413 | #define ISCSI_HOST_NETDEV_NAME (1ULL << ISCSI_HOST_PARAM_NETDEV_NAME) | |
414 | #define ISCSI_HOST_IPADDRESS (1ULL << ISCSI_HOST_PARAM_IPADDRESS) | |
1819dc81 | 415 | |
39e84790 AA |
416 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) |
417 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) | |
39e84790 AA |
418 | |
419 | /* | |
420 | * These flags presents iSCSI Data-Path capabilities. | |
421 | */ | |
422 | #define CAP_RECOVERY_L0 0x1 | |
423 | #define CAP_RECOVERY_L1 0x2 | |
424 | #define CAP_RECOVERY_L2 0x4 | |
425 | #define CAP_MULTI_R2T 0x8 | |
426 | #define CAP_HDRDGST 0x10 | |
427 | #define CAP_DATADGST 0x20 | |
428 | #define CAP_MULTI_CONN 0x40 | |
429 | #define CAP_TEXT_NEGO 0x80 | |
430 | #define CAP_MARKERS 0x100 | |
0ab823db | 431 | #define CAP_FW_DB 0x200 |
63c62f1c MC |
432 | #define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */ |
433 | #define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */ | |
434 | #define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */ | |
6df19a79 MC |
435 | #define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal, |
436 | and verification */ | |
39e84790 AA |
437 | |
438 | /* | |
439 | * These flags describes reason of stop_conn() call | |
440 | */ | |
441 | #define STOP_CONN_TERM 0x1 | |
442 | #define STOP_CONN_SUSPEND 0x2 | |
443 | #define STOP_CONN_RECOVER 0x3 | |
444 | ||
445 | #define ISCSI_STATS_CUSTOM_MAX 32 | |
446 | #define ISCSI_STATS_CUSTOM_DESC_MAX 64 | |
447 | struct iscsi_stats_custom { | |
448 | char desc[ISCSI_STATS_CUSTOM_DESC_MAX]; | |
449 | uint64_t value; | |
450 | }; | |
451 | ||
452 | /* | |
453 | * struct iscsi_stats - iSCSI Statistics (iSCSI MIB) | |
454 | * | |
455 | * Note: this structure contains counters collected on per-connection basis. | |
456 | */ | |
457 | struct iscsi_stats { | |
458 | /* octets */ | |
459 | uint64_t txdata_octets; | |
460 | uint64_t rxdata_octets; | |
461 | ||
462 | /* xmit pdus */ | |
463 | uint32_t noptx_pdus; | |
464 | uint32_t scsicmd_pdus; | |
465 | uint32_t tmfcmd_pdus; | |
466 | uint32_t login_pdus; | |
467 | uint32_t text_pdus; | |
468 | uint32_t dataout_pdus; | |
469 | uint32_t logout_pdus; | |
470 | uint32_t snack_pdus; | |
471 | ||
472 | /* recv pdus */ | |
473 | uint32_t noprx_pdus; | |
474 | uint32_t scsirsp_pdus; | |
475 | uint32_t tmfrsp_pdus; | |
476 | uint32_t textrsp_pdus; | |
477 | uint32_t datain_pdus; | |
478 | uint32_t logoutrsp_pdus; | |
479 | uint32_t r2t_pdus; | |
480 | uint32_t async_pdus; | |
481 | uint32_t rjt_pdus; | |
482 | ||
483 | /* errors */ | |
484 | uint32_t digest_err; | |
485 | uint32_t timeout_err; | |
486 | ||
487 | /* | |
488 | * iSCSI Custom Statistics support, i.e. Transport could | |
489 | * extend existing MIB statistics with its own specific statistics | |
490 | * up to ISCSI_STATS_CUSTOM_MAX | |
491 | */ | |
492 | uint32_t custom_length; | |
493 | struct iscsi_stats_custom custom[0] | |
494 | __attribute__ ((aligned (sizeof(uint64_t)))); | |
495 | }; | |
496 | ||
497 | #endif |