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