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