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