1 /* 2 * Copyright (c) 2017-2018 Cavium, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 * 27 * $FreeBSD$ 28 * 29 */ 30 31 32 #ifndef __ISCSI_COMMON__ 33 #define __ISCSI_COMMON__ 34 /**********************/ 35 /* ISCSI FW CONSTANTS */ 36 /**********************/ 37 38 /* iSCSI HSI constants */ 39 #define ISCSI_DEFAULT_MTU (1500) 40 41 /* KWQ (kernel work queue) layer codes */ 42 #define ISCSI_SLOW_PATH_LAYER_CODE (6) 43 44 /* iSCSI parameter defaults */ 45 #define ISCSI_DEFAULT_HEADER_DIGEST (0) 46 #define ISCSI_DEFAULT_DATA_DIGEST (0) 47 #define ISCSI_DEFAULT_INITIAL_R2T (1) 48 #define ISCSI_DEFAULT_IMMEDIATE_DATA (1) 49 #define ISCSI_DEFAULT_MAX_PDU_LENGTH (0x2000) 50 #define ISCSI_DEFAULT_FIRST_BURST_LENGTH (0x10000) 51 #define ISCSI_DEFAULT_MAX_BURST_LENGTH (0x40000) 52 #define ISCSI_DEFAULT_MAX_OUTSTANDING_R2T (1) 53 54 /* iSCSI parameter limits */ 55 #define ISCSI_MIN_VAL_MAX_PDU_LENGTH (0x200) 56 #define ISCSI_MAX_VAL_MAX_PDU_LENGTH (0xffffff) 57 #define ISCSI_MIN_VAL_BURST_LENGTH (0x200) 58 #define ISCSI_MAX_VAL_BURST_LENGTH (0xffffff) 59 #define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T (1) 60 #define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T (0xff) // 0x10000 according to RFC 61 62 #define ISCSI_AHS_CNTL_SIZE 4 63 64 #define ISCSI_WQE_NUM_SGES_SLOWIO (0xf) 65 66 /* iSCSI reserved params */ 67 #define ISCSI_ITT_ALL_ONES (0xffffffff) 68 #define ISCSI_TTT_ALL_ONES (0xffffffff) 69 70 #define ISCSI_OPTION_1_OFF_CHIP_TCP 1 71 #define ISCSI_OPTION_2_ON_CHIP_TCP 2 72 73 #define ISCSI_INITIATOR_MODE 0 74 #define ISCSI_TARGET_MODE 1 75 76 77 /* iSCSI request op codes */ 78 #define ISCSI_OPCODE_NOP_OUT (0) 79 #define ISCSI_OPCODE_SCSI_CMD (1) 80 #define ISCSI_OPCODE_TMF_REQUEST (2) 81 #define ISCSI_OPCODE_LOGIN_REQUEST (3) 82 #define ISCSI_OPCODE_TEXT_REQUEST (4) 83 #define ISCSI_OPCODE_DATA_OUT (5) 84 #define ISCSI_OPCODE_LOGOUT_REQUEST (6) 85 86 /* iSCSI response/messages op codes */ 87 #define ISCSI_OPCODE_NOP_IN (0x20) 88 #define ISCSI_OPCODE_SCSI_RESPONSE (0x21) 89 #define ISCSI_OPCODE_TMF_RESPONSE (0x22) 90 #define ISCSI_OPCODE_LOGIN_RESPONSE (0x23) 91 #define ISCSI_OPCODE_TEXT_RESPONSE (0x24) 92 #define ISCSI_OPCODE_DATA_IN (0x25) 93 #define ISCSI_OPCODE_LOGOUT_RESPONSE (0x26) 94 #define ISCSI_OPCODE_R2T (0x31) 95 #define ISCSI_OPCODE_ASYNC_MSG (0x32) 96 #define ISCSI_OPCODE_REJECT (0x3f) 97 98 /* iSCSI stages */ 99 #define ISCSI_STAGE_SECURITY_NEGOTIATION (0) 100 #define ISCSI_STAGE_LOGIN_OPERATIONAL_NEGOTIATION (1) 101 #define ISCSI_STAGE_FULL_FEATURE_PHASE (3) 102 103 /* iSCSI CQE errors */ 104 #define CQE_ERROR_BITMAP_DATA_DIGEST (0x08) 105 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN (0x10) 106 #define CQE_ERROR_BITMAP_DATA_TRUNCATED (0x20) 107 108 109 /* 110 * ISCSI SGL entry 111 */ 112 struct cqe_error_bitmap 113 { 114 u8 cqe_error_status_bits; 115 #define CQE_ERROR_BITMAP_DIF_ERR_BITS_MASK 0x7 /* Mark task with DIF error (3 bit): [0]-CRC/checksum, [1]-app tag, [2]-reference tag */ 116 #define CQE_ERROR_BITMAP_DIF_ERR_BITS_SHIFT 0 117 #define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_MASK 0x1 /* Mark task with data digest error (1 bit) */ 118 #define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_SHIFT 3 119 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_MASK 0x1 /* Mark receive on invalid connection */ 120 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_SHIFT 4 121 #define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_MASK 0x1 /* Target Mode - Mark middle task error, data truncated */ 122 #define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_SHIFT 5 123 #define CQE_ERROR_BITMAP_UNDER_RUN_ERR_MASK 0x1 124 #define CQE_ERROR_BITMAP_UNDER_RUN_ERR_SHIFT 6 125 #define CQE_ERROR_BITMAP_RESERVED2_MASK 0x1 126 #define CQE_ERROR_BITMAP_RESERVED2_SHIFT 7 127 }; 128 129 130 union cqe_error_status 131 { 132 u8 error_status /* all error bits as uint8 */; 133 struct cqe_error_bitmap error_bits /* cqe errors bitmap */; 134 }; 135 136 137 /* 138 * iSCSI Login Response PDU header 139 */ 140 struct data_hdr 141 { 142 __le32 data[12] /* iscsi header data */; 143 }; 144 145 146 /* 147 * iSCSI Asynchronous Message PDU header 148 */ 149 struct iscsi_async_msg_hdr 150 { 151 __le16 reserved0 /* reserved */; 152 u8 flags_attr; 153 #define ISCSI_ASYNC_MSG_HDR_RSRV_MASK 0x7F /* reserved */ 154 #define ISCSI_ASYNC_MSG_HDR_RSRV_SHIFT 0 155 #define ISCSI_ASYNC_MSG_HDR_CONST1_MASK 0x1 /* const1 */ 156 #define ISCSI_ASYNC_MSG_HDR_CONST1_SHIFT 7 157 u8 opcode /* opcode */; 158 __le32 hdr_second_dword; 159 #define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 160 #define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_SHIFT 0 161 #define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 162 #define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_SHIFT 24 163 struct regpair lun /* Logical Unit Number */; 164 __le32 all_ones /* should be 0xffffffff */; 165 __le32 reserved1 /* reserved */; 166 __le32 stat_sn /* stat_sn */; 167 __le32 exp_cmd_sn /* exp_cmd_sn */; 168 __le32 max_cmd_sn /* max_cmd_sn */; 169 __le16 param1_rsrv /* Parameter1 or Reserved */; 170 u8 async_vcode /* AsuncVCode */; 171 u8 async_event /* AsyncEvent */; 172 __le16 param3_rsrv /* Parameter3 or Reserved */; 173 __le16 param2_rsrv /* Parameter2 or Reserved */; 174 __le32 reserved7 /* reserved */; 175 }; 176 177 178 /* 179 * iSCSI Command PDU header 180 */ 181 struct iscsi_cmd_hdr 182 { 183 __le16 reserved1 /* reserved */; 184 u8 flags_attr; 185 #define ISCSI_CMD_HDR_ATTR_MASK 0x7 /* attributes */ 186 #define ISCSI_CMD_HDR_ATTR_SHIFT 0 187 #define ISCSI_CMD_HDR_RSRV_MASK 0x3 /* reserved */ 188 #define ISCSI_CMD_HDR_RSRV_SHIFT 3 189 #define ISCSI_CMD_HDR_WRITE_MASK 0x1 /* write */ 190 #define ISCSI_CMD_HDR_WRITE_SHIFT 5 191 #define ISCSI_CMD_HDR_READ_MASK 0x1 /* read */ 192 #define ISCSI_CMD_HDR_READ_SHIFT 6 193 #define ISCSI_CMD_HDR_FINAL_MASK 0x1 /* final */ 194 #define ISCSI_CMD_HDR_FINAL_SHIFT 7 195 u8 hdr_first_byte; 196 #define ISCSI_CMD_HDR_OPCODE_MASK 0x3F /* Opcode */ 197 #define ISCSI_CMD_HDR_OPCODE_SHIFT 0 198 #define ISCSI_CMD_HDR_IMM_MASK 0x1 /* Immediate delivery */ 199 #define ISCSI_CMD_HDR_IMM_SHIFT 6 200 #define ISCSI_CMD_HDR_RSRV1_MASK 0x1 /* first bit of iSCSI PDU header */ 201 #define ISCSI_CMD_HDR_RSRV1_SHIFT 7 202 __le32 hdr_second_dword; 203 #define ISCSI_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 204 #define ISCSI_CMD_HDR_DATA_SEG_LEN_SHIFT 0 205 #define ISCSI_CMD_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 206 #define ISCSI_CMD_HDR_TOTAL_AHS_LEN_SHIFT 24 207 struct regpair lun /* Logical Unit Number. [constant, initialized] */; 208 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 209 __le32 expected_transfer_length /* Expected Data Transfer Length (only 3 bytes are significant) */; 210 __le32 cmd_sn /* CmdSn. [constant, initialized] */; 211 __le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */; 212 __le32 cdb[4] /* CDB. [constant, initialized] */; 213 }; 214 215 216 /* 217 * iSCSI Common PDU header 218 */ 219 struct iscsi_common_hdr 220 { 221 u8 hdr_status /* Status field of ISCSI header */; 222 u8 hdr_response /* Response field of ISCSI header for Responses / Reserved for Data-In */; 223 u8 hdr_flags /* Flags field of ISCSI header */; 224 u8 hdr_first_byte; 225 #define ISCSI_COMMON_HDR_OPCODE_MASK 0x3F /* Opcode */ 226 #define ISCSI_COMMON_HDR_OPCODE_SHIFT 0 227 #define ISCSI_COMMON_HDR_IMM_MASK 0x1 /* Immediate */ 228 #define ISCSI_COMMON_HDR_IMM_SHIFT 6 229 #define ISCSI_COMMON_HDR_RSRV_MASK 0x1 /* first bit of iSCSI PDU header */ 230 #define ISCSI_COMMON_HDR_RSRV_SHIFT 7 231 __le32 hdr_second_dword; 232 #define ISCSI_COMMON_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 233 #define ISCSI_COMMON_HDR_DATA_SEG_LEN_SHIFT 0 234 #define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 235 #define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_SHIFT 24 236 struct regpair lun_reserved /* Bytes 8..15 : LUN (if PDU contains a LUN field) or reserved */; 237 __le32 itt /* ITT - common to all headers */; 238 __le32 ttt /* bytes 20 to 23 - common ttt to various PDU headers */; 239 __le32 cmdstat_sn /* bytes 24 to 27 - common cmd_sn (initiator) or stat_sn (target) to various PDU headers */; 240 __le32 exp_statcmd_sn /* bytes 28 to 31 - common expected stat_sn (initiator) or cmd_sn (target) to various PDU headers */; 241 __le32 max_cmd_sn /* bytes 32 to 35 - common max cmd_sn to various PDU headers */; 242 __le32 data[3] /* bytes 36 to 47 */; 243 }; 244 245 246 /* 247 * ISCSI connection offload params passed by driver to FW in ISCSI offload ramrod 248 */ 249 struct iscsi_conn_offload_params 250 { 251 struct regpair sq_pbl_addr /* PBL SQ pointer */; 252 struct regpair r2tq_pbl_addr /* PBL R2TQ pointer */; 253 struct regpair xhq_pbl_addr /* PBL XHQ pointer */; 254 struct regpair uhq_pbl_addr /* PBL UHQ pointer */; 255 __le32 initial_ack /* Initial ack, received from TCP */; 256 __le16 physical_q0 /* Physical QM queue to be tied to logical Q0 */; 257 __le16 physical_q1 /* Physical QM queue to be tied to logical Q1 */; 258 u8 flags; 259 #define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_MASK 0x1 /* TCP connect/terminate option. 0 - TCP on host (option-1); 1 - TCP on chip (option-2). */ 260 #define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_SHIFT 0 261 #define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_MASK 0x1 /* iSCSI connect mode: 0-iSCSI Initiator, 1-iSCSI Target */ 262 #define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_SHIFT 1 263 #define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_MASK 0x1 /* Restricted mode: 0 - un-restricted (deviating from the RFC), 1 - restricted (according to the RFC) */ 264 #define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_SHIFT 2 265 #define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_MASK 0x1F /* reserved */ 266 #define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_SHIFT 3 267 u8 pbl_page_size_log /* Page size with PBEs log; Page Size = 2^(page_size_log+12) */; 268 u8 pbe_page_size_log /* PBE page size with log; Page Size = 2^(page_size_log+12) */; 269 u8 default_cq /* Default CQ used to write unsolicited data */; 270 __le32 stat_sn /* StatSn for Target Mode only: the first Login Response StatSn value for Target mode */; 271 }; 272 273 274 /* 275 * spe message header 276 */ 277 struct iscsi_slow_path_hdr 278 { 279 u8 op_code /* iscsi bus-drv message opcode */; 280 u8 flags; 281 #define ISCSI_SLOW_PATH_HDR_RESERVED0_MASK 0xF 282 #define ISCSI_SLOW_PATH_HDR_RESERVED0_SHIFT 0 283 #define ISCSI_SLOW_PATH_HDR_LAYER_CODE_MASK 0x7 /* protocol layer (L2,L3,L4,L5) */ 284 #define ISCSI_SLOW_PATH_HDR_LAYER_CODE_SHIFT 4 285 #define ISCSI_SLOW_PATH_HDR_RESERVED1_MASK 0x1 286 #define ISCSI_SLOW_PATH_HDR_RESERVED1_SHIFT 7 287 }; 288 289 /* 290 * ISCSI connection update params passed by driver to FW in ISCSI update ramrod 291 */ 292 struct iscsi_conn_update_ramrod_params 293 { 294 struct iscsi_slow_path_hdr hdr /* spe message header. */; 295 __le16 conn_id /* ISCSI Connection ID. (MOTI_COHEN : draft for DrvSim sake) */; 296 __le32 fw_cid /* Context ID (cid) of the connection. (MOTI_COHEN : draft for DrvSim sake) */; 297 u8 flags; 298 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_MASK 0x1 /* Is header digest enabled */ 299 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_SHIFT 0 300 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_MASK 0x1 /* Is data digest enabled */ 301 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_SHIFT 1 302 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_MASK 0x1 /* Initial R2T */ 303 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_SHIFT 2 304 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_MASK 0x1 /* Immediate data */ 305 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_SHIFT 3 306 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_MASK 0x1 /* 0 - 512B, 1 - 4K */ 307 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_SHIFT 4 308 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_MASK 0x1 /* 0 - no DIF, 1 - could be enabled per task */ 309 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_SHIFT 5 310 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_MASK 0x3 311 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_RESERVED1_SHIFT 6 312 u8 reserved0[3]; 313 __le32 max_seq_size /* Maximum sequence size. Valid for TX and RX */; 314 __le32 max_send_pdu_length /* Maximum PDU size. Valid for the TX */; 315 __le32 max_recv_pdu_length /* Maximum PDU size. Valid for the RX */; 316 __le32 first_seq_length /* Initial sequence length */; 317 __le32 exp_stat_sn /* ExpStatSn - Option1 Only */; 318 }; 319 320 321 /* 322 * iSCSI Command PDU header with Extended CDB (Initiator Mode) 323 */ 324 struct iscsi_ext_cdb_cmd_hdr 325 { 326 __le16 reserved1 /* reserved */; 327 u8 flags_attr; 328 #define ISCSI_EXT_CDB_CMD_HDR_ATTR_MASK 0x7 /* attributes */ 329 #define ISCSI_EXT_CDB_CMD_HDR_ATTR_SHIFT 0 330 #define ISCSI_EXT_CDB_CMD_HDR_RSRV_MASK 0x3 /* reserved */ 331 #define ISCSI_EXT_CDB_CMD_HDR_RSRV_SHIFT 3 332 #define ISCSI_EXT_CDB_CMD_HDR_WRITE_MASK 0x1 /* write */ 333 #define ISCSI_EXT_CDB_CMD_HDR_WRITE_SHIFT 5 334 #define ISCSI_EXT_CDB_CMD_HDR_READ_MASK 0x1 /* read */ 335 #define ISCSI_EXT_CDB_CMD_HDR_READ_SHIFT 6 336 #define ISCSI_EXT_CDB_CMD_HDR_FINAL_MASK 0x1 /* final */ 337 #define ISCSI_EXT_CDB_CMD_HDR_FINAL_SHIFT 7 338 u8 opcode /* opcode. [constant, initialized] */; 339 __le32 hdr_second_dword; 340 #define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 341 #define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_SHIFT 0 342 #define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_MASK 0xFF /* The Extended CDB size in bytes. Maximum Extended CDB size supported is CDB 64B. */ 343 #define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_SHIFT 24 344 struct regpair lun /* Logical Unit Number. [constant, initialized] */; 345 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 346 __le32 expected_transfer_length /* Expected Data Transfer Length (only 3 bytes are significant) */; 347 __le32 cmd_sn /* CmdSn. [constant, initialized] */; 348 __le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */; 349 struct scsi_sge cdb_sge /* Extended CDBs dedicated SGE */; 350 }; 351 352 /* 353 * iSCSI login request PDU header 354 */ 355 struct iscsi_login_req_hdr 356 { 357 u8 version_min /* Version-min */; 358 u8 version_max /* Version-max */; 359 u8 flags_attr; 360 #define ISCSI_LOGIN_REQ_HDR_NSG_MASK 0x3 /* Next Stage (NSG) */ 361 #define ISCSI_LOGIN_REQ_HDR_NSG_SHIFT 0 362 #define ISCSI_LOGIN_REQ_HDR_CSG_MASK 0x3 /* Current stage (CSG) */ 363 #define ISCSI_LOGIN_REQ_HDR_CSG_SHIFT 2 364 #define ISCSI_LOGIN_REQ_HDR_RSRV_MASK 0x3 /* reserved */ 365 #define ISCSI_LOGIN_REQ_HDR_RSRV_SHIFT 4 366 #define ISCSI_LOGIN_REQ_HDR_C_MASK 0x1 /* C (Continue) bit */ 367 #define ISCSI_LOGIN_REQ_HDR_C_SHIFT 6 368 #define ISCSI_LOGIN_REQ_HDR_T_MASK 0x1 /* T (Transit) bit */ 369 #define ISCSI_LOGIN_REQ_HDR_T_SHIFT 7 370 u8 opcode /* opcode. [constant, initialized] */; 371 __le32 hdr_second_dword; 372 #define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 373 #define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_SHIFT 0 374 #define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 375 #define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_SHIFT 24 376 __le32 isid_tabc /* Session identifier high double word [constant, initialized] */; 377 __le16 tsih /* TSIH */; 378 __le16 isid_d /* Session identifier low word [constant, initialized] */; 379 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 380 __le16 reserved1; 381 __le16 cid /* Unique Connection ID within the session [constant, initialized] */; 382 __le32 cmd_sn /* CmdSn. [constant, initialized] */; 383 __le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */; 384 __le32 reserved2[4]; 385 }; 386 387 /* 388 * iSCSI logout request PDU header 389 */ 390 struct iscsi_logout_req_hdr 391 { 392 __le16 reserved0 /* reserved */; 393 u8 reason_code /* Reason Code */; 394 u8 opcode /* opcode. [constant, initialized] */; 395 __le32 reserved1; 396 __le32 reserved2[2] /* Reserved */; 397 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 398 __le16 reserved3 /* Reserved */; 399 __le16 cid /* Unique Connection ID within the session [constant, initialized] */; 400 __le32 cmd_sn /* CmdSn. [constant, initialized] */; 401 __le32 exp_stat_sn /* various fields for middle-path PDU. [constant, initialized] */; 402 __le32 reserved4[4] /* Reserved */; 403 }; 404 405 /* 406 * iSCSI Data-out PDU header 407 */ 408 struct iscsi_data_out_hdr 409 { 410 __le16 reserved1 /* reserved */; 411 u8 flags_attr; 412 #define ISCSI_DATA_OUT_HDR_RSRV_MASK 0x7F /* reserved */ 413 #define ISCSI_DATA_OUT_HDR_RSRV_SHIFT 0 414 #define ISCSI_DATA_OUT_HDR_FINAL_MASK 0x1 /* final */ 415 #define ISCSI_DATA_OUT_HDR_FINAL_SHIFT 7 416 u8 opcode /* opcode */; 417 __le32 reserved2 /* reserved */; 418 struct regpair lun /* Logical Unit Number */; 419 __le32 itt /* Initiator Task Tag (only 2 bytes are significant) */; 420 __le32 ttt /* Target Transfer Tag (from R2T) */; 421 __le32 reserved3 /* resrved */; 422 __le32 exp_stat_sn /* Expected StatSn */; 423 __le32 reserved4 /* resrved */; 424 __le32 data_sn /* DataSN - PDU index in sequnece */; 425 __le32 buffer_offset /* Buffer Offset - offset in task */; 426 __le32 reserved5 /* resrved */; 427 }; 428 429 /* 430 * iSCSI Data-in PDU header 431 */ 432 struct iscsi_data_in_hdr 433 { 434 u8 status_rsvd /* Status or reserved */; 435 u8 reserved1 /* reserved */; 436 u8 flags; 437 #define ISCSI_DATA_IN_HDR_STATUS_MASK 0x1 /* Status */ 438 #define ISCSI_DATA_IN_HDR_STATUS_SHIFT 0 439 #define ISCSI_DATA_IN_HDR_UNDERFLOW_MASK 0x1 /* Residual Underflow */ 440 #define ISCSI_DATA_IN_HDR_UNDERFLOW_SHIFT 1 441 #define ISCSI_DATA_IN_HDR_OVERFLOW_MASK 0x1 /* Residual Overflow */ 442 #define ISCSI_DATA_IN_HDR_OVERFLOW_SHIFT 2 443 #define ISCSI_DATA_IN_HDR_RSRV_MASK 0x7 /* reserved - 0 */ 444 #define ISCSI_DATA_IN_HDR_RSRV_SHIFT 3 445 #define ISCSI_DATA_IN_HDR_ACK_MASK 0x1 /* Acknowledge */ 446 #define ISCSI_DATA_IN_HDR_ACK_SHIFT 6 447 #define ISCSI_DATA_IN_HDR_FINAL_MASK 0x1 /* final */ 448 #define ISCSI_DATA_IN_HDR_FINAL_SHIFT 7 449 u8 opcode /* opcode */; 450 __le32 reserved2 /* reserved */; 451 struct regpair lun /* Logical Unit Number */; 452 __le32 itt /* Initiator Task Tag (only 2 bytes are significant) */; 453 __le32 ttt /* Target Transfer Tag (from R2T) */; 454 __le32 stat_sn /* StatSN or reserved */; 455 __le32 exp_cmd_sn /* Expected CmdSn */; 456 __le32 max_cmd_sn /* MaxCmdSn */; 457 __le32 data_sn /* DataSN - PDU index in sequnece */; 458 __le32 buffer_offset /* Buffer Offset - offset in task */; 459 __le32 residual_count /* Residual Count */; 460 }; 461 462 /* 463 * iSCSI R2T PDU header 464 */ 465 struct iscsi_r2t_hdr 466 { 467 u8 reserved0[3] /* reserved */; 468 u8 opcode /* opcode */; 469 __le32 reserved2 /* reserved */; 470 struct regpair lun /* Logical Unit Number */; 471 __le32 itt /* Initiator Task Tag */; 472 __le32 ttt /* Target Transfer Tag */; 473 __le32 stat_sn /* stat sn */; 474 __le32 exp_cmd_sn /* Expected CmdSn */; 475 __le32 max_cmd_sn /* Max CmdSn */; 476 __le32 r2t_sn /* DataSN - PDU index in sequnece */; 477 __le32 buffer_offset /* Buffer Offset - offset in task */; 478 __le32 desired_data_trns_len /* Desired data trnsfer len */; 479 }; 480 481 /* 482 * iSCSI NOP-out PDU header 483 */ 484 struct iscsi_nop_out_hdr 485 { 486 __le16 reserved1 /* reserved */; 487 u8 flags_attr; 488 #define ISCSI_NOP_OUT_HDR_RSRV_MASK 0x7F /* reserved */ 489 #define ISCSI_NOP_OUT_HDR_RSRV_SHIFT 0 490 #define ISCSI_NOP_OUT_HDR_CONST1_MASK 0x1 /* const1 */ 491 #define ISCSI_NOP_OUT_HDR_CONST1_SHIFT 7 492 u8 opcode /* opcode */; 493 __le32 reserved2 /* reserved */; 494 struct regpair lun /* Logical Unit Number */; 495 __le32 itt /* Initiator Task Tag (only 2 bytes are significant) */; 496 __le32 ttt /* Target Transfer Tag (from R2T) */; 497 __le32 cmd_sn /* CmdSN */; 498 __le32 exp_stat_sn /* Expected StatSn */; 499 __le32 reserved3 /* reserved */; 500 __le32 reserved4 /* reserved */; 501 __le32 reserved5 /* reserved */; 502 __le32 reserved6 /* reserved */; 503 }; 504 505 /* 506 * iSCSI NOP-in PDU header 507 */ 508 struct iscsi_nop_in_hdr 509 { 510 __le16 reserved0 /* reserved */; 511 u8 flags_attr; 512 #define ISCSI_NOP_IN_HDR_RSRV_MASK 0x7F /* reserved */ 513 #define ISCSI_NOP_IN_HDR_RSRV_SHIFT 0 514 #define ISCSI_NOP_IN_HDR_CONST1_MASK 0x1 /* const1 */ 515 #define ISCSI_NOP_IN_HDR_CONST1_SHIFT 7 516 u8 opcode /* opcode */; 517 __le32 hdr_second_dword; 518 #define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 519 #define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_SHIFT 0 520 #define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 521 #define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_SHIFT 24 522 struct regpair lun /* Logical Unit Number */; 523 __le32 itt /* Initiator Task Tag (only 2 bytes are significant) */; 524 __le32 ttt /* Target Transfer Tag */; 525 __le32 stat_sn /* stat_sn */; 526 __le32 exp_cmd_sn /* exp_cmd_sn */; 527 __le32 max_cmd_sn /* max_cmd_sn */; 528 __le32 reserved5 /* reserved */; 529 __le32 reserved6 /* reserved */; 530 __le32 reserved7 /* reserved */; 531 }; 532 533 /* 534 * iSCSI Login Response PDU header 535 */ 536 struct iscsi_login_response_hdr 537 { 538 u8 version_active /* Version-active */; 539 u8 version_max /* Version-max */; 540 u8 flags_attr; 541 #define ISCSI_LOGIN_RESPONSE_HDR_NSG_MASK 0x3 /* Next Stage (NSG) */ 542 #define ISCSI_LOGIN_RESPONSE_HDR_NSG_SHIFT 0 543 #define ISCSI_LOGIN_RESPONSE_HDR_CSG_MASK 0x3 /* Current stage (CSG) */ 544 #define ISCSI_LOGIN_RESPONSE_HDR_CSG_SHIFT 2 545 #define ISCSI_LOGIN_RESPONSE_HDR_RSRV_MASK 0x3 /* reserved */ 546 #define ISCSI_LOGIN_RESPONSE_HDR_RSRV_SHIFT 4 547 #define ISCSI_LOGIN_RESPONSE_HDR_C_MASK 0x1 /* C (Continue) bit */ 548 #define ISCSI_LOGIN_RESPONSE_HDR_C_SHIFT 6 549 #define ISCSI_LOGIN_RESPONSE_HDR_T_MASK 0x1 /* T (Transit) bit */ 550 #define ISCSI_LOGIN_RESPONSE_HDR_T_SHIFT 7 551 u8 opcode /* opcode. [constant, initialized] */; 552 __le32 hdr_second_dword; 553 #define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 554 #define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 555 #define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 556 #define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 557 __le32 isid_tabc /* Session identifier high double word [constant, initialized] */; 558 __le16 tsih /* TSIH */; 559 __le16 isid_d /* Session identifier low word [constant, initialized] */; 560 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 561 __le32 reserved1; 562 __le32 stat_sn /* CmdSn. [constant, initialized] */; 563 __le32 exp_cmd_sn /* various fields for middle-path PDU. [constant, initialized] */; 564 __le32 max_cmd_sn /* max_cmd_sn */; 565 __le16 reserved2; 566 u8 status_detail /* status_detail */; 567 u8 status_class /* status_class */; 568 __le32 reserved4[2]; 569 }; 570 571 /* 572 * iSCSI Logout Response PDU header 573 */ 574 struct iscsi_logout_response_hdr 575 { 576 u8 reserved1 /* reserved */; 577 u8 response /* response */; 578 u8 flags /* flags and attributes */; 579 u8 opcode /* opcode. [constant, initialized] */; 580 __le32 hdr_second_dword; 581 #define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 582 #define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 583 #define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 584 #define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 585 __le32 reserved2[2] /* Reserved */; 586 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 587 __le32 reserved3 /* Reserved */; 588 __le32 stat_sn /* CmdSN */; 589 __le32 exp_cmd_sn /* Expected StatSn */; 590 __le32 max_cmd_sn /* CmdSN */; 591 __le32 reserved4 /* Reserved */; 592 __le16 time_2_retain /* Time to Retain */; 593 __le16 time_2_wait /* Time to wait */; 594 __le32 reserved5[1] /* Reserved */; 595 }; 596 597 /* 598 * iSCSI Text Request PDU header 599 */ 600 struct iscsi_text_request_hdr 601 { 602 __le16 reserved0 /* reserved */; 603 u8 flags_attr; 604 #define ISCSI_TEXT_REQUEST_HDR_RSRV_MASK 0x3F /* reserved */ 605 #define ISCSI_TEXT_REQUEST_HDR_RSRV_SHIFT 0 606 #define ISCSI_TEXT_REQUEST_HDR_C_MASK 0x1 /* C (Continue) bit */ 607 #define ISCSI_TEXT_REQUEST_HDR_C_SHIFT 6 608 #define ISCSI_TEXT_REQUEST_HDR_F_MASK 0x1 /* F (Final) bit */ 609 #define ISCSI_TEXT_REQUEST_HDR_F_SHIFT 7 610 u8 opcode /* opcode. [constant, initialized] */; 611 __le32 hdr_second_dword; 612 #define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 613 #define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_SHIFT 0 614 #define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 615 #define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24 616 struct regpair lun /* Logical Unit Number */; 617 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 618 __le32 ttt /* Referenced Task Tag or 0xffffffff */; 619 __le32 cmd_sn /* cmd_sn */; 620 __le32 exp_stat_sn /* exp_stat_sn */; 621 __le32 reserved4[4] /* Reserved */; 622 }; 623 624 /* 625 * iSCSI Text Response PDU header 626 */ 627 struct iscsi_text_response_hdr 628 { 629 __le16 reserved1 /* reserved */; 630 u8 flags; 631 #define ISCSI_TEXT_RESPONSE_HDR_RSRV_MASK 0x3F /* reserved */ 632 #define ISCSI_TEXT_RESPONSE_HDR_RSRV_SHIFT 0 633 #define ISCSI_TEXT_RESPONSE_HDR_C_MASK 0x1 /* C (Continue) bit */ 634 #define ISCSI_TEXT_RESPONSE_HDR_C_SHIFT 6 635 #define ISCSI_TEXT_RESPONSE_HDR_F_MASK 0x1 /* F (Final) bit */ 636 #define ISCSI_TEXT_RESPONSE_HDR_F_SHIFT 7 637 u8 opcode /* opcode. [constant, initialized] */; 638 __le32 hdr_second_dword; 639 #define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 640 #define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 641 #define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 642 #define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 643 struct regpair lun /* Logical Unit Number */; 644 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 645 __le32 ttt /* Target Task Tag */; 646 __le32 stat_sn /* CmdSN */; 647 __le32 exp_cmd_sn /* Expected StatSn */; 648 __le32 max_cmd_sn /* CmdSN */; 649 __le32 reserved4[3] /* Reserved */; 650 }; 651 652 /* 653 * iSCSI TMF Request PDU header 654 */ 655 struct iscsi_tmf_request_hdr 656 { 657 __le16 reserved0 /* reserved */; 658 u8 function /* function */; 659 u8 opcode /* opcode. [constant, initialized] */; 660 __le32 hdr_second_dword; 661 #define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 662 #define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_SHIFT 0 663 #define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 664 #define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24 665 struct regpair lun /* Logical Unit Number */; 666 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 667 __le32 rtt /* Referenced Task Tag or 0xffffffff */; 668 __le32 cmd_sn /* cmd_sn */; 669 __le32 exp_stat_sn /* exp_stat_sn */; 670 __le32 ref_cmd_sn /* ref_cmd_sn */; 671 __le32 exp_data_sn /* exp_data_sn */; 672 __le32 reserved4[2] /* Reserved */; 673 }; 674 675 struct iscsi_tmf_response_hdr 676 { 677 u8 reserved2 /* reserved2 */; 678 u8 hdr_response /* Response field of ISCSI header for Responses / Reserved for Data-In */; 679 u8 hdr_flags /* Flags field of ISCSI header */; 680 u8 opcode /* opcode. [constant, initialized] */; 681 __le32 hdr_second_dword; 682 #define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 683 #define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 684 #define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 685 #define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 686 struct regpair reserved0; 687 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 688 __le32 reserved1 /* Reserved */; 689 __le32 stat_sn /* stat_sn */; 690 __le32 exp_cmd_sn /* exp_cmd_sn */; 691 __le32 max_cmd_sn /* max_cmd_sn */; 692 __le32 reserved4[3] /* Reserved */; 693 }; 694 695 /* 696 * iSCSI Response PDU header 697 */ 698 struct iscsi_response_hdr 699 { 700 u8 hdr_status /* Status field of ISCSI header */; 701 u8 hdr_response /* Response field of ISCSI header for Responses / Reserved for Data-In */; 702 u8 hdr_flags /* Flags field of ISCSI header */; 703 u8 opcode /* opcode. [constant, initialized] */; 704 __le32 hdr_second_dword; 705 #define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 706 #define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 707 #define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 708 #define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 709 struct regpair lun /* Logical Unit Number */; 710 __le32 itt /* Initiator Task Tag (only 2 bytes are significant). [constant, initialized] */; 711 __le32 snack_tag /* Currently ERL>0 is not supported */; 712 __le32 stat_sn /* CmdSN */; 713 __le32 exp_cmd_sn /* Expected StatSn */; 714 __le32 max_cmd_sn /* CmdSN */; 715 __le32 exp_data_sn /* exp_data_sn */; 716 __le32 bi_residual_count /* bi residual count */; 717 __le32 residual_count /* residual count */; 718 }; 719 720 /* 721 * iSCSI Reject PDU header 722 */ 723 struct iscsi_reject_hdr 724 { 725 u8 reserved4 /* Reserved */; 726 u8 hdr_reason /* The reject reason */; 727 u8 hdr_flags /* Flags field of ISCSI header */; 728 u8 opcode /* opcode. [constant, initialized] */; 729 __le32 hdr_second_dword; 730 #define ISCSI_REJECT_HDR_DATA_SEG_LEN_MASK 0xFFFFFF /* DataSegmentLength */ 731 #define ISCSI_REJECT_HDR_DATA_SEG_LEN_SHIFT 0 732 #define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_MASK 0xFF /* TotalAHSLength */ 733 #define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_SHIFT 24 734 struct regpair reserved0; 735 __le32 all_ones; 736 __le32 reserved2; 737 __le32 stat_sn /* stat_sn */; 738 __le32 exp_cmd_sn /* exp_cmd_sn */; 739 __le32 max_cmd_sn /* max_cmd_sn */; 740 __le32 data_sn /* data_sn */; 741 __le32 reserved3[2] /* reserved3 */; 742 }; 743 744 /* 745 * PDU header part of Ystorm task context 746 */ 747 union iscsi_task_hdr 748 { 749 struct iscsi_common_hdr common /* Command PDU header */; 750 struct data_hdr data /* Command PDU header */; 751 struct iscsi_cmd_hdr cmd /* Command PDU header */; 752 struct iscsi_ext_cdb_cmd_hdr ext_cdb_cmd /* Command PDU header with extended CDB - Initiator Mode */; 753 struct iscsi_login_req_hdr login_req /* Login request PDU header */; 754 struct iscsi_logout_req_hdr logout_req /* Logout request PDU header */; 755 struct iscsi_data_out_hdr data_out /* Data-out PDU header */; 756 struct iscsi_data_in_hdr data_in /* Data-in PDU header */; 757 struct iscsi_r2t_hdr r2t /* R2T PDU header */; 758 struct iscsi_nop_out_hdr nop_out /* NOP-out PDU header */; 759 struct iscsi_nop_in_hdr nop_in /* NOP-in PDU header */; 760 struct iscsi_login_response_hdr login_response /* Login response PDU header */; 761 struct iscsi_logout_response_hdr logout_response /* Logout response PDU header */; 762 struct iscsi_text_request_hdr text_request /* Text request PDU header */; 763 struct iscsi_text_response_hdr text_response /* Text response PDU header */; 764 struct iscsi_tmf_request_hdr tmf_request /* TMF request PDU header */; 765 struct iscsi_tmf_response_hdr tmf_response /* TMF response PDU header */; 766 struct iscsi_response_hdr response /* Text response PDU header */; 767 struct iscsi_reject_hdr reject /* Reject PDU header */; 768 struct iscsi_async_msg_hdr async_msg /* Asynchronous Message PDU header */; 769 }; 770 771 /* 772 * iSCSI CQ element 773 */ 774 struct iscsi_cqe_common 775 { 776 __le16 conn_id /* Drivers connection Id */; 777 u8 cqe_type /* Indicates CQE type */; 778 union cqe_error_status error_bitmap /* CQE error status */; 779 __le32 reserved[3]; 780 union iscsi_task_hdr iscsi_hdr /* iscsi header union */; 781 }; 782 783 /* 784 * iSCSI CQ element 785 */ 786 struct iscsi_cqe_solicited 787 { 788 __le16 conn_id /* Drivers connection Id */; 789 u8 cqe_type /* Indicates CQE type */; 790 union cqe_error_status error_bitmap /* CQE error status */; 791 __le16 itid /* initiator itt (Initiator mode) or target ttt (Target mode) */; 792 u8 task_type /* Task type */; 793 u8 fw_dbg_field /* FW debug params */; 794 u8 caused_conn_err /* Equals 1 if this TID caused the connection error, otherwise equals 0. */; 795 u8 reserved0[3]; 796 __le32 reserved1[1]; 797 union iscsi_task_hdr iscsi_hdr /* iscsi header union */; 798 }; 799 800 /* 801 * iSCSI CQ element 802 */ 803 struct iscsi_cqe_unsolicited 804 { 805 __le16 conn_id /* Drivers connection Id */; 806 u8 cqe_type /* Indicates CQE type */; 807 union cqe_error_status error_bitmap /* CQE error status */; 808 __le16 reserved0 /* Reserved */; 809 u8 reserved1 /* Reserved */; 810 u8 unsol_cqe_type /* Represent this unsolicited CQE position in a sequence of packets belonging to the same unsolicited PDU */; 811 struct regpair rqe_opaque /* Relevant for Unsolicited CQE only: The opaque data of RQ BDQ */; 812 union iscsi_task_hdr iscsi_hdr /* iscsi header union */; 813 }; 814 815 /* 816 * iSCSI CQ element 817 */ 818 union iscsi_cqe 819 { 820 struct iscsi_cqe_common cqe_common /* Common CQE */; 821 struct iscsi_cqe_solicited cqe_solicited /* Solicited CQE */; 822 struct iscsi_cqe_unsolicited cqe_unsolicited /* Unsolicited CQE. relevant only when cqe_opcode == ISCSI_CQE_TYPE_UNSOLICITED */; 823 }; 824 825 826 /* 827 * iSCSI CQE type 828 */ 829 enum iscsi_cqes_type 830 { 831 ISCSI_CQE_TYPE_SOLICITED=1 /* iSCSI CQE with solicited data */, 832 ISCSI_CQE_TYPE_UNSOLICITED /* iSCSI CQE with unsolicited data */, 833 ISCSI_CQE_TYPE_SOLICITED_WITH_SENSE /* iSCSI CQE with solicited with sense data */, 834 ISCSI_CQE_TYPE_TASK_CLEANUP /* iSCSI CQE task cleanup */, 835 ISCSI_CQE_TYPE_DUMMY /* iSCSI Dummy CQE */, 836 MAX_ISCSI_CQES_TYPE 837 }; 838 839 840 841 842 843 /* 844 * iSCSI CQE type 845 */ 846 enum iscsi_cqe_unsolicited_type 847 { 848 ISCSI_CQE_UNSOLICITED_NONE /* iSCSI CQE with unsolicited data */, 849 ISCSI_CQE_UNSOLICITED_SINGLE /* iSCSI CQE with unsolicited data */, 850 ISCSI_CQE_UNSOLICITED_FIRST /* iSCSI CQE with unsolicited data */, 851 ISCSI_CQE_UNSOLICITED_MIDDLE /* iSCSI CQE with unsolicited data */, 852 ISCSI_CQE_UNSOLICITED_LAST /* iSCSI CQE with unsolicited data */, 853 MAX_ISCSI_CQE_UNSOLICITED_TYPE 854 }; 855 856 857 858 859 /* 860 * iscsi debug modes 861 */ 862 struct iscsi_debug_modes 863 { 864 u8 flags; 865 #define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_MASK 0x1 /* Assert on Rx connection error */ 866 #define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_SHIFT 0 867 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_MASK 0x1 /* Assert if TCP RESET arrived */ 868 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_SHIFT 1 869 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_MASK 0x1 /* Assert if TCP FIN arrived */ 870 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_SHIFT 2 871 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_MASK 0x1 /* Assert if cleanup flow */ 872 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_SHIFT 3 873 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_MASK 0x1 /* Assert if REJECT PDU or ASYNC PDU arrived */ 874 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_SHIFT 4 875 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_MASK 0x1 /* Assert if NOP IN PDU or NOP OUT PDU arrived */ 876 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_SHIFT 5 877 #define ISCSI_DEBUG_MODES_ASSERT_IF_DATA_DIGEST_ERROR_MASK 0x1 /* Assert if data digest error */ 878 #define ISCSI_DEBUG_MODES_ASSERT_IF_DATA_DIGEST_ERROR_SHIFT 6 879 #define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_ERROR_MASK 0x1 /* Assert if DIF error */ 880 #define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_ERROR_SHIFT 7 881 }; 882 883 884 /* 885 * iSCSI DIF flags 886 */ 887 struct iscsi_dif_flags 888 { 889 u8 flags; 890 #define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_MASK 0xF /* Protection log interval (9=512 10=1024 11=2048 12=4096 13=8192) */ 891 #define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_SHIFT 0 892 #define ISCSI_DIF_FLAGS_DIF_TO_PEER_MASK 0x1 /* If DIF protection is configured against target (0=no, 1=yes) */ 893 #define ISCSI_DIF_FLAGS_DIF_TO_PEER_SHIFT 4 894 #define ISCSI_DIF_FLAGS_HOST_INTERFACE_MASK 0x7 /* If DIF/DIX protection is configured against the host (0=none, 1=DIF, 2=DIX 2 bytes, 3=DIX 4 bytes, 4=DIX 8 bytes) */ 895 #define ISCSI_DIF_FLAGS_HOST_INTERFACE_SHIFT 5 896 }; 897 898 899 /* 900 * iSCSI kernel completion queue IDs 901 */ 902 enum iscsi_eqe_opcode 903 { 904 ISCSI_EVENT_TYPE_INIT_FUNC=0 /* iSCSI response after init Ramrod */, 905 ISCSI_EVENT_TYPE_DESTROY_FUNC /* iSCSI response after destroy Ramrod */, 906 ISCSI_EVENT_TYPE_OFFLOAD_CONN /* iSCSI response after option 2 offload Ramrod */, 907 ISCSI_EVENT_TYPE_UPDATE_CONN /* iSCSI response after update Ramrod */, 908 ISCSI_EVENT_TYPE_CLEAR_SQ /* iSCSI response after clear sq Ramrod */, 909 ISCSI_EVENT_TYPE_TERMINATE_CONN /* iSCSI response after termination Ramrod */, 910 ISCSI_EVENT_TYPE_MAC_UPDATE_CONN /* iSCSI response after MAC address update Ramrod */, 911 ISCSI_EVENT_TYPE_ASYN_CONNECT_COMPLETE /* iSCSI response after option 2 connect completed (A-syn EQE) */, 912 ISCSI_EVENT_TYPE_ASYN_TERMINATE_DONE /* iSCSI response after option 2 termination completed (A-syn EQE) */, 913 RESERVED9 /* reserved9 */, 914 ISCSI_EVENT_TYPE_START_OF_ERROR_TYPES=10 /* Never returned in EQE, used to separate Regular event types from Error event types */, 915 ISCSI_EVENT_TYPE_ASYN_ABORT_RCVD /* iSCSI abort response after TCP RST packet receive (A-syn EQE) */, 916 ISCSI_EVENT_TYPE_ASYN_CLOSE_RCVD /* iSCSI response after close receive (A-syn EQE) */, 917 ISCSI_EVENT_TYPE_ASYN_SYN_RCVD /* iSCSI response after TCP SYN+ACK packet receive (A-syn EQE) */, 918 ISCSI_EVENT_TYPE_ASYN_MAX_RT_TIME /* iSCSI error - tcp max retransmit time (A-syn EQE) */, 919 ISCSI_EVENT_TYPE_ASYN_MAX_RT_CNT /* iSCSI error - tcp max retransmit count (A-syn EQE) */, 920 ISCSI_EVENT_TYPE_ASYN_MAX_KA_PROBES_CNT /* iSCSI error - tcp ka probes count (A-syn EQE) */, 921 ISCSI_EVENT_TYPE_ASYN_FIN_WAIT2 /* iSCSI error - tcp fin wait 2 (A-syn EQE) */, 922 ISCSI_EVENT_TYPE_ISCSI_CONN_ERROR /* iSCSI error response (A-syn EQE) */, 923 ISCSI_EVENT_TYPE_TCP_CONN_ERROR /* iSCSI error - tcp error (A-syn EQE) */, 924 MAX_ISCSI_EQE_OPCODE 925 }; 926 927 928 /* 929 * iSCSI EQE and CQE completion status 930 */ 931 enum iscsi_error_types 932 { 933 ISCSI_STATUS_NONE=0, 934 ISCSI_CQE_ERROR_UNSOLICITED_RCV_ON_INVALID_CONN=1, 935 ISCSI_CONN_ERROR_TASK_CID_MISMATCH /* iSCSI connection error - Corrupted Task context */, 936 ISCSI_CONN_ERROR_TASK_NOT_VALID /* iSCSI connection error - The task is not valid */, 937 ISCSI_CONN_ERROR_RQ_RING_IS_FULL /* iSCSI connection error - RQ full */, 938 ISCSI_CONN_ERROR_CMDQ_RING_IS_FULL /* iSCSI connection error - CMDQ full (Target only) */, 939 ISCSI_CONN_ERROR_HQE_CACHING_FAILED /* iSCSI connection error - HQ error */, 940 ISCSI_CONN_ERROR_HEADER_DIGEST_ERROR /* iSCSI connection error - Header digest error */, 941 ISCSI_CONN_ERROR_LOCAL_COMPLETION_ERROR /* iSCSI connection error - Local completion bit is not correct (A-syn EQE) */, 942 ISCSI_CONN_ERROR_DATA_OVERRUN /* iSCSI connection error - data overrun */, 943 ISCSI_CONN_ERROR_OUT_OF_SGES_ERROR /* iSCSI connection error - out of sges in task context */, 944 ISCSI_CONN_ERROR_IP_OPTIONS_ERROR /* TCP connection error - IP option error */, 945 ISCSI_CONN_ERROR_PRS_ERRORS /* TCP connection error - error indication form parser */, 946 ISCSI_CONN_ERROR_CONNECT_INVALID_TCP_OPTION /* TCP connection error - tcp options error(option 2 only) */, 947 ISCSI_CONN_ERROR_TCP_IP_FRAGMENT_ERROR /* TCP connection error - IP fragmentation error */, 948 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_LEN /* iSCSI connection error - invalid AHS length (Target only) */, 949 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_TYPE /* iSCSI connection error - invalid AHS type (Target only) */, 950 ISCSI_CONN_ERROR_PROTOCOL_ERR_ITT_OUT_OF_RANGE /* iSCSI connection error - invalid ITT */, 951 ISCSI_CONN_ERROR_PROTOCOL_ERR_TTT_OUT_OF_RANGE /* iSCSI connection error - invalid TTT (Target only) */, 952 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_EXCEEDS_PDU_SIZE /* iSCSI connection error - PDU data_seg_len > max receive pdu size */, 953 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE /* iSCSI connection error - invalid PDU opcode */, 954 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE_BEFORE_UPDATE /* iSCSI connection error - invalid PDU opcode before update ramrod (Option 2 only) */, 955 ISCSI_CONN_ERROR_UNVALID_NOPIN_DSL /* iSCSI connection error - NOPIN dsl > 0 and ITT = 0xffffffff (Initiator only) */, 956 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_CARRIES_NO_DATA /* iSCSI connection error - R2T dsl > 0 (Initiator only) */, 957 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SN /* iSCSI connection error - DATA-SN error */, 958 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_IN_TTT /* iSCSI connection error - DATA-IN TTT error (Initiator only) */, 959 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_OUT_ITT /* iSCSI connection error - DATA-OUT ITT error (Target only) */, 960 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_TTT /* iSCSI connection error - R2T TTT error (Initiator only) */, 961 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_BUFFER_OFFSET /* iSCSI connection error - R2T buffer offset error (Initiator only) */, 962 ISCSI_CONN_ERROR_PROTOCOL_ERR_BUFFER_OFFSET_OOO /* iSCSI connection error - DATA PDU buffer offset error */, 963 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_SN /* iSCSI connection error - R2T SN error (Initiator only) */, 964 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0 /* iSCSI connection error - R2T desired data transfer length = 0 (Initiator only) */, 965 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1 /* iSCSI connection error - R2T desired data transfer length less then max burst size (Initiator only) */, 966 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_2 /* iSCSI connection error - R2T desired data transfer length + buffer offset > task size (Initiator only) */, 967 ISCSI_CONN_ERROR_PROTOCOL_ERR_LUN /* iSCSI connection error - R2T unvalid LUN (Initiator only) */, 968 ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO /* iSCSI connection error - All data has been already received, however it is not the end of sequence (Initiator only) */, 969 ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO_S_BIT_ONE /* iSCSI connection error - S-bit and final bit = 1 (Initiator only) */, 970 ISCSI_CONN_ERROR_PROTOCOL_ERR_EXP_STAT_SN /* iSCSI connection error - STAT SN error (Initiator only) */, 971 ISCSI_CONN_ERROR_PROTOCOL_ERR_DSL_NOT_ZERO /* iSCSI connection error - TMF or LOGOUT PDUs dsl > 0 (Initiator only) */, 972 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_DSL /* iSCSI connection error - CMD PDU dsl>0 while immediate data is disabled (Target only) */, 973 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG /* iSCSI connection error - Data In overrun (Initiator only) */, 974 ISCSI_CONN_ERROR_PROTOCOL_ERR_OUTSTANDING_R2T_COUNT /* iSCSI connection error - >1 outstanding R2T (Initiator only) */, 975 ISCSI_CONN_ERROR_PROTOCOL_ERR_DIF_TX /* iSCSI connection error - DIF Tx error + DIF error drop is enabled (Target only) */, 976 ISCSI_CONN_ERROR_SENSE_DATA_LENGTH /* iSCSI connection error - Sense data length > 256 (Initiator only) */, 977 ISCSI_CONN_ERROR_DATA_PLACEMENT_ERROR /* iSCSI connection error - Data placement error */, 978 ISCSI_CONN_ERROR_INVALID_ITT /* iSCSI connection error - Invalid ITT (Target Only) */, 979 ISCSI_ERROR_UNKNOWN /* iSCSI connection error */, 980 MAX_ISCSI_ERROR_TYPES 981 }; 982 983 984 985 986 987 988 989 990 991 992 /* 993 * iSCSI Ramrod Command IDs 994 */ 995 enum iscsi_ramrod_cmd_id 996 { 997 ISCSI_RAMROD_CMD_ID_UNUSED=0, 998 ISCSI_RAMROD_CMD_ID_INIT_FUNC=1 /* iSCSI function init Ramrod */, 999 ISCSI_RAMROD_CMD_ID_DESTROY_FUNC=2 /* iSCSI function destroy Ramrod */, 1000 ISCSI_RAMROD_CMD_ID_OFFLOAD_CONN=3 /* iSCSI connection offload Ramrod */, 1001 ISCSI_RAMROD_CMD_ID_UPDATE_CONN=4 /* iSCSI connection update Ramrod */, 1002 ISCSI_RAMROD_CMD_ID_TERMINATION_CONN=5 /* iSCSI connection offload Ramrod. Command ID known only to FW and VBD */, 1003 ISCSI_RAMROD_CMD_ID_CLEAR_SQ=6 /* iSCSI connection clear-sq ramrod. */, 1004 ISCSI_RAMROD_CMD_ID_MAC_UPDATE=7 /* iSCSI connection update MAC address ramrod. */, 1005 MAX_ISCSI_RAMROD_CMD_ID 1006 }; 1007 1008 1009 struct iscsi_reg1 1010 { 1011 __le32 reg1_map; 1012 #define ISCSI_REG1_NUM_SGES_MASK 0xF /* Written to R2tQE */ 1013 #define ISCSI_REG1_NUM_SGES_SHIFT 0 1014 #define ISCSI_REG1_RESERVED1_MASK 0xFFFFFFF /* reserved */ 1015 #define ISCSI_REG1_RESERVED1_SHIFT 4 1016 }; 1017 1018 1019 1020 1021 /* 1022 * Union of data/r2t sequence number 1023 */ 1024 union iscsi_seq_num 1025 { 1026 __le16 data_sn /* data-in sequence number */; 1027 __le16 r2t_sn /* r2t pdu sequence number */; 1028 }; 1029 1030 1031 1032 /* 1033 * ISCSI connection termination request 1034 */ 1035 struct iscsi_spe_conn_mac_update 1036 { 1037 struct iscsi_slow_path_hdr hdr /* spe message header. */; 1038 __le16 conn_id /* ISCSI Connection ID. */; 1039 __le32 fw_cid /* Context ID (cid) of the connection. */; 1040 __le16 remote_mac_addr_lo /* new remote mac address lo */; 1041 __le16 remote_mac_addr_mid /* new remote mac address mid */; 1042 __le16 remote_mac_addr_hi /* new remote mac address hi */; 1043 u8 reserved0[2]; 1044 }; 1045 1046 1047 /* 1048 * ISCSI and TCP connection(Option 1) offload params passed by driver to FW in ISCSI offload ramrod 1049 */ 1050 struct iscsi_spe_conn_offload 1051 { 1052 struct iscsi_slow_path_hdr hdr /* spe message header. */; 1053 __le16 conn_id /* ISCSI Connection ID. */; 1054 __le32 fw_cid; 1055 struct iscsi_conn_offload_params iscsi /* iSCSI session offload params */; 1056 struct tcp_offload_params tcp /* iSCSI session offload params */; 1057 }; 1058 1059 1060 /* 1061 * ISCSI and TCP connection(Option 2) offload params passed by driver to FW in ISCSI offload ramrod 1062 */ 1063 struct iscsi_spe_conn_offload_option2 1064 { 1065 struct iscsi_slow_path_hdr hdr /* spe message header. */; 1066 __le16 conn_id /* ISCSI Connection ID. */; 1067 __le32 fw_cid; 1068 struct iscsi_conn_offload_params iscsi /* iSCSI session offload params */; 1069 struct tcp_offload_params_opt2 tcp /* iSCSI session offload params */; 1070 }; 1071 1072 1073 /* 1074 * ISCSI connection termination request 1075 */ 1076 struct iscsi_spe_conn_termination 1077 { 1078 struct iscsi_slow_path_hdr hdr /* spe message header. */; 1079 __le16 conn_id /* ISCSI Connection ID. */; 1080 __le32 fw_cid /* Context ID (cid) of the connection. */; 1081 u8 abortive /* Mark termination as abort(reset) flow */; 1082 u8 reserved0[7]; 1083 struct regpair queue_cnts_addr /* cmdq and unsolicited counters termination params */; 1084 struct regpair query_params_addr /* query_params_ptr */; 1085 }; 1086 1087 1088 /* 1089 * iSCSI firmware function destroy parameters 1090 */ 1091 struct iscsi_spe_func_dstry 1092 { 1093 struct iscsi_slow_path_hdr hdr /* spe message header. */; 1094 __le16 reserved0; 1095 __le32 reserved1; 1096 }; 1097 1098 1099 /* 1100 * iSCSI firmware function init parameters 1101 */ 1102 struct iscsi_spe_func_init 1103 { 1104 struct iscsi_slow_path_hdr hdr /* spe message header. */; 1105 __le16 half_way_close_timeout /* Half Way Close Timeout in Option 2 Close */; 1106 u8 num_sq_pages_in_ring /* Number of entries in the SQ PBL. Provided by driver at function init spe */; 1107 u8 num_r2tq_pages_in_ring /* Number of entries in the R2TQ PBL. Provided by driver at function init spe */; 1108 u8 num_uhq_pages_in_ring /* Number of entries in the uHQ PBL (xHQ entries is X2). Provided by driver at function init spe */; 1109 u8 ll2_rx_queue_id /* Queue ID of the Light-L2 Rx Queue */; 1110 u8 ooo_enable /* Enable Out Of Order mode (enable = 1) */; 1111 struct iscsi_debug_modes debug_mode /* Use iscsi_debug_mode flags */; 1112 __le16 reserved1; 1113 __le32 reserved2; 1114 __le32 reserved3; 1115 __le32 reserved4; 1116 struct scsi_init_func_params func_params /* Common SCSI init params passed by driver to FW in function init ramrod */; 1117 struct scsi_init_func_queues q_params /* SCSI RQ/CQ firmware function init parameters */; 1118 }; 1119 1120 1121 /* 1122 * The iscsi storm task context of Ystorm 1123 */ 1124 struct ystorm_iscsi_task_state 1125 { 1126 struct scsi_cached_sges data_desc; 1127 struct scsi_sgl_params sgl_params; 1128 __le32 exp_r2t_sn /* Initiator mode - Expected R2T PDU index in sequence. [variable, initialized 0] */; 1129 __le32 buffer_offset /* Payload data offset */; 1130 union iscsi_seq_num seq_num /* PDU index in sequence */; 1131 struct iscsi_dif_flags dif_flags /* Dif flags */; 1132 u8 flags; 1133 #define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_MASK 0x1 /* local_completion */ 1134 #define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_SHIFT 0 1135 #define YSTORM_ISCSI_TASK_STATE_SLOW_IO_MASK 0x1 /* Equals 1 if SGL is predicted and 0 otherwise. */ 1136 #define YSTORM_ISCSI_TASK_STATE_SLOW_IO_SHIFT 1 1137 #define YSTORM_ISCSI_TASK_STATE_RESERVED0_MASK 0x3F 1138 #define YSTORM_ISCSI_TASK_STATE_RESERVED0_SHIFT 2 1139 }; 1140 1141 /* 1142 * The iscsi storm task context of Ystorm 1143 */ 1144 struct ystorm_iscsi_task_rxmit_opt 1145 { 1146 __le32 fast_rxmit_sge_offset /* SGE offset from which to continue dummy-read or start fast retransmit */; 1147 __le32 scan_start_buffer_offset /* Starting buffer offset of next retransmit SGL scan */; 1148 __le32 fast_rxmit_buffer_offset /* Buffer offset from which to continue dummy-read or start fast retransmit */; 1149 u8 scan_start_sgl_index /* Starting SGL index of next retransmit SGL scan */; 1150 u8 fast_rxmit_sgl_index /* SGL index from which to continue dummy-read or start fast retransmit */; 1151 __le16 reserved /* reserved */; 1152 }; 1153 1154 /* 1155 * The iscsi storm task context of Ystorm 1156 */ 1157 struct ystorm_iscsi_task_st_ctx 1158 { 1159 struct ystorm_iscsi_task_state state /* iSCSI task parameters and state */; 1160 struct ystorm_iscsi_task_rxmit_opt rxmit_opt /* iSCSI retransmit optimizations parameters */; 1161 union iscsi_task_hdr pdu_hdr /* PDU header - [constant initialized] */; 1162 }; 1163 1164 struct e4_ystorm_iscsi_task_ag_ctx 1165 { 1166 u8 reserved /* cdu_validation */; 1167 u8 byte1 /* state */; 1168 __le16 word0 /* icid */; 1169 u8 flags0; 1170 #define E4_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF /* connection_type */ 1171 #define E4_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0 1172 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1 /* exist_in_qm0 */ 1173 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4 1174 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1175 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1176 #define E4_YSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1 /* bit2 */ 1177 #define E4_YSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6 1178 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK 0x1 /* bit3 */ 1179 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT 7 1180 u8 flags1; 1181 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3 /* cf0 */ 1182 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 0 1183 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 /* cf1 */ 1184 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2 1185 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_MASK 0x3 /* cf2special */ 1186 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_SHIFT 4 1187 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1 /* cf0en */ 1188 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 6 1189 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 /* cf1en */ 1190 #define E4_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7 1191 u8 flags2; 1192 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1 /* bit4 */ 1193 #define E4_YSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0 1194 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 /* rule0en */ 1195 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1 1196 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1197 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2 1198 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 /* rule2en */ 1199 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3 1200 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1201 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4 1202 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1203 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5 1204 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1205 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6 1206 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 /* rule6en */ 1207 #define E4_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7 1208 u8 byte2 /* byte2 */; 1209 __le32 TTT /* reg0 */; 1210 u8 byte3 /* byte3 */; 1211 u8 byte4 /* byte4 */; 1212 __le16 word1 /* word1 */; 1213 }; 1214 1215 struct e4_mstorm_iscsi_task_ag_ctx 1216 { 1217 u8 cdu_validation /* cdu_validation */; 1218 u8 byte1 /* state */; 1219 __le16 task_cid /* icid */; 1220 u8 flags0; 1221 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF /* connection_type */ 1222 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 1223 #define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 /* exist_in_qm0 */ 1224 #define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 1225 #define E4_MSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1226 #define E4_MSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1227 #define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1 /* bit2 */ 1228 #define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6 1229 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK 0x1 /* bit3 */ 1230 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_SHIFT 7 1231 u8 flags1; 1232 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_MASK 0x3 /* cf0 */ 1233 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_SHIFT 0 1234 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 /* cf1 */ 1235 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2 1236 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3 /* cf2 */ 1237 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 4 1238 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_MASK 0x1 /* cf0en */ 1239 #define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_SHIFT 6 1240 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 /* cf1en */ 1241 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7 1242 u8 flags2; 1243 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1 /* cf2en */ 1244 #define E4_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 0 1245 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 /* rule0en */ 1246 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1 1247 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1248 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2 1249 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 /* rule2en */ 1250 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3 1251 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1252 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4 1253 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1254 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5 1255 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1256 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6 1257 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 /* rule6en */ 1258 #define E4_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7 1259 u8 byte2 /* byte2 */; 1260 __le32 reg0 /* reg0 */; 1261 u8 byte3 /* byte3 */; 1262 u8 byte4 /* byte4 */; 1263 __le16 word1 /* word1 */; 1264 }; 1265 1266 struct e4_ustorm_iscsi_task_ag_ctx 1267 { 1268 u8 reserved /* cdu_validation */; 1269 u8 state /* state */; 1270 __le16 icid /* icid */; 1271 u8 flags0; 1272 #define E4_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF /* connection_type */ 1273 #define E4_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 1274 #define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 /* exist_in_qm0 */ 1275 #define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 1276 #define E4_USTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1277 #define E4_USTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1278 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK 0x3 /* timer0cf */ 1279 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT 6 1280 u8 flags1; 1281 #define E4_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_MASK 0x3 /* timer1cf */ 1282 #define E4_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_SHIFT 0 1283 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_MASK 0x3 /* timer2cf */ 1284 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_SHIFT 2 1285 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3 /* timer_stop_all */ 1286 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 4 1287 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_MASK 0x3 /* cf4 */ 1288 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_SHIFT 6 1289 u8 flags2; 1290 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_MASK 0x1 /* cf0en */ 1291 #define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_SHIFT 0 1292 #define E4_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_MASK 0x1 /* cf1en */ 1293 #define E4_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_SHIFT 1 1294 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_MASK 0x1 /* cf2en */ 1295 #define E4_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_SHIFT 2 1296 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1 /* cf3en */ 1297 #define E4_USTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 3 1298 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_MASK 0x1 /* cf4en */ 1299 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_SHIFT 4 1300 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_MASK 0x1 /* rule0en */ 1301 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_SHIFT 5 1302 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1303 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 6 1304 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_MASK 0x1 /* rule2en */ 1305 #define E4_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_SHIFT 7 1306 u8 flags3; 1307 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1308 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 0 1309 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1310 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 1 1311 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1312 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 2 1313 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 /* rule6en */ 1314 #define E4_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 3 1315 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_MASK 0xF /* nibble1 */ 1316 #define E4_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_SHIFT 4 1317 __le32 dif_err_intervals /* reg0 */; 1318 __le32 dif_error_1st_interval /* reg1 */; 1319 __le32 rcv_cont_len /* reg2 */; 1320 __le32 exp_cont_len /* reg3 */; 1321 __le32 total_data_acked /* reg4 */; 1322 __le32 exp_data_acked /* reg5 */; 1323 u8 next_tid_valid /* byte2 */; 1324 u8 byte3 /* byte3 */; 1325 __le16 word1 /* word1 */; 1326 __le16 next_tid /* word2 */; 1327 __le16 word3 /* word3 */; 1328 __le32 hdr_residual_count /* reg6 */; 1329 __le32 exp_r2t_sn /* reg7 */; 1330 }; 1331 1332 /* 1333 * The iscsi storm task context of Mstorm 1334 */ 1335 struct mstorm_iscsi_task_st_ctx 1336 { 1337 struct scsi_cached_sges data_desc /* Union of Data SGL / cached sge */; 1338 struct scsi_sgl_params sgl_params; 1339 __le32 rem_task_size /* Remaining task size, used for placement verification */; 1340 __le32 data_buffer_offset /* Buffer offset */; 1341 u8 task_type /* Task type, (use: iscsi_task_type enum) */; 1342 struct iscsi_dif_flags dif_flags /* sizes of host/peer protection intervals + protection log interval */; 1343 u8 reserved0[2] /* reserved0 */; 1344 struct regpair sense_db /* Pointer to sense data buffer */; 1345 __le32 expected_itt /* ITT - for target mode validations */; 1346 __le32 reserved1 /* reserved1 */; 1347 }; 1348 1349 /* 1350 * The iscsi storm task context of Ustorm 1351 */ 1352 struct ustorm_iscsi_task_st_ctx 1353 { 1354 __le32 rem_rcv_len /* Remaining data to be received in bytes. Used in validations */; 1355 __le32 exp_data_transfer_len /* iSCSI Initiator - The size of the transmitted task, iSCSI Target - the size of the Rx continuation */; 1356 __le32 exp_data_sn /* Expected data SN */; 1357 struct regpair lun /* LUN */; 1358 struct iscsi_reg1 reg1; 1359 u8 flags2; 1360 #define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_MASK 0x1 /* Initiator Mode - Mark AHS exist */ 1361 #define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_SHIFT 0 1362 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_MASK 0x7F 1363 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_SHIFT 1 1364 struct iscsi_dif_flags dif_flags /* Dif flags (written to R2T WQE) */; 1365 __le16 reserved3; 1366 __le32 reserved4; 1367 __le32 reserved5; 1368 __le32 reserved6; 1369 __le32 reserved7; 1370 u8 task_type /* Task Type */; 1371 u8 error_flags; 1372 #define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_MASK 0x1 /* Mark task with data digest error (1 bit) */ 1373 #define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_SHIFT 0 1374 #define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_MASK 0x1 /* Target Mode - Mark middle task error, data truncated */ 1375 #define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_SHIFT 1 1376 #define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_MASK 0x1 1377 #define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_SHIFT 2 1378 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_MASK 0x1F 1379 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_SHIFT 3 1380 u8 flags; 1381 #define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_MASK 0x3 /* mark task cqe write (for cleanup flow) */ 1382 #define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_SHIFT 0 1383 #define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_MASK 0x1 /* local completion bit */ 1384 #define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_SHIFT 2 1385 #define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_MASK 0x1 /* write R2TQE from Q0 flow */ 1386 #define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_SHIFT 3 1387 #define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_MASK 0x1 /* Mark total data acked or disabled */ 1388 #define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_SHIFT 4 1389 #define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_MASK 0x1 /* Mark HQ scanned or disabled */ 1390 #define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_SHIFT 5 1391 #define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_MASK 0x1 /* Mark HQ scanned or disabled */ 1392 #define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_SHIFT 6 1393 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_MASK 0x1 1394 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_SHIFT 7 1395 u8 cq_rss_number /* Task CQ_RSS number 0.63 */; 1396 }; 1397 1398 /* 1399 * iscsi task context 1400 */ 1401 struct iscsi_task_context 1402 { 1403 struct ystorm_iscsi_task_st_ctx ystorm_st_context /* ystorm storm context */; 1404 struct e4_ystorm_iscsi_task_ag_ctx ystorm_ag_context /* ystorm aggregative context */; 1405 struct regpair ystorm_ag_padding[2] /* padding */; 1406 struct tdif_task_context tdif_context /* tdif context */; 1407 struct e4_mstorm_iscsi_task_ag_ctx mstorm_ag_context /* mstorm aggregative context */; 1408 struct regpair mstorm_ag_padding[2] /* padding */; 1409 struct e4_ustorm_iscsi_task_ag_ctx ustorm_ag_context /* ustorm aggregative context */; 1410 struct mstorm_iscsi_task_st_ctx mstorm_st_context /* mstorm storm context */; 1411 struct ustorm_iscsi_task_st_ctx ustorm_st_context /* ustorm storm context */; 1412 struct rdif_task_context rdif_context /* rdif context */; 1413 }; 1414 1415 1416 1417 /* 1418 * iSCSI task type 1419 */ 1420 enum iscsi_task_type 1421 { 1422 ISCSI_TASK_TYPE_INITIATOR_WRITE, 1423 ISCSI_TASK_TYPE_INITIATOR_READ, 1424 ISCSI_TASK_TYPE_MIDPATH, 1425 ISCSI_TASK_TYPE_UNSOLIC, 1426 ISCSI_TASK_TYPE_EXCHCLEANUP, 1427 ISCSI_TASK_TYPE_IRRELEVANT, 1428 ISCSI_TASK_TYPE_TARGET_WRITE, 1429 ISCSI_TASK_TYPE_TARGET_READ, 1430 ISCSI_TASK_TYPE_TARGET_RESPONSE, 1431 ISCSI_TASK_TYPE_LOGIN_RESPONSE, 1432 MAX_ISCSI_TASK_TYPE 1433 }; 1434 1435 1436 1437 1438 1439 1440 /* 1441 * iSCSI DesiredDataTransferLength/ttt union 1442 */ 1443 union iscsi_ttt_txlen_union 1444 { 1445 __le32 desired_tx_len /* desired data transfer length */; 1446 __le32 ttt /* target transfer tag */; 1447 }; 1448 1449 1450 /* 1451 * iSCSI uHQ element 1452 */ 1453 struct iscsi_uhqe 1454 { 1455 __le32 reg1; 1456 #define ISCSI_UHQE_PDU_PAYLOAD_LEN_MASK 0xFFFFF /* iSCSI payload (doesnt include padding or digest) or AHS length */ 1457 #define ISCSI_UHQE_PDU_PAYLOAD_LEN_SHIFT 0 1458 #define ISCSI_UHQE_LOCAL_COMP_MASK 0x1 /* local compleiton flag */ 1459 #define ISCSI_UHQE_LOCAL_COMP_SHIFT 20 1460 #define ISCSI_UHQE_TOGGLE_BIT_MASK 0x1 /* toggle bit to protect from uHQ full */ 1461 #define ISCSI_UHQE_TOGGLE_BIT_SHIFT 21 1462 #define ISCSI_UHQE_PURE_PAYLOAD_MASK 0x1 /* indicates whether pdu_payload_len contains pure payload length. if not, pdu_payload_len is AHS length */ 1463 #define ISCSI_UHQE_PURE_PAYLOAD_SHIFT 22 1464 #define ISCSI_UHQE_LOGIN_RESPONSE_PDU_MASK 0x1 /* indicates login pdu */ 1465 #define ISCSI_UHQE_LOGIN_RESPONSE_PDU_SHIFT 23 1466 #define ISCSI_UHQE_TASK_ID_HI_MASK 0xFF /* most significant byte of task_id */ 1467 #define ISCSI_UHQE_TASK_ID_HI_SHIFT 24 1468 __le32 reg2; 1469 #define ISCSI_UHQE_BUFFER_OFFSET_MASK 0xFFFFFF /* absolute offset in task */ 1470 #define ISCSI_UHQE_BUFFER_OFFSET_SHIFT 0 1471 #define ISCSI_UHQE_TASK_ID_LO_MASK 0xFF /* least significant byte of task_id */ 1472 #define ISCSI_UHQE_TASK_ID_LO_SHIFT 24 1473 }; 1474 1475 1476 /* 1477 * iSCSI WQ element 1478 */ 1479 struct iscsi_wqe 1480 { 1481 __le16 task_id /* The task identifier (itt) includes all the relevant information required for the task processing */; 1482 u8 flags; 1483 #define ISCSI_WQE_WQE_TYPE_MASK 0x7 /* Wqe type [use iscsi_wqe_type] */ 1484 #define ISCSI_WQE_WQE_TYPE_SHIFT 0 1485 #define ISCSI_WQE_NUM_SGES_MASK 0xF /* The driver will give a hint about sizes of SGEs for better credits evaluation at Xstorm */ 1486 #define ISCSI_WQE_NUM_SGES_SHIFT 3 1487 #define ISCSI_WQE_RESPONSE_MASK 0x1 /* 1 if this Wqe triggers a response and advances stat_sn, 0 otherwise */ 1488 #define ISCSI_WQE_RESPONSE_SHIFT 7 1489 struct iscsi_dif_flags prot_flags /* Task data-integrity flags (protection) */; 1490 __le32 contlen_cdbsize; 1491 #define ISCSI_WQE_CONT_LEN_MASK 0xFFFFFF /* expected/desired data transfer length */ 1492 #define ISCSI_WQE_CONT_LEN_SHIFT 0 1493 #define ISCSI_WQE_CDB_SIZE_MASK 0xFF /* Initiator mode only: equals SCSI command CDB size if extended CDB is used, otherwise equals zero. */ 1494 #define ISCSI_WQE_CDB_SIZE_SHIFT 24 1495 }; 1496 1497 1498 /* 1499 * iSCSI wqe type 1500 */ 1501 enum iscsi_wqe_type 1502 { 1503 ISCSI_WQE_TYPE_NORMAL /* iSCSI WQE type normal. excluding status bit in target mode. */, 1504 ISCSI_WQE_TYPE_TASK_CLEANUP /* iSCSI WQE type task cleanup */, 1505 ISCSI_WQE_TYPE_MIDDLE_PATH /* iSCSI WQE type middle path */, 1506 ISCSI_WQE_TYPE_LOGIN /* iSCSI WQE type login */, 1507 ISCSI_WQE_TYPE_FIRST_R2T_CONT /* iSCSI WQE type First Write Continuation (Target) */, 1508 ISCSI_WQE_TYPE_NONFIRST_R2T_CONT /* iSCSI WQE type Non-First Write Continuation (Target) */, 1509 ISCSI_WQE_TYPE_RESPONSE /* iSCSI WQE type SCSI response */, 1510 MAX_ISCSI_WQE_TYPE 1511 }; 1512 1513 1514 /* 1515 * iSCSI xHQ element 1516 */ 1517 struct iscsi_xhqe 1518 { 1519 union iscsi_ttt_txlen_union ttt_or_txlen /* iSCSI DesiredDataTransferLength/ttt union */; 1520 __le32 exp_stat_sn /* expected StatSn */; 1521 struct iscsi_dif_flags prot_flags /* Task data-integrity flags (protection) */; 1522 u8 total_ahs_length /* Initiator mode only: Total AHS Length. greater than zero if and only if PDU is SCSI command and CDB > 16 */; 1523 u8 opcode /* Type opcode for command PDU */; 1524 u8 flags; 1525 #define ISCSI_XHQE_FINAL_MASK 0x1 /* The Final(F) for this PDU */ 1526 #define ISCSI_XHQE_FINAL_SHIFT 0 1527 #define ISCSI_XHQE_STATUS_BIT_MASK 0x1 /* Whether this PDU is Data-In PDU with status_bit = 1 */ 1528 #define ISCSI_XHQE_STATUS_BIT_SHIFT 1 1529 #define ISCSI_XHQE_NUM_SGES_MASK 0xF /* If Predicted IO equals Min(8, number of SGEs in SGL), otherwise equals 0 */ 1530 #define ISCSI_XHQE_NUM_SGES_SHIFT 2 1531 #define ISCSI_XHQE_RESERVED0_MASK 0x3 /* reserved */ 1532 #define ISCSI_XHQE_RESERVED0_SHIFT 6 1533 union iscsi_seq_num seq_num /* R2T/DataSN sequence number */; 1534 __le16 reserved1; 1535 }; 1536 1537 1538 /* 1539 * Per PF iSCSI receive path statistics - mStorm RAM structure 1540 */ 1541 struct mstorm_iscsi_stats_drv 1542 { 1543 struct regpair iscsi_rx_dropped_PDUs_task_not_valid /* Number of Rx silently dropped PDUs due to task not valid */; 1544 }; 1545 1546 1547 1548 /* 1549 * Per PF iSCSI transmit path statistics - pStorm RAM structure 1550 */ 1551 struct pstorm_iscsi_stats_drv 1552 { 1553 struct regpair iscsi_tx_bytes_cnt /* Counts the number of tx bytes that were transmitted */; 1554 struct regpair iscsi_tx_packet_cnt /* Counts the number of tx packets that were transmitted */; 1555 }; 1556 1557 1558 /* 1559 * Per PF iSCSI receive path statistics - tStorm RAM structure 1560 */ 1561 struct tstorm_iscsi_stats_drv 1562 { 1563 struct regpair iscsi_rx_bytes_cnt /* Counts the number of rx bytes that were received */; 1564 struct regpair iscsi_rx_packet_cnt /* Counts the number of rx packets that were received */; 1565 struct regpair iscsi_rx_new_ooo_isle_events_cnt /* Counts the number of new out-of-order isle event */; 1566 __le32 iscsi_cmdq_threshold_cnt /* Counts the number of times elements in cmdQ reached threshold */; 1567 __le32 iscsi_rq_threshold_cnt /* Counts the number of times elements in RQQ reached threshold */; 1568 __le32 iscsi_immq_threshold_cnt /* Counts the number of times elements in immQ reached threshold */; 1569 }; 1570 1571 1572 /* 1573 * Per PF iSCSI receive path statistics - uStorm RAM structure 1574 */ 1575 struct ustorm_iscsi_stats_drv 1576 { 1577 struct regpair iscsi_rx_data_pdu_cnt /* Number of data PDUs that were received */; 1578 struct regpair iscsi_rx_r2t_pdu_cnt /* Number of R2T PDUs that were received */; 1579 struct regpair iscsi_rx_total_pdu_cnt /* Number of total PDUs that were received */; 1580 }; 1581 1582 1583 1584 /* 1585 * Per PF iSCSI transmit path statistics - xStorm RAM structure 1586 */ 1587 struct xstorm_iscsi_stats_drv 1588 { 1589 struct regpair iscsi_tx_go_to_slow_start_event_cnt /* Number of times slow start event occurred */; 1590 struct regpair iscsi_tx_fast_retransmit_event_cnt /* Number of times fast retransmit event occurred */; 1591 }; 1592 1593 1594 /* 1595 * Per PF iSCSI transmit path statistics - yStorm RAM structure 1596 */ 1597 struct ystorm_iscsi_stats_drv 1598 { 1599 struct regpair iscsi_tx_data_pdu_cnt /* Number of data PDUs that were transmitted */; 1600 struct regpair iscsi_tx_r2t_pdu_cnt /* Number of R2T PDUs that were transmitted */; 1601 struct regpair iscsi_tx_total_pdu_cnt /* Number of total PDUs that were transmitted */; 1602 }; 1603 1604 1605 1606 1607 1608 1609 struct e4_tstorm_iscsi_task_ag_ctx 1610 { 1611 u8 byte0 /* cdu_validation */; 1612 u8 byte1 /* state */; 1613 __le16 word0 /* icid */; 1614 u8 flags0; 1615 #define E4_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF /* connection_type */ 1616 #define E4_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0 1617 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1 /* exist_in_qm0 */ 1618 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4 1619 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1620 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1621 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT2_MASK 0x1 /* bit2 */ 1622 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT2_SHIFT 6 1623 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK 0x1 /* bit3 */ 1624 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT 7 1625 u8 flags1; 1626 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1 /* bit4 */ 1627 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0 1628 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT5_MASK 0x1 /* bit5 */ 1629 #define E4_TSTORM_ISCSI_TASK_AG_CTX_BIT5_SHIFT 1 1630 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3 /* timer0cf */ 1631 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 2 1632 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 /* timer1cf */ 1633 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 4 1634 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3 /* timer2cf */ 1635 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 6 1636 u8 flags2; 1637 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3 /* timer_stop_all */ 1638 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 0 1639 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4_MASK 0x3 /* cf4 */ 1640 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4_SHIFT 2 1641 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5_MASK 0x3 /* cf5 */ 1642 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5_SHIFT 4 1643 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6_MASK 0x3 /* cf6 */ 1644 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6_SHIFT 6 1645 u8 flags3; 1646 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7_MASK 0x3 /* cf7 */ 1647 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7_SHIFT 0 1648 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1 /* cf0en */ 1649 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 2 1650 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 /* cf1en */ 1651 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 3 1652 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1 /* cf2en */ 1653 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 4 1654 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1 /* cf3en */ 1655 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 5 1656 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_MASK 0x1 /* cf4en */ 1657 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_SHIFT 6 1658 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_MASK 0x1 /* cf5en */ 1659 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_SHIFT 7 1660 u8 flags4; 1661 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_MASK 0x1 /* cf6en */ 1662 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_SHIFT 0 1663 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_MASK 0x1 /* cf7en */ 1664 #define E4_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_SHIFT 1 1665 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 /* rule0en */ 1666 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 2 1667 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1668 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 3 1669 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 /* rule2en */ 1670 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 4 1671 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1672 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 5 1673 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1674 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 6 1675 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1676 #define E4_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 7 1677 u8 byte2 /* byte2 */; 1678 __le16 word1 /* word1 */; 1679 __le32 reg0 /* reg0 */; 1680 u8 byte3 /* byte3 */; 1681 u8 byte4 /* byte4 */; 1682 __le16 word2 /* word2 */; 1683 __le16 word3 /* word3 */; 1684 __le16 word4 /* word4 */; 1685 __le32 reg1 /* reg1 */; 1686 __le32 reg2 /* reg2 */; 1687 }; 1688 1689 1690 1691 1692 struct e5_mstorm_iscsi_task_ag_ctx 1693 { 1694 u8 cdu_validation /* cdu_validation */; 1695 u8 byte1 /* state_and_core_id */; 1696 __le16 task_cid /* icid */; 1697 u8 flags0; 1698 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF /* connection_type */ 1699 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 1700 #define E5_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 /* exist_in_qm0 */ 1701 #define E5_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 1702 #define E5_MSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1703 #define E5_MSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1704 #define E5_MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1 /* bit2 */ 1705 #define E5_MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6 1706 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK 0x1 /* bit3 */ 1707 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_SHIFT 7 1708 u8 flags1; 1709 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_MASK 0x3 /* cf0 */ 1710 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_SHIFT 0 1711 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 /* cf1 */ 1712 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2 1713 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3 /* cf2 */ 1714 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 4 1715 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_MASK 0x1 /* cf0en */ 1716 #define E5_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_SHIFT 6 1717 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 /* cf1en */ 1718 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7 1719 u8 flags2; 1720 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1 /* cf2en */ 1721 #define E5_MSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 0 1722 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 /* rule0en */ 1723 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1 1724 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1725 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2 1726 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 /* rule2en */ 1727 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3 1728 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1729 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4 1730 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1731 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5 1732 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1733 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6 1734 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 /* rule6en */ 1735 #define E5_MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7 1736 u8 flags3; 1737 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_MASK 0x1 /* bit4 */ 1738 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_SHIFT 0 1739 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_MASK 0x3 /* cf3 */ 1740 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_SHIFT 1 1741 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_MASK 0x3 /* cf4 */ 1742 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_SHIFT 3 1743 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_MASK 0x1 /* cf3en */ 1744 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_SHIFT 5 1745 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_MASK 0x1 /* cf4en */ 1746 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_SHIFT 6 1747 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_MASK 0x1 /* rule7en */ 1748 #define E5_MSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_SHIFT 7 1749 __le32 reg0 /* reg0 */; 1750 u8 byte2 /* byte2 */; 1751 u8 byte3 /* byte3 */; 1752 u8 byte4 /* byte4 */; 1753 u8 e4_reserved7 /* byte5 */; 1754 }; 1755 1756 1757 struct e5_tstorm_iscsi_task_ag_ctx 1758 { 1759 u8 byte0 /* cdu_validation */; 1760 u8 byte1 /* state_and_core_id */; 1761 __le16 word0 /* icid */; 1762 u8 flags0; 1763 #define E5_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF /* connection_type */ 1764 #define E5_TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0 1765 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1 /* exist_in_qm0 */ 1766 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4 1767 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1768 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1769 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT2_MASK 0x1 /* bit2 */ 1770 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT2_SHIFT 6 1771 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK 0x1 /* bit3 */ 1772 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT 7 1773 u8 flags1; 1774 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1 /* bit4 */ 1775 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0 1776 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT5_MASK 0x1 /* bit5 */ 1777 #define E5_TSTORM_ISCSI_TASK_AG_CTX_BIT5_SHIFT 1 1778 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3 /* timer0cf */ 1779 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 2 1780 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 /* timer1cf */ 1781 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 4 1782 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3 /* timer2cf */ 1783 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 6 1784 u8 flags2; 1785 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3 /* timer_stop_all */ 1786 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 0 1787 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4_MASK 0x3 /* cf4 */ 1788 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4_SHIFT 2 1789 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5_MASK 0x3 /* cf5 */ 1790 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5_SHIFT 4 1791 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6_MASK 0x3 /* cf6 */ 1792 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6_SHIFT 6 1793 u8 flags3; 1794 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7_MASK 0x3 /* cf7 */ 1795 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7_SHIFT 0 1796 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1 /* cf0en */ 1797 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 2 1798 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 /* cf1en */ 1799 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 3 1800 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1 /* cf2en */ 1801 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 4 1802 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1 /* cf3en */ 1803 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 5 1804 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_MASK 0x1 /* cf4en */ 1805 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF4EN_SHIFT 6 1806 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_MASK 0x1 /* cf5en */ 1807 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF5EN_SHIFT 7 1808 u8 flags4; 1809 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_MASK 0x1 /* cf6en */ 1810 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF6EN_SHIFT 0 1811 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_MASK 0x1 /* cf7en */ 1812 #define E5_TSTORM_ISCSI_TASK_AG_CTX_CF7EN_SHIFT 1 1813 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 /* rule0en */ 1814 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 2 1815 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1816 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 3 1817 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 /* rule2en */ 1818 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 4 1819 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1820 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 5 1821 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1822 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 6 1823 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1824 #define E5_TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 7 1825 u8 byte2 /* byte2 */; 1826 __le16 word1 /* word1 */; 1827 __le32 reg0 /* reg0 */; 1828 u8 byte3 /* regpair0 */; 1829 u8 byte4 /* byte4 */; 1830 __le16 word2 /* word2 */; 1831 __le16 word3 /* word3 */; 1832 __le16 word4 /* word4 */; 1833 __le32 reg1 /* regpair1 */; 1834 __le32 reg2 /* reg2 */; 1835 }; 1836 1837 1838 struct e5_ustorm_iscsi_task_ag_ctx 1839 { 1840 u8 reserved /* cdu_validation */; 1841 u8 state_and_core_id /* state_and_core_id */; 1842 __le16 icid /* icid */; 1843 u8 flags0; 1844 #define E5_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF /* connection_type */ 1845 #define E5_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 1846 #define E5_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 /* exist_in_qm0 */ 1847 #define E5_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 1848 #define E5_USTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1849 #define E5_USTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1850 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK 0x3 /* timer0cf */ 1851 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT 6 1852 u8 flags1; 1853 #define E5_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_MASK 0x3 /* timer1cf */ 1854 #define E5_USTORM_ISCSI_TASK_AG_CTX_RESERVED1_SHIFT 0 1855 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_MASK 0x3 /* timer2cf */ 1856 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_SHIFT 2 1857 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3 /* timer_stop_all */ 1858 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 4 1859 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_MASK 0x3 /* dif_error_cf */ 1860 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_SHIFT 6 1861 u8 flags2; 1862 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_MASK 0x1 /* cf0en */ 1863 #define E5_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_SHIFT 0 1864 #define E5_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_MASK 0x1 /* cf1en */ 1865 #define E5_USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_SHIFT 1 1866 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_MASK 0x1 /* cf2en */ 1867 #define E5_USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_SHIFT 2 1868 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1 /* cf3en */ 1869 #define E5_USTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 3 1870 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_MASK 0x1 /* cf4en */ 1871 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_SHIFT 4 1872 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_MASK 0x1 /* rule0en */ 1873 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_SHIFT 5 1874 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1875 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 6 1876 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_MASK 0x1 /* rule2en */ 1877 #define E5_USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_SHIFT 7 1878 u8 flags3; 1879 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1880 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 0 1881 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1882 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 1 1883 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1884 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 2 1885 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 /* rule6en */ 1886 #define E5_USTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 3 1887 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_MASK 0x1 /* bit2 */ 1888 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_SHIFT 4 1889 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_MASK 0x1 /* bit3 */ 1890 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_SHIFT 5 1891 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_MASK 0x1 /* bit4 */ 1892 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_SHIFT 6 1893 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_MASK 0x1 /* rule7en */ 1894 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_SHIFT 7 1895 u8 flags4; 1896 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_MASK 0x3 /* cf5 */ 1897 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_SHIFT 0 1898 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_MASK 0x1 /* cf5en */ 1899 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_SHIFT 2 1900 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED7_MASK 0x1 /* rule8en */ 1901 #define E5_USTORM_ISCSI_TASK_AG_CTX_E4_RESERVED7_SHIFT 3 1902 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_MASK 0xF /* dif_error_type */ 1903 #define E5_USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_SHIFT 4 1904 u8 next_tid_valid /* byte2 */; 1905 u8 byte3 /* byte3 */; 1906 u8 e4_reserved8 /* byte4 */; 1907 __le32 dif_err_intervals /* dif_err_intervals */; 1908 __le32 dif_error_1st_interval /* dif_error_1st_interval */; 1909 __le32 rcv_cont_len /* reg2 */; 1910 __le32 exp_cont_len /* reg3 */; 1911 __le32 total_data_acked /* reg4 */; 1912 __le32 exp_data_acked /* reg5 */; 1913 __le16 word1 /* word1 */; 1914 __le16 next_tid /* word2 */; 1915 __le32 hdr_residual_count /* reg6 */; 1916 __le32 exp_r2t_sn /* reg7 */; 1917 }; 1918 1919 1920 struct e5_ystorm_iscsi_task_ag_ctx 1921 { 1922 u8 reserved /* cdu_validation */; 1923 u8 byte1 /* state_and_core_id */; 1924 __le16 word0 /* icid */; 1925 u8 flags0; 1926 #define E5_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF /* connection_type */ 1927 #define E5_YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0 1928 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1 /* exist_in_qm0 */ 1929 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4 1930 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 /* exist_in_qm1 */ 1931 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1932 #define E5_YSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1 /* bit2 */ 1933 #define E5_YSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6 1934 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK 0x1 /* bit3 */ 1935 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT 7 1936 u8 flags1; 1937 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3 /* cf0 */ 1938 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 0 1939 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 /* cf1 */ 1940 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2 1941 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_MASK 0x3 /* cf2special */ 1942 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_SHIFT 4 1943 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1 /* cf0en */ 1944 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 6 1945 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 /* cf1en */ 1946 #define E5_YSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7 1947 u8 flags2; 1948 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1 /* bit4 */ 1949 #define E5_YSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0 1950 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 /* rule0en */ 1951 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1 1952 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 /* rule1en */ 1953 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2 1954 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 /* rule2en */ 1955 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3 1956 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 /* rule3en */ 1957 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4 1958 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 /* rule4en */ 1959 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5 1960 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 /* rule5en */ 1961 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6 1962 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 /* rule6en */ 1963 #define E5_YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7 1964 u8 flags3; 1965 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_MASK 0x1 /* bit5 */ 1966 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED1_SHIFT 0 1967 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_MASK 0x3 /* cf3 */ 1968 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED2_SHIFT 1 1969 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_MASK 0x3 /* cf4 */ 1970 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED3_SHIFT 3 1971 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_MASK 0x1 /* cf3en */ 1972 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED4_SHIFT 5 1973 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_MASK 0x1 /* cf4en */ 1974 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED5_SHIFT 6 1975 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_MASK 0x1 /* rule7en */ 1976 #define E5_YSTORM_ISCSI_TASK_AG_CTX_E4_RESERVED6_SHIFT 7 1977 __le32 TTT /* reg0 */; 1978 u8 byte2 /* byte2 */; 1979 u8 byte3 /* byte3 */; 1980 u8 byte4 /* byte4 */; 1981 u8 e4_reserved7 /* byte5 */; 1982 }; 1983 1984 1985 /* 1986 * iSCSI doorbell data 1987 */ 1988 struct iscsi_db_data 1989 { 1990 u8 params; 1991 #define ISCSI_DB_DATA_DEST_MASK 0x3 /* destination of doorbell (use enum db_dest) */ 1992 #define ISCSI_DB_DATA_DEST_SHIFT 0 1993 #define ISCSI_DB_DATA_AGG_CMD_MASK 0x3 /* aggregative command to CM (use enum db_agg_cmd_sel) */ 1994 #define ISCSI_DB_DATA_AGG_CMD_SHIFT 2 1995 #define ISCSI_DB_DATA_BYPASS_EN_MASK 0x1 /* enable QM bypass */ 1996 #define ISCSI_DB_DATA_BYPASS_EN_SHIFT 4 1997 #define ISCSI_DB_DATA_RESERVED_MASK 0x1 1998 #define ISCSI_DB_DATA_RESERVED_SHIFT 5 1999 #define ISCSI_DB_DATA_AGG_VAL_SEL_MASK 0x3 /* aggregative value selection */ 2000 #define ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT 6 2001 u8 agg_flags /* bit for every DQ counter flags in CM context that DQ can increment */; 2002 __le16 sq_prod; 2003 }; 2004 2005 #endif /* __ISCSI_COMMON__ */ 2006