Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 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> |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 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 |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 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 | |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 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 | |
Mike Christie | 01cb225 | 2006-06-28 12:00:22 -0500 | [diff] [blame] | 55 | ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15, |
Mike Christie | 1d9bf13 | 2007-05-30 12:57:11 -0500 | [diff] [blame] | 56 | ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16, |
Mike Christie | 2697478 | 2007-12-13 12:43:29 -0600 | [diff] [blame] | 57 | ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17, |
Mike Christie | 10eb0f0 | 2009-05-13 17:57:38 -0500 | [diff] [blame] | 58 | ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18, |
| 59 | ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19, |
Mike Christie | 01cb225 | 2006-06-28 12:00:22 -0500 | [diff] [blame] | 60 | |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 61 | ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20, |
Mike Christie | 56c155b | 2011-07-25 13:48:37 -0500 | [diff] [blame] | 62 | ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21, |
Vikas Chaudhary | ac20c7b | 2012-02-13 18:30:48 +0530 | [diff] [blame] | 63 | ISCSI_UEVENT_PING = UEVENT_BASE + 22, |
Nilesh Javali | 6260a5d | 2012-02-27 03:08:51 -0800 | [diff] [blame] | 64 | ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23, |
| 65 | ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24, |
Adheer Chandravanshi | c6a4bb2 | 2013-03-22 07:41:29 -0400 | [diff] [blame] | 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, |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 72 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 73 | /* up events */ |
| 74 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
| 75 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, |
| 76 | ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, |
Mike Christie | 53cb8a1 | 2006-06-28 12:00:32 -0500 | [diff] [blame] | 77 | ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4, |
Mike Christie | 2697478 | 2007-12-13 12:43:29 -0600 | [diff] [blame] | 78 | ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5, |
| 79 | ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6, |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 80 | |
| 81 | ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7, |
| 82 | ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8, |
Manish Rangankar | 17fa575 | 2011-07-25 13:48:52 -0500 | [diff] [blame] | 83 | ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9, |
Vikas Chaudhary | a11e254 | 2012-02-13 18:30:46 +0530 | [diff] [blame] | 84 | ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10, |
Vikas Chaudhary | ac20c7b | 2012-02-13 18:30:48 +0530 | [diff] [blame] | 85 | ISCSI_KEVENT_PING_COMP = KEVENT_BASE + 11, |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
Mike Christie | 01cb225 | 2006-06-28 12:00:22 -0500 | [diff] [blame] | 88 | enum iscsi_tgt_dscvr { |
| 89 | ISCSI_TGT_DSCVR_SEND_TARGETS = 1, |
| 90 | ISCSI_TGT_DSCVR_ISNS = 2, |
| 91 | ISCSI_TGT_DSCVR_SLP = 3, |
| 92 | }; |
| 93 | |
Vikas Chaudhary | a11e254 | 2012-02-13 18:30:46 +0530 | [diff] [blame] | 94 | enum iscsi_host_event_code { |
| 95 | ISCSI_EVENT_LINKUP = 1, |
| 96 | ISCSI_EVENT_LINKDOWN, |
| 97 | /* must always be last */ |
| 98 | ISCSI_EVENT_MAX, |
| 99 | }; |
| 100 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 101 | struct iscsi_uevent { |
| 102 | uint32_t type; /* k/u events type */ |
| 103 | uint32_t iferror; /* carries interface or resource errors */ |
| 104 | uint64_t transport_handle; |
| 105 | |
| 106 | union { |
| 107 | /* messages u -> k */ |
| 108 | struct msg_create_session { |
| 109 | uint32_t initial_cmdsn; |
Mike Christie | 1548271 | 2007-05-30 12:57:19 -0500 | [diff] [blame] | 110 | uint16_t cmds_max; |
| 111 | uint16_t queue_depth; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 112 | } c_session; |
Mike Christie | 40753ca | 2008-05-21 15:53:56 -0500 | [diff] [blame] | 113 | struct msg_create_bound_session { |
Mike Christie | d82ff9be | 2008-05-21 15:54:13 -0500 | [diff] [blame] | 114 | uint64_t ep_handle; |
Mike Christie | 40753ca | 2008-05-21 15:53:56 -0500 | [diff] [blame] | 115 | uint32_t initial_cmdsn; |
| 116 | uint16_t cmds_max; |
| 117 | uint16_t queue_depth; |
| 118 | } c_bound_session; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 119 | struct msg_destroy_session { |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 120 | uint32_t sid; |
| 121 | } d_session; |
| 122 | struct msg_create_conn { |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 123 | uint32_t sid; |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 124 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 125 | } c_conn; |
| 126 | struct msg_bind_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 127 | uint32_t sid; |
| 128 | uint32_t cid; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 129 | uint64_t transport_eph; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 130 | uint32_t is_leading; |
| 131 | } b_conn; |
| 132 | struct msg_destroy_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 133 | uint32_t sid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 134 | uint32_t cid; |
| 135 | } d_conn; |
| 136 | struct msg_send_pdu { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 137 | uint32_t sid; |
| 138 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 139 | uint32_t hdr_size; |
| 140 | uint32_t data_size; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 141 | } send_pdu; |
| 142 | struct msg_set_param { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 143 | uint32_t sid; |
| 144 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 145 | uint32_t param; /* enum iscsi_param */ |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 146 | uint32_t len; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 147 | } set_param; |
| 148 | struct msg_start_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 149 | uint32_t sid; |
| 150 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 151 | } start_conn; |
| 152 | struct msg_stop_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 153 | uint32_t sid; |
| 154 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 155 | uint64_t conn_handle; |
| 156 | uint32_t flag; |
| 157 | } stop_conn; |
| 158 | struct msg_get_stats { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 159 | uint32_t sid; |
| 160 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 161 | } get_stats; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 162 | struct msg_transport_connect { |
| 163 | uint32_t non_blocking; |
| 164 | } ep_connect; |
Mike Christie | 10eb0f0 | 2009-05-13 17:57:38 -0500 | [diff] [blame] | 165 | struct msg_transport_connect_through_host { |
| 166 | uint32_t host_no; |
| 167 | uint32_t non_blocking; |
| 168 | } ep_connect_through_host; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 169 | struct msg_transport_poll { |
| 170 | uint64_t ep_handle; |
| 171 | uint32_t timeout_ms; |
| 172 | } ep_poll; |
| 173 | struct msg_transport_disconnect { |
| 174 | uint64_t ep_handle; |
| 175 | } ep_disconnect; |
Mike Christie | 01cb225 | 2006-06-28 12:00:22 -0500 | [diff] [blame] | 176 | struct msg_tgt_dscvr { |
| 177 | enum iscsi_tgt_dscvr type; |
| 178 | uint32_t host_no; |
| 179 | /* |
| 180 | * enable = 1 to establish a new connection |
| 181 | * with the server. enable = 0 to disconnect |
| 182 | * from the server. Used primarily to switch |
| 183 | * from one iSNS server to another. |
| 184 | */ |
| 185 | uint32_t enable; |
| 186 | } tgt_dscvr; |
Mike Christie | 1d9bf13 | 2007-05-30 12:57:11 -0500 | [diff] [blame] | 187 | struct msg_set_host_param { |
| 188 | uint32_t host_no; |
| 189 | uint32_t param; /* enum iscsi_host_param */ |
| 190 | uint32_t len; |
| 191 | } set_host_param; |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 192 | struct msg_set_path { |
| 193 | uint32_t host_no; |
| 194 | } set_path; |
Mike Christie | 56c155b | 2011-07-25 13:48:37 -0500 | [diff] [blame] | 195 | struct msg_set_iface_params { |
| 196 | uint32_t host_no; |
| 197 | uint32_t count; |
| 198 | } set_iface_params; |
Vikas Chaudhary | ac20c7b | 2012-02-13 18:30:48 +0530 | [diff] [blame] | 199 | struct msg_iscsi_ping { |
| 200 | uint32_t host_no; |
| 201 | uint32_t iface_num; |
| 202 | uint32_t iface_type; |
| 203 | uint32_t payload_size; |
| 204 | uint32_t pid; /* unique ping id associated |
| 205 | with each ping request */ |
| 206 | } iscsi_ping; |
Nilesh Javali | 6260a5d | 2012-02-27 03:08:51 -0800 | [diff] [blame] | 207 | struct msg_get_chap { |
| 208 | uint32_t host_no; |
| 209 | uint32_t num_entries; /* number of CHAP entries |
| 210 | * on request, number of |
| 211 | * valid CHAP entries on |
| 212 | * response */ |
| 213 | uint16_t chap_tbl_idx; |
| 214 | } get_chap; |
| 215 | struct msg_delete_chap { |
| 216 | uint32_t host_no; |
| 217 | uint16_t chap_tbl_idx; |
| 218 | } delete_chap; |
Adheer Chandravanshi | c6a4bb2 | 2013-03-22 07:41:29 -0400 | [diff] [blame] | 219 | struct msg_set_flashnode_param { |
| 220 | uint32_t host_no; |
| 221 | uint32_t flashnode_idx; |
| 222 | uint32_t count; |
| 223 | } set_flashnode; |
| 224 | struct msg_new_flashnode { |
| 225 | uint32_t host_no; |
| 226 | uint32_t len; |
| 227 | } new_flashnode; |
| 228 | struct msg_del_flashnode { |
| 229 | uint32_t host_no; |
| 230 | uint32_t flashnode_idx; |
| 231 | } del_flashnode; |
| 232 | struct msg_login_flashnode { |
| 233 | uint32_t host_no; |
| 234 | uint32_t flashnode_idx; |
| 235 | } login_flashnode; |
| 236 | struct msg_logout_flashnode { |
| 237 | uint32_t host_no; |
| 238 | uint32_t flashnode_idx; |
| 239 | } logout_flashnode; |
| 240 | struct msg_logout_flashnode_sid { |
| 241 | uint32_t host_no; |
| 242 | uint32_t sid; |
| 243 | } logout_flashnode_sid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 244 | } u; |
| 245 | union { |
| 246 | /* messages k -> u */ |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 247 | int retcode; |
| 248 | struct msg_create_session_ret { |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 249 | uint32_t sid; |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 250 | uint32_t host_no; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 251 | } c_session_ret; |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 252 | struct msg_create_conn_ret { |
| 253 | uint32_t sid; |
| 254 | uint32_t cid; |
| 255 | } c_conn_ret; |
Mike Christie | 2697478 | 2007-12-13 12:43:29 -0600 | [diff] [blame] | 256 | struct msg_unbind_session { |
| 257 | uint32_t sid; |
| 258 | uint32_t host_no; |
| 259 | } unbind_session; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 260 | struct msg_recv_req { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 261 | uint32_t sid; |
| 262 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 263 | uint64_t recv_handle; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 264 | } recv_req; |
Manish Rangankar | 17fa575 | 2011-07-25 13:48:52 -0500 | [diff] [blame] | 265 | struct msg_conn_login { |
| 266 | uint32_t sid; |
| 267 | uint32_t cid; |
| 268 | uint32_t state; /* enum iscsi_conn_state */ |
| 269 | } conn_login; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 270 | struct msg_conn_error { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 271 | uint32_t sid; |
| 272 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 273 | uint32_t error; /* enum iscsi_err */ |
| 274 | } connerror; |
Mike Christie | 53cb8a1 | 2006-06-28 12:00:32 -0500 | [diff] [blame] | 275 | struct msg_session_destroyed { |
| 276 | uint32_t host_no; |
| 277 | uint32_t sid; |
| 278 | } d_session; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 279 | struct msg_transport_connect_ret { |
| 280 | uint64_t handle; |
| 281 | } ep_connect_ret; |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 282 | struct msg_req_path { |
| 283 | uint32_t host_no; |
| 284 | } req_path; |
| 285 | struct msg_notify_if_down { |
| 286 | uint32_t host_no; |
| 287 | } notify_if_down; |
Vikas Chaudhary | a11e254 | 2012-02-13 18:30:46 +0530 | [diff] [blame] | 288 | struct msg_host_event { |
| 289 | uint32_t host_no; |
| 290 | uint32_t data_size; |
| 291 | enum iscsi_host_event_code code; |
| 292 | } host_event; |
Vikas Chaudhary | ac20c7b | 2012-02-13 18:30:48 +0530 | [diff] [blame] | 293 | struct msg_ping_comp { |
| 294 | uint32_t host_no; |
Vikas Chaudhary | 1a590ca | 2012-03-06 04:16:04 -0800 | [diff] [blame] | 295 | uint32_t status; /* enum |
| 296 | * iscsi_ping_status_code */ |
Vikas Chaudhary | ac20c7b | 2012-02-13 18:30:48 +0530 | [diff] [blame] | 297 | uint32_t pid; /* unique ping id associated |
| 298 | with each ping request */ |
| 299 | uint32_t data_size; |
| 300 | } ping_comp; |
Adheer Chandravanshi | c6a4bb2 | 2013-03-22 07:41:29 -0400 | [diff] [blame] | 301 | struct msg_new_flashnode_ret { |
| 302 | uint32_t flashnode_idx; |
| 303 | } new_flashnode_ret; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 304 | } r; |
| 305 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
| 306 | |
Mike Christie | 56c155b | 2011-07-25 13:48:37 -0500 | [diff] [blame] | 307 | enum iscsi_param_type { |
| 308 | ISCSI_PARAM, /* iscsi_param (session, conn, target, LU) */ |
| 309 | ISCSI_HOST_PARAM, /* iscsi_host_param */ |
| 310 | ISCSI_NET_PARAM, /* iscsi_net_param */ |
Adheer Chandravanshi | c6a4bb2 | 2013-03-22 07:41:29 -0400 | [diff] [blame] | 311 | ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */ |
Mike Christie | 56c155b | 2011-07-25 13:48:37 -0500 | [diff] [blame] | 312 | }; |
| 313 | |
| 314 | struct iscsi_iface_param_info { |
| 315 | uint32_t iface_num; /* iface number, 0 - n */ |
| 316 | uint32_t len; /* Actual length of the param */ |
| 317 | uint16_t param; /* iscsi param value */ |
| 318 | uint8_t iface_type; /* IPv4 or IPv6 */ |
| 319 | uint8_t param_type; /* iscsi_param_type */ |
| 320 | uint8_t value[0]; /* length sized value follows */ |
| 321 | } __packed; |
| 322 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 323 | /* |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 324 | * To keep the struct iscsi_uevent size the same for userspace code |
| 325 | * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and |
| 326 | * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the |
| 327 | * struct iscsi_uevent in the NETLINK_ISCSI message. |
| 328 | */ |
| 329 | struct iscsi_path { |
| 330 | uint64_t handle; |
| 331 | uint8_t mac_addr[6]; |
| 332 | uint8_t mac_addr_old[6]; |
| 333 | uint32_t ip_addr_len; /* 4 or 16 */ |
| 334 | union { |
| 335 | struct in_addr v4_addr; |
| 336 | struct in6_addr v6_addr; |
| 337 | } src; |
| 338 | union { |
| 339 | struct in_addr v4_addr; |
| 340 | struct in6_addr v6_addr; |
| 341 | } dst; |
| 342 | uint16_t vlan_id; |
| 343 | uint16_t pmtu; |
| 344 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
| 345 | |
Mike Christie | 56c155b | 2011-07-25 13:48:37 -0500 | [diff] [blame] | 346 | /* iscsi iface enabled/disabled setting */ |
| 347 | #define ISCSI_IFACE_DISABLE 0x01 |
| 348 | #define ISCSI_IFACE_ENABLE 0x02 |
| 349 | |
| 350 | /* ipv4 bootproto */ |
| 351 | #define ISCSI_BOOTPROTO_STATIC 0x01 |
| 352 | #define ISCSI_BOOTPROTO_DHCP 0x02 |
| 353 | |
| 354 | /* ipv6 addr autoconfig type */ |
| 355 | #define ISCSI_IPV6_AUTOCFG_DISABLE 0x01 |
| 356 | #define ISCSI_IPV6_AUTOCFG_ND_ENABLE 0x02 |
| 357 | #define ISCSI_IPV6_AUTOCFG_DHCPV6_ENABLE 0x03 |
| 358 | |
| 359 | /* ipv6 link local addr type */ |
| 360 | #define ISCSI_IPV6_LINKLOCAL_AUTOCFG_ENABLE 0x01 |
| 361 | #define ISCSI_IPV6_LINKLOCAL_AUTOCFG_DISABLE 0x02 |
| 362 | |
| 363 | /* ipv6 router addr type */ |
| 364 | #define ISCSI_IPV6_ROUTER_AUTOCFG_ENABLE 0x01 |
| 365 | #define ISCSI_IPV6_ROUTER_AUTOCFG_DISABLE 0x02 |
| 366 | |
| 367 | #define ISCSI_IFACE_TYPE_IPV4 0x01 |
| 368 | #define ISCSI_IFACE_TYPE_IPV6 0x02 |
| 369 | |
Mike Christie | 4223b9e | 2011-07-25 13:48:47 -0500 | [diff] [blame] | 370 | #define ISCSI_MAX_VLAN_ID 4095 |
| 371 | #define ISCSI_MAX_VLAN_PRIORITY 7 |
| 372 | |
| 373 | /* iscsi vlan enable/disabled setting */ |
| 374 | #define ISCSI_VLAN_DISABLE 0x01 |
| 375 | #define ISCSI_VLAN_ENABLE 0x02 |
| 376 | |
Mike Christie | 56c155b | 2011-07-25 13:48:37 -0500 | [diff] [blame] | 377 | /* iSCSI network params */ |
| 378 | enum iscsi_net_param { |
| 379 | ISCSI_NET_PARAM_IPV4_ADDR = 1, |
| 380 | ISCSI_NET_PARAM_IPV4_SUBNET = 2, |
| 381 | ISCSI_NET_PARAM_IPV4_GW = 3, |
| 382 | ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4, |
| 383 | ISCSI_NET_PARAM_MAC = 5, |
| 384 | ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6, |
| 385 | ISCSI_NET_PARAM_IPV6_ADDR = 7, |
| 386 | ISCSI_NET_PARAM_IPV6_ROUTER = 8, |
| 387 | ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9, |
| 388 | ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10, |
| 389 | ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11, |
| 390 | ISCSI_NET_PARAM_IFACE_ENABLE = 12, |
| 391 | ISCSI_NET_PARAM_VLAN_ID = 13, |
Mike Christie | 4223b9e | 2011-07-25 13:48:47 -0500 | [diff] [blame] | 392 | ISCSI_NET_PARAM_VLAN_PRIORITY = 14, |
| 393 | ISCSI_NET_PARAM_VLAN_ENABLED = 15, |
Mike Christie | 2d63673 | 2011-10-11 17:55:11 -0500 | [diff] [blame] | 394 | ISCSI_NET_PARAM_VLAN_TAG = 16, |
| 395 | ISCSI_NET_PARAM_IFACE_TYPE = 17, |
| 396 | ISCSI_NET_PARAM_IFACE_NAME = 18, |
| 397 | ISCSI_NET_PARAM_MTU = 19, |
| 398 | ISCSI_NET_PARAM_PORT = 20, |
Mike Christie | 56c155b | 2011-07-25 13:48:37 -0500 | [diff] [blame] | 399 | }; |
| 400 | |
Manish Rangankar | 17fa575 | 2011-07-25 13:48:52 -0500 | [diff] [blame] | 401 | enum iscsi_conn_state { |
| 402 | ISCSI_CONN_STATE_FREE, |
| 403 | ISCSI_CONN_STATE_XPT_WAIT, |
| 404 | ISCSI_CONN_STATE_IN_LOGIN, |
| 405 | ISCSI_CONN_STATE_LOGGED_IN, |
| 406 | ISCSI_CONN_STATE_IN_LOGOUT, |
| 407 | ISCSI_CONN_STATE_LOGOUT_REQUESTED, |
| 408 | ISCSI_CONN_STATE_CLEANUP_WAIT, |
| 409 | }; |
| 410 | |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 411 | /* |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 412 | * Common error codes |
| 413 | */ |
| 414 | enum iscsi_err { |
| 415 | ISCSI_OK = 0, |
| 416 | |
| 417 | ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1, |
| 418 | ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2, |
| 419 | ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3, |
| 420 | ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4, |
| 421 | ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5, |
| 422 | ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6, |
| 423 | ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7, |
| 424 | ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8, |
| 425 | ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9, |
| 426 | ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10, |
| 427 | ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11, |
| 428 | ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12, |
| 429 | ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13, |
| 430 | ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14, |
| 431 | ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, |
Mike Christie | 7996a77 | 2006-04-06 21:13:41 -0500 | [diff] [blame] | 432 | ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, |
| 433 | ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, |
Mike Christie | e5bd7b5 | 2008-09-24 11:46:10 -0500 | [diff] [blame] | 434 | ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18, |
Mike Christie | 6f481e3 | 2008-09-24 11:46:13 -0500 | [diff] [blame] | 435 | ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, |
Mike Christie | d1af8a3 | 2009-08-20 15:11:02 -0500 | [diff] [blame] | 436 | ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20, |
Mike Christie | df4da5c | 2010-12-31 02:22:18 -0600 | [diff] [blame] | 437 | ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21, |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 438 | }; |
| 439 | |
| 440 | /* |
| 441 | * iSCSI Parameters (RFC3720) |
| 442 | */ |
| 443 | enum iscsi_param { |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 444 | /* passed in using netlink set param */ |
| 445 | ISCSI_PARAM_MAX_RECV_DLENGTH, |
| 446 | ISCSI_PARAM_MAX_XMIT_DLENGTH, |
| 447 | ISCSI_PARAM_HDRDGST_EN, |
| 448 | ISCSI_PARAM_DATADGST_EN, |
| 449 | ISCSI_PARAM_INITIAL_R2T_EN, |
| 450 | ISCSI_PARAM_MAX_R2T, |
| 451 | ISCSI_PARAM_IMM_DATA_EN, |
| 452 | ISCSI_PARAM_FIRST_BURST, |
| 453 | ISCSI_PARAM_MAX_BURST, |
| 454 | ISCSI_PARAM_PDU_INORDER_EN, |
| 455 | ISCSI_PARAM_DATASEQ_INORDER_EN, |
| 456 | ISCSI_PARAM_ERL, |
| 457 | ISCSI_PARAM_IFMARKER_EN, |
| 458 | ISCSI_PARAM_OFMARKER_EN, |
Mike Christie | 8d2860b | 2006-05-02 19:46:47 -0500 | [diff] [blame] | 459 | ISCSI_PARAM_EXP_STATSN, |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 460 | ISCSI_PARAM_TARGET_NAME, |
| 461 | ISCSI_PARAM_TPGT, |
| 462 | ISCSI_PARAM_PERSISTENT_ADDRESS, |
| 463 | ISCSI_PARAM_PERSISTENT_PORT, |
Mike Christie | 30a6c65 | 2006-04-06 21:13:39 -0500 | [diff] [blame] | 464 | ISCSI_PARAM_SESS_RECOVERY_TMO, |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 465 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 466 | /* passed in through bind conn using transport_fd */ |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 467 | ISCSI_PARAM_CONN_PORT, |
| 468 | ISCSI_PARAM_CONN_ADDRESS, |
| 469 | |
Mike Christie | b2c6416 | 2007-05-30 12:57:16 -0500 | [diff] [blame] | 470 | ISCSI_PARAM_USERNAME, |
| 471 | ISCSI_PARAM_USERNAME_IN, |
| 472 | ISCSI_PARAM_PASSWORD, |
| 473 | ISCSI_PARAM_PASSWORD_IN, |
| 474 | |
Mike Christie | 843c0a8 | 2007-12-13 12:43:20 -0600 | [diff] [blame] | 475 | ISCSI_PARAM_FAST_ABORT, |
Mike Christie | f6d5180 | 2007-12-13 12:43:30 -0600 | [diff] [blame] | 476 | ISCSI_PARAM_ABORT_TMO, |
| 477 | ISCSI_PARAM_LU_RESET_TMO, |
| 478 | ISCSI_PARAM_HOST_RESET_TMO, |
| 479 | |
| 480 | ISCSI_PARAM_PING_TMO, |
| 481 | ISCSI_PARAM_RECV_TMO, |
Mike Christie | 88dfd34 | 2008-05-21 15:54:16 -0500 | [diff] [blame] | 482 | |
| 483 | ISCSI_PARAM_IFACE_NAME, |
| 484 | ISCSI_PARAM_ISID, |
| 485 | ISCSI_PARAM_INITIATOR_NAME, |
Mike Christie | 3fe5ae8 | 2009-11-11 16:34:33 -0600 | [diff] [blame] | 486 | |
| 487 | ISCSI_PARAM_TGT_RESET_TMO, |
Vikas Chaudhary | 3b2bef1 | 2010-07-10 14:51:30 +0530 | [diff] [blame] | 488 | ISCSI_PARAM_TARGET_ALIAS, |
Mike Christie | 3053495 | 2012-02-27 03:08:53 -0800 | [diff] [blame] | 489 | |
| 490 | ISCSI_PARAM_CHAP_IN_IDX, |
| 491 | ISCSI_PARAM_CHAP_OUT_IDX, |
Eddie Wai | 3b9373e | 2013-06-20 10:21:26 -0700 | [diff] [blame] | 492 | |
| 493 | ISCSI_PARAM_BOOT_ROOT, |
| 494 | ISCSI_PARAM_BOOT_NIC, |
| 495 | ISCSI_PARAM_BOOT_TARGET, |
| 496 | |
Adheer Chandravanshi | ae542ed | 2013-07-01 05:54:11 -0400 | [diff] [blame] | 497 | ISCSI_PARAM_AUTO_SND_TGT_DISABLE, |
| 498 | ISCSI_PARAM_DISCOVERY_SESS, |
| 499 | ISCSI_PARAM_PORTAL_TYPE, |
| 500 | ISCSI_PARAM_CHAP_AUTH_EN, |
| 501 | ISCSI_PARAM_DISCOVERY_LOGOUT_EN, |
| 502 | ISCSI_PARAM_BIDI_CHAP_EN, |
| 503 | ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL, |
| 504 | |
| 505 | ISCSI_PARAM_DEF_TIME2WAIT, |
| 506 | ISCSI_PARAM_DEF_TIME2RETAIN, |
| 507 | ISCSI_PARAM_MAX_SEGMENT_SIZE, |
| 508 | ISCSI_PARAM_STATSN, |
| 509 | ISCSI_PARAM_KEEPALIVE_TMO, |
| 510 | ISCSI_PARAM_LOCAL_PORT, |
| 511 | ISCSI_PARAM_TSID, |
| 512 | ISCSI_PARAM_DEF_TASKMGMT_TMO, |
| 513 | |
| 514 | ISCSI_PARAM_TCP_TIMESTAMP_STAT, |
| 515 | ISCSI_PARAM_TCP_WSF_DISABLE, |
| 516 | ISCSI_PARAM_TCP_NAGLE_DISABLE, |
| 517 | ISCSI_PARAM_TCP_TIMER_SCALE, |
| 518 | ISCSI_PARAM_TCP_TIMESTAMP_EN, |
| 519 | ISCSI_PARAM_TCP_XMIT_WSF, |
| 520 | ISCSI_PARAM_TCP_RECV_WSF, |
| 521 | ISCSI_PARAM_IP_FRAGMENT_DISABLE, |
| 522 | ISCSI_PARAM_IPV4_TOS, |
| 523 | ISCSI_PARAM_IPV6_TC, |
| 524 | ISCSI_PARAM_IPV6_FLOW_LABEL, |
| 525 | ISCSI_PARAM_IS_FW_ASSIGNED_IPV6, |
| 526 | |
| 527 | ISCSI_PARAM_DISCOVERY_PARENT_IDX, |
| 528 | ISCSI_PARAM_DISCOVERY_PARENT_TYPE, |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 529 | /* must always be last */ |
| 530 | ISCSI_PARAM_MAX, |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 531 | }; |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 532 | |
Mike Christie | 1819dc8 | 2007-05-30 12:57:08 -0500 | [diff] [blame] | 533 | /* iSCSI HBA params */ |
| 534 | enum iscsi_host_param { |
| 535 | ISCSI_HOST_PARAM_HWADDRESS, |
Mike Christie | 8ad5781 | 2007-05-30 12:57:13 -0500 | [diff] [blame] | 536 | ISCSI_HOST_PARAM_INITIATOR_NAME, |
Mike Christie | d8196ed | 2007-05-30 12:57:25 -0500 | [diff] [blame] | 537 | ISCSI_HOST_PARAM_NETDEV_NAME, |
Mike Christie | 2223696 | 2007-05-30 12:57:24 -0500 | [diff] [blame] | 538 | ISCSI_HOST_PARAM_IPADDRESS, |
Vikas Chaudhary | aeddde2 | 2012-01-19 03:06:55 -0800 | [diff] [blame] | 539 | ISCSI_HOST_PARAM_PORT_STATE, |
| 540 | ISCSI_HOST_PARAM_PORT_SPEED, |
Mike Christie | 1819dc8 | 2007-05-30 12:57:08 -0500 | [diff] [blame] | 541 | ISCSI_HOST_PARAM_MAX, |
| 542 | }; |
| 543 | |
Adheer Chandravanshi | 2902eb4 | 2013-03-25 08:08:31 -0400 | [diff] [blame] | 544 | /* portal type */ |
| 545 | #define PORTAL_TYPE_IPV4 "ipv4" |
| 546 | #define PORTAL_TYPE_IPV6 "ipv6" |
| 547 | |
Adheer Chandravanshi | c6a4bb2 | 2013-03-22 07:41:29 -0400 | [diff] [blame] | 548 | /* iSCSI Flash Target params */ |
| 549 | enum iscsi_flashnode_param { |
| 550 | ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6, |
| 551 | ISCSI_FLASHNODE_PORTAL_TYPE, |
| 552 | ISCSI_FLASHNODE_AUTO_SND_TGT_DISABLE, |
| 553 | ISCSI_FLASHNODE_DISCOVERY_SESS, |
| 554 | ISCSI_FLASHNODE_ENTRY_EN, |
| 555 | ISCSI_FLASHNODE_HDR_DGST_EN, |
| 556 | ISCSI_FLASHNODE_DATA_DGST_EN, |
| 557 | ISCSI_FLASHNODE_IMM_DATA_EN, |
| 558 | ISCSI_FLASHNODE_INITIAL_R2T_EN, |
| 559 | ISCSI_FLASHNODE_DATASEQ_INORDER, |
| 560 | ISCSI_FLASHNODE_PDU_INORDER, |
| 561 | ISCSI_FLASHNODE_CHAP_AUTH_EN, |
| 562 | ISCSI_FLASHNODE_SNACK_REQ_EN, |
| 563 | ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN, |
| 564 | ISCSI_FLASHNODE_BIDI_CHAP_EN, |
| 565 | /* make authentication for discovery sessions optional */ |
| 566 | ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL, |
| 567 | ISCSI_FLASHNODE_ERL, |
| 568 | ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT, |
| 569 | ISCSI_FLASHNODE_TCP_NAGLE_DISABLE, |
| 570 | ISCSI_FLASHNODE_TCP_WSF_DISABLE, |
| 571 | ISCSI_FLASHNODE_TCP_TIMER_SCALE, |
| 572 | ISCSI_FLASHNODE_TCP_TIMESTAMP_EN, |
| 573 | ISCSI_FLASHNODE_IP_FRAG_DISABLE, |
| 574 | ISCSI_FLASHNODE_MAX_RECV_DLENGTH, |
| 575 | ISCSI_FLASHNODE_MAX_XMIT_DLENGTH, |
| 576 | ISCSI_FLASHNODE_FIRST_BURST, |
| 577 | ISCSI_FLASHNODE_DEF_TIME2WAIT, |
| 578 | ISCSI_FLASHNODE_DEF_TIME2RETAIN, |
| 579 | ISCSI_FLASHNODE_MAX_R2T, |
| 580 | ISCSI_FLASHNODE_KEEPALIVE_TMO, |
| 581 | ISCSI_FLASHNODE_ISID, |
| 582 | ISCSI_FLASHNODE_TSID, |
| 583 | ISCSI_FLASHNODE_PORT, |
| 584 | ISCSI_FLASHNODE_MAX_BURST, |
| 585 | ISCSI_FLASHNODE_DEF_TASKMGMT_TMO, |
| 586 | ISCSI_FLASHNODE_IPADDR, |
| 587 | ISCSI_FLASHNODE_ALIAS, |
| 588 | ISCSI_FLASHNODE_REDIRECT_IPADDR, |
| 589 | ISCSI_FLASHNODE_MAX_SEGMENT_SIZE, |
| 590 | ISCSI_FLASHNODE_LOCAL_PORT, |
| 591 | ISCSI_FLASHNODE_IPV4_TOS, |
| 592 | ISCSI_FLASHNODE_IPV6_TC, |
| 593 | ISCSI_FLASHNODE_IPV6_FLOW_LABEL, |
| 594 | ISCSI_FLASHNODE_NAME, |
| 595 | ISCSI_FLASHNODE_TPGT, |
| 596 | ISCSI_FLASHNODE_LINK_LOCAL_IPV6, |
| 597 | ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX, |
| 598 | ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE, |
| 599 | ISCSI_FLASHNODE_TCP_XMIT_WSF, |
| 600 | ISCSI_FLASHNODE_TCP_RECV_WSF, |
| 601 | ISCSI_FLASHNODE_CHAP_IN_IDX, |
| 602 | ISCSI_FLASHNODE_CHAP_OUT_IDX, |
| 603 | ISCSI_FLASHNODE_USERNAME, |
| 604 | ISCSI_FLASHNODE_USERNAME_IN, |
| 605 | ISCSI_FLASHNODE_PASSWORD, |
| 606 | ISCSI_FLASHNODE_PASSWORD_IN, |
| 607 | ISCSI_FLASHNODE_STATSN, |
| 608 | ISCSI_FLASHNODE_EXP_STATSN, |
| 609 | ISCSI_FLASHNODE_IS_BOOT_TGT, |
| 610 | |
| 611 | ISCSI_FLASHNODE_MAX, |
| 612 | }; |
| 613 | |
| 614 | struct iscsi_flashnode_param_info { |
| 615 | uint32_t len; /* Actual length of the param */ |
| 616 | uint16_t param; /* iscsi param value */ |
| 617 | uint8_t value[0]; /* length sized value follows */ |
| 618 | } __packed; |
| 619 | |
| 620 | enum iscsi_discovery_parent_type { |
| 621 | ISCSI_DISC_PARENT_UNKNOWN = 0x1, |
| 622 | ISCSI_DISC_PARENT_SENDTGT = 0x2, |
| 623 | ISCSI_DISC_PARENT_ISNS = 0x3, |
| 624 | }; |
| 625 | |
Vikas Chaudhary | aeddde2 | 2012-01-19 03:06:55 -0800 | [diff] [blame] | 626 | /* iSCSI port Speed */ |
| 627 | enum iscsi_port_speed { |
| 628 | ISCSI_PORT_SPEED_UNKNOWN = 0x1, |
| 629 | ISCSI_PORT_SPEED_10MBPS = 0x2, |
| 630 | ISCSI_PORT_SPEED_100MBPS = 0x4, |
| 631 | ISCSI_PORT_SPEED_1GBPS = 0x8, |
| 632 | ISCSI_PORT_SPEED_10GBPS = 0x10, |
| 633 | }; |
| 634 | |
| 635 | /* iSCSI port state */ |
| 636 | enum iscsi_port_state { |
| 637 | ISCSI_PORT_STATE_DOWN = 0x1, |
| 638 | ISCSI_PORT_STATE_UP = 0x2, |
| 639 | }; |
| 640 | |
Vikas Chaudhary | 1a590ca | 2012-03-06 04:16:04 -0800 | [diff] [blame] | 641 | /* iSCSI PING status/error code */ |
| 642 | enum iscsi_ping_status_code { |
| 643 | ISCSI_PING_SUCCESS = 0, |
| 644 | ISCSI_PING_FW_DISABLED = 0x1, |
| 645 | ISCSI_PING_IPADDR_INVALID = 0x2, |
| 646 | ISCSI_PING_LINKLOCAL_IPV6_ADDR_INVALID = 0x3, |
| 647 | ISCSI_PING_TIMEOUT = 0x4, |
| 648 | ISCSI_PING_INVALID_DEST_ADDR = 0x5, |
| 649 | ISCSI_PING_OVERSIZE_PACKET = 0x6, |
| 650 | ISCSI_PING_ICMP_ERROR = 0x7, |
| 651 | ISCSI_PING_MAX_REQ_EXCEEDED = 0x8, |
| 652 | ISCSI_PING_NO_ARP_RECEIVED = 0x9, |
| 653 | }; |
| 654 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 655 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) |
| 656 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 657 | |
| 658 | /* |
| 659 | * These flags presents iSCSI Data-Path capabilities. |
| 660 | */ |
| 661 | #define CAP_RECOVERY_L0 0x1 |
| 662 | #define CAP_RECOVERY_L1 0x2 |
| 663 | #define CAP_RECOVERY_L2 0x4 |
| 664 | #define CAP_MULTI_R2T 0x8 |
| 665 | #define CAP_HDRDGST 0x10 |
| 666 | #define CAP_DATADGST 0x20 |
| 667 | #define CAP_MULTI_CONN 0x40 |
| 668 | #define CAP_TEXT_NEGO 0x80 |
| 669 | #define CAP_MARKERS 0x100 |
Mike Christie | 0ab823d | 2007-05-30 12:57:22 -0500 | [diff] [blame] | 670 | #define CAP_FW_DB 0x200 |
Mike Christie | 63c62f1 | 2008-12-02 00:32:04 -0600 | [diff] [blame] | 671 | #define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */ |
| 672 | #define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */ |
| 673 | #define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */ |
Mike Christie | 6df19a7 | 2008-12-02 00:32:16 -0600 | [diff] [blame] | 674 | #define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal, |
| 675 | and verification */ |
Manish Rangankar | 17fa575 | 2011-07-25 13:48:52 -0500 | [diff] [blame] | 676 | #define CAP_LOGIN_OFFLOAD 0x4000 /* offload session login */ |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 677 | |
| 678 | /* |
| 679 | * These flags describes reason of stop_conn() call |
| 680 | */ |
| 681 | #define STOP_CONN_TERM 0x1 |
| 682 | #define STOP_CONN_SUSPEND 0x2 |
| 683 | #define STOP_CONN_RECOVER 0x3 |
| 684 | |
| 685 | #define ISCSI_STATS_CUSTOM_MAX 32 |
| 686 | #define ISCSI_STATS_CUSTOM_DESC_MAX 64 |
| 687 | struct iscsi_stats_custom { |
| 688 | char desc[ISCSI_STATS_CUSTOM_DESC_MAX]; |
| 689 | uint64_t value; |
| 690 | }; |
| 691 | |
| 692 | /* |
| 693 | * struct iscsi_stats - iSCSI Statistics (iSCSI MIB) |
| 694 | * |
| 695 | * Note: this structure contains counters collected on per-connection basis. |
| 696 | */ |
| 697 | struct iscsi_stats { |
| 698 | /* octets */ |
| 699 | uint64_t txdata_octets; |
| 700 | uint64_t rxdata_octets; |
| 701 | |
| 702 | /* xmit pdus */ |
| 703 | uint32_t noptx_pdus; |
| 704 | uint32_t scsicmd_pdus; |
| 705 | uint32_t tmfcmd_pdus; |
| 706 | uint32_t login_pdus; |
| 707 | uint32_t text_pdus; |
| 708 | uint32_t dataout_pdus; |
| 709 | uint32_t logout_pdus; |
| 710 | uint32_t snack_pdus; |
| 711 | |
| 712 | /* recv pdus */ |
| 713 | uint32_t noprx_pdus; |
| 714 | uint32_t scsirsp_pdus; |
| 715 | uint32_t tmfrsp_pdus; |
| 716 | uint32_t textrsp_pdus; |
| 717 | uint32_t datain_pdus; |
| 718 | uint32_t logoutrsp_pdus; |
| 719 | uint32_t r2t_pdus; |
| 720 | uint32_t async_pdus; |
| 721 | uint32_t rjt_pdus; |
| 722 | |
| 723 | /* errors */ |
| 724 | uint32_t digest_err; |
| 725 | uint32_t timeout_err; |
| 726 | |
| 727 | /* |
| 728 | * iSCSI Custom Statistics support, i.e. Transport could |
| 729 | * extend existing MIB statistics with its own specific statistics |
| 730 | * up to ISCSI_STATS_CUSTOM_MAX |
| 731 | */ |
| 732 | uint32_t custom_length; |
| 733 | struct iscsi_stats_custom custom[0] |
| 734 | __attribute__ ((aligned (sizeof(uint64_t)))); |
| 735 | }; |
| 736 | |
Nilesh Javali | 6260a5d | 2012-02-27 03:08:51 -0800 | [diff] [blame] | 737 | enum chap_type_e { |
| 738 | CHAP_TYPE_OUT, |
| 739 | CHAP_TYPE_IN, |
| 740 | }; |
| 741 | |
| 742 | #define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256 |
| 743 | #define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256 |
| 744 | struct iscsi_chap_rec { |
| 745 | uint16_t chap_tbl_idx; |
| 746 | enum chap_type_e chap_type; |
| 747 | char username[ISCSI_CHAP_AUTH_NAME_MAX_LEN]; |
| 748 | uint8_t password[ISCSI_CHAP_AUTH_SECRET_MAX_LEN]; |
| 749 | uint8_t password_length; |
Vikas Chaudhary | 5a5a15f | 2012-03-06 04:16:05 -0800 | [diff] [blame] | 750 | }; |
Nilesh Javali | 6260a5d | 2012-02-27 03:08:51 -0800 | [diff] [blame] | 751 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 752 | #endif |