1 /** 2 * Copyright (C) 2005 - 2016 Broadcom 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License version 2 7 * as published by the Free Software Foundation. The full GNU General 8 * Public License is included in this distribution in the file called COPYING. 9 * 10 * Contact Information: 11 * linux-drivers@broadcom.com 12 * 13 * Emulex 14 * 3333 Susan Street 15 * Costa Mesa, CA 92626 16 */ 17 18 #ifndef BEISCSI_CMDS_H 19 #define BEISCSI_CMDS_H 20 21 /** 22 * The driver sends configuration and managements command requests to the 23 * firmware in the BE. These requests are communicated to the processor 24 * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one 25 * WRB inside a MAILBOX. 26 * The commands are serviced by the ARM processor in the OneConnect's MPU. 27 */ 28 struct be_sge { 29 __le32 pa_lo; 30 __le32 pa_hi; 31 __le32 len; 32 }; 33 34 struct be_mcc_wrb { 35 u32 emb_sgecnt_special; /* dword 0 */ 36 /* bits 0 - embedded */ 37 /* bits 1 - 2 reserved */ 38 /* bits 3 - 7 sge count */ 39 /* bits 8 - 23 reserved */ 40 /* bits 24 - 31 special */ 41 #define MCC_WRB_EMBEDDED_MASK 1 42 #define MCC_WRB_SGE_CNT_SHIFT 3 43 #define MCC_WRB_SGE_CNT_MASK 0x1F 44 u32 payload_length; /* dword 1 */ 45 u32 tag0; /* dword 2 */ 46 u32 tag1; /* dword 3 */ 47 u32 rsvd; /* dword 4 */ 48 union { 49 #define EMBED_MBX_MAX_PAYLOAD_SIZE 220 50 u8 embedded_payload[236]; /* used by embedded cmds */ 51 struct be_sge sgl[19]; /* used by non-embedded cmds */ 52 } payload; 53 }; 54 55 #define CQE_FLAGS_VALID_MASK (1 << 31) 56 #define CQE_FLAGS_ASYNC_MASK (1 << 30) 57 #define CQE_FLAGS_COMPLETED_MASK (1 << 28) 58 #define CQE_FLAGS_CONSUMED_MASK (1 << 27) 59 60 /* Completion Status */ 61 #define MCC_STATUS_SUCCESS 0x0 62 #define MCC_STATUS_FAILED 0x1 63 #define MCC_STATUS_ILLEGAL_REQUEST 0x2 64 #define MCC_STATUS_ILLEGAL_FIELD 0x3 65 #define MCC_STATUS_INSUFFICIENT_BUFFER 0x4 66 #define MCC_STATUS_INVALID_LENGTH 0x74 67 68 #define CQE_STATUS_COMPL_MASK 0xFFFF 69 #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ 70 #define CQE_STATUS_EXTD_MASK 0xFFFF 71 #define CQE_STATUS_EXTD_SHIFT 16 /* bits 31 - 16 */ 72 #define CQE_STATUS_ADDL_MASK 0xFF00 73 #define CQE_STATUS_ADDL_SHIFT 8 74 #define CQE_STATUS_MASK 0xFF 75 #define CQE_STATUS_WRB_MASK 0xFF0000 76 #define CQE_STATUS_WRB_SHIFT 16 77 78 #define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000) 79 #define BEISCSI_FW_MBX_TIMEOUT 100 80 81 /* MBOX Command VER */ 82 #define MBX_CMD_VER1 0x01 83 #define MBX_CMD_VER2 0x02 84 85 struct be_mcc_compl { 86 u32 status; /* dword 0 */ 87 u32 tag0; /* dword 1 */ 88 u32 tag1; /* dword 2 */ 89 u32 flags; /* dword 3 */ 90 }; 91 92 /********* Mailbox door bell *************/ 93 /** 94 * Used for driver communication with the FW. 95 * The software must write this register twice to post any command. First, 96 * it writes the register with hi=1 and the upper bits of the physical address 97 * for the MAILBOX structure. Software must poll the ready bit until this 98 * is acknowledged. Then, sotware writes the register with hi=0 with the lower 99 * bits in the address. It must poll the ready bit until the command is 100 * complete. Upon completion, the MAILBOX will contain a valid completion 101 * queue entry. 102 */ 103 #define MPU_MAILBOX_DB_OFFSET 0x160 104 #define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */ 105 #define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */ 106 107 /********** MPU semphore: used for SH & BE ******************/ 108 #define SLIPORT_SOFTRESET_OFFSET 0x5c /* CSR BAR offset */ 109 #define SLIPORT_SEMAPHORE_OFFSET_BEx 0xac /* CSR BAR offset */ 110 #define SLIPORT_SEMAPHORE_OFFSET_SH 0x94 /* PCI-CFG offset */ 111 #define POST_STAGE_MASK 0x0000FFFF 112 #define POST_ERROR_BIT 0x80000000 113 #define POST_ERR_RECOVERY_CODE_MASK 0xF000 114 115 /* Soft Reset register masks */ 116 #define SLIPORT_SOFTRESET_SR_MASK 0x00000080 /* SR bit */ 117 118 /* MPU semphore POST stage values */ 119 #define POST_STAGE_AWAITING_HOST_RDY 0x1 /* FW awaiting goahead from host */ 120 #define POST_STAGE_HOST_RDY 0x2 /* Host has given go-ahed to FW */ 121 #define POST_STAGE_BE_RESET 0x3 /* Host wants to reset chip */ 122 #define POST_STAGE_ARMFW_RDY 0xC000 /* FW is done with POST */ 123 #define POST_STAGE_RECOVERABLE_ERR 0xE000 /* Recoverable err detected */ 124 125 /********** MCC door bell ************/ 126 #define DB_MCCQ_OFFSET 0x140 127 #define DB_MCCQ_RING_ID_MASK 0xFFFF /* bits 0 - 15 */ 128 /* Number of entries posted */ 129 #define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */ 130 131 /** 132 * When the async bit of mcc_compl is set, the last 4 bytes of 133 * mcc_compl is interpreted as follows: 134 */ 135 #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */ 136 #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF 137 #define ASYNC_EVENT_CODE_LINK_STATE 0x1 138 #define ASYNC_EVENT_CODE_ISCSI 0x4 139 #define ASYNC_EVENT_CODE_SLI 0x11 140 141 #define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16 /* bits 16 - 23 */ 142 #define ASYNC_TRAILER_EVENT_TYPE_MASK 0xFF 143 144 /* iSCSI events */ 145 #define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4 146 #define ASYNC_EVENT_NEW_ISCSI_CONN 0x5 147 #define ASYNC_EVENT_NEW_TCP_CONN 0x7 148 149 /* SLI events */ 150 #define ASYNC_SLI_EVENT_TYPE_MISCONFIGURED 0x9 151 #define ASYNC_SLI_LINK_EFFECT_VALID(le) (le & 0x80) 152 #define ASYNC_SLI_LINK_EFFECT_SEV(le) ((le >> 1) & 0x03) 153 #define ASYNC_SLI_LINK_EFFECT_STATE(le) (le & 0x01) 154 155 struct be_async_event_trailer { 156 u32 code; 157 }; 158 159 enum { 160 ASYNC_EVENT_LINK_DOWN = 0x0, 161 ASYNC_EVENT_LINK_UP = 0x1, 162 }; 163 164 /** 165 * When the event code of an async trailer is link-state, the mcc_compl 166 * must be interpreted as follows 167 */ 168 struct be_async_event_link_state { 169 u8 physical_port; 170 u8 port_link_status; 171 /** 172 * ASYNC_EVENT_LINK_DOWN 0x0 173 * ASYNC_EVENT_LINK_UP 0x1 174 * ASYNC_EVENT_LINK_LOGICAL_DOWN 0x2 175 * ASYNC_EVENT_LINK_LOGICAL_UP 0x3 176 */ 177 #define BE_ASYNC_LINK_UP_MASK 0x01 178 u8 port_duplex; 179 u8 port_speed; 180 /* BE2ISCSI_LINK_SPEED_ZERO 0x00 - no link */ 181 #define BE2ISCSI_LINK_SPEED_10MBPS 0x01 182 #define BE2ISCSI_LINK_SPEED_100MBPS 0x02 183 #define BE2ISCSI_LINK_SPEED_1GBPS 0x03 184 #define BE2ISCSI_LINK_SPEED_10GBPS 0x04 185 #define BE2ISCSI_LINK_SPEED_25GBPS 0x06 186 #define BE2ISCSI_LINK_SPEED_40GBPS 0x07 187 u8 port_fault; 188 u8 event_reason; 189 u16 qos_link_speed; 190 u32 event_tag; 191 struct be_async_event_trailer trailer; 192 } __packed; 193 194 /** 195 * When async-trailer is SLI event, mcc_compl is interpreted as 196 */ 197 struct be_async_event_sli { 198 u32 event_data1; 199 u32 event_data2; 200 u32 reserved; 201 u32 trailer; 202 } __packed; 203 204 struct be_mcc_mailbox { 205 struct be_mcc_wrb wrb; 206 struct be_mcc_compl compl; 207 }; 208 209 /* Type of subsystems supported by FW */ 210 #define CMD_SUBSYSTEM_COMMON 0x1 211 #define CMD_SUBSYSTEM_ISCSI 0x2 212 #define CMD_SUBSYSTEM_ETH 0x3 213 #define CMD_SUBSYSTEM_ISCSI_INI 0x6 214 #define CMD_COMMON_TCP_UPLOAD 0x1 215 216 /** 217 * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON 218 * These opcodes are unique for each subsystem defined above 219 */ 220 #define OPCODE_COMMON_CQ_CREATE 12 221 #define OPCODE_COMMON_EQ_CREATE 13 222 #define OPCODE_COMMON_MCC_CREATE 21 223 #define OPCODE_COMMON_MCC_CREATE_EXT 90 224 #define OPCODE_COMMON_ADD_TEMPLATE_HEADER_BUFFERS 24 225 #define OPCODE_COMMON_REMOVE_TEMPLATE_HEADER_BUFFERS 25 226 #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32 227 #define OPCODE_COMMON_GET_FW_VERSION 35 228 #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 229 #define OPCODE_COMMON_FIRMWARE_CONFIG 42 230 #define OPCODE_COMMON_MCC_DESTROY 53 231 #define OPCODE_COMMON_CQ_DESTROY 54 232 #define OPCODE_COMMON_EQ_DESTROY 55 233 #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 234 #define OPCODE_COMMON_FUNCTION_RESET 61 235 #define OPCODE_COMMON_GET_PORT_NAME 77 236 #define OPCODE_COMMON_SET_FEATURES 191 237 238 /** 239 * LIST of opcodes that are common between Initiator and Target 240 * used by CMD_SUBSYSTEM_ISCSI 241 * These opcodes are unique for each subsystem defined above 242 */ 243 #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2 244 #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3 245 #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7 246 #define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14 247 #define OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR 17 248 #define OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR 18 249 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21 250 #define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22 251 #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23 252 #define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24 253 #define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25 254 #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61 255 #define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64 256 #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65 257 #define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66 258 #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67 259 260 struct be_cmd_req_hdr { 261 u8 opcode; /* dword 0 */ 262 u8 subsystem; /* dword 0 */ 263 u8 port_number; /* dword 0 */ 264 u8 domain; /* dword 0 */ 265 u32 timeout; /* dword 1 */ 266 u32 request_length; /* dword 2 */ 267 u8 version; /* dword 3 */ 268 u8 rsvd0[3]; /* dword 3 */ 269 }; 270 271 struct be_cmd_resp_hdr { 272 u32 info; /* dword 0 */ 273 u32 status; /* dword 1 */ 274 u32 response_length; /* dword 2 */ 275 u32 actual_resp_len; /* dword 3 */ 276 }; 277 278 struct phys_addr { 279 u32 lo; 280 u32 hi; 281 }; 282 283 struct virt_addr { 284 u32 lo; 285 u32 hi; 286 }; 287 /************************** 288 * BE Command definitions * 289 **************************/ 290 291 /** 292 * Pseudo amap definition in which each bit of the actual structure is defined 293 * as a byte - used to calculate offset/shift/mask of each field 294 */ 295 struct amap_eq_context { 296 u8 cidx[13]; /* dword 0 */ 297 u8 rsvd0[3]; /* dword 0 */ 298 u8 epidx[13]; /* dword 0 */ 299 u8 valid; /* dword 0 */ 300 u8 rsvd1; /* dword 0 */ 301 u8 size; /* dword 0 */ 302 u8 pidx[13]; /* dword 1 */ 303 u8 rsvd2[3]; /* dword 1 */ 304 u8 pd[10]; /* dword 1 */ 305 u8 count[3]; /* dword 1 */ 306 u8 solevent; /* dword 1 */ 307 u8 stalled; /* dword 1 */ 308 u8 armed; /* dword 1 */ 309 u8 rsvd3[4]; /* dword 2 */ 310 u8 func[8]; /* dword 2 */ 311 u8 rsvd4; /* dword 2 */ 312 u8 delaymult[10]; /* dword 2 */ 313 u8 rsvd5[2]; /* dword 2 */ 314 u8 phase[2]; /* dword 2 */ 315 u8 nodelay; /* dword 2 */ 316 u8 rsvd6[4]; /* dword 2 */ 317 u8 rsvd7[32]; /* dword 3 */ 318 } __packed; 319 320 struct be_cmd_req_eq_create { 321 struct be_cmd_req_hdr hdr; /* dw[4] */ 322 u16 num_pages; /* sword */ 323 u16 rsvd0; /* sword */ 324 u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */ 325 struct phys_addr pages[8]; 326 } __packed; 327 328 struct be_cmd_resp_eq_create { 329 struct be_cmd_resp_hdr resp_hdr; 330 u16 eq_id; /* sword */ 331 u16 rsvd0; /* sword */ 332 } __packed; 333 334 struct be_set_eqd { 335 u32 eq_id; 336 u32 phase; 337 u32 delay_multiplier; 338 } __packed; 339 340 struct mgmt_chap_format { 341 u32 flags; 342 u8 intr_chap_name[256]; 343 u8 intr_secret[16]; 344 u8 target_chap_name[256]; 345 u8 target_secret[16]; 346 u16 intr_chap_name_length; 347 u16 intr_secret_length; 348 u16 target_chap_name_length; 349 u16 target_secret_length; 350 } __packed; 351 352 struct mgmt_auth_method_format { 353 u8 auth_method_type; 354 u8 padding[3]; 355 struct mgmt_chap_format chap; 356 } __packed; 357 358 struct be_cmd_req_logout_fw_sess { 359 struct be_cmd_req_hdr hdr; /* dw[4] */ 360 uint32_t session_handle; 361 } __packed; 362 363 struct be_cmd_resp_logout_fw_sess { 364 struct be_cmd_resp_hdr hdr; /* dw[4] */ 365 uint32_t session_status; 366 #define BE_SESS_STATUS_CLOSE 0x20 367 } __packed; 368 369 struct mgmt_conn_login_options { 370 u8 flags; 371 u8 header_digest; 372 u8 data_digest; 373 u8 rsvd0; 374 u32 max_recv_datasegment_len_ini; 375 u32 max_recv_datasegment_len_tgt; 376 u32 tcp_mss; 377 u32 tcp_window_size; 378 struct mgmt_auth_method_format auth_data; 379 } __packed; 380 381 struct ip_addr_format { 382 u16 size_of_structure; 383 u8 reserved; 384 u8 ip_type; 385 #define BEISCSI_IP_TYPE_V4 0x1 386 #define BEISCSI_IP_TYPE_STATIC_V4 0x3 387 #define BEISCSI_IP_TYPE_DHCP_V4 0x5 388 /* type v4 values < type v6 values */ 389 #define BEISCSI_IP_TYPE_V6 0x10 390 #define BEISCSI_IP_TYPE_ROUTABLE_V6 0x30 391 #define BEISCSI_IP_TYPE_LINK_LOCAL_V6 0x50 392 #define BEISCSI_IP_TYPE_AUTO_V6 0x90 393 u8 addr[16]; 394 u32 rsvd0; 395 } __packed; 396 397 struct mgmt_conn_info { 398 u32 connection_handle; 399 u32 connection_status; 400 u16 src_port; 401 u16 dest_port; 402 u16 dest_port_redirected; 403 u16 cid; 404 u32 estimated_throughput; 405 struct ip_addr_format src_ipaddr; 406 struct ip_addr_format dest_ipaddr; 407 struct ip_addr_format dest_ipaddr_redirected; 408 struct mgmt_conn_login_options negotiated_login_options; 409 } __packed; 410 411 struct mgmt_session_login_options { 412 u8 flags; 413 u8 error_recovery_level; 414 u16 rsvd0; 415 u32 first_burst_length; 416 u32 max_burst_length; 417 u16 max_connections; 418 u16 max_outstanding_r2t; 419 u16 default_time2wait; 420 u16 default_time2retain; 421 } __packed; 422 423 struct mgmt_session_info { 424 u32 session_handle; 425 u32 status; 426 u8 isid[6]; 427 u16 tsih; 428 u32 session_flags; 429 u16 conn_count; 430 u16 pad; 431 u8 target_name[224]; 432 u8 initiator_iscsiname[224]; 433 struct mgmt_session_login_options negotiated_login_options; 434 struct mgmt_conn_info conn_list[1]; 435 } __packed; 436 437 struct be_cmd_get_session_req { 438 struct be_cmd_req_hdr hdr; 439 u32 session_handle; 440 } __packed; 441 442 struct be_cmd_get_session_resp { 443 struct be_cmd_resp_hdr hdr; 444 struct mgmt_session_info session_info; 445 } __packed; 446 447 struct mac_addr { 448 u16 size_of_structure; 449 u8 addr[ETH_ALEN]; 450 } __packed; 451 452 struct be_cmd_get_boot_target_req { 453 struct be_cmd_req_hdr hdr; 454 } __packed; 455 456 struct be_cmd_get_boot_target_resp { 457 struct be_cmd_resp_hdr hdr; 458 u32 boot_session_count; 459 u32 boot_session_handle; 460 /** 461 * FW returns 0xffffffff if it couldn't establish connection with 462 * configured boot target. 463 */ 464 #define BE_BOOT_INVALID_SHANDLE 0xffffffff 465 }; 466 467 struct be_cmd_reopen_session_req { 468 struct be_cmd_req_hdr hdr; 469 #define BE_REOPEN_ALL_SESSIONS 0x00 470 #define BE_REOPEN_BOOT_SESSIONS 0x01 471 #define BE_REOPEN_A_SESSION 0x02 472 u16 reopen_type; 473 u16 rsvd; 474 u32 session_handle; 475 } __packed; 476 477 struct be_cmd_reopen_session_resp { 478 struct be_cmd_resp_hdr hdr; 479 u32 rsvd; 480 u32 session_handle; 481 } __packed; 482 483 484 struct be_cmd_mac_query_req { 485 struct be_cmd_req_hdr hdr; 486 u8 type; 487 u8 permanent; 488 u16 if_id; 489 } __packed; 490 491 struct be_cmd_get_mac_resp { 492 struct be_cmd_resp_hdr hdr; 493 struct mac_addr mac; 494 }; 495 496 struct be_ip_addr_subnet_format { 497 u16 size_of_structure; 498 u8 ip_type; 499 u8 ipv6_prefix_length; 500 u8 addr[16]; 501 u8 subnet_mask[16]; 502 u32 rsvd0; 503 } __packed; 504 505 struct be_cmd_get_if_info_req { 506 struct be_cmd_req_hdr hdr; 507 u32 interface_hndl; 508 u32 ip_type; 509 } __packed; 510 511 struct be_cmd_get_if_info_resp { 512 struct be_cmd_req_hdr hdr; 513 u32 interface_hndl; 514 u32 vlan_priority; 515 u32 ip_addr_count; 516 u32 dhcp_state; 517 struct be_ip_addr_subnet_format ip_addr; 518 } __packed; 519 520 struct be_ip_addr_record { 521 u32 action; 522 u32 interface_hndl; 523 struct be_ip_addr_subnet_format ip_addr; 524 u32 status; 525 } __packed; 526 527 struct be_ip_addr_record_params { 528 u32 record_entry_count; 529 struct be_ip_addr_record ip_record; 530 } __packed; 531 532 struct be_cmd_set_ip_addr_req { 533 struct be_cmd_req_hdr hdr; 534 struct be_ip_addr_record_params ip_params; 535 } __packed; 536 537 538 struct be_cmd_set_dhcp_req { 539 struct be_cmd_req_hdr hdr; 540 u32 interface_hndl; 541 u32 ip_type; 542 u32 flags; 543 u32 retry_count; 544 } __packed; 545 546 struct be_cmd_rel_dhcp_req { 547 struct be_cmd_req_hdr hdr; 548 u32 interface_hndl; 549 u32 ip_type; 550 } __packed; 551 552 struct be_cmd_set_def_gateway_req { 553 struct be_cmd_req_hdr hdr; 554 u32 action; 555 struct ip_addr_format ip_addr; 556 } __packed; 557 558 struct be_cmd_get_def_gateway_req { 559 struct be_cmd_req_hdr hdr; 560 u32 ip_type; 561 } __packed; 562 563 struct be_cmd_get_def_gateway_resp { 564 struct be_cmd_req_hdr hdr; 565 struct ip_addr_format ip_addr; 566 } __packed; 567 568 #define BEISCSI_VLAN_DISABLE 0xFFFF 569 struct be_cmd_set_vlan_req { 570 struct be_cmd_req_hdr hdr; 571 u32 interface_hndl; 572 u32 vlan_priority; 573 } __packed; 574 /******************** Create CQ ***************************/ 575 /** 576 * Pseudo amap definition in which each bit of the actual structure is defined 577 * as a byte - used to calculate offset/shift/mask of each field 578 */ 579 struct amap_cq_context { 580 u8 cidx[11]; /* dword 0 */ 581 u8 rsvd0; /* dword 0 */ 582 u8 coalescwm[2]; /* dword 0 */ 583 u8 nodelay; /* dword 0 */ 584 u8 epidx[11]; /* dword 0 */ 585 u8 rsvd1; /* dword 0 */ 586 u8 count[2]; /* dword 0 */ 587 u8 valid; /* dword 0 */ 588 u8 solevent; /* dword 0 */ 589 u8 eventable; /* dword 0 */ 590 u8 pidx[11]; /* dword 1 */ 591 u8 rsvd2; /* dword 1 */ 592 u8 pd[10]; /* dword 1 */ 593 u8 eqid[8]; /* dword 1 */ 594 u8 stalled; /* dword 1 */ 595 u8 armed; /* dword 1 */ 596 u8 rsvd3[4]; /* dword 2 */ 597 u8 func[8]; /* dword 2 */ 598 u8 rsvd4[20]; /* dword 2 */ 599 u8 rsvd5[32]; /* dword 3 */ 600 } __packed; 601 602 struct amap_cq_context_v2 { 603 u8 rsvd0[12]; /* dword 0 */ 604 u8 coalescwm[2]; /* dword 0 */ 605 u8 nodelay; /* dword 0 */ 606 u8 rsvd1[12]; /* dword 0 */ 607 u8 count[2]; /* dword 0 */ 608 u8 valid; /* dword 0 */ 609 u8 rsvd2; /* dword 0 */ 610 u8 eventable; /* dword 0 */ 611 u8 eqid[16]; /* dword 1 */ 612 u8 rsvd3[15]; /* dword 1 */ 613 u8 armed; /* dword 1 */ 614 u8 cqecount[16];/* dword 2 */ 615 u8 rsvd4[16]; /* dword 2 */ 616 u8 rsvd5[32]; /* dword 3 */ 617 }; 618 619 struct be_cmd_req_cq_create { 620 struct be_cmd_req_hdr hdr; 621 u16 num_pages; 622 u8 page_size; 623 u8 rsvd0; 624 u8 context[sizeof(struct amap_cq_context) / 8]; 625 struct phys_addr pages[4]; 626 } __packed; 627 628 struct be_cmd_resp_cq_create { 629 struct be_cmd_resp_hdr hdr; 630 u16 cq_id; 631 u16 rsvd0; 632 } __packed; 633 634 /******************** Create MCCQ ***************************/ 635 /** 636 * Pseudo amap definition in which each bit of the actual structure is defined 637 * as a byte - used to calculate offset/shift/mask of each field 638 */ 639 struct amap_mcc_context { 640 u8 con_index[14]; 641 u8 rsvd0[2]; 642 u8 ring_size[4]; 643 u8 fetch_wrb; 644 u8 fetch_r2t; 645 u8 cq_id[10]; 646 u8 prod_index[14]; 647 u8 fid[8]; 648 u8 pdid[9]; 649 u8 valid; 650 u8 rsvd1[32]; 651 u8 rsvd2[32]; 652 } __packed; 653 654 struct be_cmd_req_mcc_create_ext { 655 struct be_cmd_req_hdr hdr; 656 u16 num_pages; 657 u16 rsvd0; 658 u32 async_evt_bitmap; 659 u8 context[sizeof(struct amap_mcc_context) / 8]; 660 struct phys_addr pages[8]; 661 } __packed; 662 663 struct be_cmd_resp_mcc_create { 664 struct be_cmd_resp_hdr hdr; 665 u16 id; 666 u16 rsvd0; 667 } __packed; 668 669 /******************** Q Destroy ***************************/ 670 /* Type of Queue to be destroyed */ 671 enum { 672 QTYPE_EQ = 1, 673 QTYPE_CQ, 674 QTYPE_MCCQ, 675 QTYPE_WRBQ, 676 QTYPE_DPDUQ, 677 QTYPE_SGL 678 }; 679 680 struct be_cmd_req_q_destroy { 681 struct be_cmd_req_hdr hdr; 682 u16 id; 683 u16 bypass_flush; /* valid only for rx q destroy */ 684 } __packed; 685 686 struct macaddr { 687 u8 byte[ETH_ALEN]; 688 }; 689 690 struct be_cmd_req_mcast_mac_config { 691 struct be_cmd_req_hdr hdr; 692 u16 num_mac; 693 u8 promiscuous; 694 u8 interface_id; 695 struct macaddr mac[32]; 696 } __packed; 697 698 static inline void *embedded_payload(struct be_mcc_wrb *wrb) 699 { 700 return wrb->payload.embedded_payload; 701 } 702 703 static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb) 704 { 705 return &wrb->payload.sgl[0]; 706 } 707 708 /******************** Modify EQ Delay *******************/ 709 struct be_cmd_req_modify_eq_delay { 710 struct be_cmd_req_hdr hdr; 711 __le32 num_eq; 712 struct { 713 __le32 eq_id; 714 __le32 phase; 715 __le32 delay_multiplier; 716 } delay[MAX_CPUS]; 717 } __packed; 718 719 /******************** Get MAC ADDR *******************/ 720 721 struct be_cmd_get_nic_conf_resp { 722 struct be_cmd_resp_hdr hdr; 723 u32 nic_port_count; 724 u32 speed; 725 u32 max_speed; 726 u32 link_state; 727 u32 max_frame_size; 728 u16 size_of_structure; 729 u8 mac_address[ETH_ALEN]; 730 } __packed; 731 732 /******************** Get HBA NAME *******************/ 733 734 struct be_cmd_hba_name { 735 struct be_cmd_req_hdr hdr; 736 u16 flags; 737 u16 rsvd0; 738 u8 initiator_name[ISCSI_NAME_LEN]; 739 #define BE_INI_ALIAS_LEN 32 740 u8 initiator_alias[BE_INI_ALIAS_LEN]; 741 } __packed; 742 743 /******************** COMMON SET Features *******************/ 744 #define BE_CMD_SET_FEATURE_UER 0x10 745 #define BE_CMD_UER_SUPP_BIT 0x1 746 struct be_uer_req { 747 u32 uer; 748 u32 rsvd; 749 }; 750 751 struct be_uer_resp { 752 u32 uer; 753 u16 ue2rp; 754 u16 ue2sr; 755 }; 756 757 struct be_cmd_set_features { 758 union { 759 struct be_cmd_req_hdr req_hdr; 760 struct be_cmd_resp_hdr resp_hdr; 761 } h; 762 u32 feature; 763 u32 param_len; 764 union { 765 struct be_uer_req req; 766 struct be_uer_resp resp; 767 u32 rsvd[2]; 768 } param; 769 } __packed; 770 771 int beiscsi_cmd_function_reset(struct beiscsi_hba *phba); 772 773 int beiscsi_cmd_special_wrb(struct be_ctrl_info *ctrl, u32 load); 774 775 int beiscsi_check_fw_rdy(struct beiscsi_hba *phba); 776 777 int beiscsi_init_sliport(struct beiscsi_hba *phba); 778 779 int beiscsi_cmd_iscsi_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num); 780 781 int beiscsi_detect_ue(struct beiscsi_hba *phba); 782 783 int beiscsi_detect_tpe(struct beiscsi_hba *phba); 784 785 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, 786 struct be_queue_info *eq, int eq_delay); 787 788 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, 789 struct be_queue_info *cq, struct be_queue_info *eq, 790 bool sol_evts, bool no_delay, 791 int num_cqe_dma_coalesce); 792 793 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, 794 int type); 795 int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba, 796 struct be_queue_info *mccq, 797 struct be_queue_info *cq); 798 799 unsigned int be_cmd_get_initname(struct beiscsi_hba *phba); 800 801 void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag); 802 803 int beiscsi_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *, 804 int num); 805 int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba, 806 unsigned int tag, 807 struct be_mcc_wrb **wrb, 808 struct be_dma_mem *mbx_cmd_mem); 809 int __beiscsi_mcc_compl_status(struct beiscsi_hba *phba, 810 unsigned int tag, 811 struct be_mcc_wrb **wrb, 812 struct be_dma_mem *mbx_cmd_mem); 813 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem); 814 void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag); 815 struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba, 816 unsigned int *ref_tag); 817 void beiscsi_process_async_event(struct beiscsi_hba *phba, 818 struct be_mcc_compl *compl); 819 int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl, 820 struct be_mcc_compl *compl); 821 822 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl, 823 struct be_queue_info *cq, 824 struct be_queue_info *dq, int length, 825 int entry_size, uint8_t is_header, 826 uint8_t ulp_num); 827 828 int be_cmd_iscsi_post_template_hdr(struct be_ctrl_info *ctrl, 829 struct be_dma_mem *q_mem); 830 831 int be_cmd_iscsi_remove_template_hdr(struct be_ctrl_info *ctrl); 832 833 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, 834 struct be_dma_mem *q_mem, u32 page_offset, 835 u32 num_pages); 836 837 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem, 838 struct be_queue_info *wrbq, 839 struct hwi_wrb_context *pwrb_context, 840 uint8_t ulp_num); 841 842 /* Configuration Functions */ 843 int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag); 844 845 int beiscsi_check_supported_fw(struct be_ctrl_info *ctrl, 846 struct beiscsi_hba *phba); 847 848 int beiscsi_get_fw_config(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba); 849 850 int beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba); 851 852 int beiscsi_set_uer_feature(struct beiscsi_hba *phba); 853 854 struct be_default_pdu_context { 855 u32 dw[4]; 856 } __packed; 857 858 struct amap_be_default_pdu_context { 859 u8 dbuf_cindex[13]; /* dword 0 */ 860 u8 rsvd0[3]; /* dword 0 */ 861 u8 ring_size[4]; /* dword 0 */ 862 u8 ring_state[4]; /* dword 0 */ 863 u8 rsvd1[8]; /* dword 0 */ 864 u8 dbuf_pindex[13]; /* dword 1 */ 865 u8 rsvd2; /* dword 1 */ 866 u8 pci_func_id[8]; /* dword 1 */ 867 u8 rx_pdid[9]; /* dword 1 */ 868 u8 rx_pdid_valid; /* dword 1 */ 869 u8 default_buffer_size[16]; /* dword 2 */ 870 u8 cq_id_recv[10]; /* dword 2 */ 871 u8 rx_pdid_not_valid; /* dword 2 */ 872 u8 rsvd3[5]; /* dword 2 */ 873 u8 rsvd4[32]; /* dword 3 */ 874 } __packed; 875 876 struct amap_default_pdu_context_ext { 877 u8 rsvd0[16]; /* dword 0 */ 878 u8 ring_size[4]; /* dword 0 */ 879 u8 rsvd1[12]; /* dword 0 */ 880 u8 rsvd2[22]; /* dword 1 */ 881 u8 rx_pdid[9]; /* dword 1 */ 882 u8 rx_pdid_valid; /* dword 1 */ 883 u8 default_buffer_size[16]; /* dword 2 */ 884 u8 cq_id_recv[16]; /* dword 2 */ 885 u8 rsvd3[32]; /* dword 3 */ 886 } __packed; 887 888 struct be_defq_create_req { 889 struct be_cmd_req_hdr hdr; 890 u16 num_pages; 891 u8 ulp_num; 892 #define BEISCSI_DUAL_ULP_AWARE_BIT 0 /* Byte 3 - Bit 0 */ 893 #define BEISCSI_BIND_Q_TO_ULP_BIT 1 /* Byte 3 - Bit 1 */ 894 u8 dua_feature; 895 struct be_default_pdu_context context; 896 struct phys_addr pages[8]; 897 } __packed; 898 899 struct be_defq_create_resp { 900 struct be_cmd_req_hdr hdr; 901 u16 id; 902 u8 rsvd0; 903 u8 ulp_num; 904 u32 doorbell_offset; 905 u16 register_set; 906 u16 doorbell_format; 907 } __packed; 908 909 struct be_post_template_pages_req { 910 struct be_cmd_req_hdr hdr; 911 u16 num_pages; 912 #define BEISCSI_TEMPLATE_HDR_TYPE_ISCSI 0x1 913 u16 type; 914 struct phys_addr scratch_pa; 915 struct virt_addr scratch_va; 916 struct virt_addr pages_va; 917 struct phys_addr pages[16]; 918 } __packed; 919 920 struct be_remove_template_pages_req { 921 struct be_cmd_req_hdr hdr; 922 u16 type; 923 u16 rsvd0; 924 } __packed; 925 926 struct be_post_sgl_pages_req { 927 struct be_cmd_req_hdr hdr; 928 u16 num_pages; 929 u16 page_offset; 930 u32 rsvd0; 931 struct phys_addr pages[26]; 932 u32 rsvd1; 933 } __packed; 934 935 struct be_wrbq_create_req { 936 struct be_cmd_req_hdr hdr; 937 u16 num_pages; 938 u8 ulp_num; 939 u8 dua_feature; 940 struct phys_addr pages[8]; 941 } __packed; 942 943 struct be_wrbq_create_resp { 944 struct be_cmd_resp_hdr resp_hdr; 945 u16 cid; 946 u8 rsvd0; 947 u8 ulp_num; 948 u32 doorbell_offset; 949 u16 register_set; 950 u16 doorbell_format; 951 } __packed; 952 953 #define SOL_CID_MASK 0x0000FFC0 954 #define SOL_CODE_MASK 0x0000003F 955 #define SOL_WRB_INDEX_MASK 0x00FF0000 956 #define SOL_CMD_WND_MASK 0xFF000000 957 #define SOL_RES_CNT_MASK 0x7FFFFFFF 958 #define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF 959 #define SOL_HW_STS_MASK 0x000000FF 960 #define SOL_STS_MASK 0x0000FF00 961 #define SOL_RESP_MASK 0x00FF0000 962 #define SOL_FLAGS_MASK 0x7F000000 963 #define SOL_S_MASK 0x80000000 964 965 struct sol_cqe { 966 u32 dw[4]; 967 }; 968 969 struct amap_sol_cqe { 970 u8 hw_sts[8]; /* dword 0 */ 971 u8 i_sts[8]; /* dword 0 */ 972 u8 i_resp[8]; /* dword 0 */ 973 u8 i_flags[7]; /* dword 0 */ 974 u8 s; /* dword 0 */ 975 u8 i_exp_cmd_sn[32]; /* dword 1 */ 976 u8 code[6]; /* dword 2 */ 977 u8 cid[10]; /* dword 2 */ 978 u8 wrb_index[8]; /* dword 2 */ 979 u8 i_cmd_wnd[8]; /* dword 2 */ 980 u8 i_res_cnt[31]; /* dword 3 */ 981 u8 valid; /* dword 3 */ 982 } __packed; 983 984 #define SOL_ICD_INDEX_MASK 0x0003FFC0 985 struct amap_sol_cqe_ring { 986 u8 hw_sts[8]; /* dword 0 */ 987 u8 i_sts[8]; /* dword 0 */ 988 u8 i_resp[8]; /* dword 0 */ 989 u8 i_flags[7]; /* dword 0 */ 990 u8 s; /* dword 0 */ 991 u8 i_exp_cmd_sn[32]; /* dword 1 */ 992 u8 code[6]; /* dword 2 */ 993 u8 icd_index[12]; /* dword 2 */ 994 u8 rsvd[6]; /* dword 2 */ 995 u8 i_cmd_wnd[8]; /* dword 2 */ 996 u8 i_res_cnt[31]; /* dword 3 */ 997 u8 valid; /* dword 3 */ 998 } __packed; 999 1000 struct amap_sol_cqe_v2 { 1001 u8 hw_sts[8]; /* dword 0 */ 1002 u8 i_sts[8]; /* dword 0 */ 1003 u8 wrb_index[16]; /* dword 0 */ 1004 u8 i_exp_cmd_sn[32]; /* dword 1 */ 1005 u8 code[6]; /* dword 2 */ 1006 u8 cmd_cmpl; /* dword 2 */ 1007 u8 rsvd0; /* dword 2 */ 1008 u8 i_cmd_wnd[8]; /* dword 2 */ 1009 u8 cid[13]; /* dword 2 */ 1010 u8 u; /* dword 2 */ 1011 u8 o; /* dword 2 */ 1012 u8 s; /* dword 2 */ 1013 u8 i_res_cnt[31]; /* dword 3 */ 1014 u8 valid; /* dword 3 */ 1015 } __packed; 1016 1017 struct common_sol_cqe { 1018 u32 exp_cmdsn; 1019 u32 res_cnt; 1020 u16 wrb_index; 1021 u16 cid; 1022 u8 hw_sts; 1023 u8 cmd_wnd; 1024 u8 res_flag; /* the s feild of structure */ 1025 u8 i_resp; /* for skh if cmd_complete is set then i_sts is response */ 1026 u8 i_flags; /* for skh or the u and o feilds */ 1027 u8 i_sts; /* for skh if cmd_complete is not-set then i_sts is status */ 1028 }; 1029 1030 /*** iSCSI ack/driver message completions ***/ 1031 struct amap_it_dmsg_cqe { 1032 u8 ack_num[32]; /* DWORD 0 */ 1033 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */ 1034 u8 code[6]; /* DWORD 2 */ 1035 u8 cid[10]; /* DWORD 2 */ 1036 u8 wrb_idx[8]; /* DWORD 2 */ 1037 u8 rsvd0[8]; /* DWORD 2*/ 1038 u8 rsvd1[31]; /* DWORD 3*/ 1039 u8 valid; /* DWORD 3 */ 1040 } __packed; 1041 1042 struct amap_it_dmsg_cqe_v2 { 1043 u8 ack_num[32]; /* DWORD 0 */ 1044 u8 pdu_bytes_rcvd[32]; /* DWORD 1 */ 1045 u8 code[6]; /* DWORD 2 */ 1046 u8 rsvd0[10]; /* DWORD 2 */ 1047 u8 wrb_idx[16]; /* DWORD 2 */ 1048 u8 rsvd1[16]; /* DWORD 3 */ 1049 u8 cid[13]; /* DWORD 3 */ 1050 u8 rsvd2[2]; /* DWORD 3 */ 1051 u8 valid; /* DWORD 3 */ 1052 } __packed; 1053 1054 1055 /** 1056 * Post WRB Queue Doorbell Register used by the host Storage 1057 * stack to notify the 1058 * controller of a posted Work Request Block 1059 */ 1060 #define DB_WRB_POST_CID_MASK 0xFFFF /* bits 0 - 16 */ 1061 #define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */ 1062 1063 #define DB_DEF_PDU_WRB_INDEX_SHIFT 16 1064 #define DB_DEF_PDU_NUM_POSTED_SHIFT 24 1065 1066 struct fragnum_bits_for_sgl_cra_in { 1067 struct be_cmd_req_hdr hdr; 1068 u32 num_bits; 1069 } __packed; 1070 1071 struct iscsi_cleanup_req { 1072 struct be_cmd_req_hdr hdr; 1073 u16 chute; 1074 u8 hdr_ring_id; 1075 u8 data_ring_id; 1076 } __packed; 1077 1078 struct iscsi_cleanup_req_v1 { 1079 struct be_cmd_req_hdr hdr; 1080 u16 chute; 1081 u16 rsvd1; 1082 u16 hdr_ring_id; 1083 u16 rsvd2; 1084 u16 data_ring_id; 1085 u16 rsvd3; 1086 } __packed; 1087 1088 struct eq_delay { 1089 u32 eq_id; 1090 u32 phase; 1091 u32 delay_multiplier; 1092 } __packed; 1093 1094 struct be_eq_delay_params_in { 1095 struct be_cmd_req_hdr hdr; 1096 u32 num_eq; 1097 struct eq_delay delay[8]; 1098 } __packed; 1099 1100 struct tcp_connect_and_offload_in { 1101 struct be_cmd_req_hdr hdr; 1102 struct ip_addr_format ip_address; 1103 u16 tcp_port; 1104 u16 cid; 1105 u16 cq_id; 1106 u16 defq_id; 1107 struct phys_addr dataout_template_pa; 1108 u16 hdr_ring_id; 1109 u16 data_ring_id; 1110 u8 do_offload; 1111 u8 rsvd0[3]; 1112 } __packed; 1113 1114 struct tcp_connect_and_offload_in_v1 { 1115 struct be_cmd_req_hdr hdr; 1116 struct ip_addr_format ip_address; 1117 u16 tcp_port; 1118 u16 cid; 1119 u16 cq_id; 1120 u16 defq_id; 1121 struct phys_addr dataout_template_pa; 1122 u16 hdr_ring_id; 1123 u16 data_ring_id; 1124 u8 do_offload; 1125 u8 ifd_state; 1126 u8 rsvd0[2]; 1127 u16 tcp_window_size; 1128 u8 tcp_window_scale_count; 1129 u8 rsvd1; 1130 u32 tcp_mss:24; 1131 u8 rsvd2; 1132 } __packed; 1133 1134 struct tcp_connect_and_offload_out { 1135 struct be_cmd_resp_hdr hdr; 1136 u32 connection_handle; 1137 u16 cid; 1138 u16 rsvd0; 1139 1140 } __packed; 1141 1142 #define DB_DEF_PDU_RING_ID_MASK 0x3FFF /* bits 0 - 13 */ 1143 #define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 16 - 29 */ 1144 #define DB_DEF_PDU_REARM_SHIFT 14 1145 #define DB_DEF_PDU_EVENT_SHIFT 15 1146 #define DB_DEF_PDU_CQPROC_SHIFT 16 1147 1148 struct dmsg_cqe { 1149 u32 dw[4]; 1150 } __packed; 1151 1152 struct tcp_upload_params_in { 1153 struct be_cmd_req_hdr hdr; 1154 u16 id; 1155 u16 upload_type; 1156 u32 reset_seq; 1157 } __packed; 1158 1159 struct tcp_upload_params_out { 1160 u32 dw[32]; 1161 } __packed; 1162 1163 union tcp_upload_params { 1164 struct tcp_upload_params_in request; 1165 struct tcp_upload_params_out response; 1166 } __packed; 1167 1168 struct be_ulp_fw_cfg { 1169 #define BEISCSI_ULP_ISCSI_INI_MODE 0x10 1170 u32 ulp_mode; 1171 u32 etx_base; 1172 u32 etx_count; 1173 u32 sq_base; 1174 u32 sq_count; 1175 u32 rq_base; 1176 u32 rq_count; 1177 u32 dq_base; 1178 u32 dq_count; 1179 u32 lro_base; 1180 u32 lro_count; 1181 u32 icd_base; 1182 u32 icd_count; 1183 }; 1184 1185 struct be_ulp_chain_icd { 1186 u32 chain_base; 1187 u32 chain_count; 1188 }; 1189 1190 struct be_fw_cfg { 1191 struct be_cmd_req_hdr hdr; 1192 u32 be_config_number; 1193 u32 asic_revision; 1194 u32 phys_port; 1195 #define BEISCSI_FUNC_ISCSI_INI_MODE 0x10 1196 #define BEISCSI_FUNC_DUA_MODE 0x800 1197 u32 function_mode; 1198 struct be_ulp_fw_cfg ulp[2]; 1199 u32 function_caps; 1200 u32 cqid_base; 1201 u32 cqid_count; 1202 u32 eqid_base; 1203 u32 eqid_count; 1204 struct be_ulp_chain_icd chain_icd[2]; 1205 } __packed; 1206 1207 struct be_cmd_get_all_if_id_req { 1208 struct be_cmd_req_hdr hdr; 1209 u32 if_count; 1210 u32 if_hndl_list[1]; 1211 } __packed; 1212 1213 struct be_cmd_get_port_name { 1214 union { 1215 struct be_cmd_req_hdr req_hdr; 1216 struct be_cmd_resp_hdr resp_hdr; 1217 } h; 1218 union { 1219 struct { 1220 u32 reserved; 1221 } req; 1222 struct { 1223 u32 port_names; 1224 } resp; 1225 } p; 1226 } __packed; 1227 1228 #define ISCSI_OPCODE_SCSI_DATA_OUT 5 1229 #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5 1230 #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 1231 #define OPCODE_COMMON_ISCSI_CLEANUP 59 1232 #define OPCODE_COMMON_TCP_UPLOAD 56 1233 #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70 1234 #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1 1235 #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6 1236 #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7 1237 #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14 1238 #define OPCODE_ISCSI_INI_SESSION_LOGOUT_TARGET 24 1239 #define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36 1240 #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41 1241 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42 1242 #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52 1243 #define OPCODE_COMMON_WRITE_FLASH 96 1244 #define OPCODE_COMMON_READ_FLASH 97 1245 1246 /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */ 1247 #define CMD_ISCSI_COMMAND_INVALIDATE 1 1248 #define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001 1249 #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002 1250 1251 #define INI_WR_CMD 1 /* Initiator write command */ 1252 #define INI_TMF_CMD 2 /* Initiator TMF command */ 1253 #define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */ 1254 #define INI_RD_CMD 5 /* Initiator requesting to send 1255 * a read command 1256 */ 1257 #define TGT_CTX_UPDT_CMD 7 /* Target context update */ 1258 #define TGT_STS_CMD 8 /* Target R2T and other BHS 1259 * where only the status number 1260 * need to be updated 1261 */ 1262 #define TGT_DATAIN_CMD 9 /* Target Data-Ins in response 1263 * to read command 1264 */ 1265 #define TGT_SOS_PDU 10 /* Target:standalone status 1266 * response 1267 */ 1268 #define TGT_DM_CMD 11 /* Indicates that the bhs 1269 * preparedby 1270 * driver should not be touched 1271 */ 1272 /* --- CMD_CHUTE_TYPE --- */ 1273 #define CMD_CONNECTION_CHUTE_0 1 1274 #define CMD_CONNECTION_CHUTE_1 2 1275 #define CMD_CONNECTION_CHUTE_2 3 1276 1277 #define EQ_MAJOR_CODE_COMPLETION 0 1278 1279 #define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0 1280 #define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1 1281 1282 /* --- CONNECTION_UPLOAD_PARAMS --- */ 1283 /* These parameters are used to define the type of upload desired. */ 1284 #define CONNECTION_UPLOAD_GRACEFUL 1 /* Graceful upload */ 1285 #define CONNECTION_UPLOAD_ABORT_RESET 2 /* Abortive upload with 1286 * reset 1287 */ 1288 #define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without 1289 * reset 1290 */ 1291 #define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset, 1292 * sequence number by driver */ 1293 1294 /* Returns the number of items in the field array. */ 1295 #define BE_NUMBER_OF_FIELD(_type_, _field_) \ 1296 (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\ 1297 1298 /** 1299 * Different types of iSCSI completions to host driver for both initiator 1300 * and taget mode 1301 * of operation. 1302 */ 1303 #define SOL_CMD_COMPLETE 1 /* Solicited command completed 1304 * normally 1305 */ 1306 #define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got 1307 * invalidated internally due 1308 * to Data Digest error 1309 */ 1310 #define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated 1311 * internally 1312 * due to a received PDU 1313 * size > DSL 1314 */ 1315 #define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated 1316 * internally due ti received 1317 * PDU sequence size > 1318 * FBL/MBL. 1319 */ 1320 #define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated 1321 * internally due to a received 1322 * PDU Hdr that has 1323 * AHS */ 1324 #define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated 1325 * internally due to Hdr Digest 1326 * error 1327 */ 1328 #define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated 1329 * internally 1330 * due to a bad opcode in the 1331 * pdu hdr 1332 */ 1333 #define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated 1334 * internally due to a received 1335 * ITT/TTT that does not belong 1336 * to this Connection 1337 */ 1338 #define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated 1339 * internally due to received 1340 * ITT/TTT value > Max 1341 * Supported ITTs/TTTs 1342 */ 1343 #define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated 1344 * internally due to an 1345 * incoming TCP RST 1346 */ 1347 #define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated 1348 * internally due to timeout on 1349 * tcp segment 12 retransmit 1350 * attempts failed 1351 */ 1352 #define CXN_KILLED_RST_SENT 12 /* Connection got invalidated 1353 * internally due to TCP RST 1354 * sent by the Tx side 1355 */ 1356 #define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated 1357 * internally due to an 1358 * incoming TCP FIN. 1359 */ 1360 #define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated 1361 * internally due to bad 1362 * unsolicited PDU Unsolicited 1363 * PDUs are PDUs with 1364 * ITT=0xffffffff 1365 */ 1366 #define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated 1367 * internally due to bad WRB 1368 * index. 1369 */ 1370 #define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated 1371 * internally due to received 1372 * command has residual 1373 * over run bytes. 1374 */ 1375 #define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated 1376 * internally due to received 1377 * command has residual under 1378 * run bytes. 1379 */ 1380 #define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated 1381 * internally due to a received 1382 * PDU has an invalid StatusSN 1383 */ 1384 #define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated 1385 * internally due to a received 1386 * an R2T with some invalid 1387 * fields in it 1388 */ 1389 #define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated 1390 * internally due to received 1391 * PDU has an invalid LUN. 1392 */ 1393 #define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated 1394 * internally due to the 1395 * corresponding ICD not in a 1396 * valid state 1397 */ 1398 #define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due 1399 * to received PDU has an 1400 * invalid ITT. 1401 */ 1402 #define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due 1403 * to received sequence buffer 1404 * offset is out of order. 1405 */ 1406 #define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated 1407 * internally due to a 1408 * received PDU has an invalid 1409 * DataSN 1410 */ 1411 #define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation 1412 * completion notify. 1413 */ 1414 #define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation 1415 * completion 1416 * with data PDU index. 1417 */ 1418 #define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation 1419 * completionnotifify. 1420 */ 1421 #define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/ 1422 #define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/ 1423 #define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest 1424 * error notify. 1425 */ 1426 #define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based 1427 * notification. 1428 */ 1429 #define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated 1430 * internally due to command 1431 * and data are not on same 1432 * connection. 1433 */ 1434 #define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got 1435 * invalidated internally due 1436 * to DIF error 1437 */ 1438 #define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated 1439 * internally due to incoming 1440 * TCP SYN 1441 */ 1442 #define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated 1443 * internally due to an 1444 * incoming Unsolicited PDU 1445 * that has immediate data on 1446 * the cxn 1447 */ 1448 1449 void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len, 1450 bool embedded, u8 sge_cnt); 1451 1452 void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr, 1453 u8 subsystem, u8 opcode, int cmd_len); 1454 #endif /* !BEISCSI_CMDS_H */ 1455