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