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