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, |
| 62 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 63 | /* up events */ |
| 64 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
| 65 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, |
| 66 | ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, |
Mike Christie | 53cb8a1 | 2006-06-28 12:00:32 -0500 | [diff] [blame] | 67 | ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4, |
Mike Christie | 2697478 | 2007-12-13 12:43:29 -0600 | [diff] [blame] | 68 | ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5, |
| 69 | ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6, |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 70 | |
| 71 | ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7, |
| 72 | ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8, |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
Mike Christie | 01cb225 | 2006-06-28 12:00:22 -0500 | [diff] [blame] | 75 | enum iscsi_tgt_dscvr { |
| 76 | ISCSI_TGT_DSCVR_SEND_TARGETS = 1, |
| 77 | ISCSI_TGT_DSCVR_ISNS = 2, |
| 78 | ISCSI_TGT_DSCVR_SLP = 3, |
| 79 | }; |
| 80 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 81 | struct iscsi_uevent { |
| 82 | uint32_t type; /* k/u events type */ |
| 83 | uint32_t iferror; /* carries interface or resource errors */ |
| 84 | uint64_t transport_handle; |
| 85 | |
| 86 | union { |
| 87 | /* messages u -> k */ |
| 88 | struct msg_create_session { |
| 89 | uint32_t initial_cmdsn; |
Mike Christie | 1548271 | 2007-05-30 12:57:19 -0500 | [diff] [blame] | 90 | uint16_t cmds_max; |
| 91 | uint16_t queue_depth; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 92 | } c_session; |
Mike Christie | 40753ca | 2008-05-21 15:53:56 -0500 | [diff] [blame] | 93 | struct msg_create_bound_session { |
Mike Christie | d82ff9be | 2008-05-21 15:54:13 -0500 | [diff] [blame] | 94 | uint64_t ep_handle; |
Mike Christie | 40753ca | 2008-05-21 15:53:56 -0500 | [diff] [blame] | 95 | uint32_t initial_cmdsn; |
| 96 | uint16_t cmds_max; |
| 97 | uint16_t queue_depth; |
| 98 | } c_bound_session; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 99 | struct msg_destroy_session { |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 100 | uint32_t sid; |
| 101 | } d_session; |
| 102 | struct msg_create_conn { |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 103 | uint32_t sid; |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 104 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 105 | } c_conn; |
| 106 | struct msg_bind_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 107 | uint32_t sid; |
| 108 | uint32_t cid; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 109 | uint64_t transport_eph; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 110 | uint32_t is_leading; |
| 111 | } b_conn; |
| 112 | struct msg_destroy_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 113 | uint32_t sid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 114 | uint32_t cid; |
| 115 | } d_conn; |
| 116 | struct msg_send_pdu { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 117 | uint32_t sid; |
| 118 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 119 | uint32_t hdr_size; |
| 120 | uint32_t data_size; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 121 | } send_pdu; |
| 122 | struct msg_set_param { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 123 | uint32_t sid; |
| 124 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 125 | uint32_t param; /* enum iscsi_param */ |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 126 | uint32_t len; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 127 | } set_param; |
| 128 | struct msg_start_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 129 | uint32_t sid; |
| 130 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 131 | } start_conn; |
| 132 | struct msg_stop_conn { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 133 | uint32_t sid; |
| 134 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 135 | uint64_t conn_handle; |
| 136 | uint32_t flag; |
| 137 | } stop_conn; |
| 138 | struct msg_get_stats { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 139 | uint32_t sid; |
| 140 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 141 | } get_stats; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 142 | struct msg_transport_connect { |
| 143 | uint32_t non_blocking; |
| 144 | } ep_connect; |
Mike Christie | 10eb0f0 | 2009-05-13 17:57:38 -0500 | [diff] [blame] | 145 | struct msg_transport_connect_through_host { |
| 146 | uint32_t host_no; |
| 147 | uint32_t non_blocking; |
| 148 | } ep_connect_through_host; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 149 | struct msg_transport_poll { |
| 150 | uint64_t ep_handle; |
| 151 | uint32_t timeout_ms; |
| 152 | } ep_poll; |
| 153 | struct msg_transport_disconnect { |
| 154 | uint64_t ep_handle; |
| 155 | } ep_disconnect; |
Mike Christie | 01cb225 | 2006-06-28 12:00:22 -0500 | [diff] [blame] | 156 | struct msg_tgt_dscvr { |
| 157 | enum iscsi_tgt_dscvr type; |
| 158 | uint32_t host_no; |
| 159 | /* |
| 160 | * enable = 1 to establish a new connection |
| 161 | * with the server. enable = 0 to disconnect |
| 162 | * from the server. Used primarily to switch |
| 163 | * from one iSNS server to another. |
| 164 | */ |
| 165 | uint32_t enable; |
| 166 | } tgt_dscvr; |
Mike Christie | 1d9bf13 | 2007-05-30 12:57:11 -0500 | [diff] [blame] | 167 | struct msg_set_host_param { |
| 168 | uint32_t host_no; |
| 169 | uint32_t param; /* enum iscsi_host_param */ |
| 170 | uint32_t len; |
| 171 | } set_host_param; |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 172 | struct msg_set_path { |
| 173 | uint32_t host_no; |
| 174 | } set_path; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 175 | } u; |
| 176 | union { |
| 177 | /* messages k -> u */ |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 178 | int retcode; |
| 179 | struct msg_create_session_ret { |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 180 | uint32_t sid; |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 181 | uint32_t host_no; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 182 | } c_session_ret; |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 183 | struct msg_create_conn_ret { |
| 184 | uint32_t sid; |
| 185 | uint32_t cid; |
| 186 | } c_conn_ret; |
Mike Christie | 2697478 | 2007-12-13 12:43:29 -0600 | [diff] [blame] | 187 | struct msg_unbind_session { |
| 188 | uint32_t sid; |
| 189 | uint32_t host_no; |
| 190 | } unbind_session; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 191 | struct msg_recv_req { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 192 | uint32_t sid; |
| 193 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 194 | uint64_t recv_handle; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 195 | } recv_req; |
| 196 | struct msg_conn_error { |
Mike Christie | b5c7a12 | 2006-04-06 21:13:33 -0500 | [diff] [blame] | 197 | uint32_t sid; |
| 198 | uint32_t cid; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 199 | uint32_t error; /* enum iscsi_err */ |
| 200 | } connerror; |
Mike Christie | 53cb8a1 | 2006-06-28 12:00:32 -0500 | [diff] [blame] | 201 | struct msg_session_destroyed { |
| 202 | uint32_t host_no; |
| 203 | uint32_t sid; |
| 204 | } d_session; |
Or Gerlitz | 264faaa | 2006-05-02 19:46:36 -0500 | [diff] [blame] | 205 | struct msg_transport_connect_ret { |
| 206 | uint64_t handle; |
| 207 | } ep_connect_ret; |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 208 | struct msg_req_path { |
| 209 | uint32_t host_no; |
| 210 | } req_path; |
| 211 | struct msg_notify_if_down { |
| 212 | uint32_t host_no; |
| 213 | } notify_if_down; |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 214 | } r; |
| 215 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
| 216 | |
| 217 | /* |
Michael Chan | 4351477 | 2009-06-08 18:14:41 -0700 | [diff] [blame] | 218 | * To keep the struct iscsi_uevent size the same for userspace code |
| 219 | * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and |
| 220 | * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the |
| 221 | * struct iscsi_uevent in the NETLINK_ISCSI message. |
| 222 | */ |
| 223 | struct iscsi_path { |
| 224 | uint64_t handle; |
| 225 | uint8_t mac_addr[6]; |
| 226 | uint8_t mac_addr_old[6]; |
| 227 | uint32_t ip_addr_len; /* 4 or 16 */ |
| 228 | union { |
| 229 | struct in_addr v4_addr; |
| 230 | struct in6_addr v6_addr; |
| 231 | } src; |
| 232 | union { |
| 233 | struct in_addr v4_addr; |
| 234 | struct in6_addr v6_addr; |
| 235 | } dst; |
| 236 | uint16_t vlan_id; |
| 237 | uint16_t pmtu; |
| 238 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
| 239 | |
| 240 | /* |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 241 | * Common error codes |
| 242 | */ |
| 243 | enum iscsi_err { |
| 244 | ISCSI_OK = 0, |
| 245 | |
| 246 | ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1, |
| 247 | ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2, |
| 248 | ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3, |
| 249 | ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4, |
| 250 | ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5, |
| 251 | ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6, |
| 252 | ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7, |
| 253 | ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8, |
| 254 | ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9, |
| 255 | ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10, |
| 256 | ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11, |
| 257 | ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12, |
| 258 | ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13, |
| 259 | ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14, |
| 260 | ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, |
Mike Christie | 7996a77 | 2006-04-06 21:13:41 -0500 | [diff] [blame] | 261 | ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, |
| 262 | ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, |
Mike Christie | e5bd7b5 | 2008-09-24 11:46:10 -0500 | [diff] [blame] | 263 | ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18, |
Mike Christie | 6f481e3 | 2008-09-24 11:46:13 -0500 | [diff] [blame] | 264 | ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, |
Mike Christie | d1af8a3 | 2009-08-20 15:11:02 -0500 | [diff] [blame] | 265 | ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20, |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 266 | }; |
| 267 | |
| 268 | /* |
| 269 | * iSCSI Parameters (RFC3720) |
| 270 | */ |
| 271 | enum iscsi_param { |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 272 | /* passed in using netlink set param */ |
| 273 | ISCSI_PARAM_MAX_RECV_DLENGTH, |
| 274 | ISCSI_PARAM_MAX_XMIT_DLENGTH, |
| 275 | ISCSI_PARAM_HDRDGST_EN, |
| 276 | ISCSI_PARAM_DATADGST_EN, |
| 277 | ISCSI_PARAM_INITIAL_R2T_EN, |
| 278 | ISCSI_PARAM_MAX_R2T, |
| 279 | ISCSI_PARAM_IMM_DATA_EN, |
| 280 | ISCSI_PARAM_FIRST_BURST, |
| 281 | ISCSI_PARAM_MAX_BURST, |
| 282 | ISCSI_PARAM_PDU_INORDER_EN, |
| 283 | ISCSI_PARAM_DATASEQ_INORDER_EN, |
| 284 | ISCSI_PARAM_ERL, |
| 285 | ISCSI_PARAM_IFMARKER_EN, |
| 286 | ISCSI_PARAM_OFMARKER_EN, |
Mike Christie | 8d2860b | 2006-05-02 19:46:47 -0500 | [diff] [blame] | 287 | ISCSI_PARAM_EXP_STATSN, |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 288 | ISCSI_PARAM_TARGET_NAME, |
| 289 | ISCSI_PARAM_TPGT, |
| 290 | ISCSI_PARAM_PERSISTENT_ADDRESS, |
| 291 | ISCSI_PARAM_PERSISTENT_PORT, |
Mike Christie | 30a6c65 | 2006-04-06 21:13:39 -0500 | [diff] [blame] | 292 | ISCSI_PARAM_SESS_RECOVERY_TMO, |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 293 | |
| 294 | /* pased in through bind conn using transport_fd */ |
| 295 | ISCSI_PARAM_CONN_PORT, |
| 296 | ISCSI_PARAM_CONN_ADDRESS, |
| 297 | |
Mike Christie | b2c6416 | 2007-05-30 12:57:16 -0500 | [diff] [blame] | 298 | ISCSI_PARAM_USERNAME, |
| 299 | ISCSI_PARAM_USERNAME_IN, |
| 300 | ISCSI_PARAM_PASSWORD, |
| 301 | ISCSI_PARAM_PASSWORD_IN, |
| 302 | |
Mike Christie | 843c0a8 | 2007-12-13 12:43:20 -0600 | [diff] [blame] | 303 | ISCSI_PARAM_FAST_ABORT, |
Mike Christie | f6d5180 | 2007-12-13 12:43:30 -0600 | [diff] [blame] | 304 | ISCSI_PARAM_ABORT_TMO, |
| 305 | ISCSI_PARAM_LU_RESET_TMO, |
| 306 | ISCSI_PARAM_HOST_RESET_TMO, |
| 307 | |
| 308 | ISCSI_PARAM_PING_TMO, |
| 309 | ISCSI_PARAM_RECV_TMO, |
Mike Christie | 88dfd34 | 2008-05-21 15:54:16 -0500 | [diff] [blame] | 310 | |
| 311 | ISCSI_PARAM_IFACE_NAME, |
| 312 | ISCSI_PARAM_ISID, |
| 313 | ISCSI_PARAM_INITIATOR_NAME, |
Mike Christie | 3fe5ae8 | 2009-11-11 16:34:33 -0600 | [diff] [blame] | 314 | |
| 315 | ISCSI_PARAM_TGT_RESET_TMO, |
Vikas Chaudhary | 3b2bef1 | 2010-07-10 14:51:30 +0530 | [diff] [blame] | 316 | ISCSI_PARAM_TARGET_ALIAS, |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 317 | /* must always be last */ |
| 318 | ISCSI_PARAM_MAX, |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 319 | }; |
Mike Christie | fd7255f | 2006-04-06 21:13:36 -0500 | [diff] [blame] | 320 | |
Mike Christie | 88dfd34 | 2008-05-21 15:54:16 -0500 | [diff] [blame] | 321 | #define ISCSI_MAX_RECV_DLENGTH (1ULL << ISCSI_PARAM_MAX_RECV_DLENGTH) |
| 322 | #define ISCSI_MAX_XMIT_DLENGTH (1ULL << ISCSI_PARAM_MAX_XMIT_DLENGTH) |
| 323 | #define ISCSI_HDRDGST_EN (1ULL << ISCSI_PARAM_HDRDGST_EN) |
| 324 | #define ISCSI_DATADGST_EN (1ULL << ISCSI_PARAM_DATADGST_EN) |
| 325 | #define ISCSI_INITIAL_R2T_EN (1ULL << ISCSI_PARAM_INITIAL_R2T_EN) |
| 326 | #define ISCSI_MAX_R2T (1ULL << ISCSI_PARAM_MAX_R2T) |
| 327 | #define ISCSI_IMM_DATA_EN (1ULL << ISCSI_PARAM_IMM_DATA_EN) |
| 328 | #define ISCSI_FIRST_BURST (1ULL << ISCSI_PARAM_FIRST_BURST) |
| 329 | #define ISCSI_MAX_BURST (1ULL << ISCSI_PARAM_MAX_BURST) |
| 330 | #define ISCSI_PDU_INORDER_EN (1ULL << ISCSI_PARAM_PDU_INORDER_EN) |
| 331 | #define ISCSI_DATASEQ_INORDER_EN (1ULL << ISCSI_PARAM_DATASEQ_INORDER_EN) |
| 332 | #define ISCSI_ERL (1ULL << ISCSI_PARAM_ERL) |
| 333 | #define ISCSI_IFMARKER_EN (1ULL << ISCSI_PARAM_IFMARKER_EN) |
| 334 | #define ISCSI_OFMARKER_EN (1ULL << ISCSI_PARAM_OFMARKER_EN) |
| 335 | #define ISCSI_EXP_STATSN (1ULL << ISCSI_PARAM_EXP_STATSN) |
| 336 | #define ISCSI_TARGET_NAME (1ULL << ISCSI_PARAM_TARGET_NAME) |
| 337 | #define ISCSI_TPGT (1ULL << ISCSI_PARAM_TPGT) |
| 338 | #define ISCSI_PERSISTENT_ADDRESS (1ULL << ISCSI_PARAM_PERSISTENT_ADDRESS) |
| 339 | #define ISCSI_PERSISTENT_PORT (1ULL << ISCSI_PARAM_PERSISTENT_PORT) |
| 340 | #define ISCSI_SESS_RECOVERY_TMO (1ULL << ISCSI_PARAM_SESS_RECOVERY_TMO) |
| 341 | #define ISCSI_CONN_PORT (1ULL << ISCSI_PARAM_CONN_PORT) |
| 342 | #define ISCSI_CONN_ADDRESS (1ULL << ISCSI_PARAM_CONN_ADDRESS) |
| 343 | #define ISCSI_USERNAME (1ULL << ISCSI_PARAM_USERNAME) |
| 344 | #define ISCSI_USERNAME_IN (1ULL << ISCSI_PARAM_USERNAME_IN) |
| 345 | #define ISCSI_PASSWORD (1ULL << ISCSI_PARAM_PASSWORD) |
| 346 | #define ISCSI_PASSWORD_IN (1ULL << ISCSI_PARAM_PASSWORD_IN) |
| 347 | #define ISCSI_FAST_ABORT (1ULL << ISCSI_PARAM_FAST_ABORT) |
| 348 | #define ISCSI_ABORT_TMO (1ULL << ISCSI_PARAM_ABORT_TMO) |
| 349 | #define ISCSI_LU_RESET_TMO (1ULL << ISCSI_PARAM_LU_RESET_TMO) |
| 350 | #define ISCSI_HOST_RESET_TMO (1ULL << ISCSI_PARAM_HOST_RESET_TMO) |
| 351 | #define ISCSI_PING_TMO (1ULL << ISCSI_PARAM_PING_TMO) |
| 352 | #define ISCSI_RECV_TMO (1ULL << ISCSI_PARAM_RECV_TMO) |
| 353 | #define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME) |
| 354 | #define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) |
| 355 | #define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) |
Mike Christie | 3fe5ae8 | 2009-11-11 16:34:33 -0600 | [diff] [blame] | 356 | #define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO) |
Vikas Chaudhary | 3b2bef1 | 2010-07-10 14:51:30 +0530 | [diff] [blame] | 357 | #define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS) |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 358 | |
Mike Christie | 1819dc8 | 2007-05-30 12:57:08 -0500 | [diff] [blame] | 359 | /* iSCSI HBA params */ |
| 360 | enum iscsi_host_param { |
| 361 | ISCSI_HOST_PARAM_HWADDRESS, |
Mike Christie | 8ad5781 | 2007-05-30 12:57:13 -0500 | [diff] [blame] | 362 | ISCSI_HOST_PARAM_INITIATOR_NAME, |
Mike Christie | d8196ed | 2007-05-30 12:57:25 -0500 | [diff] [blame] | 363 | ISCSI_HOST_PARAM_NETDEV_NAME, |
Mike Christie | 2223696 | 2007-05-30 12:57:24 -0500 | [diff] [blame] | 364 | ISCSI_HOST_PARAM_IPADDRESS, |
Mike Christie | 1819dc8 | 2007-05-30 12:57:08 -0500 | [diff] [blame] | 365 | ISCSI_HOST_PARAM_MAX, |
| 366 | }; |
| 367 | |
Mike Christie | 88dfd34 | 2008-05-21 15:54:16 -0500 | [diff] [blame] | 368 | #define ISCSI_HOST_HWADDRESS (1ULL << ISCSI_HOST_PARAM_HWADDRESS) |
| 369 | #define ISCSI_HOST_INITIATOR_NAME (1ULL << ISCSI_HOST_PARAM_INITIATOR_NAME) |
| 370 | #define ISCSI_HOST_NETDEV_NAME (1ULL << ISCSI_HOST_PARAM_NETDEV_NAME) |
| 371 | #define ISCSI_HOST_IPADDRESS (1ULL << ISCSI_HOST_PARAM_IPADDRESS) |
Mike Christie | 1819dc8 | 2007-05-30 12:57:08 -0500 | [diff] [blame] | 372 | |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 373 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) |
| 374 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 375 | |
| 376 | /* |
| 377 | * These flags presents iSCSI Data-Path capabilities. |
| 378 | */ |
| 379 | #define CAP_RECOVERY_L0 0x1 |
| 380 | #define CAP_RECOVERY_L1 0x2 |
| 381 | #define CAP_RECOVERY_L2 0x4 |
| 382 | #define CAP_MULTI_R2T 0x8 |
| 383 | #define CAP_HDRDGST 0x10 |
| 384 | #define CAP_DATADGST 0x20 |
| 385 | #define CAP_MULTI_CONN 0x40 |
| 386 | #define CAP_TEXT_NEGO 0x80 |
| 387 | #define CAP_MARKERS 0x100 |
Mike Christie | 0ab823d | 2007-05-30 12:57:22 -0500 | [diff] [blame] | 388 | #define CAP_FW_DB 0x200 |
Mike Christie | 63c62f1 | 2008-12-02 00:32:04 -0600 | [diff] [blame] | 389 | #define CAP_SENDTARGETS_OFFLOAD 0x400 /* offload discovery process */ |
| 390 | #define CAP_DATA_PATH_OFFLOAD 0x800 /* offload entire IO path */ |
| 391 | #define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */ |
Mike Christie | 6df19a7 | 2008-12-02 00:32:16 -0600 | [diff] [blame] | 392 | #define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal, |
| 393 | and verification */ |
Alex Aizman | 39e8479 | 2005-08-04 19:31:00 -0700 | [diff] [blame] | 394 | |
| 395 | /* |
| 396 | * These flags describes reason of stop_conn() call |
| 397 | */ |
| 398 | #define STOP_CONN_TERM 0x1 |
| 399 | #define STOP_CONN_SUSPEND 0x2 |
| 400 | #define STOP_CONN_RECOVER 0x3 |
| 401 | |
| 402 | #define ISCSI_STATS_CUSTOM_MAX 32 |
| 403 | #define ISCSI_STATS_CUSTOM_DESC_MAX 64 |
| 404 | struct iscsi_stats_custom { |
| 405 | char desc[ISCSI_STATS_CUSTOM_DESC_MAX]; |
| 406 | uint64_t value; |
| 407 | }; |
| 408 | |
| 409 | /* |
| 410 | * struct iscsi_stats - iSCSI Statistics (iSCSI MIB) |
| 411 | * |
| 412 | * Note: this structure contains counters collected on per-connection basis. |
| 413 | */ |
| 414 | struct iscsi_stats { |
| 415 | /* octets */ |
| 416 | uint64_t txdata_octets; |
| 417 | uint64_t rxdata_octets; |
| 418 | |
| 419 | /* xmit pdus */ |
| 420 | uint32_t noptx_pdus; |
| 421 | uint32_t scsicmd_pdus; |
| 422 | uint32_t tmfcmd_pdus; |
| 423 | uint32_t login_pdus; |
| 424 | uint32_t text_pdus; |
| 425 | uint32_t dataout_pdus; |
| 426 | uint32_t logout_pdus; |
| 427 | uint32_t snack_pdus; |
| 428 | |
| 429 | /* recv pdus */ |
| 430 | uint32_t noprx_pdus; |
| 431 | uint32_t scsirsp_pdus; |
| 432 | uint32_t tmfrsp_pdus; |
| 433 | uint32_t textrsp_pdus; |
| 434 | uint32_t datain_pdus; |
| 435 | uint32_t logoutrsp_pdus; |
| 436 | uint32_t r2t_pdus; |
| 437 | uint32_t async_pdus; |
| 438 | uint32_t rjt_pdus; |
| 439 | |
| 440 | /* errors */ |
| 441 | uint32_t digest_err; |
| 442 | uint32_t timeout_err; |
| 443 | |
| 444 | /* |
| 445 | * iSCSI Custom Statistics support, i.e. Transport could |
| 446 | * extend existing MIB statistics with its own specific statistics |
| 447 | * up to ISCSI_STATS_CUSTOM_MAX |
| 448 | */ |
| 449 | uint32_t custom_length; |
| 450 | struct iscsi_stats_custom custom[0] |
| 451 | __attribute__ ((aligned (sizeof(uint64_t)))); |
| 452 | }; |
| 453 | |
| 454 | #endif |