Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 1 | /** |
Jayamohan Kallickal | 255fa9a | 2011-03-25 14:23:57 -0700 | [diff] [blame] | 2 | * Copyright (C) 2005 - 2011 Emulex |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 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: |
Jayamohan Kallickal | 255fa9a | 2011-03-25 14:23:57 -0700 | [diff] [blame] | 11 | * linux-drivers@emulex.com |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 12 | * |
Jayamohan Kallickal | 255fa9a | 2011-03-25 14:23:57 -0700 | [diff] [blame] | 13 | * Emulex |
| 14 | * 3333 Susan Street |
| 15 | * Costa Mesa, CA 92626 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 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. |
Jayamohan Kallickal | 2f63588 | 2012-04-03 23:41:45 -0500 | [diff] [blame] | 26 | * The commands are serviced by the ARM processor in the OneConnect's MPU. |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 27 | */ |
| 28 | struct be_sge { |
| 29 | u32 pa_lo; |
| 30 | u32 pa_hi; |
| 31 | u32 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 | u8 embedded_payload[236]; /* used by embedded cmds */ |
| 44 | struct be_sge sgl[19]; /* used by non-embedded cmds */ |
| 45 | } payload; |
| 46 | }; |
| 47 | |
| 48 | #define CQE_FLAGS_VALID_MASK (1 << 31) |
| 49 | #define CQE_FLAGS_ASYNC_MASK (1 << 30) |
Jayamohan Kallickal | 457ff3b | 2010-07-22 04:16:00 +0530 | [diff] [blame] | 50 | #define CQE_FLAGS_COMPLETED_MASK (1 << 28) |
| 51 | #define CQE_FLAGS_CONSUMED_MASK (1 << 27) |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 52 | |
| 53 | /* Completion Status */ |
| 54 | #define MCC_STATUS_SUCCESS 0x0 |
| 55 | |
| 56 | #define CQE_STATUS_COMPL_MASK 0xFFFF |
| 57 | #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ |
| 58 | #define CQE_STATUS_EXTD_MASK 0xFFFF |
Jayamohan Kallickal | b38c1e8 | 2010-07-22 04:28:13 +0530 | [diff] [blame] | 59 | #define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */ |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 60 | |
| 61 | struct be_mcc_compl { |
| 62 | u32 status; /* dword 0 */ |
| 63 | u32 tag0; /* dword 1 */ |
| 64 | u32 tag1; /* dword 2 */ |
| 65 | u32 flags; /* dword 3 */ |
| 66 | }; |
| 67 | |
| 68 | /********* Mailbox door bell *************/ |
| 69 | /** |
| 70 | * Used for driver communication with the FW. |
| 71 | * The software must write this register twice to post any command. First, |
| 72 | * it writes the register with hi=1 and the upper bits of the physical address |
| 73 | * for the MAILBOX structure. Software must poll the ready bit until this |
| 74 | * is acknowledged. Then, sotware writes the register with hi=0 with the lower |
| 75 | * bits in the address. It must poll the ready bit until the command is |
| 76 | * complete. Upon completion, the MAILBOX will contain a valid completion |
| 77 | * queue entry. |
| 78 | */ |
| 79 | #define MPU_MAILBOX_DB_OFFSET 0x160 |
| 80 | #define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */ |
| 81 | #define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */ |
| 82 | |
| 83 | /********** MPU semphore ******************/ |
| 84 | #define MPU_EP_SEMAPHORE_OFFSET 0xac |
| 85 | #define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF |
| 86 | #define EP_SEMAPHORE_POST_ERR_MASK 0x1 |
| 87 | #define EP_SEMAPHORE_POST_ERR_SHIFT 31 |
| 88 | |
| 89 | /********** MCC door bell ************/ |
| 90 | #define DB_MCCQ_OFFSET 0x140 |
| 91 | #define DB_MCCQ_RING_ID_MASK 0x7FF /* bits 0 - 10 */ |
| 92 | /* Number of entries posted */ |
| 93 | #define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */ |
| 94 | |
| 95 | /* MPU semphore POST stage values */ |
| 96 | #define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */ |
| 97 | |
| 98 | /** |
| 99 | * When the async bit of mcc_compl is set, the last 4 bytes of |
| 100 | * mcc_compl is interpreted as follows: |
| 101 | */ |
| 102 | #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */ |
| 103 | #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF |
| 104 | #define ASYNC_EVENT_CODE_LINK_STATE 0x1 |
| 105 | struct be_async_event_trailer { |
| 106 | u32 code; |
| 107 | }; |
| 108 | |
| 109 | enum { |
| 110 | ASYNC_EVENT_LINK_DOWN = 0x0, |
| 111 | ASYNC_EVENT_LINK_UP = 0x1 |
| 112 | }; |
| 113 | |
| 114 | /** |
| 115 | * When the event code of an async trailer is link-state, the mcc_compl |
| 116 | * must be interpreted as follows |
| 117 | */ |
| 118 | struct be_async_event_link_state { |
| 119 | u8 physical_port; |
| 120 | u8 port_link_status; |
| 121 | u8 port_duplex; |
| 122 | u8 port_speed; |
| 123 | u8 port_fault; |
| 124 | u8 rsvd0[7]; |
| 125 | struct be_async_event_trailer trailer; |
| 126 | } __packed; |
| 127 | |
| 128 | struct be_mcc_mailbox { |
| 129 | struct be_mcc_wrb wrb; |
| 130 | struct be_mcc_compl compl; |
| 131 | }; |
| 132 | |
| 133 | /* Type of subsystems supported by FW */ |
| 134 | #define CMD_SUBSYSTEM_COMMON 0x1 |
| 135 | #define CMD_SUBSYSTEM_ISCSI 0x2 |
| 136 | #define CMD_SUBSYSTEM_ETH 0x3 |
| 137 | #define CMD_SUBSYSTEM_ISCSI_INI 0x6 |
| 138 | #define CMD_COMMON_TCP_UPLOAD 0x1 |
| 139 | |
| 140 | /** |
| 141 | * List of common opcodes subsystem CMD_SUBSYSTEM_COMMON |
| 142 | * These opcodes are unique for each subsystem defined above |
| 143 | */ |
| 144 | #define OPCODE_COMMON_CQ_CREATE 12 |
| 145 | #define OPCODE_COMMON_EQ_CREATE 13 |
Jayamohan Kallickal | 457ff3b | 2010-07-22 04:16:00 +0530 | [diff] [blame] | 146 | #define OPCODE_COMMON_MCC_CREATE 21 |
| 147 | #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 148 | #define OPCODE_COMMON_GET_FW_VERSION 35 |
| 149 | #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 |
| 150 | #define OPCODE_COMMON_FIRMWARE_CONFIG 42 |
Jayamohan Kallickal | 457ff3b | 2010-07-22 04:16:00 +0530 | [diff] [blame] | 151 | #define OPCODE_COMMON_MCC_DESTROY 53 |
| 152 | #define OPCODE_COMMON_CQ_DESTROY 54 |
| 153 | #define OPCODE_COMMON_EQ_DESTROY 55 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 154 | #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 |
| 155 | #define OPCODE_COMMON_FUNCTION_RESET 61 |
| 156 | |
| 157 | /** |
| 158 | * LIST of opcodes that are common between Initiator and Target |
| 159 | * used by CMD_SUBSYSTEM_ISCSI |
| 160 | * These opcodes are unique for each subsystem defined above |
| 161 | */ |
| 162 | #define OPCODE_COMMON_ISCSI_CFG_POST_SGL_PAGES 2 |
| 163 | #define OPCODE_COMMON_ISCSI_CFG_REMOVE_SGL_PAGES 3 |
| 164 | #define OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG 7 |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 165 | #define OPCODE_COMMON_ISCSI_NTWK_SET_VLAN 14 |
| 166 | #define OPCODE_COMMON_ISCSI_NTWK_CONFIGURE_STATELESS_IP_ADDR 17 |
| 167 | #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR 21 |
| 168 | #define OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY 22 |
| 169 | #define OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY 23 |
| 170 | #define OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID 24 |
| 171 | #define OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO 25 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 172 | #define OPCODE_COMMON_ISCSI_SET_FRAGNUM_BITS_FOR_SGL_CRA 61 |
| 173 | #define OPCODE_COMMON_ISCSI_DEFQ_CREATE 64 |
Jayamohan Kallickal | 457ff3b | 2010-07-22 04:16:00 +0530 | [diff] [blame] | 174 | #define OPCODE_COMMON_ISCSI_DEFQ_DESTROY 65 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 175 | #define OPCODE_COMMON_ISCSI_WRBQ_CREATE 66 |
Jayamohan Kallickal | 457ff3b | 2010-07-22 04:16:00 +0530 | [diff] [blame] | 176 | #define OPCODE_COMMON_ISCSI_WRBQ_DESTROY 67 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 177 | |
| 178 | struct be_cmd_req_hdr { |
| 179 | u8 opcode; /* dword 0 */ |
| 180 | u8 subsystem; /* dword 0 */ |
| 181 | u8 port_number; /* dword 0 */ |
| 182 | u8 domain; /* dword 0 */ |
| 183 | u32 timeout; /* dword 1 */ |
| 184 | u32 request_length; /* dword 2 */ |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 185 | u32 rsvd0; /* dword 3 */ |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 186 | }; |
| 187 | |
| 188 | struct be_cmd_resp_hdr { |
| 189 | u32 info; /* dword 0 */ |
| 190 | u32 status; /* dword 1 */ |
| 191 | u32 response_length; /* dword 2 */ |
| 192 | u32 actual_resp_len; /* dword 3 */ |
| 193 | }; |
| 194 | |
| 195 | struct phys_addr { |
| 196 | u32 lo; |
| 197 | u32 hi; |
| 198 | }; |
| 199 | |
| 200 | /************************** |
| 201 | * BE Command definitions * |
| 202 | **************************/ |
| 203 | |
| 204 | /** |
| 205 | * Pseudo amap definition in which each bit of the actual structure is defined |
| 206 | * as a byte - used to calculate offset/shift/mask of each field |
| 207 | */ |
| 208 | struct amap_eq_context { |
| 209 | u8 cidx[13]; /* dword 0 */ |
| 210 | u8 rsvd0[3]; /* dword 0 */ |
| 211 | u8 epidx[13]; /* dword 0 */ |
| 212 | u8 valid; /* dword 0 */ |
| 213 | u8 rsvd1; /* dword 0 */ |
| 214 | u8 size; /* dword 0 */ |
| 215 | u8 pidx[13]; /* dword 1 */ |
| 216 | u8 rsvd2[3]; /* dword 1 */ |
| 217 | u8 pd[10]; /* dword 1 */ |
| 218 | u8 count[3]; /* dword 1 */ |
| 219 | u8 solevent; /* dword 1 */ |
| 220 | u8 stalled; /* dword 1 */ |
| 221 | u8 armed; /* dword 1 */ |
| 222 | u8 rsvd3[4]; /* dword 2 */ |
| 223 | u8 func[8]; /* dword 2 */ |
| 224 | u8 rsvd4; /* dword 2 */ |
| 225 | u8 delaymult[10]; /* dword 2 */ |
| 226 | u8 rsvd5[2]; /* dword 2 */ |
| 227 | u8 phase[2]; /* dword 2 */ |
| 228 | u8 nodelay; /* dword 2 */ |
| 229 | u8 rsvd6[4]; /* dword 2 */ |
| 230 | u8 rsvd7[32]; /* dword 3 */ |
| 231 | } __packed; |
| 232 | |
| 233 | struct be_cmd_req_eq_create { |
| 234 | struct be_cmd_req_hdr hdr; /* dw[4] */ |
| 235 | u16 num_pages; /* sword */ |
| 236 | u16 rsvd0; /* sword */ |
| 237 | u8 context[sizeof(struct amap_eq_context) / 8]; /* dw[4] */ |
| 238 | struct phys_addr pages[8]; |
| 239 | } __packed; |
| 240 | |
| 241 | struct be_cmd_resp_eq_create { |
| 242 | struct be_cmd_resp_hdr resp_hdr; |
| 243 | u16 eq_id; /* sword */ |
| 244 | u16 rsvd0; /* sword */ |
| 245 | } __packed; |
| 246 | |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 247 | struct mgmt_chap_format { |
| 248 | u32 flags; |
| 249 | u8 intr_chap_name[256]; |
| 250 | u8 intr_secret[16]; |
| 251 | u8 target_chap_name[256]; |
| 252 | u8 target_secret[16]; |
| 253 | u16 intr_chap_name_length; |
| 254 | u16 intr_secret_length; |
| 255 | u16 target_chap_name_length; |
| 256 | u16 target_secret_length; |
| 257 | } __packed; |
| 258 | |
| 259 | struct mgmt_auth_method_format { |
| 260 | u8 auth_method_type; |
| 261 | u8 padding[3]; |
| 262 | struct mgmt_chap_format chap; |
| 263 | } __packed; |
| 264 | |
| 265 | struct mgmt_conn_login_options { |
| 266 | u8 flags; |
| 267 | u8 header_digest; |
| 268 | u8 data_digest; |
| 269 | u8 rsvd0; |
| 270 | u32 max_recv_datasegment_len_ini; |
| 271 | u32 max_recv_datasegment_len_tgt; |
| 272 | u32 tcp_mss; |
| 273 | u32 tcp_window_size; |
| 274 | struct mgmt_auth_method_format auth_data; |
| 275 | } __packed; |
| 276 | |
| 277 | struct ip_address_format { |
| 278 | u16 size_of_structure; |
| 279 | u8 reserved; |
| 280 | u8 ip_type; |
| 281 | u8 ip_address[16]; |
| 282 | u32 rsvd0; |
| 283 | } __packed; |
| 284 | |
| 285 | struct mgmt_conn_info { |
| 286 | u32 connection_handle; |
| 287 | u32 connection_status; |
| 288 | u16 src_port; |
| 289 | u16 dest_port; |
| 290 | u16 dest_port_redirected; |
| 291 | u16 cid; |
| 292 | u32 estimated_throughput; |
| 293 | struct ip_address_format src_ipaddr; |
| 294 | struct ip_address_format dest_ipaddr; |
| 295 | struct ip_address_format dest_ipaddr_redirected; |
| 296 | struct mgmt_conn_login_options negotiated_login_options; |
| 297 | } __packed; |
| 298 | |
| 299 | struct mgmt_session_login_options { |
| 300 | u8 flags; |
| 301 | u8 error_recovery_level; |
| 302 | u16 rsvd0; |
| 303 | u32 first_burst_length; |
| 304 | u32 max_burst_length; |
| 305 | u16 max_connections; |
| 306 | u16 max_outstanding_r2t; |
| 307 | u16 default_time2wait; |
| 308 | u16 default_time2retain; |
| 309 | } __packed; |
| 310 | |
| 311 | struct mgmt_session_info { |
| 312 | u32 session_handle; |
| 313 | u32 status; |
| 314 | u8 isid[6]; |
| 315 | u16 tsih; |
| 316 | u32 session_flags; |
| 317 | u16 conn_count; |
| 318 | u16 pad; |
| 319 | u8 target_name[224]; |
| 320 | u8 initiator_iscsiname[224]; |
| 321 | struct mgmt_session_login_options negotiated_login_options; |
| 322 | struct mgmt_conn_info conn_list[1]; |
| 323 | } __packed; |
| 324 | |
| 325 | struct be_cmd_req_get_session { |
| 326 | struct be_cmd_req_hdr hdr; |
| 327 | u32 session_handle; |
| 328 | } __packed; |
| 329 | |
| 330 | struct be_cmd_resp_get_session { |
| 331 | struct be_cmd_resp_hdr hdr; |
| 332 | struct mgmt_session_info session_info; |
| 333 | } __packed; |
| 334 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 335 | struct mac_addr { |
| 336 | u16 size_of_struct; |
| 337 | u8 addr[ETH_ALEN]; |
| 338 | } __packed; |
| 339 | |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 340 | struct be_cmd_req_get_boot_target { |
| 341 | struct be_cmd_req_hdr hdr; |
| 342 | } __packed; |
| 343 | |
| 344 | struct be_cmd_resp_get_boot_target { |
| 345 | struct be_cmd_resp_hdr hdr; |
| 346 | u32 boot_session_count; |
| 347 | int boot_session_handle; |
| 348 | }; |
| 349 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 350 | struct be_cmd_req_mac_query { |
| 351 | struct be_cmd_req_hdr hdr; |
| 352 | u8 type; |
| 353 | u8 permanent; |
| 354 | u16 if_id; |
| 355 | } __packed; |
| 356 | |
| 357 | struct be_cmd_resp_mac_query { |
| 358 | struct be_cmd_resp_hdr hdr; |
| 359 | struct mac_addr mac; |
| 360 | }; |
| 361 | |
| 362 | /******************** Create CQ ***************************/ |
| 363 | /** |
| 364 | * Pseudo amap definition in which each bit of the actual structure is defined |
| 365 | * as a byte - used to calculate offset/shift/mask of each field |
| 366 | */ |
| 367 | struct amap_cq_context { |
| 368 | u8 cidx[11]; /* dword 0 */ |
| 369 | u8 rsvd0; /* dword 0 */ |
| 370 | u8 coalescwm[2]; /* dword 0 */ |
| 371 | u8 nodelay; /* dword 0 */ |
| 372 | u8 epidx[11]; /* dword 0 */ |
| 373 | u8 rsvd1; /* dword 0 */ |
| 374 | u8 count[2]; /* dword 0 */ |
| 375 | u8 valid; /* dword 0 */ |
| 376 | u8 solevent; /* dword 0 */ |
| 377 | u8 eventable; /* dword 0 */ |
| 378 | u8 pidx[11]; /* dword 1 */ |
| 379 | u8 rsvd2; /* dword 1 */ |
| 380 | u8 pd[10]; /* dword 1 */ |
| 381 | u8 eqid[8]; /* dword 1 */ |
| 382 | u8 stalled; /* dword 1 */ |
| 383 | u8 armed; /* dword 1 */ |
| 384 | u8 rsvd3[4]; /* dword 2 */ |
| 385 | u8 func[8]; /* dword 2 */ |
| 386 | u8 rsvd4[20]; /* dword 2 */ |
| 387 | u8 rsvd5[32]; /* dword 3 */ |
| 388 | } __packed; |
| 389 | |
| 390 | struct be_cmd_req_cq_create { |
| 391 | struct be_cmd_req_hdr hdr; |
| 392 | u16 num_pages; |
| 393 | u16 rsvd0; |
| 394 | u8 context[sizeof(struct amap_cq_context) / 8]; |
| 395 | struct phys_addr pages[4]; |
| 396 | } __packed; |
| 397 | |
| 398 | struct be_cmd_resp_cq_create { |
| 399 | struct be_cmd_resp_hdr hdr; |
| 400 | u16 cq_id; |
| 401 | u16 rsvd0; |
| 402 | } __packed; |
| 403 | |
| 404 | /******************** Create MCCQ ***************************/ |
| 405 | /** |
| 406 | * Pseudo amap definition in which each bit of the actual structure is defined |
| 407 | * as a byte - used to calculate offset/shift/mask of each field |
| 408 | */ |
| 409 | struct amap_mcc_context { |
| 410 | u8 con_index[14]; |
| 411 | u8 rsvd0[2]; |
| 412 | u8 ring_size[4]; |
| 413 | u8 fetch_wrb; |
| 414 | u8 fetch_r2t; |
| 415 | u8 cq_id[10]; |
| 416 | u8 prod_index[14]; |
| 417 | u8 fid[8]; |
| 418 | u8 pdid[9]; |
| 419 | u8 valid; |
| 420 | u8 rsvd1[32]; |
| 421 | u8 rsvd2[32]; |
| 422 | } __packed; |
| 423 | |
| 424 | struct be_cmd_req_mcc_create { |
| 425 | struct be_cmd_req_hdr hdr; |
| 426 | u16 num_pages; |
| 427 | u16 rsvd0; |
| 428 | u8 context[sizeof(struct amap_mcc_context) / 8]; |
| 429 | struct phys_addr pages[8]; |
| 430 | } __packed; |
| 431 | |
| 432 | struct be_cmd_resp_mcc_create { |
| 433 | struct be_cmd_resp_hdr hdr; |
| 434 | u16 id; |
| 435 | u16 rsvd0; |
| 436 | } __packed; |
| 437 | |
| 438 | /******************** Q Destroy ***************************/ |
| 439 | /* Type of Queue to be destroyed */ |
| 440 | enum { |
| 441 | QTYPE_EQ = 1, |
| 442 | QTYPE_CQ, |
| 443 | QTYPE_MCCQ, |
| 444 | QTYPE_WRBQ, |
| 445 | QTYPE_DPDUQ, |
| 446 | QTYPE_SGL |
| 447 | }; |
| 448 | |
| 449 | struct be_cmd_req_q_destroy { |
| 450 | struct be_cmd_req_hdr hdr; |
| 451 | u16 id; |
| 452 | u16 bypass_flush; /* valid only for rx q destroy */ |
| 453 | } __packed; |
| 454 | |
| 455 | struct macaddr { |
| 456 | u8 byte[ETH_ALEN]; |
| 457 | }; |
| 458 | |
| 459 | struct be_cmd_req_mcast_mac_config { |
| 460 | struct be_cmd_req_hdr hdr; |
| 461 | u16 num_mac; |
| 462 | u8 promiscuous; |
| 463 | u8 interface_id; |
| 464 | struct macaddr mac[32]; |
| 465 | } __packed; |
| 466 | |
| 467 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) |
| 468 | { |
| 469 | return wrb->payload.embedded_payload; |
| 470 | } |
| 471 | |
| 472 | static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb) |
| 473 | { |
| 474 | return &wrb->payload.sgl[0]; |
| 475 | } |
| 476 | |
| 477 | /******************** Modify EQ Delay *******************/ |
| 478 | struct be_cmd_req_modify_eq_delay { |
| 479 | struct be_cmd_req_hdr hdr; |
| 480 | u32 num_eq; |
| 481 | struct { |
| 482 | u32 eq_id; |
| 483 | u32 phase; |
| 484 | u32 delay_multiplier; |
| 485 | } delay[8]; |
| 486 | } __packed; |
| 487 | |
| 488 | /******************** Get MAC ADDR *******************/ |
| 489 | |
| 490 | #define ETH_ALEN 6 |
| 491 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 492 | struct be_cmd_req_get_mac_addr { |
| 493 | struct be_cmd_req_hdr hdr; |
| 494 | u32 nic_port_count; |
| 495 | u32 speed; |
| 496 | u32 max_speed; |
| 497 | u32 link_state; |
| 498 | u32 max_frame_size; |
| 499 | u16 size_of_structure; |
| 500 | u8 mac_address[ETH_ALEN]; |
| 501 | u32 rsvd[23]; |
| 502 | }; |
| 503 | |
| 504 | struct be_cmd_resp_get_mac_addr { |
| 505 | struct be_cmd_resp_hdr hdr; |
| 506 | u32 nic_port_count; |
| 507 | u32 speed; |
| 508 | u32 max_speed; |
| 509 | u32 link_state; |
| 510 | u32 max_frame_size; |
| 511 | u16 size_of_structure; |
| 512 | u8 mac_address[6]; |
| 513 | u32 rsvd[23]; |
| 514 | }; |
| 515 | |
John Soni Jose | 2177199 | 2012-04-03 23:41:49 -0500 | [diff] [blame] | 516 | #define BEISCSI_ALIAS_LEN 32 |
| 517 | |
| 518 | struct be_cmd_hba_name { |
| 519 | struct be_cmd_req_hdr hdr; |
| 520 | u16 flags; |
| 521 | u16 rsvd0; |
| 522 | u8 initiator_name[ISCSI_NAME_LEN]; |
| 523 | u8 initiator_alias[BEISCSI_ALIAS_LEN]; |
| 524 | } __packed; |
| 525 | |
| 526 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 527 | int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, |
| 528 | struct be_queue_info *eq, int eq_delay); |
| 529 | |
| 530 | int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, |
| 531 | struct be_queue_info *cq, struct be_queue_info *eq, |
| 532 | bool sol_evts, bool no_delay, |
| 533 | int num_cqe_dma_coalesce); |
| 534 | |
| 535 | int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, |
| 536 | int type); |
Jayamohan Kallickal | 35e6601 | 2009-10-23 11:53:49 +0530 | [diff] [blame] | 537 | int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba, |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 538 | struct be_queue_info *mccq, |
| 539 | struct be_queue_info *cq); |
| 540 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 541 | int be_poll_mcc(struct be_ctrl_info *ctrl); |
Jayamohan Kallickal | 03a1231 | 2010-07-22 04:17:16 +0530 | [diff] [blame] | 542 | int mgmt_check_supported_fw(struct be_ctrl_info *ctrl, |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 543 | struct beiscsi_hba *phba); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame] | 544 | unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba); |
John Soni Jose | 2177199 | 2012-04-03 23:41:49 -0500 | [diff] [blame] | 545 | unsigned int be_cmd_get_initname(struct beiscsi_hba *phba); |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 546 | unsigned int beiscsi_get_boot_target(struct beiscsi_hba *phba); |
| 547 | unsigned int beiscsi_get_session_info(struct beiscsi_hba *phba, |
| 548 | u32 boot_session_handle, |
| 549 | struct be_dma_mem *nonemb_cmd); |
| 550 | |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame] | 551 | void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 552 | /*ISCSI Functuions */ |
| 553 | int be_cmd_fw_initialize(struct be_ctrl_info *ctrl); |
| 554 | |
| 555 | struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem); |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 556 | struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba); |
| 557 | int be_mcc_notify_wait(struct beiscsi_hba *phba); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame] | 558 | void be_mcc_notify(struct beiscsi_hba *phba); |
| 559 | unsigned int alloc_mcc_tag(struct beiscsi_hba *phba); |
| 560 | void beiscsi_async_link_state_process(struct beiscsi_hba *phba, |
| 561 | struct be_async_event_link_state *evt); |
| 562 | int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl, |
| 563 | struct be_mcc_compl *compl); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 564 | |
| 565 | int be_mbox_notify(struct be_ctrl_info *ctrl); |
| 566 | |
| 567 | int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl, |
| 568 | struct be_queue_info *cq, |
| 569 | struct be_queue_info *dq, int length, |
| 570 | int entry_size); |
| 571 | |
| 572 | int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, |
| 573 | struct be_dma_mem *q_mem, u32 page_offset, |
| 574 | u32 num_pages); |
| 575 | |
Jayamohan Kallickal | e528586 | 2011-10-07 19:31:08 -0500 | [diff] [blame] | 576 | int beiscsi_cmd_reset_function(struct beiscsi_hba *phba); |
| 577 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 578 | int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem, |
| 579 | struct be_queue_info *wrbq); |
| 580 | |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame] | 581 | bool is_link_state_evt(u32 trailer); |
| 582 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 583 | struct be_default_pdu_context { |
| 584 | u32 dw[4]; |
| 585 | } __packed; |
| 586 | |
| 587 | struct amap_be_default_pdu_context { |
| 588 | u8 dbuf_cindex[13]; /* dword 0 */ |
| 589 | u8 rsvd0[3]; /* dword 0 */ |
| 590 | u8 ring_size[4]; /* dword 0 */ |
| 591 | u8 ring_state[4]; /* dword 0 */ |
| 592 | u8 rsvd1[8]; /* dword 0 */ |
| 593 | u8 dbuf_pindex[13]; /* dword 1 */ |
| 594 | u8 rsvd2; /* dword 1 */ |
| 595 | u8 pci_func_id[8]; /* dword 1 */ |
| 596 | u8 rx_pdid[9]; /* dword 1 */ |
| 597 | u8 rx_pdid_valid; /* dword 1 */ |
| 598 | u8 default_buffer_size[16]; /* dword 2 */ |
| 599 | u8 cq_id_recv[10]; /* dword 2 */ |
| 600 | u8 rx_pdid_not_valid; /* dword 2 */ |
| 601 | u8 rsvd3[5]; /* dword 2 */ |
| 602 | u8 rsvd4[32]; /* dword 3 */ |
| 603 | } __packed; |
| 604 | |
| 605 | struct be_defq_create_req { |
| 606 | struct be_cmd_req_hdr hdr; |
| 607 | u16 num_pages; |
| 608 | u8 ulp_num; |
| 609 | u8 rsvd0; |
| 610 | struct be_default_pdu_context context; |
| 611 | struct phys_addr pages[8]; |
| 612 | } __packed; |
| 613 | |
| 614 | struct be_defq_create_resp { |
| 615 | struct be_cmd_req_hdr hdr; |
| 616 | u16 id; |
| 617 | u16 rsvd0; |
| 618 | } __packed; |
| 619 | |
| 620 | struct be_post_sgl_pages_req { |
| 621 | struct be_cmd_req_hdr hdr; |
| 622 | u16 num_pages; |
| 623 | u16 page_offset; |
| 624 | u32 rsvd0; |
| 625 | struct phys_addr pages[26]; |
| 626 | u32 rsvd1; |
| 627 | } __packed; |
| 628 | |
| 629 | struct be_wrbq_create_req { |
| 630 | struct be_cmd_req_hdr hdr; |
| 631 | u16 num_pages; |
| 632 | u8 ulp_num; |
| 633 | u8 rsvd0; |
| 634 | struct phys_addr pages[8]; |
| 635 | } __packed; |
| 636 | |
| 637 | struct be_wrbq_create_resp { |
| 638 | struct be_cmd_resp_hdr resp_hdr; |
| 639 | u16 cid; |
| 640 | u16 rsvd0; |
| 641 | } __packed; |
| 642 | |
| 643 | #define SOL_CID_MASK 0x0000FFC0 |
| 644 | #define SOL_CODE_MASK 0x0000003F |
| 645 | #define SOL_WRB_INDEX_MASK 0x00FF0000 |
| 646 | #define SOL_CMD_WND_MASK 0xFF000000 |
| 647 | #define SOL_RES_CNT_MASK 0x7FFFFFFF |
| 648 | #define SOL_EXP_CMD_SN_MASK 0xFFFFFFFF |
| 649 | #define SOL_HW_STS_MASK 0x000000FF |
| 650 | #define SOL_STS_MASK 0x0000FF00 |
| 651 | #define SOL_RESP_MASK 0x00FF0000 |
| 652 | #define SOL_FLAGS_MASK 0x7F000000 |
| 653 | #define SOL_S_MASK 0x80000000 |
| 654 | |
| 655 | struct sol_cqe { |
| 656 | u32 dw[4]; |
| 657 | }; |
| 658 | |
| 659 | struct amap_sol_cqe { |
| 660 | u8 hw_sts[8]; /* dword 0 */ |
| 661 | u8 i_sts[8]; /* dword 0 */ |
| 662 | u8 i_resp[8]; /* dword 0 */ |
| 663 | u8 i_flags[7]; /* dword 0 */ |
| 664 | u8 s; /* dword 0 */ |
| 665 | u8 i_exp_cmd_sn[32]; /* dword 1 */ |
| 666 | u8 code[6]; /* dword 2 */ |
| 667 | u8 cid[10]; /* dword 2 */ |
| 668 | u8 wrb_index[8]; /* dword 2 */ |
| 669 | u8 i_cmd_wnd[8]; /* dword 2 */ |
| 670 | u8 i_res_cnt[31]; /* dword 3 */ |
| 671 | u8 valid; /* dword 3 */ |
| 672 | } __packed; |
| 673 | |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 674 | #define SOL_ICD_INDEX_MASK 0x0003FFC0 |
| 675 | struct amap_sol_cqe_ring { |
| 676 | u8 hw_sts[8]; /* dword 0 */ |
| 677 | u8 i_sts[8]; /* dword 0 */ |
| 678 | u8 i_resp[8]; /* dword 0 */ |
| 679 | u8 i_flags[7]; /* dword 0 */ |
| 680 | u8 s; /* dword 0 */ |
| 681 | u8 i_exp_cmd_sn[32]; /* dword 1 */ |
| 682 | u8 code[6]; /* dword 2 */ |
| 683 | u8 icd_index[12]; /* dword 2 */ |
| 684 | u8 rsvd[6]; /* dword 2 */ |
| 685 | u8 i_cmd_wnd[8]; /* dword 2 */ |
| 686 | u8 i_res_cnt[31]; /* dword 3 */ |
| 687 | u8 valid; /* dword 3 */ |
| 688 | } __packed; |
| 689 | |
| 690 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 691 | |
| 692 | /** |
| 693 | * Post WRB Queue Doorbell Register used by the host Storage |
| 694 | * stack to notify the |
| 695 | * controller of a posted Work Request Block |
| 696 | */ |
| 697 | #define DB_WRB_POST_CID_MASK 0x3FF /* bits 0 - 9 */ |
| 698 | #define DB_DEF_PDU_WRB_INDEX_MASK 0xFF /* bits 0 - 9 */ |
| 699 | |
| 700 | #define DB_DEF_PDU_WRB_INDEX_SHIFT 16 |
| 701 | #define DB_DEF_PDU_NUM_POSTED_SHIFT 24 |
| 702 | |
| 703 | struct fragnum_bits_for_sgl_cra_in { |
| 704 | struct be_cmd_req_hdr hdr; |
| 705 | u32 num_bits; |
| 706 | } __packed; |
| 707 | |
| 708 | struct iscsi_cleanup_req { |
| 709 | struct be_cmd_req_hdr hdr; |
| 710 | u16 chute; |
| 711 | u8 hdr_ring_id; |
| 712 | u8 data_ring_id; |
| 713 | |
| 714 | } __packed; |
| 715 | |
| 716 | struct eq_delay { |
| 717 | u32 eq_id; |
| 718 | u32 phase; |
| 719 | u32 delay_multiplier; |
| 720 | } __packed; |
| 721 | |
| 722 | struct be_eq_delay_params_in { |
| 723 | struct be_cmd_req_hdr hdr; |
| 724 | u32 num_eq; |
| 725 | struct eq_delay delay[8]; |
| 726 | } __packed; |
| 727 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 728 | struct tcp_connect_and_offload_in { |
| 729 | struct be_cmd_req_hdr hdr; |
| 730 | struct ip_address_format ip_address; |
| 731 | u16 tcp_port; |
| 732 | u16 cid; |
| 733 | u16 cq_id; |
| 734 | u16 defq_id; |
| 735 | struct phys_addr dataout_template_pa; |
| 736 | u16 hdr_ring_id; |
| 737 | u16 data_ring_id; |
| 738 | u8 do_offload; |
| 739 | u8 rsvd0[3]; |
| 740 | } __packed; |
| 741 | |
| 742 | struct tcp_connect_and_offload_out { |
| 743 | struct be_cmd_resp_hdr hdr; |
| 744 | u32 connection_handle; |
| 745 | u16 cid; |
| 746 | u16 rsvd0; |
| 747 | |
| 748 | } __packed; |
| 749 | |
| 750 | struct be_mcc_wrb_context { |
| 751 | struct MCC_WRB *wrb; |
| 752 | int *users_final_status; |
| 753 | } __packed; |
| 754 | |
| 755 | #define DB_DEF_PDU_RING_ID_MASK 0x3FF /* bits 0 - 9 */ |
| 756 | #define DB_DEF_PDU_CQPROC_MASK 0x3FFF /* bits 0 - 9 */ |
| 757 | #define DB_DEF_PDU_REARM_SHIFT 14 |
| 758 | #define DB_DEF_PDU_EVENT_SHIFT 15 |
| 759 | #define DB_DEF_PDU_CQPROC_SHIFT 16 |
| 760 | |
| 761 | struct dmsg_cqe { |
| 762 | u32 dw[4]; |
| 763 | } __packed; |
| 764 | |
| 765 | struct tcp_upload_params_in { |
| 766 | struct be_cmd_req_hdr hdr; |
| 767 | u16 id; |
| 768 | u16 upload_type; |
| 769 | u32 reset_seq; |
| 770 | } __packed; |
| 771 | |
| 772 | struct tcp_upload_params_out { |
| 773 | u32 dw[32]; |
| 774 | } __packed; |
| 775 | |
| 776 | union tcp_upload_params { |
| 777 | struct tcp_upload_params_in request; |
| 778 | struct tcp_upload_params_out response; |
| 779 | } __packed; |
| 780 | |
| 781 | struct be_ulp_fw_cfg { |
| 782 | u32 ulp_mode; |
| 783 | u32 etx_base; |
| 784 | u32 etx_count; |
| 785 | u32 sq_base; |
| 786 | u32 sq_count; |
| 787 | u32 rq_base; |
| 788 | u32 rq_count; |
| 789 | u32 dq_base; |
| 790 | u32 dq_count; |
| 791 | u32 lro_base; |
| 792 | u32 lro_count; |
| 793 | u32 icd_base; |
| 794 | u32 icd_count; |
| 795 | }; |
| 796 | |
| 797 | struct be_fw_cfg { |
| 798 | struct be_cmd_req_hdr hdr; |
| 799 | u32 be_config_number; |
| 800 | u32 asic_revision; |
| 801 | u32 phys_port; |
| 802 | u32 function_mode; |
| 803 | struct be_ulp_fw_cfg ulp[2]; |
| 804 | u32 function_caps; |
| 805 | } __packed; |
| 806 | |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 807 | struct be_all_if_id { |
| 808 | struct be_cmd_req_hdr hdr; |
| 809 | u32 if_count; |
| 810 | u32 if_hndl_list[1]; |
| 811 | } __packed; |
| 812 | |
| 813 | #define ISCSI_OPCODE_SCSI_DATA_OUT 5 |
| 814 | #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 |
| 815 | #define OPCODE_COMMON_ISCSI_CLEANUP 59 |
| 816 | #define OPCODE_COMMON_TCP_UPLOAD 56 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 817 | #define OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD 70 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 818 | #define OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS 1 |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 819 | #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6 |
| 820 | #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7 |
| 821 | #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14 |
| 822 | #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 823 | #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42 |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 824 | #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET 52 |
Jayamohan Kallickal | ffce3e2 | 2012-04-03 23:41:50 -0500 | [diff] [blame^] | 825 | #define OPCODE_COMMON_WRITE_FLASH 96 |
| 826 | #define OPCODE_COMMON_READ_FLASH 97 |
Jayamohan Kallickal | c7acc5b | 2010-07-22 04:29:18 +0530 | [diff] [blame] | 827 | |
| 828 | /* --- CMD_ISCSI_INVALIDATE_CONNECTION_TYPE --- */ |
| 829 | #define CMD_ISCSI_COMMAND_INVALIDATE 1 |
| 830 | #define CMD_ISCSI_CONNECTION_INVALIDATE 0x8001 |
| 831 | #define CMD_ISCSI_CONNECTION_ISSUE_TCP_RST 0x8002 |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 832 | |
| 833 | #define INI_WR_CMD 1 /* Initiator write command */ |
| 834 | #define INI_TMF_CMD 2 /* Initiator TMF command */ |
| 835 | #define INI_NOPOUT_CMD 3 /* Initiator; Send a NOP-OUT */ |
| 836 | #define INI_RD_CMD 5 /* Initiator requesting to send |
| 837 | * a read command |
| 838 | */ |
| 839 | #define TGT_CTX_UPDT_CMD 7 /* Target context update */ |
| 840 | #define TGT_STS_CMD 8 /* Target R2T and other BHS |
| 841 | * where only the status number |
| 842 | * need to be updated |
| 843 | */ |
| 844 | #define TGT_DATAIN_CMD 9 /* Target Data-Ins in response |
| 845 | * to read command |
| 846 | */ |
| 847 | #define TGT_SOS_PDU 10 /* Target:standalone status |
| 848 | * response |
| 849 | */ |
| 850 | #define TGT_DM_CMD 11 /* Indicates that the bhs |
| 851 | * preparedby |
| 852 | * driver should not be touched |
| 853 | */ |
| 854 | /* --- CMD_CHUTE_TYPE --- */ |
| 855 | #define CMD_CONNECTION_CHUTE_0 1 |
| 856 | #define CMD_CONNECTION_CHUTE_1 2 |
| 857 | #define CMD_CONNECTION_CHUTE_2 3 |
| 858 | |
| 859 | #define EQ_MAJOR_CODE_COMPLETION 0 |
| 860 | |
| 861 | #define CMD_ISCSI_SESSION_DEL_CFG_FROM_FLASH 0 |
| 862 | #define CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH 1 |
| 863 | |
| 864 | /* --- CONNECTION_UPLOAD_PARAMS --- */ |
| 865 | /* These parameters are used to define the type of upload desired. */ |
| 866 | #define CONNECTION_UPLOAD_GRACEFUL 1 /* Graceful upload */ |
| 867 | #define CONNECTION_UPLOAD_ABORT_RESET 2 /* Abortive upload with |
| 868 | * reset |
| 869 | */ |
| 870 | #define CONNECTION_UPLOAD_ABORT 3 /* Abortive upload without |
| 871 | * reset |
| 872 | */ |
| 873 | #define CONNECTION_UPLOAD_ABORT_WITH_SEQ 4 /* Abortive upload with reset, |
| 874 | * sequence number by driver */ |
| 875 | |
| 876 | /* Returns byte size of given field with a structure. */ |
| 877 | |
| 878 | /* Returns the number of items in the field array. */ |
| 879 | #define BE_NUMBER_OF_FIELD(_type_, _field_) \ |
| 880 | (FIELD_SIZEOF(_type_, _field_)/sizeof((((_type_ *)0)->_field_[0])))\ |
| 881 | |
| 882 | /** |
| 883 | * Different types of iSCSI completions to host driver for both initiator |
| 884 | * and taget mode |
| 885 | * of operation. |
| 886 | */ |
| 887 | #define SOL_CMD_COMPLETE 1 /* Solicited command completed |
| 888 | * normally |
| 889 | */ |
| 890 | #define SOL_CMD_KILLED_DATA_DIGEST_ERR 2 /* Solicited command got |
| 891 | * invalidated internally due |
| 892 | * to Data Digest error |
| 893 | */ |
| 894 | #define CXN_KILLED_PDU_SIZE_EXCEEDS_DSL 3 /* Connection got invalidated |
| 895 | * internally |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 896 | * due to a received PDU |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 897 | * size > DSL |
| 898 | */ |
| 899 | #define CXN_KILLED_BURST_LEN_MISMATCH 4 /* Connection got invalidated |
| 900 | * internally due ti received |
| 901 | * PDU sequence size > |
| 902 | * FBL/MBL. |
| 903 | */ |
| 904 | #define CXN_KILLED_AHS_RCVD 5 /* Connection got invalidated |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 905 | * internally due to a received |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 906 | * PDU Hdr that has |
| 907 | * AHS */ |
| 908 | #define CXN_KILLED_HDR_DIGEST_ERR 6 /* Connection got invalidated |
| 909 | * internally due to Hdr Digest |
| 910 | * error |
| 911 | */ |
| 912 | #define CXN_KILLED_UNKNOWN_HDR 7 /* Connection got invalidated |
| 913 | * internally |
| 914 | * due to a bad opcode in the |
| 915 | * pdu hdr |
| 916 | */ |
| 917 | #define CXN_KILLED_STALE_ITT_TTT_RCVD 8 /* Connection got invalidated |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 918 | * internally due to a received |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 919 | * ITT/TTT that does not belong |
| 920 | * to this Connection |
| 921 | */ |
| 922 | #define CXN_KILLED_INVALID_ITT_TTT_RCVD 9 /* Connection got invalidated |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 923 | * internally due to received |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 924 | * ITT/TTT value > Max |
| 925 | * Supported ITTs/TTTs |
| 926 | */ |
| 927 | #define CXN_KILLED_RST_RCVD 10 /* Connection got invalidated |
| 928 | * internally due to an |
| 929 | * incoming TCP RST |
| 930 | */ |
| 931 | #define CXN_KILLED_TIMED_OUT 11 /* Connection got invalidated |
| 932 | * internally due to timeout on |
| 933 | * tcp segment 12 retransmit |
| 934 | * attempts failed |
| 935 | */ |
| 936 | #define CXN_KILLED_RST_SENT 12 /* Connection got invalidated |
| 937 | * internally due to TCP RST |
| 938 | * sent by the Tx side |
| 939 | */ |
| 940 | #define CXN_KILLED_FIN_RCVD 13 /* Connection got invalidated |
| 941 | * internally due to an |
| 942 | * incoming TCP FIN. |
| 943 | */ |
| 944 | #define CXN_KILLED_BAD_UNSOL_PDU_RCVD 14 /* Connection got invalidated |
| 945 | * internally due to bad |
| 946 | * unsolicited PDU Unsolicited |
| 947 | * PDUs are PDUs with |
| 948 | * ITT=0xffffffff |
| 949 | */ |
| 950 | #define CXN_KILLED_BAD_WRB_INDEX_ERROR 15 /* Connection got invalidated |
| 951 | * internally due to bad WRB |
| 952 | * index. |
| 953 | */ |
| 954 | #define CXN_KILLED_OVER_RUN_RESIDUAL 16 /* Command got invalidated |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 955 | * internally due to received |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 956 | * command has residual |
| 957 | * over run bytes. |
| 958 | */ |
| 959 | #define CXN_KILLED_UNDER_RUN_RESIDUAL 17 /* Command got invalidated |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 960 | * internally due to received |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 961 | * command has residual under |
| 962 | * run bytes. |
| 963 | */ |
| 964 | #define CMD_KILLED_INVALID_STATSN_RCVD 18 /* Command got invalidated |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 965 | * internally due to a received |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 966 | * PDU has an invalid StatusSN |
| 967 | */ |
| 968 | #define CMD_KILLED_INVALID_R2T_RCVD 19 /* Command got invalidated |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 969 | * internally due to a received |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 970 | * an R2T with some invalid |
| 971 | * fields in it |
| 972 | */ |
| 973 | #define CMD_CXN_KILLED_LUN_INVALID 20 /* Command got invalidated |
| 974 | * internally due to received |
| 975 | * PDU has an invalid LUN. |
| 976 | */ |
| 977 | #define CMD_CXN_KILLED_ICD_INVALID 21 /* Command got invalidated |
| 978 | * internally due to the |
| 979 | * corresponding ICD not in a |
| 980 | * valid state |
| 981 | */ |
| 982 | #define CMD_CXN_KILLED_ITT_INVALID 22 /* Command got invalidated due |
| 983 | * to received PDU has an |
| 984 | * invalid ITT. |
| 985 | */ |
| 986 | #define CMD_CXN_KILLED_SEQ_OUTOFORDER 23 /* Command got invalidated due |
| 987 | * to received sequence buffer |
| 988 | * offset is out of order. |
| 989 | */ |
| 990 | #define CMD_CXN_KILLED_INVALID_DATASN_RCVD 24 /* Command got invalidated |
| 991 | * internally due to a |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 992 | * received PDU has an invalid |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 993 | * DataSN |
| 994 | */ |
| 995 | #define CXN_INVALIDATE_NOTIFY 25 /* Connection invalidation |
| 996 | * completion notify. |
| 997 | */ |
| 998 | #define CXN_INVALIDATE_INDEX_NOTIFY 26 /* Connection invalidation |
| 999 | * completion |
| 1000 | * with data PDU index. |
| 1001 | */ |
| 1002 | #define CMD_INVALIDATED_NOTIFY 27 /* Command invalidation |
| 1003 | * completionnotifify. |
| 1004 | */ |
| 1005 | #define UNSOL_HDR_NOTIFY 28 /* Unsolicited header notify.*/ |
| 1006 | #define UNSOL_DATA_NOTIFY 29 /* Unsolicited data notify.*/ |
Jayamohan Kallickal | 457ff3b | 2010-07-22 04:16:00 +0530 | [diff] [blame] | 1007 | #define UNSOL_DATA_DIGEST_ERROR_NOTIFY 30 /* Unsolicited data digest |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 1008 | * error notify. |
| 1009 | */ |
| 1010 | #define DRIVERMSG_NOTIFY 31 /* TCP acknowledge based |
| 1011 | * notification. |
| 1012 | */ |
| 1013 | #define CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN 32 /* Connection got invalidated |
| 1014 | * internally due to command |
| 1015 | * and data are not on same |
| 1016 | * connection. |
| 1017 | */ |
| 1018 | #define SOL_CMD_KILLED_DIF_ERR 33 /* Solicited command got |
| 1019 | * invalidated internally due |
| 1020 | * to DIF error |
| 1021 | */ |
| 1022 | #define CXN_KILLED_SYN_RCVD 34 /* Connection got invalidated |
| 1023 | * internally due to incoming |
| 1024 | * TCP SYN |
| 1025 | */ |
| 1026 | #define CXN_KILLED_IMM_DATA_RCVD 35 /* Connection got invalidated |
| 1027 | * internally due to an |
| 1028 | * incoming Unsolicited PDU |
| 1029 | * that has immediate data on |
| 1030 | * the cxn |
| 1031 | */ |
| 1032 | |
Jayamohan Kallickal | e9b9119 | 2010-07-22 04:24:53 +0530 | [diff] [blame] | 1033 | int beiscsi_pci_soft_reset(struct beiscsi_hba *phba); |
| 1034 | int be_chk_reset_complete(struct beiscsi_hba *phba); |
| 1035 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 1036 | void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len, |
| 1037 | bool embedded, u8 sge_cnt); |
| 1038 | |
| 1039 | void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr, |
| 1040 | u8 subsystem, u8 opcode, int cmd_len); |
| 1041 | |
| 1042 | #endif /* !BEISCSI_CMDS_H */ |