1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 2 /* QLogic qed NIC Driver 3 * Copyright (c) 2015-2017 QLogic Corporation 4 * Copyright (c) 2019-2020 Marvell International Ltd. 5 */ 6 7 #ifndef __ISCSI_COMMON__ 8 #define __ISCSI_COMMON__ 9 10 /**********************/ 11 /* ISCSI FW CONSTANTS */ 12 /**********************/ 13 14 /* iSCSI HSI constants */ 15 #define ISCSI_DEFAULT_MTU (1500) 16 17 /* KWQ (kernel work queue) layer codes */ 18 #define ISCSI_SLOW_PATH_LAYER_CODE (6) 19 20 /* iSCSI parameter defaults */ 21 #define ISCSI_DEFAULT_HEADER_DIGEST (0) 22 #define ISCSI_DEFAULT_DATA_DIGEST (0) 23 #define ISCSI_DEFAULT_INITIAL_R2T (1) 24 #define ISCSI_DEFAULT_IMMEDIATE_DATA (1) 25 #define ISCSI_DEFAULT_MAX_PDU_LENGTH (0x2000) 26 #define ISCSI_DEFAULT_FIRST_BURST_LENGTH (0x10000) 27 #define ISCSI_DEFAULT_MAX_BURST_LENGTH (0x40000) 28 #define ISCSI_DEFAULT_MAX_OUTSTANDING_R2T (1) 29 30 /* iSCSI parameter limits */ 31 #define ISCSI_MIN_VAL_MAX_PDU_LENGTH (0x200) 32 #define ISCSI_MAX_VAL_MAX_PDU_LENGTH (0xffffff) 33 #define ISCSI_MIN_VAL_BURST_LENGTH (0x200) 34 #define ISCSI_MAX_VAL_BURST_LENGTH (0xffffff) 35 #define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T (1) 36 #define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T (0xff) 37 38 #define ISCSI_AHS_CNTL_SIZE 4 39 40 #define ISCSI_WQE_NUM_SGES_SLOWIO (0xf) 41 42 /* iSCSI reserved params */ 43 #define ISCSI_ITT_ALL_ONES (0xffffffff) 44 #define ISCSI_TTT_ALL_ONES (0xffffffff) 45 46 #define ISCSI_OPTION_1_OFF_CHIP_TCP 1 47 #define ISCSI_OPTION_2_ON_CHIP_TCP 2 48 49 #define ISCSI_INITIATOR_MODE 0 50 #define ISCSI_TARGET_MODE 1 51 52 /* iSCSI request op codes */ 53 #define ISCSI_OPCODE_NOP_OUT (0) 54 #define ISCSI_OPCODE_SCSI_CMD (1) 55 #define ISCSI_OPCODE_TMF_REQUEST (2) 56 #define ISCSI_OPCODE_LOGIN_REQUEST (3) 57 #define ISCSI_OPCODE_TEXT_REQUEST (4) 58 #define ISCSI_OPCODE_DATA_OUT (5) 59 #define ISCSI_OPCODE_LOGOUT_REQUEST (6) 60 61 /* iSCSI response/messages op codes */ 62 #define ISCSI_OPCODE_NOP_IN (0x20) 63 #define ISCSI_OPCODE_SCSI_RESPONSE (0x21) 64 #define ISCSI_OPCODE_TMF_RESPONSE (0x22) 65 #define ISCSI_OPCODE_LOGIN_RESPONSE (0x23) 66 #define ISCSI_OPCODE_TEXT_RESPONSE (0x24) 67 #define ISCSI_OPCODE_DATA_IN (0x25) 68 #define ISCSI_OPCODE_LOGOUT_RESPONSE (0x26) 69 #define ISCSI_OPCODE_R2T (0x31) 70 #define ISCSI_OPCODE_ASYNC_MSG (0x32) 71 #define ISCSI_OPCODE_REJECT (0x3f) 72 73 /* iSCSI stages */ 74 #define ISCSI_STAGE_SECURITY_NEGOTIATION (0) 75 #define ISCSI_STAGE_LOGIN_OPERATIONAL_NEGOTIATION (1) 76 #define ISCSI_STAGE_FULL_FEATURE_PHASE (3) 77 78 /* iSCSI CQE errors */ 79 #define CQE_ERROR_BITMAP_DATA_DIGEST (0x08) 80 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN (0x10) 81 #define CQE_ERROR_BITMAP_DATA_TRUNCATED (0x20) 82 83 /* Union of data bd_opaque/ tq_tid */ 84 union bd_opaque_tq_union { 85 __le16 bd_opaque; 86 __le16 tq_tid; 87 }; 88 89 /* ISCSI SGL entry */ 90 struct cqe_error_bitmap { 91 u8 cqe_error_status_bits; 92 #define CQE_ERROR_BITMAP_DIF_ERR_BITS_MASK 0x7 93 #define CQE_ERROR_BITMAP_DIF_ERR_BITS_SHIFT 0 94 #define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_MASK 0x1 95 #define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_SHIFT 3 96 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_MASK 0x1 97 #define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_SHIFT 4 98 #define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_MASK 0x1 99 #define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_SHIFT 5 100 #define CQE_ERROR_BITMAP_UNDER_RUN_ERR_MASK 0x1 101 #define CQE_ERROR_BITMAP_UNDER_RUN_ERR_SHIFT 6 102 #define CQE_ERROR_BITMAP_RESERVED2_MASK 0x1 103 #define CQE_ERROR_BITMAP_RESERVED2_SHIFT 7 104 }; 105 106 union cqe_error_status { 107 u8 error_status; 108 struct cqe_error_bitmap error_bits; 109 }; 110 111 /* iSCSI Login Response PDU header */ 112 struct data_hdr { 113 __le32 data[12]; 114 }; 115 116 struct lun_mapper_addr_reserved { 117 struct regpair lun_mapper_addr; 118 u8 reserved0[8]; 119 }; 120 121 /* rdif conetxt for dif on immediate */ 122 struct dif_on_immediate_params { 123 __le32 initial_ref_tag; 124 __le16 application_tag; 125 __le16 application_tag_mask; 126 __le16 flags1; 127 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_GUARD_MASK 0x1 128 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_GUARD_SHIFT 0 129 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_APP_TAG_MASK 0x1 130 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_APP_TAG_SHIFT 1 131 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_REF_TAG_MASK 0x1 132 #define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_REF_TAG_SHIFT 2 133 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_GUARD_MASK 0x1 134 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_GUARD_SHIFT 3 135 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_MASK 0x1 136 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_SHIFT 4 137 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_MASK 0x1 138 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_SHIFT 5 139 #define DIF_ON_IMMEDIATE_PARAMS_INTERVAL_SIZE_MASK 0x1 140 #define DIF_ON_IMMEDIATE_PARAMS_INTERVAL_SIZE_SHIFT 6 141 #define DIF_ON_IMMEDIATE_PARAMS_NETWORK_INTERFACE_MASK 0x1 142 #define DIF_ON_IMMEDIATE_PARAMS_NETWORK_INTERFACE_SHIFT 7 143 #define DIF_ON_IMMEDIATE_PARAMS_HOST_INTERFACE_MASK 0x3 144 #define DIF_ON_IMMEDIATE_PARAMS_HOST_INTERFACE_SHIFT 8 145 #define DIF_ON_IMMEDIATE_PARAMS_REF_TAG_MASK_MASK 0xF 146 #define DIF_ON_IMMEDIATE_PARAMS_REF_TAG_MASK_SHIFT 10 147 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_WITH_MASK_MASK 0x1 148 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_WITH_MASK_SHIFT 14 149 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_WITH_MASK_MASK 0x1 150 #define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_WITH_MASK_SHIFT 15 151 u8 flags0; 152 #define DIF_ON_IMMEDIATE_PARAMS_RESERVED_MASK 0x1 153 #define DIF_ON_IMMEDIATE_PARAMS_RESERVED_SHIFT 0 154 #define DIF_ON_IMMEDIATE_PARAMS_IGNORE_APP_TAG_MASK 0x1 155 #define DIF_ON_IMMEDIATE_PARAMS_IGNORE_APP_TAG_SHIFT 1 156 #define DIF_ON_IMMEDIATE_PARAMS_INITIAL_REF_TAG_IS_VALID_MASK 0x1 157 #define DIF_ON_IMMEDIATE_PARAMS_INITIAL_REF_TAG_IS_VALID_SHIFT 2 158 #define DIF_ON_IMMEDIATE_PARAMS_HOST_GUARD_TYPE_MASK 0x1 159 #define DIF_ON_IMMEDIATE_PARAMS_HOST_GUARD_TYPE_SHIFT 3 160 #define DIF_ON_IMMEDIATE_PARAMS_PROTECTION_TYPE_MASK 0x3 161 #define DIF_ON_IMMEDIATE_PARAMS_PROTECTION_TYPE_SHIFT 4 162 #define DIF_ON_IMMEDIATE_PARAMS_CRC_SEED_MASK 0x1 163 #define DIF_ON_IMMEDIATE_PARAMS_CRC_SEED_SHIFT 6 164 #define DIF_ON_IMMEDIATE_PARAMS_KEEP_REF_TAG_CONST_MASK 0x1 165 #define DIF_ON_IMMEDIATE_PARAMS_KEEP_REF_TAG_CONST_SHIFT 7 166 u8 reserved_zero[5]; 167 }; 168 169 /* iSCSI dif on immediate mode attributes union */ 170 union dif_configuration_params { 171 struct lun_mapper_addr_reserved lun_mapper_address; 172 struct dif_on_immediate_params def_dif_conf; 173 }; 174 175 /* Union of data/r2t sequence number */ 176 union iscsi_seq_num { 177 __le16 data_sn; 178 __le16 r2t_sn; 179 }; 180 181 /* iSCSI DIF flags */ 182 struct iscsi_dif_flags { 183 u8 flags; 184 #define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_MASK 0xF 185 #define ISCSI_DIF_FLAGS_PROT_INTERVAL_SIZE_LOG_SHIFT 0 186 #define ISCSI_DIF_FLAGS_DIF_TO_PEER_MASK 0x1 187 #define ISCSI_DIF_FLAGS_DIF_TO_PEER_SHIFT 4 188 #define ISCSI_DIF_FLAGS_HOST_INTERFACE_MASK 0x7 189 #define ISCSI_DIF_FLAGS_HOST_INTERFACE_SHIFT 5 190 }; 191 192 /* The iscsi storm task context of Ystorm */ 193 struct ystorm_iscsi_task_state { 194 struct scsi_cached_sges data_desc; 195 struct scsi_sgl_params sgl_params; 196 __le32 exp_r2t_sn; 197 __le32 buffer_offset; 198 union iscsi_seq_num seq_num; 199 struct iscsi_dif_flags dif_flags; 200 u8 flags; 201 #define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_MASK 0x1 202 #define YSTORM_ISCSI_TASK_STATE_LOCAL_COMP_SHIFT 0 203 #define YSTORM_ISCSI_TASK_STATE_SLOW_IO_MASK 0x1 204 #define YSTORM_ISCSI_TASK_STATE_SLOW_IO_SHIFT 1 205 #define YSTORM_ISCSI_TASK_STATE_SET_DIF_OFFSET_MASK 0x1 206 #define YSTORM_ISCSI_TASK_STATE_SET_DIF_OFFSET_SHIFT 2 207 #define YSTORM_ISCSI_TASK_STATE_RESERVED0_MASK 0x1F 208 #define YSTORM_ISCSI_TASK_STATE_RESERVED0_SHIFT 3 209 }; 210 211 /* The iscsi storm task context of Ystorm */ 212 struct ystorm_iscsi_task_rxmit_opt { 213 __le32 fast_rxmit_sge_offset; 214 __le32 scan_start_buffer_offset; 215 __le32 fast_rxmit_buffer_offset; 216 u8 scan_start_sgl_index; 217 u8 fast_rxmit_sgl_index; 218 __le16 reserved; 219 }; 220 221 /* iSCSI Common PDU header */ 222 struct iscsi_common_hdr { 223 u8 hdr_status; 224 u8 hdr_response; 225 u8 hdr_flags; 226 u8 hdr_first_byte; 227 #define ISCSI_COMMON_HDR_OPCODE_MASK 0x3F 228 #define ISCSI_COMMON_HDR_OPCODE_SHIFT 0 229 #define ISCSI_COMMON_HDR_IMM_MASK 0x1 230 #define ISCSI_COMMON_HDR_IMM_SHIFT 6 231 #define ISCSI_COMMON_HDR_RSRV_MASK 0x1 232 #define ISCSI_COMMON_HDR_RSRV_SHIFT 7 233 __le32 hdr_second_dword; 234 #define ISCSI_COMMON_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 235 #define ISCSI_COMMON_HDR_DATA_SEG_LEN_SHIFT 0 236 #define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_MASK 0xFF 237 #define ISCSI_COMMON_HDR_TOTAL_AHS_LEN_SHIFT 24 238 struct regpair lun_reserved; 239 __le32 itt; 240 __le32 ttt; 241 __le32 cmdstat_sn; 242 __le32 exp_statcmd_sn; 243 __le32 max_cmd_sn; 244 __le32 data[3]; 245 }; 246 247 /* iSCSI Command PDU header */ 248 struct iscsi_cmd_hdr { 249 __le16 reserved1; 250 u8 flags_attr; 251 #define ISCSI_CMD_HDR_ATTR_MASK 0x7 252 #define ISCSI_CMD_HDR_ATTR_SHIFT 0 253 #define ISCSI_CMD_HDR_RSRV_MASK 0x3 254 #define ISCSI_CMD_HDR_RSRV_SHIFT 3 255 #define ISCSI_CMD_HDR_WRITE_MASK 0x1 256 #define ISCSI_CMD_HDR_WRITE_SHIFT 5 257 #define ISCSI_CMD_HDR_READ_MASK 0x1 258 #define ISCSI_CMD_HDR_READ_SHIFT 6 259 #define ISCSI_CMD_HDR_FINAL_MASK 0x1 260 #define ISCSI_CMD_HDR_FINAL_SHIFT 7 261 u8 hdr_first_byte; 262 #define ISCSI_CMD_HDR_OPCODE_MASK 0x3F 263 #define ISCSI_CMD_HDR_OPCODE_SHIFT 0 264 #define ISCSI_CMD_HDR_IMM_MASK 0x1 265 #define ISCSI_CMD_HDR_IMM_SHIFT 6 266 #define ISCSI_CMD_HDR_RSRV1_MASK 0x1 267 #define ISCSI_CMD_HDR_RSRV1_SHIFT 7 268 __le32 hdr_second_dword; 269 #define ISCSI_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 270 #define ISCSI_CMD_HDR_DATA_SEG_LEN_SHIFT 0 271 #define ISCSI_CMD_HDR_TOTAL_AHS_LEN_MASK 0xFF 272 #define ISCSI_CMD_HDR_TOTAL_AHS_LEN_SHIFT 24 273 struct regpair lun; 274 __le32 itt; 275 __le32 expected_transfer_length; 276 __le32 cmd_sn; 277 __le32 exp_stat_sn; 278 __le32 cdb[4]; 279 }; 280 281 /* iSCSI Command PDU header with Extended CDB (Initiator Mode) */ 282 struct iscsi_ext_cdb_cmd_hdr { 283 __le16 reserved1; 284 u8 flags_attr; 285 #define ISCSI_EXT_CDB_CMD_HDR_ATTR_MASK 0x7 286 #define ISCSI_EXT_CDB_CMD_HDR_ATTR_SHIFT 0 287 #define ISCSI_EXT_CDB_CMD_HDR_RSRV_MASK 0x3 288 #define ISCSI_EXT_CDB_CMD_HDR_RSRV_SHIFT 3 289 #define ISCSI_EXT_CDB_CMD_HDR_WRITE_MASK 0x1 290 #define ISCSI_EXT_CDB_CMD_HDR_WRITE_SHIFT 5 291 #define ISCSI_EXT_CDB_CMD_HDR_READ_MASK 0x1 292 #define ISCSI_EXT_CDB_CMD_HDR_READ_SHIFT 6 293 #define ISCSI_EXT_CDB_CMD_HDR_FINAL_MASK 0x1 294 #define ISCSI_EXT_CDB_CMD_HDR_FINAL_SHIFT 7 295 u8 opcode; 296 __le32 hdr_second_dword; 297 #define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 298 #define ISCSI_EXT_CDB_CMD_HDR_DATA_SEG_LEN_SHIFT 0 299 #define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_MASK 0xFF 300 #define ISCSI_EXT_CDB_CMD_HDR_CDB_SIZE_SHIFT 24 301 struct regpair lun; 302 __le32 itt; 303 __le32 expected_transfer_length; 304 __le32 cmd_sn; 305 __le32 exp_stat_sn; 306 struct scsi_sge cdb_sge; 307 }; 308 309 /* iSCSI login request PDU header */ 310 struct iscsi_login_req_hdr { 311 u8 version_min; 312 u8 version_max; 313 u8 flags_attr; 314 #define ISCSI_LOGIN_REQ_HDR_NSG_MASK 0x3 315 #define ISCSI_LOGIN_REQ_HDR_NSG_SHIFT 0 316 #define ISCSI_LOGIN_REQ_HDR_CSG_MASK 0x3 317 #define ISCSI_LOGIN_REQ_HDR_CSG_SHIFT 2 318 #define ISCSI_LOGIN_REQ_HDR_RSRV_MASK 0x3 319 #define ISCSI_LOGIN_REQ_HDR_RSRV_SHIFT 4 320 #define ISCSI_LOGIN_REQ_HDR_C_MASK 0x1 321 #define ISCSI_LOGIN_REQ_HDR_C_SHIFT 6 322 #define ISCSI_LOGIN_REQ_HDR_T_MASK 0x1 323 #define ISCSI_LOGIN_REQ_HDR_T_SHIFT 7 324 u8 opcode; 325 __le32 hdr_second_dword; 326 #define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 327 #define ISCSI_LOGIN_REQ_HDR_DATA_SEG_LEN_SHIFT 0 328 #define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_MASK 0xFF 329 #define ISCSI_LOGIN_REQ_HDR_TOTAL_AHS_LEN_SHIFT 24 330 __le32 isid_tabc; 331 __le16 tsih; 332 __le16 isid_d; 333 __le32 itt; 334 __le16 reserved1; 335 __le16 cid; 336 __le32 cmd_sn; 337 __le32 exp_stat_sn; 338 __le32 reserved2[4]; 339 }; 340 341 /* iSCSI logout request PDU header */ 342 struct iscsi_logout_req_hdr { 343 __le16 reserved0; 344 u8 reason_code; 345 u8 opcode; 346 __le32 reserved1; 347 __le32 reserved2[2]; 348 __le32 itt; 349 __le16 reserved3; 350 __le16 cid; 351 __le32 cmd_sn; 352 __le32 exp_stat_sn; 353 __le32 reserved4[4]; 354 }; 355 356 /* iSCSI Data-out PDU header */ 357 struct iscsi_data_out_hdr { 358 __le16 reserved1; 359 u8 flags_attr; 360 #define ISCSI_DATA_OUT_HDR_RSRV_MASK 0x7F 361 #define ISCSI_DATA_OUT_HDR_RSRV_SHIFT 0 362 #define ISCSI_DATA_OUT_HDR_FINAL_MASK 0x1 363 #define ISCSI_DATA_OUT_HDR_FINAL_SHIFT 7 364 u8 opcode; 365 __le32 reserved2; 366 struct regpair lun; 367 __le32 itt; 368 __le32 ttt; 369 __le32 reserved3; 370 __le32 exp_stat_sn; 371 __le32 reserved4; 372 __le32 data_sn; 373 __le32 buffer_offset; 374 __le32 reserved5; 375 }; 376 377 /* iSCSI Data-in PDU header */ 378 struct iscsi_data_in_hdr { 379 u8 status_rsvd; 380 u8 reserved1; 381 u8 flags; 382 #define ISCSI_DATA_IN_HDR_STATUS_MASK 0x1 383 #define ISCSI_DATA_IN_HDR_STATUS_SHIFT 0 384 #define ISCSI_DATA_IN_HDR_UNDERFLOW_MASK 0x1 385 #define ISCSI_DATA_IN_HDR_UNDERFLOW_SHIFT 1 386 #define ISCSI_DATA_IN_HDR_OVERFLOW_MASK 0x1 387 #define ISCSI_DATA_IN_HDR_OVERFLOW_SHIFT 2 388 #define ISCSI_DATA_IN_HDR_RSRV_MASK 0x7 389 #define ISCSI_DATA_IN_HDR_RSRV_SHIFT 3 390 #define ISCSI_DATA_IN_HDR_ACK_MASK 0x1 391 #define ISCSI_DATA_IN_HDR_ACK_SHIFT 6 392 #define ISCSI_DATA_IN_HDR_FINAL_MASK 0x1 393 #define ISCSI_DATA_IN_HDR_FINAL_SHIFT 7 394 u8 opcode; 395 __le32 reserved2; 396 struct regpair lun; 397 __le32 itt; 398 __le32 ttt; 399 __le32 stat_sn; 400 __le32 exp_cmd_sn; 401 __le32 max_cmd_sn; 402 __le32 data_sn; 403 __le32 buffer_offset; 404 __le32 residual_count; 405 }; 406 407 /* iSCSI R2T PDU header */ 408 struct iscsi_r2t_hdr { 409 u8 reserved0[3]; 410 u8 opcode; 411 __le32 reserved2; 412 struct regpair lun; 413 __le32 itt; 414 __le32 ttt; 415 __le32 stat_sn; 416 __le32 exp_cmd_sn; 417 __le32 max_cmd_sn; 418 __le32 r2t_sn; 419 __le32 buffer_offset; 420 __le32 desired_data_trns_len; 421 }; 422 423 /* iSCSI NOP-out PDU header */ 424 struct iscsi_nop_out_hdr { 425 __le16 reserved1; 426 u8 flags_attr; 427 #define ISCSI_NOP_OUT_HDR_RSRV_MASK 0x7F 428 #define ISCSI_NOP_OUT_HDR_RSRV_SHIFT 0 429 #define ISCSI_NOP_OUT_HDR_CONST1_MASK 0x1 430 #define ISCSI_NOP_OUT_HDR_CONST1_SHIFT 7 431 u8 opcode; 432 __le32 reserved2; 433 struct regpair lun; 434 __le32 itt; 435 __le32 ttt; 436 __le32 cmd_sn; 437 __le32 exp_stat_sn; 438 __le32 reserved3; 439 __le32 reserved4; 440 __le32 reserved5; 441 __le32 reserved6; 442 }; 443 444 /* iSCSI NOP-in PDU header */ 445 struct iscsi_nop_in_hdr { 446 __le16 reserved0; 447 u8 flags_attr; 448 #define ISCSI_NOP_IN_HDR_RSRV_MASK 0x7F 449 #define ISCSI_NOP_IN_HDR_RSRV_SHIFT 0 450 #define ISCSI_NOP_IN_HDR_CONST1_MASK 0x1 451 #define ISCSI_NOP_IN_HDR_CONST1_SHIFT 7 452 u8 opcode; 453 __le32 hdr_second_dword; 454 #define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 455 #define ISCSI_NOP_IN_HDR_DATA_SEG_LEN_SHIFT 0 456 #define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_MASK 0xFF 457 #define ISCSI_NOP_IN_HDR_TOTAL_AHS_LEN_SHIFT 24 458 struct regpair lun; 459 __le32 itt; 460 __le32 ttt; 461 __le32 stat_sn; 462 __le32 exp_cmd_sn; 463 __le32 max_cmd_sn; 464 __le32 reserved5; 465 __le32 reserved6; 466 __le32 reserved7; 467 }; 468 469 /* iSCSI Login Response PDU header */ 470 struct iscsi_login_response_hdr { 471 u8 version_active; 472 u8 version_max; 473 u8 flags_attr; 474 #define ISCSI_LOGIN_RESPONSE_HDR_NSG_MASK 0x3 475 #define ISCSI_LOGIN_RESPONSE_HDR_NSG_SHIFT 0 476 #define ISCSI_LOGIN_RESPONSE_HDR_CSG_MASK 0x3 477 #define ISCSI_LOGIN_RESPONSE_HDR_CSG_SHIFT 2 478 #define ISCSI_LOGIN_RESPONSE_HDR_RSRV_MASK 0x3 479 #define ISCSI_LOGIN_RESPONSE_HDR_RSRV_SHIFT 4 480 #define ISCSI_LOGIN_RESPONSE_HDR_C_MASK 0x1 481 #define ISCSI_LOGIN_RESPONSE_HDR_C_SHIFT 6 482 #define ISCSI_LOGIN_RESPONSE_HDR_T_MASK 0x1 483 #define ISCSI_LOGIN_RESPONSE_HDR_T_SHIFT 7 484 u8 opcode; 485 __le32 hdr_second_dword; 486 #define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 487 #define ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 488 #define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF 489 #define ISCSI_LOGIN_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 490 __le32 isid_tabc; 491 __le16 tsih; 492 __le16 isid_d; 493 __le32 itt; 494 __le32 reserved1; 495 __le32 stat_sn; 496 __le32 exp_cmd_sn; 497 __le32 max_cmd_sn; 498 __le16 reserved2; 499 u8 status_detail; 500 u8 status_class; 501 __le32 reserved4[2]; 502 }; 503 504 /* iSCSI Logout Response PDU header */ 505 struct iscsi_logout_response_hdr { 506 u8 reserved1; 507 u8 response; 508 u8 flags; 509 u8 opcode; 510 __le32 hdr_second_dword; 511 #define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 512 #define ISCSI_LOGOUT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 513 #define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF 514 #define ISCSI_LOGOUT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 515 __le32 reserved2[2]; 516 __le32 itt; 517 __le32 reserved3; 518 __le32 stat_sn; 519 __le32 exp_cmd_sn; 520 __le32 max_cmd_sn; 521 __le32 reserved4; 522 __le16 time_2_retain; 523 __le16 time_2_wait; 524 __le32 reserved5[1]; 525 }; 526 527 /* iSCSI Text Request PDU header */ 528 struct iscsi_text_request_hdr { 529 __le16 reserved0; 530 u8 flags_attr; 531 #define ISCSI_TEXT_REQUEST_HDR_RSRV_MASK 0x3F 532 #define ISCSI_TEXT_REQUEST_HDR_RSRV_SHIFT 0 533 #define ISCSI_TEXT_REQUEST_HDR_C_MASK 0x1 534 #define ISCSI_TEXT_REQUEST_HDR_C_SHIFT 6 535 #define ISCSI_TEXT_REQUEST_HDR_F_MASK 0x1 536 #define ISCSI_TEXT_REQUEST_HDR_F_SHIFT 7 537 u8 opcode; 538 __le32 hdr_second_dword; 539 #define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 540 #define ISCSI_TEXT_REQUEST_HDR_DATA_SEG_LEN_SHIFT 0 541 #define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_MASK 0xFF 542 #define ISCSI_TEXT_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24 543 struct regpair lun; 544 __le32 itt; 545 __le32 ttt; 546 __le32 cmd_sn; 547 __le32 exp_stat_sn; 548 __le32 reserved4[4]; 549 }; 550 551 /* iSCSI Text Response PDU header */ 552 struct iscsi_text_response_hdr { 553 __le16 reserved1; 554 u8 flags; 555 #define ISCSI_TEXT_RESPONSE_HDR_RSRV_MASK 0x3F 556 #define ISCSI_TEXT_RESPONSE_HDR_RSRV_SHIFT 0 557 #define ISCSI_TEXT_RESPONSE_HDR_C_MASK 0x1 558 #define ISCSI_TEXT_RESPONSE_HDR_C_SHIFT 6 559 #define ISCSI_TEXT_RESPONSE_HDR_F_MASK 0x1 560 #define ISCSI_TEXT_RESPONSE_HDR_F_SHIFT 7 561 u8 opcode; 562 __le32 hdr_second_dword; 563 #define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 564 #define ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 565 #define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF 566 #define ISCSI_TEXT_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 567 struct regpair lun; 568 __le32 itt; 569 __le32 ttt; 570 __le32 stat_sn; 571 __le32 exp_cmd_sn; 572 __le32 max_cmd_sn; 573 __le32 reserved4[3]; 574 }; 575 576 /* iSCSI TMF Request PDU header */ 577 struct iscsi_tmf_request_hdr { 578 __le16 reserved0; 579 u8 function; 580 u8 opcode; 581 __le32 hdr_second_dword; 582 #define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 583 #define ISCSI_TMF_REQUEST_HDR_DATA_SEG_LEN_SHIFT 0 584 #define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_MASK 0xFF 585 #define ISCSI_TMF_REQUEST_HDR_TOTAL_AHS_LEN_SHIFT 24 586 struct regpair lun; 587 __le32 itt; 588 __le32 rtt; 589 __le32 cmd_sn; 590 __le32 exp_stat_sn; 591 __le32 ref_cmd_sn; 592 __le32 exp_data_sn; 593 __le32 reserved4[2]; 594 }; 595 596 struct iscsi_tmf_response_hdr { 597 u8 reserved2; 598 u8 hdr_response; 599 u8 hdr_flags; 600 u8 opcode; 601 __le32 hdr_second_dword; 602 #define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 603 #define ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 604 #define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF 605 #define ISCSI_TMF_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 606 struct regpair reserved0; 607 __le32 itt; 608 __le32 reserved1; 609 __le32 stat_sn; 610 __le32 exp_cmd_sn; 611 __le32 max_cmd_sn; 612 __le32 reserved4[3]; 613 }; 614 615 /* iSCSI Response PDU header */ 616 struct iscsi_response_hdr { 617 u8 hdr_status; 618 u8 hdr_response; 619 u8 hdr_flags; 620 u8 opcode; 621 __le32 hdr_second_dword; 622 #define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 623 #define ISCSI_RESPONSE_HDR_DATA_SEG_LEN_SHIFT 0 624 #define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_MASK 0xFF 625 #define ISCSI_RESPONSE_HDR_TOTAL_AHS_LEN_SHIFT 24 626 struct regpair lun; 627 __le32 itt; 628 __le32 snack_tag; 629 __le32 stat_sn; 630 __le32 exp_cmd_sn; 631 __le32 max_cmd_sn; 632 __le32 exp_data_sn; 633 __le32 bi_residual_count; 634 __le32 residual_count; 635 }; 636 637 /* iSCSI Reject PDU header */ 638 struct iscsi_reject_hdr { 639 u8 reserved4; 640 u8 hdr_reason; 641 u8 hdr_flags; 642 u8 opcode; 643 __le32 hdr_second_dword; 644 #define ISCSI_REJECT_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 645 #define ISCSI_REJECT_HDR_DATA_SEG_LEN_SHIFT 0 646 #define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_MASK 0xFF 647 #define ISCSI_REJECT_HDR_TOTAL_AHS_LEN_SHIFT 24 648 struct regpair reserved0; 649 __le32 all_ones; 650 __le32 reserved2; 651 __le32 stat_sn; 652 __le32 exp_cmd_sn; 653 __le32 max_cmd_sn; 654 __le32 data_sn; 655 __le32 reserved3[2]; 656 }; 657 658 /* iSCSI Asynchronous Message PDU header */ 659 struct iscsi_async_msg_hdr { 660 __le16 reserved0; 661 u8 flags_attr; 662 #define ISCSI_ASYNC_MSG_HDR_RSRV_MASK 0x7F 663 #define ISCSI_ASYNC_MSG_HDR_RSRV_SHIFT 0 664 #define ISCSI_ASYNC_MSG_HDR_CONST1_MASK 0x1 665 #define ISCSI_ASYNC_MSG_HDR_CONST1_SHIFT 7 666 u8 opcode; 667 __le32 hdr_second_dword; 668 #define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_MASK 0xFFFFFF 669 #define ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_SHIFT 0 670 #define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_MASK 0xFF 671 #define ISCSI_ASYNC_MSG_HDR_TOTAL_AHS_LEN_SHIFT 24 672 struct regpair lun; 673 __le32 all_ones; 674 __le32 reserved1; 675 __le32 stat_sn; 676 __le32 exp_cmd_sn; 677 __le32 max_cmd_sn; 678 __le16 param1_rsrv; 679 u8 async_vcode; 680 u8 async_event; 681 __le16 param3_rsrv; 682 __le16 param2_rsrv; 683 __le32 reserved7; 684 }; 685 686 /* PDU header part of Ystorm task context */ 687 union iscsi_task_hdr { 688 struct iscsi_common_hdr common; 689 struct data_hdr data; 690 struct iscsi_cmd_hdr cmd; 691 struct iscsi_ext_cdb_cmd_hdr ext_cdb_cmd; 692 struct iscsi_login_req_hdr login_req; 693 struct iscsi_logout_req_hdr logout_req; 694 struct iscsi_data_out_hdr data_out; 695 struct iscsi_data_in_hdr data_in; 696 struct iscsi_r2t_hdr r2t; 697 struct iscsi_nop_out_hdr nop_out; 698 struct iscsi_nop_in_hdr nop_in; 699 struct iscsi_login_response_hdr login_response; 700 struct iscsi_logout_response_hdr logout_response; 701 struct iscsi_text_request_hdr text_request; 702 struct iscsi_text_response_hdr text_response; 703 struct iscsi_tmf_request_hdr tmf_request; 704 struct iscsi_tmf_response_hdr tmf_response; 705 struct iscsi_response_hdr response; 706 struct iscsi_reject_hdr reject; 707 struct iscsi_async_msg_hdr async_msg; 708 }; 709 710 /* The iscsi storm task context of Ystorm */ 711 struct ystorm_iscsi_task_st_ctx { 712 struct ystorm_iscsi_task_state state; 713 struct ystorm_iscsi_task_rxmit_opt rxmit_opt; 714 union iscsi_task_hdr pdu_hdr; 715 }; 716 717 struct ystorm_iscsi_task_ag_ctx { 718 u8 reserved; 719 u8 byte1; 720 __le16 word0; 721 u8 flags0; 722 #define YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF 723 #define YSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0 724 #define YSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1 725 #define YSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4 726 #define YSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 727 #define YSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 728 #define YSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1 729 #define YSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6 730 #define YSTORM_ISCSI_TASK_AG_CTX_TTT_VALID_MASK 0x1 /* bit3 */ 731 #define YSTORM_ISCSI_TASK_AG_CTX_TTT_VALID_SHIFT 7 732 u8 flags1; 733 #define YSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3 734 #define YSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 0 735 #define YSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 736 #define YSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2 737 #define YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_MASK 0x3 738 #define YSTORM_ISCSI_TASK_AG_CTX_CF2SPECIAL_SHIFT 4 739 #define YSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1 740 #define YSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 6 741 #define YSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 742 #define YSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7 743 u8 flags2; 744 #define YSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1 745 #define YSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0 746 #define YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 747 #define YSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1 748 #define YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 749 #define YSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2 750 #define YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 751 #define YSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3 752 #define YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 753 #define YSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4 754 #define YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 755 #define YSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5 756 #define YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 757 #define YSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6 758 #define YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 759 #define YSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7 760 u8 byte2; 761 __le32 TTT; 762 u8 byte3; 763 u8 byte4; 764 __le16 word1; 765 }; 766 767 struct mstorm_iscsi_task_ag_ctx { 768 u8 cdu_validation; 769 u8 byte1; 770 __le16 task_cid; 771 u8 flags0; 772 #define MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF 773 #define MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 774 #define MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 775 #define MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 776 #define MSTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_MASK 0x1 777 #define MSTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_SHIFT 5 778 #define MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1 779 #define MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6 780 #define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK 0x1 781 #define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_SHIFT 7 782 u8 flags1; 783 #define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_MASK 0x3 784 #define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_SHIFT 0 785 #define MSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 786 #define MSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 2 787 #define MSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3 788 #define MSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 4 789 #define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_MASK 0x1 790 #define MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_CF_EN_SHIFT 6 791 #define MSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 792 #define MSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 7 793 u8 flags2; 794 #define MSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1 795 #define MSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 0 796 #define MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 797 #define MSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 1 798 #define MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 799 #define MSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 2 800 #define MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 801 #define MSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 3 802 #define MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 803 #define MSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 4 804 #define MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 805 #define MSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 5 806 #define MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 807 #define MSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 6 808 #define MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 809 #define MSTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 7 810 u8 byte2; 811 __le32 reg0; 812 u8 byte3; 813 u8 byte4; 814 __le16 word1; 815 }; 816 817 struct ustorm_iscsi_task_ag_ctx { 818 u8 reserved; 819 u8 state; 820 __le16 icid; 821 u8 flags0; 822 #define USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_MASK 0xF 823 #define USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 824 #define USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 825 #define USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 826 #define USTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_MASK 0x1 827 #define USTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_SHIFT 5 828 #define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK 0x3 829 #define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT 6 830 u8 flags1; 831 #define USTORM_ISCSI_TASK_AG_CTX_RESERVED1_MASK 0x3 832 #define USTORM_ISCSI_TASK_AG_CTX_RESERVED1_SHIFT 0 833 #define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_MASK 0x3 834 #define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_SHIFT 2 835 #define USTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3 836 #define USTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 4 837 #define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_MASK 0x3 838 #define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_SHIFT 6 839 u8 flags2; 840 #define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_MASK 0x1 841 #define USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_EN_SHIFT 0 842 #define USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_MASK 0x1 843 #define USTORM_ISCSI_TASK_AG_CTX_DISABLE_DATA_ACKED_SHIFT 1 844 #define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_MASK 0x1 845 #define USTORM_ISCSI_TASK_AG_CTX_R2T2RECV_EN_SHIFT 2 846 #define USTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1 847 #define USTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 3 848 #define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_MASK 0x1 849 #define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_CF_EN_SHIFT 4 850 #define USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_MASK 0x1 851 #define USTORM_ISCSI_TASK_AG_CTX_CMP_DATA_TOTAL_EXP_EN_SHIFT 5 852 #define USTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 853 #define USTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 6 854 #define USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_MASK 0x1 855 #define USTORM_ISCSI_TASK_AG_CTX_CMP_CONT_RCV_EXP_EN_SHIFT 7 856 u8 flags3; 857 #define USTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 858 #define USTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 0 859 #define USTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 860 #define USTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 1 861 #define USTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 862 #define USTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 2 863 #define USTORM_ISCSI_TASK_AG_CTX_RULE6EN_MASK 0x1 864 #define USTORM_ISCSI_TASK_AG_CTX_RULE6EN_SHIFT 3 865 #define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_MASK 0xF 866 #define USTORM_ISCSI_TASK_AG_CTX_DIF_ERROR_TYPE_SHIFT 4 867 __le32 dif_err_intervals; 868 __le32 dif_error_1st_interval; 869 __le32 rcv_cont_len; 870 __le32 exp_cont_len; 871 __le32 total_data_acked; 872 __le32 exp_data_acked; 873 u8 byte2; 874 u8 byte3; 875 __le16 word1; 876 __le16 next_tid; 877 __le16 word3; 878 __le32 hdr_residual_count; 879 __le32 exp_r2t_sn; 880 }; 881 882 /* The iscsi storm task context of Mstorm */ 883 struct mstorm_iscsi_task_st_ctx { 884 struct scsi_cached_sges data_desc; 885 struct scsi_sgl_params sgl_params; 886 __le32 rem_task_size; 887 __le32 data_buffer_offset; 888 u8 task_type; 889 struct iscsi_dif_flags dif_flags; 890 __le16 dif_task_icid; 891 struct regpair sense_db; 892 __le32 expected_itt; 893 __le32 reserved1; 894 }; 895 896 struct iscsi_reg1 { 897 __le32 reg1_map; 898 #define ISCSI_REG1_NUM_SGES_MASK 0xF 899 #define ISCSI_REG1_NUM_SGES_SHIFT 0 900 #define ISCSI_REG1_RESERVED1_MASK 0xFFFFFFF 901 #define ISCSI_REG1_RESERVED1_SHIFT 4 902 }; 903 904 struct tqe_opaque { 905 __le16 opaque[2]; 906 }; 907 908 /* The iscsi storm task context of Ustorm */ 909 struct ustorm_iscsi_task_st_ctx { 910 __le32 rem_rcv_len; 911 __le32 exp_data_transfer_len; 912 __le32 exp_data_sn; 913 struct regpair lun; 914 struct iscsi_reg1 reg1; 915 u8 flags2; 916 #define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_MASK 0x1 917 #define USTORM_ISCSI_TASK_ST_CTX_AHS_EXIST_SHIFT 0 918 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_MASK 0x7F 919 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED1_SHIFT 1 920 struct iscsi_dif_flags dif_flags; 921 __le16 reserved3; 922 struct tqe_opaque tqe_opaque_list; 923 __le32 reserved5; 924 __le32 reserved6; 925 __le32 reserved7; 926 u8 task_type; 927 u8 error_flags; 928 #define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_MASK 0x1 929 #define USTORM_ISCSI_TASK_ST_CTX_DATA_DIGEST_ERROR_SHIFT 0 930 #define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_MASK 0x1 931 #define USTORM_ISCSI_TASK_ST_CTX_DATA_TRUNCATED_ERROR_SHIFT 1 932 #define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_MASK 0x1 933 #define USTORM_ISCSI_TASK_ST_CTX_UNDER_RUN_ERROR_SHIFT 2 934 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_MASK 0x1F 935 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED8_SHIFT 3 936 u8 flags; 937 #define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_MASK 0x3 938 #define USTORM_ISCSI_TASK_ST_CTX_CQE_WRITE_SHIFT 0 939 #define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_MASK 0x1 940 #define USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP_SHIFT 2 941 #define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_MASK 0x1 942 #define USTORM_ISCSI_TASK_ST_CTX_Q0_R2TQE_WRITE_SHIFT 3 943 #define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_MASK 0x1 944 #define USTORM_ISCSI_TASK_ST_CTX_TOTAL_DATA_ACKED_DONE_SHIFT 4 945 #define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_MASK 0x1 946 #define USTORM_ISCSI_TASK_ST_CTX_HQ_SCANNED_DONE_SHIFT 5 947 #define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_MASK 0x1 948 #define USTORM_ISCSI_TASK_ST_CTX_R2T2RECV_DONE_SHIFT 6 949 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_MASK 0x1 950 #define USTORM_ISCSI_TASK_ST_CTX_RESERVED0_SHIFT 7 951 u8 cq_rss_number; 952 }; 953 954 /* iscsi task context */ 955 struct iscsi_task_context { 956 struct ystorm_iscsi_task_st_ctx ystorm_st_context; 957 struct ystorm_iscsi_task_ag_ctx ystorm_ag_context; 958 struct regpair ystorm_ag_padding[2]; 959 struct tdif_task_context tdif_context; 960 struct mstorm_iscsi_task_ag_ctx mstorm_ag_context; 961 struct regpair mstorm_ag_padding[2]; 962 struct ustorm_iscsi_task_ag_ctx ustorm_ag_context; 963 struct mstorm_iscsi_task_st_ctx mstorm_st_context; 964 struct ustorm_iscsi_task_st_ctx ustorm_st_context; 965 struct rdif_task_context rdif_context; 966 }; 967 968 /* iSCSI connection offload params passed by driver to FW in ISCSI offload 969 * ramrod. 970 */ 971 struct iscsi_conn_offload_params { 972 struct regpair sq_pbl_addr; 973 struct regpair r2tq_pbl_addr; 974 struct regpair xhq_pbl_addr; 975 struct regpair uhq_pbl_addr; 976 __le16 physical_q0; 977 __le16 physical_q1; 978 u8 flags; 979 #define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_MASK 0x1 980 #define ISCSI_CONN_OFFLOAD_PARAMS_TCP_ON_CHIP_1B_SHIFT 0 981 #define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_MASK 0x1 982 #define ISCSI_CONN_OFFLOAD_PARAMS_TARGET_MODE_SHIFT 1 983 #define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_MASK 0x1 984 #define ISCSI_CONN_OFFLOAD_PARAMS_RESTRICTED_MODE_SHIFT 2 985 #define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_MASK 0x1F 986 #define ISCSI_CONN_OFFLOAD_PARAMS_RESERVED1_SHIFT 3 987 u8 default_cq; 988 __le16 reserved0; 989 __le32 stat_sn; 990 __le32 initial_ack; 991 }; 992 993 /* iSCSI connection statistics */ 994 struct iscsi_conn_stats_params { 995 struct regpair iscsi_tcp_tx_packets_cnt; 996 struct regpair iscsi_tcp_tx_bytes_cnt; 997 struct regpair iscsi_tcp_tx_rxmit_cnt; 998 struct regpair iscsi_tcp_rx_packets_cnt; 999 struct regpair iscsi_tcp_rx_bytes_cnt; 1000 struct regpair iscsi_tcp_rx_dup_ack_cnt; 1001 __le32 iscsi_tcp_rx_chksum_err_cnt; 1002 __le32 reserved; 1003 }; 1004 1005 1006 /* iSCSI connection update params passed by driver to FW in ISCSI update 1007 *ramrod. 1008 */ 1009 struct iscsi_conn_update_ramrod_params { 1010 __le16 reserved0; 1011 __le16 conn_id; 1012 __le32 reserved1; 1013 u8 flags; 1014 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_MASK 0x1 1015 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN_SHIFT 0 1016 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_MASK 0x1 1017 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN_SHIFT 1 1018 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_MASK 0x1 1019 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T_SHIFT 2 1020 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_MASK 0x1 1021 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA_SHIFT 3 1022 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_MASK 0x1 1023 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_BLOCK_SIZE_SHIFT 4 1024 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_MASK 0x1 1025 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_HOST_EN_SHIFT 5 1026 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_IMM_EN_MASK 0x1 1027 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_DIF_ON_IMM_EN_SHIFT 6 1028 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_LUN_MAPPER_EN_MASK 0x1 1029 #define ISCSI_CONN_UPDATE_RAMROD_PARAMS_LUN_MAPPER_EN_SHIFT 7 1030 u8 reserved3[3]; 1031 __le32 max_seq_size; 1032 __le32 max_send_pdu_length; 1033 __le32 max_recv_pdu_length; 1034 __le32 first_seq_length; 1035 __le32 exp_stat_sn; 1036 union dif_configuration_params dif_on_imme_params; 1037 }; 1038 1039 /* iSCSI CQ element */ 1040 struct iscsi_cqe_common { 1041 __le16 conn_id; 1042 u8 cqe_type; 1043 union cqe_error_status error_bitmap; 1044 __le32 reserved[3]; 1045 union iscsi_task_hdr iscsi_hdr; 1046 }; 1047 1048 /* iSCSI CQ element */ 1049 struct iscsi_cqe_solicited { 1050 __le16 conn_id; 1051 u8 cqe_type; 1052 union cqe_error_status error_bitmap; 1053 __le16 itid; 1054 u8 task_type; 1055 u8 fw_dbg_field; 1056 u8 caused_conn_err; 1057 u8 reserved0[3]; 1058 __le32 data_truncated_bytes; 1059 union iscsi_task_hdr iscsi_hdr; 1060 }; 1061 1062 /* iSCSI CQ element */ 1063 struct iscsi_cqe_unsolicited { 1064 __le16 conn_id; 1065 u8 cqe_type; 1066 union cqe_error_status error_bitmap; 1067 __le16 reserved0; 1068 u8 reserved1; 1069 u8 unsol_cqe_type; 1070 __le16 rqe_opaque; 1071 __le16 reserved2[3]; 1072 union iscsi_task_hdr iscsi_hdr; 1073 }; 1074 1075 /* iSCSI CQ element */ 1076 union iscsi_cqe { 1077 struct iscsi_cqe_common cqe_common; 1078 struct iscsi_cqe_solicited cqe_solicited; 1079 struct iscsi_cqe_unsolicited cqe_unsolicited; 1080 }; 1081 1082 /* iSCSI CQE type */ 1083 enum iscsi_cqes_type { 1084 ISCSI_CQE_TYPE_SOLICITED = 1, 1085 ISCSI_CQE_TYPE_UNSOLICITED, 1086 ISCSI_CQE_TYPE_SOLICITED_WITH_SENSE, 1087 ISCSI_CQE_TYPE_TASK_CLEANUP, 1088 ISCSI_CQE_TYPE_DUMMY, 1089 MAX_ISCSI_CQES_TYPE 1090 }; 1091 1092 /* iSCSI CQE type */ 1093 enum iscsi_cqe_unsolicited_type { 1094 ISCSI_CQE_UNSOLICITED_NONE, 1095 ISCSI_CQE_UNSOLICITED_SINGLE, 1096 ISCSI_CQE_UNSOLICITED_FIRST, 1097 ISCSI_CQE_UNSOLICITED_MIDDLE, 1098 ISCSI_CQE_UNSOLICITED_LAST, 1099 MAX_ISCSI_CQE_UNSOLICITED_TYPE 1100 }; 1101 1102 /* iscsi debug modes */ 1103 struct iscsi_debug_modes { 1104 u8 flags; 1105 #define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_MASK 0x1 1106 #define ISCSI_DEBUG_MODES_ASSERT_IF_RX_CONN_ERROR_SHIFT 0 1107 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_MASK 0x1 1108 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_RESET_SHIFT 1 1109 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_MASK 0x1 1110 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_FIN_SHIFT 2 1111 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_MASK 0x1 1112 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_CLEANUP_SHIFT 3 1113 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_MASK 0x1 1114 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_REJECT_OR_ASYNC_SHIFT 4 1115 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_MASK 0x1 1116 #define ISCSI_DEBUG_MODES_ASSERT_IF_RECV_NOP_SHIFT 5 1117 #define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_OR_DATA_DIGEST_ERROR_MASK 0x1 1118 #define ISCSI_DEBUG_MODES_ASSERT_IF_DIF_OR_DATA_DIGEST_ERROR_SHIFT 6 1119 #define ISCSI_DEBUG_MODES_ASSERT_IF_HQ_CORRUPT_MASK 0x1 1120 #define ISCSI_DEBUG_MODES_ASSERT_IF_HQ_CORRUPT_SHIFT 7 1121 }; 1122 1123 /* iSCSI kernel completion queue IDs */ 1124 enum iscsi_eqe_opcode { 1125 ISCSI_EVENT_TYPE_INIT_FUNC = 0, 1126 ISCSI_EVENT_TYPE_DESTROY_FUNC, 1127 ISCSI_EVENT_TYPE_OFFLOAD_CONN, 1128 ISCSI_EVENT_TYPE_UPDATE_CONN, 1129 ISCSI_EVENT_TYPE_CLEAR_SQ, 1130 ISCSI_EVENT_TYPE_TERMINATE_CONN, 1131 ISCSI_EVENT_TYPE_MAC_UPDATE_CONN, 1132 ISCSI_EVENT_TYPE_COLLECT_STATS_CONN, 1133 ISCSI_EVENT_TYPE_ASYN_CONNECT_COMPLETE, 1134 ISCSI_EVENT_TYPE_ASYN_TERMINATE_DONE, 1135 ISCSI_EVENT_TYPE_START_OF_ERROR_TYPES = 10, 1136 ISCSI_EVENT_TYPE_ASYN_ABORT_RCVD, 1137 ISCSI_EVENT_TYPE_ASYN_CLOSE_RCVD, 1138 ISCSI_EVENT_TYPE_ASYN_SYN_RCVD, 1139 ISCSI_EVENT_TYPE_ASYN_MAX_RT_TIME, 1140 ISCSI_EVENT_TYPE_ASYN_MAX_RT_CNT, 1141 ISCSI_EVENT_TYPE_ASYN_MAX_KA_PROBES_CNT, 1142 ISCSI_EVENT_TYPE_ASYN_FIN_WAIT2, 1143 ISCSI_EVENT_TYPE_ISCSI_CONN_ERROR, 1144 ISCSI_EVENT_TYPE_TCP_CONN_ERROR, 1145 MAX_ISCSI_EQE_OPCODE 1146 }; 1147 1148 /* iSCSI EQE and CQE completion status */ 1149 enum iscsi_error_types { 1150 ISCSI_STATUS_NONE = 0, 1151 ISCSI_CQE_ERROR_UNSOLICITED_RCV_ON_INVALID_CONN = 1, 1152 ISCSI_CONN_ERROR_TASK_CID_MISMATCH, 1153 ISCSI_CONN_ERROR_TASK_NOT_VALID, 1154 ISCSI_CONN_ERROR_RQ_RING_IS_FULL, 1155 ISCSI_CONN_ERROR_CMDQ_RING_IS_FULL, 1156 ISCSI_CONN_ERROR_HQE_CACHING_FAILED, 1157 ISCSI_CONN_ERROR_HEADER_DIGEST_ERROR, 1158 ISCSI_CONN_ERROR_LOCAL_COMPLETION_ERROR, 1159 ISCSI_CONN_ERROR_DATA_OVERRUN, 1160 ISCSI_CONN_ERROR_OUT_OF_SGES_ERROR, 1161 ISCSI_CONN_ERROR_IP_OPTIONS_ERROR, 1162 ISCSI_CONN_ERROR_PRS_ERRORS, 1163 ISCSI_CONN_ERROR_CONNECT_INVALID_TCP_OPTION, 1164 ISCSI_CONN_ERROR_TCP_IP_FRAGMENT_ERROR, 1165 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_LEN, 1166 ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_TYPE, 1167 ISCSI_CONN_ERROR_PROTOCOL_ERR_ITT_OUT_OF_RANGE, 1168 ISCSI_CONN_ERROR_PROTOCOL_ERR_TTT_OUT_OF_RANGE, 1169 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_EXCEEDS_PDU_SIZE, 1170 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE, 1171 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE_BEFORE_UPDATE, 1172 ISCSI_CONN_ERROR_UNVALID_NOPIN_DSL, 1173 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_CARRIES_NO_DATA, 1174 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SN, 1175 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_IN_TTT, 1176 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_OUT_ITT, 1177 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_TTT, 1178 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_BUFFER_OFFSET, 1179 ISCSI_CONN_ERROR_PROTOCOL_ERR_BUFFER_OFFSET_OOO, 1180 ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_SN, 1181 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0, 1182 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1, 1183 ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_2, 1184 ISCSI_CONN_ERROR_PROTOCOL_ERR_LUN, 1185 ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO, 1186 ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO_S_BIT_ONE, 1187 ISCSI_CONN_ERROR_PROTOCOL_ERR_EXP_STAT_SN, 1188 ISCSI_CONN_ERROR_PROTOCOL_ERR_DSL_NOT_ZERO, 1189 ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_DSL, 1190 ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG, 1191 ISCSI_CONN_ERROR_PROTOCOL_ERR_OUTSTANDING_R2T_COUNT, 1192 ISCSI_CONN_ERROR_PROTOCOL_ERR_DIF_TX, 1193 ISCSI_CONN_ERROR_SENSE_DATA_LENGTH, 1194 ISCSI_CONN_ERROR_DATA_PLACEMENT_ERROR, 1195 ISCSI_CONN_ERROR_INVALID_ITT, 1196 ISCSI_ERROR_UNKNOWN, 1197 MAX_ISCSI_ERROR_TYPES 1198 }; 1199 1200 /* iSCSI Ramrod Command IDs */ 1201 enum iscsi_ramrod_cmd_id { 1202 ISCSI_RAMROD_CMD_ID_UNUSED = 0, 1203 ISCSI_RAMROD_CMD_ID_INIT_FUNC = 1, 1204 ISCSI_RAMROD_CMD_ID_DESTROY_FUNC = 2, 1205 ISCSI_RAMROD_CMD_ID_OFFLOAD_CONN = 3, 1206 ISCSI_RAMROD_CMD_ID_UPDATE_CONN = 4, 1207 ISCSI_RAMROD_CMD_ID_TERMINATION_CONN = 5, 1208 ISCSI_RAMROD_CMD_ID_CLEAR_SQ = 6, 1209 ISCSI_RAMROD_CMD_ID_MAC_UPDATE = 7, 1210 ISCSI_RAMROD_CMD_ID_CONN_STATS = 8, 1211 MAX_ISCSI_RAMROD_CMD_ID 1212 }; 1213 1214 /* iSCSI connection termination request */ 1215 struct iscsi_spe_conn_mac_update { 1216 __le16 reserved0; 1217 __le16 conn_id; 1218 __le32 reserved1; 1219 __le16 remote_mac_addr_lo; 1220 __le16 remote_mac_addr_mid; 1221 __le16 remote_mac_addr_hi; 1222 u8 reserved2[2]; 1223 }; 1224 1225 /* iSCSI and TCP connection (Option 1) offload params passed by driver to FW in 1226 * iSCSI offload ramrod. 1227 */ 1228 struct iscsi_spe_conn_offload { 1229 __le16 reserved0; 1230 __le16 conn_id; 1231 __le32 reserved1; 1232 struct iscsi_conn_offload_params iscsi; 1233 struct tcp_offload_params tcp; 1234 }; 1235 1236 /* iSCSI and TCP connection(Option 2) offload params passed by driver to FW in 1237 * iSCSI offload ramrod. 1238 */ 1239 struct iscsi_spe_conn_offload_option2 { 1240 __le16 reserved0; 1241 __le16 conn_id; 1242 __le32 reserved1; 1243 struct iscsi_conn_offload_params iscsi; 1244 struct tcp_offload_params_opt2 tcp; 1245 }; 1246 1247 /* iSCSI collect connection statistics request */ 1248 struct iscsi_spe_conn_statistics { 1249 __le16 reserved0; 1250 __le16 conn_id; 1251 __le32 reserved1; 1252 u8 reset_stats; 1253 u8 reserved2[7]; 1254 struct regpair stats_cnts_addr; 1255 }; 1256 1257 /* iSCSI connection termination request */ 1258 struct iscsi_spe_conn_termination { 1259 __le16 reserved0; 1260 __le16 conn_id; 1261 __le32 reserved1; 1262 u8 abortive; 1263 u8 reserved2[7]; 1264 struct regpair queue_cnts_addr; 1265 struct regpair query_params_addr; 1266 }; 1267 1268 /* iSCSI firmware function init parameters */ 1269 struct iscsi_spe_func_init { 1270 __le16 half_way_close_timeout; 1271 u8 num_sq_pages_in_ring; 1272 u8 num_r2tq_pages_in_ring; 1273 u8 num_uhq_pages_in_ring; 1274 u8 ll2_rx_queue_id; 1275 u8 flags; 1276 #define ISCSI_SPE_FUNC_INIT_COUNTERS_EN_MASK 0x1 1277 #define ISCSI_SPE_FUNC_INIT_COUNTERS_EN_SHIFT 0 1278 #define ISCSI_SPE_FUNC_INIT_RESERVED0_MASK 0x7F 1279 #define ISCSI_SPE_FUNC_INIT_RESERVED0_SHIFT 1 1280 struct iscsi_debug_modes debug_mode; 1281 u8 params; 1282 #define ISCSI_SPE_FUNC_INIT_MAX_SYN_RT_MASK 0xF 1283 #define ISCSI_SPE_FUNC_INIT_MAX_SYN_RT_SHIFT 0 1284 #define ISCSI_SPE_FUNC_INIT_RESERVED1_MASK 0xF 1285 #define ISCSI_SPE_FUNC_INIT_RESERVED1_SHIFT 4 1286 u8 reserved2[7]; 1287 struct scsi_init_func_params func_params; 1288 struct scsi_init_func_queues q_params; 1289 }; 1290 1291 /* iSCSI task type */ 1292 enum iscsi_task_type { 1293 ISCSI_TASK_TYPE_INITIATOR_WRITE, 1294 ISCSI_TASK_TYPE_INITIATOR_READ, 1295 ISCSI_TASK_TYPE_MIDPATH, 1296 ISCSI_TASK_TYPE_UNSOLIC, 1297 ISCSI_TASK_TYPE_EXCHCLEANUP, 1298 ISCSI_TASK_TYPE_IRRELEVANT, 1299 ISCSI_TASK_TYPE_TARGET_WRITE, 1300 ISCSI_TASK_TYPE_TARGET_READ, 1301 ISCSI_TASK_TYPE_TARGET_RESPONSE, 1302 ISCSI_TASK_TYPE_LOGIN_RESPONSE, 1303 ISCSI_TASK_TYPE_TARGET_IMM_W_DIF, 1304 MAX_ISCSI_TASK_TYPE 1305 }; 1306 1307 /* iSCSI DesiredDataTransferLength/ttt union */ 1308 union iscsi_ttt_txlen_union { 1309 __le32 desired_tx_len; 1310 __le32 ttt; 1311 }; 1312 1313 /* iSCSI uHQ element */ 1314 struct iscsi_uhqe { 1315 __le32 reg1; 1316 #define ISCSI_UHQE_PDU_PAYLOAD_LEN_MASK 0xFFFFF 1317 #define ISCSI_UHQE_PDU_PAYLOAD_LEN_SHIFT 0 1318 #define ISCSI_UHQE_LOCAL_COMP_MASK 0x1 1319 #define ISCSI_UHQE_LOCAL_COMP_SHIFT 20 1320 #define ISCSI_UHQE_TOGGLE_BIT_MASK 0x1 1321 #define ISCSI_UHQE_TOGGLE_BIT_SHIFT 21 1322 #define ISCSI_UHQE_PURE_PAYLOAD_MASK 0x1 1323 #define ISCSI_UHQE_PURE_PAYLOAD_SHIFT 22 1324 #define ISCSI_UHQE_LOGIN_RESPONSE_PDU_MASK 0x1 1325 #define ISCSI_UHQE_LOGIN_RESPONSE_PDU_SHIFT 23 1326 #define ISCSI_UHQE_TASK_ID_HI_MASK 0xFF 1327 #define ISCSI_UHQE_TASK_ID_HI_SHIFT 24 1328 __le32 reg2; 1329 #define ISCSI_UHQE_BUFFER_OFFSET_MASK 0xFFFFFF 1330 #define ISCSI_UHQE_BUFFER_OFFSET_SHIFT 0 1331 #define ISCSI_UHQE_TASK_ID_LO_MASK 0xFF 1332 #define ISCSI_UHQE_TASK_ID_LO_SHIFT 24 1333 }; 1334 1335 /* iSCSI WQ element */ 1336 struct iscsi_wqe { 1337 __le16 task_id; 1338 u8 flags; 1339 #define ISCSI_WQE_WQE_TYPE_MASK 0x7 1340 #define ISCSI_WQE_WQE_TYPE_SHIFT 0 1341 #define ISCSI_WQE_NUM_SGES_MASK 0xF 1342 #define ISCSI_WQE_NUM_SGES_SHIFT 3 1343 #define ISCSI_WQE_RESPONSE_MASK 0x1 1344 #define ISCSI_WQE_RESPONSE_SHIFT 7 1345 struct iscsi_dif_flags prot_flags; 1346 __le32 contlen_cdbsize; 1347 #define ISCSI_WQE_CONT_LEN_MASK 0xFFFFFF 1348 #define ISCSI_WQE_CONT_LEN_SHIFT 0 1349 #define ISCSI_WQE_CDB_SIZE_MASK 0xFF 1350 #define ISCSI_WQE_CDB_SIZE_SHIFT 24 1351 }; 1352 1353 /* iSCSI wqe type */ 1354 enum iscsi_wqe_type { 1355 ISCSI_WQE_TYPE_NORMAL, 1356 ISCSI_WQE_TYPE_TASK_CLEANUP, 1357 ISCSI_WQE_TYPE_MIDDLE_PATH, 1358 ISCSI_WQE_TYPE_LOGIN, 1359 ISCSI_WQE_TYPE_FIRST_R2T_CONT, 1360 ISCSI_WQE_TYPE_NONFIRST_R2T_CONT, 1361 ISCSI_WQE_TYPE_RESPONSE, 1362 MAX_ISCSI_WQE_TYPE 1363 }; 1364 1365 /* iSCSI xHQ element */ 1366 struct iscsi_xhqe { 1367 union iscsi_ttt_txlen_union ttt_or_txlen; 1368 __le32 exp_stat_sn; 1369 struct iscsi_dif_flags prot_flags; 1370 u8 total_ahs_length; 1371 u8 opcode; 1372 u8 flags; 1373 #define ISCSI_XHQE_FINAL_MASK 0x1 1374 #define ISCSI_XHQE_FINAL_SHIFT 0 1375 #define ISCSI_XHQE_STATUS_BIT_MASK 0x1 1376 #define ISCSI_XHQE_STATUS_BIT_SHIFT 1 1377 #define ISCSI_XHQE_NUM_SGES_MASK 0xF 1378 #define ISCSI_XHQE_NUM_SGES_SHIFT 2 1379 #define ISCSI_XHQE_RESERVED0_MASK 0x3 1380 #define ISCSI_XHQE_RESERVED0_SHIFT 6 1381 union iscsi_seq_num seq_num; 1382 __le16 reserved1; 1383 }; 1384 1385 /* Per PF iSCSI receive path statistics - mStorm RAM structure */ 1386 struct mstorm_iscsi_stats_drv { 1387 struct regpair iscsi_rx_dropped_pdus_task_not_valid; 1388 struct regpair iscsi_rx_dup_ack_cnt; 1389 }; 1390 1391 /* Per PF iSCSI transmit path statistics - pStorm RAM structure */ 1392 struct pstorm_iscsi_stats_drv { 1393 struct regpair iscsi_tx_bytes_cnt; 1394 struct regpair iscsi_tx_packet_cnt; 1395 }; 1396 1397 /* Per PF iSCSI receive path statistics - tStorm RAM structure */ 1398 struct tstorm_iscsi_stats_drv { 1399 struct regpair iscsi_rx_bytes_cnt; 1400 struct regpair iscsi_rx_packet_cnt; 1401 struct regpair iscsi_rx_new_ooo_isle_events_cnt; 1402 struct regpair iscsi_rx_tcp_payload_bytes_cnt; 1403 struct regpair iscsi_rx_tcp_pkt_cnt; 1404 struct regpair iscsi_rx_pure_ack_cnt; 1405 __le32 iscsi_cmdq_threshold_cnt; 1406 __le32 iscsi_rq_threshold_cnt; 1407 __le32 iscsi_immq_threshold_cnt; 1408 }; 1409 1410 /* Per PF iSCSI receive path statistics - uStorm RAM structure */ 1411 struct ustorm_iscsi_stats_drv { 1412 struct regpair iscsi_rx_data_pdu_cnt; 1413 struct regpair iscsi_rx_r2t_pdu_cnt; 1414 struct regpair iscsi_rx_total_pdu_cnt; 1415 }; 1416 1417 /* Per PF iSCSI transmit path statistics - xStorm RAM structure */ 1418 struct xstorm_iscsi_stats_drv { 1419 struct regpair iscsi_tx_go_to_slow_start_event_cnt; 1420 struct regpair iscsi_tx_fast_retransmit_event_cnt; 1421 struct regpair iscsi_tx_pure_ack_cnt; 1422 struct regpair iscsi_tx_delayed_ack_cnt; 1423 }; 1424 1425 /* Per PF iSCSI transmit path statistics - yStorm RAM structure */ 1426 struct ystorm_iscsi_stats_drv { 1427 struct regpair iscsi_tx_data_pdu_cnt; 1428 struct regpair iscsi_tx_r2t_pdu_cnt; 1429 struct regpair iscsi_tx_total_pdu_cnt; 1430 struct regpair iscsi_tx_tcp_payload_bytes_cnt; 1431 struct regpair iscsi_tx_tcp_pkt_cnt; 1432 }; 1433 1434 struct tstorm_iscsi_task_ag_ctx { 1435 u8 byte0; 1436 u8 byte1; 1437 __le16 word0; 1438 u8 flags0; 1439 #define TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_MASK 0xF 1440 #define TSTORM_ISCSI_TASK_AG_CTX_NIBBLE0_SHIFT 0 1441 #define TSTORM_ISCSI_TASK_AG_CTX_BIT0_MASK 0x1 1442 #define TSTORM_ISCSI_TASK_AG_CTX_BIT0_SHIFT 4 1443 #define TSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 1444 #define TSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 1445 #define TSTORM_ISCSI_TASK_AG_CTX_BIT2_MASK 0x1 1446 #define TSTORM_ISCSI_TASK_AG_CTX_BIT2_SHIFT 6 1447 #define TSTORM_ISCSI_TASK_AG_CTX_BIT3_MASK 0x1 1448 #define TSTORM_ISCSI_TASK_AG_CTX_BIT3_SHIFT 7 1449 u8 flags1; 1450 #define TSTORM_ISCSI_TASK_AG_CTX_BIT4_MASK 0x1 1451 #define TSTORM_ISCSI_TASK_AG_CTX_BIT4_SHIFT 0 1452 #define TSTORM_ISCSI_TASK_AG_CTX_BIT5_MASK 0x1 1453 #define TSTORM_ISCSI_TASK_AG_CTX_BIT5_SHIFT 1 1454 #define TSTORM_ISCSI_TASK_AG_CTX_CF0_MASK 0x3 1455 #define TSTORM_ISCSI_TASK_AG_CTX_CF0_SHIFT 2 1456 #define TSTORM_ISCSI_TASK_AG_CTX_CF1_MASK 0x3 1457 #define TSTORM_ISCSI_TASK_AG_CTX_CF1_SHIFT 4 1458 #define TSTORM_ISCSI_TASK_AG_CTX_CF2_MASK 0x3 1459 #define TSTORM_ISCSI_TASK_AG_CTX_CF2_SHIFT 6 1460 u8 flags2; 1461 #define TSTORM_ISCSI_TASK_AG_CTX_CF3_MASK 0x3 1462 #define TSTORM_ISCSI_TASK_AG_CTX_CF3_SHIFT 0 1463 #define TSTORM_ISCSI_TASK_AG_CTX_CF4_MASK 0x3 1464 #define TSTORM_ISCSI_TASK_AG_CTX_CF4_SHIFT 2 1465 #define TSTORM_ISCSI_TASK_AG_CTX_CF5_MASK 0x3 1466 #define TSTORM_ISCSI_TASK_AG_CTX_CF5_SHIFT 4 1467 #define TSTORM_ISCSI_TASK_AG_CTX_CF6_MASK 0x3 1468 #define TSTORM_ISCSI_TASK_AG_CTX_CF6_SHIFT 6 1469 u8 flags3; 1470 #define TSTORM_ISCSI_TASK_AG_CTX_CF7_MASK 0x3 1471 #define TSTORM_ISCSI_TASK_AG_CTX_CF7_SHIFT 0 1472 #define TSTORM_ISCSI_TASK_AG_CTX_CF0EN_MASK 0x1 1473 #define TSTORM_ISCSI_TASK_AG_CTX_CF0EN_SHIFT 2 1474 #define TSTORM_ISCSI_TASK_AG_CTX_CF1EN_MASK 0x1 1475 #define TSTORM_ISCSI_TASK_AG_CTX_CF1EN_SHIFT 3 1476 #define TSTORM_ISCSI_TASK_AG_CTX_CF2EN_MASK 0x1 1477 #define TSTORM_ISCSI_TASK_AG_CTX_CF2EN_SHIFT 4 1478 #define TSTORM_ISCSI_TASK_AG_CTX_CF3EN_MASK 0x1 1479 #define TSTORM_ISCSI_TASK_AG_CTX_CF3EN_SHIFT 5 1480 #define TSTORM_ISCSI_TASK_AG_CTX_CF4EN_MASK 0x1 1481 #define TSTORM_ISCSI_TASK_AG_CTX_CF4EN_SHIFT 6 1482 #define TSTORM_ISCSI_TASK_AG_CTX_CF5EN_MASK 0x1 1483 #define TSTORM_ISCSI_TASK_AG_CTX_CF5EN_SHIFT 7 1484 u8 flags4; 1485 #define TSTORM_ISCSI_TASK_AG_CTX_CF6EN_MASK 0x1 1486 #define TSTORM_ISCSI_TASK_AG_CTX_CF6EN_SHIFT 0 1487 #define TSTORM_ISCSI_TASK_AG_CTX_CF7EN_MASK 0x1 1488 #define TSTORM_ISCSI_TASK_AG_CTX_CF7EN_SHIFT 1 1489 #define TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_MASK 0x1 1490 #define TSTORM_ISCSI_TASK_AG_CTX_RULE0EN_SHIFT 2 1491 #define TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_MASK 0x1 1492 #define TSTORM_ISCSI_TASK_AG_CTX_RULE1EN_SHIFT 3 1493 #define TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_MASK 0x1 1494 #define TSTORM_ISCSI_TASK_AG_CTX_RULE2EN_SHIFT 4 1495 #define TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_MASK 0x1 1496 #define TSTORM_ISCSI_TASK_AG_CTX_RULE3EN_SHIFT 5 1497 #define TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_MASK 0x1 1498 #define TSTORM_ISCSI_TASK_AG_CTX_RULE4EN_SHIFT 6 1499 #define TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_MASK 0x1 1500 #define TSTORM_ISCSI_TASK_AG_CTX_RULE5EN_SHIFT 7 1501 u8 byte2; 1502 __le16 word1; 1503 __le32 reg0; 1504 u8 byte3; 1505 u8 byte4; 1506 __le16 word2; 1507 __le16 word3; 1508 __le16 word4; 1509 __le32 reg1; 1510 __le32 reg2; 1511 }; 1512 1513 /* iSCSI doorbell data */ 1514 struct iscsi_db_data { 1515 u8 params; 1516 #define ISCSI_DB_DATA_DEST_MASK 0x3 1517 #define ISCSI_DB_DATA_DEST_SHIFT 0 1518 #define ISCSI_DB_DATA_AGG_CMD_MASK 0x3 1519 #define ISCSI_DB_DATA_AGG_CMD_SHIFT 2 1520 #define ISCSI_DB_DATA_BYPASS_EN_MASK 0x1 1521 #define ISCSI_DB_DATA_BYPASS_EN_SHIFT 4 1522 #define ISCSI_DB_DATA_RESERVED_MASK 0x1 1523 #define ISCSI_DB_DATA_RESERVED_SHIFT 5 1524 #define ISCSI_DB_DATA_AGG_VAL_SEL_MASK 0x3 1525 #define ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT 6 1526 u8 agg_flags; 1527 __le16 sq_prod; 1528 }; 1529 1530 #endif /* __ISCSI_COMMON__ */ 1531
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.