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