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