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