net/ice/base: support programming a new switch recipe
[dpdk.git] / drivers / net / ice / base / ice_adminq_cmd.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2019
3  */
4
5 #ifndef _ICE_ADMINQ_CMD_H_
6 #define _ICE_ADMINQ_CMD_H_
7
8 /* This header file defines the Admin Queue commands, error codes and
9  * descriptor format. It is shared between Firmware and Software.
10  */
11
12
13 #define ICE_MAX_VSI                     768
14 #define ICE_AQC_TOPO_MAX_LEVEL_NUM      0x9
15 #define ICE_AQ_SET_MAC_FRAME_SIZE_MAX   9728
16
17
18 struct ice_aqc_generic {
19         __le32 param0;
20         __le32 param1;
21         __le32 addr_high;
22         __le32 addr_low;
23 };
24
25
26 /* Get version (direct 0x0001) */
27 struct ice_aqc_get_ver {
28         __le32 rom_ver;
29         __le32 fw_build;
30         u8 fw_branch;
31         u8 fw_major;
32         u8 fw_minor;
33         u8 fw_patch;
34         u8 api_branch;
35         u8 api_major;
36         u8 api_minor;
37         u8 api_patch;
38 };
39
40
41 /* Send driver version (indirect 0x0002) */
42 struct ice_aqc_driver_ver {
43         u8 major_ver;
44         u8 minor_ver;
45         u8 build_ver;
46         u8 subbuild_ver;
47         u8 reserved[4];
48         __le32 addr_high;
49         __le32 addr_low;
50 };
51
52
53 /* Queue Shutdown (direct 0x0003) */
54 struct ice_aqc_q_shutdown {
55         __le32 driver_unloading;
56 #define ICE_AQC_DRIVER_UNLOADING        BIT(0)
57         u8 reserved[12];
58 };
59
60
61
62
63 /* Request resource ownership (direct 0x0008)
64  * Release resource ownership (direct 0x0009)
65  */
66 struct ice_aqc_req_res {
67         __le16 res_id;
68 #define ICE_AQC_RES_ID_NVM              1
69 #define ICE_AQC_RES_ID_SDP              2
70 #define ICE_AQC_RES_ID_CHNG_LOCK        3
71 #define ICE_AQC_RES_ID_GLBL_LOCK        4
72         __le16 access_type;
73 #define ICE_AQC_RES_ACCESS_READ         1
74 #define ICE_AQC_RES_ACCESS_WRITE        2
75
76         /* Upon successful completion, FW writes this value and driver is
77          * expected to release resource before timeout. This value is provided
78          * in milliseconds.
79          */
80         __le32 timeout;
81 #define ICE_AQ_RES_NVM_READ_DFLT_TIMEOUT_MS     3000
82 #define ICE_AQ_RES_NVM_WRITE_DFLT_TIMEOUT_MS    180000
83 #define ICE_AQ_RES_CHNG_LOCK_DFLT_TIMEOUT_MS    1000
84 #define ICE_AQ_RES_GLBL_LOCK_DFLT_TIMEOUT_MS    3000
85         /* For SDP: pin ID of the SDP */
86         __le32 res_number;
87         /* Status is only used for ICE_AQC_RES_ID_GLBL_LOCK */
88         __le16 status;
89 #define ICE_AQ_RES_GLBL_SUCCESS         0
90 #define ICE_AQ_RES_GLBL_IN_PROG         1
91 #define ICE_AQ_RES_GLBL_DONE            2
92         u8 reserved[2];
93 };
94
95
96 /* Get function capabilities (indirect 0x000A)
97  * Get device capabilities (indirect 0x000B)
98  */
99 struct ice_aqc_list_caps {
100         u8 cmd_flags;
101         u8 pf_index;
102         u8 reserved[2];
103         __le32 count;
104         __le32 addr_high;
105         __le32 addr_low;
106 };
107
108
109 /* Device/Function buffer entry, repeated per reported capability */
110 struct ice_aqc_list_caps_elem {
111         __le16 cap;
112 #define ICE_AQC_CAPS_VALID_FUNCTIONS                    0x0005
113 #define ICE_AQC_CAPS_VSI                                0x0017
114 #define ICE_AQC_CAPS_DCB                                0x0018
115 #define ICE_AQC_CAPS_RSS                                0x0040
116 #define ICE_AQC_CAPS_RXQS                               0x0041
117 #define ICE_AQC_CAPS_TXQS                               0x0042
118 #define ICE_AQC_CAPS_MSIX                               0x0043
119 #define ICE_AQC_CAPS_FD                                 0x0045
120 #define ICE_AQC_CAPS_MAX_MTU                            0x0047
121
122         u8 major_ver;
123         u8 minor_ver;
124         /* Number of resources described by this capability */
125         __le32 number;
126         /* Only meaningful for some types of resources */
127         __le32 logical_id;
128         /* Only meaningful for some types of resources */
129         __le32 phys_id;
130         __le64 rsvd1;
131         __le64 rsvd2;
132 };
133
134
135 /* Manage MAC address, read command - indirect (0x0107)
136  * This struct is also used for the response
137  */
138 struct ice_aqc_manage_mac_read {
139         __le16 flags; /* Zeroed by device driver */
140 #define ICE_AQC_MAN_MAC_LAN_ADDR_VALID          BIT(4)
141 #define ICE_AQC_MAN_MAC_SAN_ADDR_VALID          BIT(5)
142 #define ICE_AQC_MAN_MAC_PORT_ADDR_VALID         BIT(6)
143 #define ICE_AQC_MAN_MAC_WOL_ADDR_VALID          BIT(7)
144 #define ICE_AQC_MAN_MAC_READ_S                  4
145 #define ICE_AQC_MAN_MAC_READ_M                  (0xF << ICE_AQC_MAN_MAC_READ_S)
146         u8 lport_num;
147         u8 lport_num_valid;
148 #define ICE_AQC_MAN_MAC_PORT_NUM_IS_VALID       BIT(0)
149         u8 num_addr; /* Used in response */
150         u8 reserved[3];
151         __le32 addr_high;
152         __le32 addr_low;
153 };
154
155
156 /* Response buffer format for manage MAC read command */
157 struct ice_aqc_manage_mac_read_resp {
158         u8 lport_num;
159         u8 addr_type;
160 #define ICE_AQC_MAN_MAC_ADDR_TYPE_LAN           0
161 #define ICE_AQC_MAN_MAC_ADDR_TYPE_WOL           1
162         u8 mac_addr[ETH_ALEN];
163 };
164
165
166 /* Manage MAC address, write command - direct (0x0108) */
167 struct ice_aqc_manage_mac_write {
168         u8 port_num;
169         u8 flags;
170 #define ICE_AQC_MAN_MAC_WR_MC_MAG_EN            BIT(0)
171 #define ICE_AQC_MAN_MAC_WR_WOL_LAA_PFR_KEEP     BIT(1)
172 #define ICE_AQC_MAN_MAC_WR_S            6
173 #define ICE_AQC_MAN_MAC_WR_M            (3 << ICE_AQC_MAN_MAC_WR_S)
174 #define ICE_AQC_MAN_MAC_UPDATE_LAA      0
175 #define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL  (BIT(0) << ICE_AQC_MAN_MAC_WR_S)
176         /* High 16 bits of MAC address in big endian order */
177         __be16 sah;
178         /* Low 32 bits of MAC address in big endian order */
179         __be32 sal;
180         __le32 addr_high;
181         __le32 addr_low;
182 };
183
184
185 /* Clear PXE Command and response (direct 0x0110) */
186 struct ice_aqc_clear_pxe {
187         u8 rx_cnt;
188 #define ICE_AQC_CLEAR_PXE_RX_CNT                0x2
189         u8 reserved[15];
190 };
191
192
193 /* Configure No-Drop Policy Command (direct 0x0112) */
194 struct ice_aqc_config_no_drop_policy {
195         u8 opts;
196 #define ICE_AQC_FORCE_NO_DROP                   BIT(0)
197         u8 rsvd[15];
198 };
199
200 /* Get switch configuration (0x0200) */
201 struct ice_aqc_get_sw_cfg {
202         /* Reserved for command and copy of request flags for response */
203         __le16 flags;
204         /* First desc in case of command and next_elem in case of response
205          * In case of response, if it is not zero, means all the configuration
206          * was not returned and new command shall be sent with this value in
207          * the 'first desc' field
208          */
209         __le16 element;
210         /* Reserved for command, only used for response */
211         __le16 num_elems;
212         __le16 rsvd;
213         __le32 addr_high;
214         __le32 addr_low;
215 };
216
217
218 /* Each entry in the response buffer is of the following type: */
219 struct ice_aqc_get_sw_cfg_resp_elem {
220         /* VSI/Port Number */
221         __le16 vsi_port_num;
222 #define ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_S 0
223 #define ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_M \
224                         (0x3FF << ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_S)
225 #define ICE_AQC_GET_SW_CONF_RESP_TYPE_S 14
226 #define ICE_AQC_GET_SW_CONF_RESP_TYPE_M (0x3 << ICE_AQC_GET_SW_CONF_RESP_TYPE_S)
227 #define ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT      0
228 #define ICE_AQC_GET_SW_CONF_RESP_VIRT_PORT      1
229 #define ICE_AQC_GET_SW_CONF_RESP_VSI            2
230
231         /* SWID VSI/Port belongs to */
232         __le16 swid;
233
234         /* Bit 14..0 : PF/VF number VSI belongs to
235          * Bit 15 : VF indication bit
236          */
237         __le16 pf_vf_num;
238 #define ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_S     0
239 #define ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_M     \
240                                 (0x7FFF << ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_S)
241 #define ICE_AQC_GET_SW_CONF_RESP_IS_VF          BIT(15)
242 };
243
244
245 /* The response buffer is as follows. Note that the length of the
246  * elements array varies with the length of the command response.
247  */
248 struct ice_aqc_get_sw_cfg_resp {
249         struct ice_aqc_get_sw_cfg_resp_elem elements[1];
250 };
251
252
253
254 /* These resource type defines are used for all switch resource
255  * commands where a resource type is required, such as:
256  * Get Resource Allocation command (indirect 0x0204)
257  * Allocate Resources command (indirect 0x0208)
258  * Free Resources command (indirect 0x0209)
259  * Get Allocated Resource Descriptors Command (indirect 0x020A)
260  */
261 #define ICE_AQC_RES_TYPE_VEB_COUNTER                    0x00
262 #define ICE_AQC_RES_TYPE_VLAN_COUNTER                   0x01
263 #define ICE_AQC_RES_TYPE_MIRROR_RULE                    0x02
264 #define ICE_AQC_RES_TYPE_VSI_LIST_REP                   0x03
265 #define ICE_AQC_RES_TYPE_VSI_LIST_PRUNE                 0x04
266 #define ICE_AQC_RES_TYPE_RECIPE                         0x05
267 #define ICE_AQC_RES_TYPE_PROFILE                        0x06
268 #define ICE_AQC_RES_TYPE_SWID                           0x07
269 #define ICE_AQC_RES_TYPE_VSI                            0x08
270 #define ICE_AQC_RES_TYPE_FLU                            0x09
271 #define ICE_AQC_RES_TYPE_WIDE_TABLE_1                   0x0A
272 #define ICE_AQC_RES_TYPE_WIDE_TABLE_2                   0x0B
273 #define ICE_AQC_RES_TYPE_WIDE_TABLE_4                   0x0C
274 #define ICE_AQC_RES_TYPE_GLOBAL_RSS_HASH                0x20
275 #define ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK             0x21
276 #define ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES        0x22
277 #define ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES            0x23
278 #define ICE_AQC_RES_TYPE_FLEX_DESC_PROG                 0x30
279 #define ICE_AQC_RES_TYPE_SWITCH_PROF_BLDR_PROFID        0x48
280 #define ICE_AQC_RES_TYPE_SWITCH_PROF_BLDR_TCAM          0x49
281 #define ICE_AQC_RES_TYPE_ACL_PROF_BLDR_PROFID           0x50
282 #define ICE_AQC_RES_TYPE_ACL_PROF_BLDR_TCAM             0x51
283 #define ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID            0x58
284 #define ICE_AQC_RES_TYPE_FD_PROF_BLDR_TCAM              0x59
285 #define ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID          0x60
286 #define ICE_AQC_RES_TYPE_HASH_PROF_BLDR_TCAM            0x61
287 /* Resource types 0x62-67 are reserved for Hash profile builder */
288 #define ICE_AQC_RES_TYPE_QHASH_PROF_BLDR_PROFID         0x68
289 #define ICE_AQC_RES_TYPE_QHASH_PROF_BLDR_TCAM           0x69
290
291 #define ICE_AQC_RES_TYPE_FLAG_SHARED                    BIT(7)
292 #define ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM               BIT(12)
293 #define ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX              BIT(13)
294
295 #define ICE_AQC_RES_TYPE_FLAG_DEDICATED                 0x00
296
297 #define ICE_AQC_RES_TYPE_S      0
298 #define ICE_AQC_RES_TYPE_M      (0x07F << ICE_AQC_RES_TYPE_S)
299
300 /* Get Resource Allocation command (indirect 0x0204) */
301 struct ice_aqc_get_res_alloc {
302         __le16 resp_elem_num; /* Used in response, reserved in command */
303         u8 reserved[6];
304         __le32 addr_high;
305         __le32 addr_low;
306 };
307
308 /* Get Resource Allocation Response Buffer per response */
309 struct ice_aqc_get_res_resp_elem {
310         __le16 res_type; /* Types defined above cmd 0x0204 */
311         __le16 total_capacity; /* Resources available to all PF's */
312         __le16 total_function; /* Resources allocated for a PF */
313         __le16 total_shared; /* Resources allocated as shared */
314         __le16 total_free; /* Resources un-allocated/not reserved by any PF */
315 };
316
317 /* Buffer for Get Resource command */
318 struct ice_aqc_get_res_resp {
319         /* Number of resource entries to be calculated using
320          * datalen/sizeof(struct ice_aqc_cmd_resp)).
321          * Value of 'datalen' gets updated as part of response.
322          */
323         struct ice_aqc_get_res_resp_elem elem[1];
324 };
325
326
327 /* Allocate Resources command (indirect 0x0208)
328  * Free Resources command (indirect 0x0209)
329  */
330 struct ice_aqc_alloc_free_res_cmd {
331         __le16 num_entries; /* Number of Resource entries */
332         u8 reserved[6];
333         __le32 addr_high;
334         __le32 addr_low;
335 };
336
337
338 /* Resource descriptor */
339 struct ice_aqc_res_elem {
340         union {
341                 __le16 sw_resp;
342                 __le16 flu_resp;
343         } e;
344 };
345
346
347 /* Buffer for Allocate/Free Resources commands */
348 struct ice_aqc_alloc_free_res_elem {
349         __le16 res_type; /* Types defined above cmd 0x0204 */
350 #define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S       8
351 #define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_M       \
352                                 (0xF << ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S)
353         __le16 num_elems;
354         struct ice_aqc_res_elem elem[1];
355 };
356
357
358 /* Get Allocated Resource Descriptors Command (indirect 0x020A) */
359 struct ice_aqc_get_allocd_res_desc {
360         union {
361                 struct {
362                         __le16 res; /* Types defined above cmd 0x0204 */
363                         __le16 first_desc;
364                         __le32 reserved;
365                 } cmd;
366                 struct {
367                         __le16 res;
368                         __le16 next_desc;
369                         __le16 num_desc;
370                         __le16 reserved;
371                 } resp;
372         } ops;
373         __le32 addr_high;
374         __le32 addr_low;
375 };
376
377 struct ice_aqc_get_allocd_res_desc_resp {
378         struct ice_aqc_res_elem elem[1];
379 };
380
381
382 /* Add VSI (indirect 0x0210)
383  * Update VSI (indirect 0x0211)
384  * Get VSI (indirect 0x0212)
385  * Free VSI (indirect 0x0213)
386  */
387 struct ice_aqc_add_get_update_free_vsi {
388         __le16 vsi_num;
389 #define ICE_AQ_VSI_NUM_S        0
390 #define ICE_AQ_VSI_NUM_M        (0x03FF << ICE_AQ_VSI_NUM_S)
391 #define ICE_AQ_VSI_IS_VALID     BIT(15)
392         __le16 cmd_flags;
393 #define ICE_AQ_VSI_KEEP_ALLOC   0x1
394         u8 vf_id;
395         u8 reserved;
396         __le16 vsi_flags;
397 #define ICE_AQ_VSI_TYPE_S       0
398 #define ICE_AQ_VSI_TYPE_M       (0x3 << ICE_AQ_VSI_TYPE_S)
399 #define ICE_AQ_VSI_TYPE_VF      0x0
400 #define ICE_AQ_VSI_TYPE_VMDQ2   0x1
401 #define ICE_AQ_VSI_TYPE_PF      0x2
402 #define ICE_AQ_VSI_TYPE_EMP_MNG 0x3
403         __le32 addr_high;
404         __le32 addr_low;
405 };
406
407
408 /* Response descriptor for:
409  * Add VSI (indirect 0x0210)
410  * Update VSI (indirect 0x0211)
411  * Free VSI (indirect 0x0213)
412  */
413 struct ice_aqc_add_update_free_vsi_resp {
414         __le16 vsi_num;
415         __le16 ext_status;
416         __le16 vsi_used;
417         __le16 vsi_free;
418         __le32 addr_high;
419         __le32 addr_low;
420 };
421
422
423 struct ice_aqc_get_vsi_resp {
424         __le16 vsi_num;
425         u8 vf_id;
426         /* The vsi_flags field uses the ICE_AQ_VSI_TYPE_* defines for values.
427          * These are found above in struct ice_aqc_add_get_update_free_vsi.
428          */
429         u8 vsi_flags;
430         __le16 vsi_used;
431         __le16 vsi_free;
432         __le32 addr_high;
433         __le32 addr_low;
434 };
435
436
437 struct ice_aqc_vsi_props {
438         __le16 valid_sections;
439 #define ICE_AQ_VSI_PROP_SW_VALID                BIT(0)
440 #define ICE_AQ_VSI_PROP_SECURITY_VALID          BIT(1)
441 #define ICE_AQ_VSI_PROP_VLAN_VALID              BIT(2)
442 #define ICE_AQ_VSI_PROP_OUTER_TAG_VALID         BIT(3)
443 #define ICE_AQ_VSI_PROP_INGRESS_UP_VALID        BIT(4)
444 #define ICE_AQ_VSI_PROP_EGRESS_UP_VALID         BIT(5)
445 #define ICE_AQ_VSI_PROP_RXQ_MAP_VALID           BIT(6)
446 #define ICE_AQ_VSI_PROP_Q_OPT_VALID             BIT(7)
447 #define ICE_AQ_VSI_PROP_OUTER_UP_VALID          BIT(8)
448 #define ICE_AQ_VSI_PROP_FLOW_DIR_VALID          BIT(11)
449 #define ICE_AQ_VSI_PROP_PASID_VALID             BIT(12)
450         /* switch section */
451         u8 sw_id;
452         u8 sw_flags;
453 #define ICE_AQ_VSI_SW_FLAG_ALLOW_LB             BIT(5)
454 #define ICE_AQ_VSI_SW_FLAG_LOCAL_LB             BIT(6)
455 #define ICE_AQ_VSI_SW_FLAG_SRC_PRUNE            BIT(7)
456         u8 sw_flags2;
457 #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S        0
458 #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_M        \
459                                 (0xF << ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S)
460 #define ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA    BIT(0)
461 #define ICE_AQ_VSI_SW_FLAG_LAN_ENA              BIT(4)
462         u8 veb_stat_id;
463 #define ICE_AQ_VSI_SW_VEB_STAT_ID_S             0
464 #define ICE_AQ_VSI_SW_VEB_STAT_ID_M     (0x1F << ICE_AQ_VSI_SW_VEB_STAT_ID_S)
465 #define ICE_AQ_VSI_SW_VEB_STAT_ID_VALID         BIT(5)
466         /* security section */
467         u8 sec_flags;
468 #define ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD     BIT(0)
469 #define ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF  BIT(2)
470 #define ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S   4
471 #define ICE_AQ_VSI_SEC_TX_PRUNE_ENA_M   (0xF << ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S)
472 #define ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA        BIT(0)
473         u8 sec_reserved;
474         /* VLAN section */
475         __le16 pvid; /* VLANS include priority bits */
476         u8 pvlan_reserved[2];
477         u8 vlan_flags;
478 #define ICE_AQ_VSI_VLAN_MODE_S  0
479 #define ICE_AQ_VSI_VLAN_MODE_M  (0x3 << ICE_AQ_VSI_VLAN_MODE_S)
480 #define ICE_AQ_VSI_VLAN_MODE_UNTAGGED   0x1
481 #define ICE_AQ_VSI_VLAN_MODE_TAGGED     0x2
482 #define ICE_AQ_VSI_VLAN_MODE_ALL        0x3
483 #define ICE_AQ_VSI_PVLAN_INSERT_PVID    BIT(2)
484 #define ICE_AQ_VSI_VLAN_EMOD_S  3
485 #define ICE_AQ_VSI_VLAN_EMOD_M  (0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
486 #define ICE_AQ_VSI_VLAN_EMOD_STR_BOTH   (0x0 << ICE_AQ_VSI_VLAN_EMOD_S)
487 #define ICE_AQ_VSI_VLAN_EMOD_STR_UP     (0x1 << ICE_AQ_VSI_VLAN_EMOD_S)
488 #define ICE_AQ_VSI_VLAN_EMOD_STR        (0x2 << ICE_AQ_VSI_VLAN_EMOD_S)
489 #define ICE_AQ_VSI_VLAN_EMOD_NOTHING    (0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
490         u8 pvlan_reserved2[3];
491         /* ingress egress up sections */
492         __le32 ingress_table; /* bitmap, 3 bits per up */
493 #define ICE_AQ_VSI_UP_TABLE_UP0_S       0
494 #define ICE_AQ_VSI_UP_TABLE_UP0_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP0_S)
495 #define ICE_AQ_VSI_UP_TABLE_UP1_S       3
496 #define ICE_AQ_VSI_UP_TABLE_UP1_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP1_S)
497 #define ICE_AQ_VSI_UP_TABLE_UP2_S       6
498 #define ICE_AQ_VSI_UP_TABLE_UP2_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP2_S)
499 #define ICE_AQ_VSI_UP_TABLE_UP3_S       9
500 #define ICE_AQ_VSI_UP_TABLE_UP3_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP3_S)
501 #define ICE_AQ_VSI_UP_TABLE_UP4_S       12
502 #define ICE_AQ_VSI_UP_TABLE_UP4_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP4_S)
503 #define ICE_AQ_VSI_UP_TABLE_UP5_S       15
504 #define ICE_AQ_VSI_UP_TABLE_UP5_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP5_S)
505 #define ICE_AQ_VSI_UP_TABLE_UP6_S       18
506 #define ICE_AQ_VSI_UP_TABLE_UP6_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP6_S)
507 #define ICE_AQ_VSI_UP_TABLE_UP7_S       21
508 #define ICE_AQ_VSI_UP_TABLE_UP7_M       (0x7 << ICE_AQ_VSI_UP_TABLE_UP7_S)
509         __le32 egress_table;   /* same defines as for ingress table */
510         /* outer tags section */
511         __le16 outer_tag;
512         u8 outer_tag_flags;
513 #define ICE_AQ_VSI_OUTER_TAG_MODE_S     0
514 #define ICE_AQ_VSI_OUTER_TAG_MODE_M     (0x3 << ICE_AQ_VSI_OUTER_TAG_MODE_S)
515 #define ICE_AQ_VSI_OUTER_TAG_NOTHING    0x0
516 #define ICE_AQ_VSI_OUTER_TAG_REMOVE     0x1
517 #define ICE_AQ_VSI_OUTER_TAG_COPY       0x2
518 #define ICE_AQ_VSI_OUTER_TAG_TYPE_S     2
519 #define ICE_AQ_VSI_OUTER_TAG_TYPE_M     (0x3 << ICE_AQ_VSI_OUTER_TAG_TYPE_S)
520 #define ICE_AQ_VSI_OUTER_TAG_NONE       0x0
521 #define ICE_AQ_VSI_OUTER_TAG_STAG       0x1
522 #define ICE_AQ_VSI_OUTER_TAG_VLAN_8100  0x2
523 #define ICE_AQ_VSI_OUTER_TAG_VLAN_9100  0x3
524 #define ICE_AQ_VSI_OUTER_TAG_INSERT     BIT(4)
525 #define ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST BIT(6)
526         u8 outer_tag_reserved;
527         /* queue mapping section */
528         __le16 mapping_flags;
529 #define ICE_AQ_VSI_Q_MAP_CONTIG 0x0
530 #define ICE_AQ_VSI_Q_MAP_NONCONTIG      BIT(0)
531         __le16 q_mapping[16];
532 #define ICE_AQ_VSI_Q_S          0
533 #define ICE_AQ_VSI_Q_M          (0x7FF << ICE_AQ_VSI_Q_S)
534         __le16 tc_mapping[8];
535 #define ICE_AQ_VSI_TC_Q_OFFSET_S        0
536 #define ICE_AQ_VSI_TC_Q_OFFSET_M        (0x7FF << ICE_AQ_VSI_TC_Q_OFFSET_S)
537 #define ICE_AQ_VSI_TC_Q_NUM_S           11
538 #define ICE_AQ_VSI_TC_Q_NUM_M           (0xF << ICE_AQ_VSI_TC_Q_NUM_S)
539         /* queueing option section */
540         u8 q_opt_rss;
541 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_S      0
542 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_M      (0x3 << ICE_AQ_VSI_Q_OPT_RSS_LUT_S)
543 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI    0x0
544 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_PF     0x2
545 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_GBL    0x3
546 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S  2
547 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M  (0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
548 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S     6
549 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_M     (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
550 #define ICE_AQ_VSI_Q_OPT_RSS_TPLZ       (0x0 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
551 #define ICE_AQ_VSI_Q_OPT_RSS_SYM_TPLZ   (0x1 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
552 #define ICE_AQ_VSI_Q_OPT_RSS_XOR        (0x2 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
553 #define ICE_AQ_VSI_Q_OPT_RSS_JHASH      (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
554         u8 q_opt_tc;
555 #define ICE_AQ_VSI_Q_OPT_TC_OVR_S       0
556 #define ICE_AQ_VSI_Q_OPT_TC_OVR_M       (0x1F << ICE_AQ_VSI_Q_OPT_TC_OVR_S)
557 #define ICE_AQ_VSI_Q_OPT_PROF_TC_OVR    BIT(7)
558         u8 q_opt_flags;
559 #define ICE_AQ_VSI_Q_OPT_PE_FLTR_EN     BIT(0)
560         u8 q_opt_reserved[3];
561         /* outer up section */
562         __le32 outer_up_table; /* same structure and defines as ingress tbl */
563         /* section 10 */
564         __le16 sect_10_reserved;
565         /* flow director section */
566         __le16 fd_options;
567 #define ICE_AQ_VSI_FD_ENABLE            BIT(0)
568 #define ICE_AQ_VSI_FD_TX_AUTO_ENABLE    BIT(1)
569 #define ICE_AQ_VSI_FD_PROG_ENABLE       BIT(3)
570         __le16 max_fd_fltr_dedicated;
571         __le16 max_fd_fltr_shared;
572         __le16 fd_def_q;
573 #define ICE_AQ_VSI_FD_DEF_Q_S           0
574 #define ICE_AQ_VSI_FD_DEF_Q_M           (0x7FF << ICE_AQ_VSI_FD_DEF_Q_S)
575 #define ICE_AQ_VSI_FD_DEF_GRP_S 12
576 #define ICE_AQ_VSI_FD_DEF_GRP_M (0x7 << ICE_AQ_VSI_FD_DEF_GRP_S)
577         __le16 fd_report_opt;
578 #define ICE_AQ_VSI_FD_REPORT_Q_S        0
579 #define ICE_AQ_VSI_FD_REPORT_Q_M        (0x7FF << ICE_AQ_VSI_FD_REPORT_Q_S)
580 #define ICE_AQ_VSI_FD_DEF_PRIORITY_S    12
581 #define ICE_AQ_VSI_FD_DEF_PRIORITY_M    (0x7 << ICE_AQ_VSI_FD_DEF_PRIORITY_S)
582 #define ICE_AQ_VSI_FD_DEF_DROP          BIT(15)
583         /* PASID section */
584         __le32 pasid_id;
585 #define ICE_AQ_VSI_PASID_ID_S           0
586 #define ICE_AQ_VSI_PASID_ID_M           (0xFFFFF << ICE_AQ_VSI_PASID_ID_S)
587 #define ICE_AQ_VSI_PASID_ID_VALID       BIT(31)
588         u8 reserved[24];
589 };
590
591
592 /* Add/update mirror rule - direct (0x0260) */
593 #define ICE_AQC_RULE_ID_VALID_S         7
594 #define ICE_AQC_RULE_ID_VALID_M         (0x1 << ICE_AQC_RULE_ID_VALID_S)
595 #define ICE_AQC_RULE_ID_S               0
596 #define ICE_AQC_RULE_ID_M               (0x3F << ICE_AQC_RULE_ID_S)
597
598 /* Following defines to be used while processing caller specified mirror list
599  * of VSI indexes.
600  */
601 /* Action: Byte.bit (1.7)
602  *      0 = Remove VSI from mirror rule
603  *      1 = Add VSI to mirror rule
604  */
605 #define ICE_AQC_RULE_ACT_S      15
606 #define ICE_AQC_RULE_ACT_M      (0x1 << ICE_AQC_RULE_ACT_S)
607 /* Action: 1.2:0.0 = Mirrored VSI */
608 #define ICE_AQC_RULE_MIRRORED_VSI_S     0
609 #define ICE_AQC_RULE_MIRRORED_VSI_M     (0x7FF << ICE_AQC_RULE_MIRRORED_VSI_S)
610
611 /* This is to be used by add/update mirror rule Admin Queue command.
612  * In case of add mirror rule - if rule ID is specified as
613  * INVAL_MIRROR_RULE_ID, new rule ID is allocated from shared pool.
614  * If specified rule_id is valid, then it is used. If specified rule_id
615  * is in use then new mirroring rule is added.
616  */
617 #define ICE_INVAL_MIRROR_RULE_ID        0xFFFF
618
619 struct ice_aqc_add_update_mir_rule {
620         __le16 rule_id;
621
622         __le16 rule_type;
623 #define ICE_AQC_RULE_TYPE_S             0
624 #define ICE_AQC_RULE_TYPE_M             (0x7 << ICE_AQC_RULE_TYPE_S)
625         /* VPORT ingress/egress */
626 #define ICE_AQC_RULE_TYPE_VPORT_INGRESS 0x1
627 #define ICE_AQC_RULE_TYPE_VPORT_EGRESS  0x2
628         /* Physical port ingress mirroring.
629          * All traffic received by this port
630          */
631 #define ICE_AQC_RULE_TYPE_PPORT_INGRESS 0x6
632         /* Physical port egress mirroring. All traffic sent by this port */
633 #define ICE_AQC_RULE_TYPE_PPORT_EGRESS  0x7
634
635         /* Number of mirrored entries.
636          * The values are in the command buffer
637          */
638         __le16 num_entries;
639
640         /* Destination VSI */
641         __le16 dest;
642         __le32 addr_high;
643         __le32 addr_low;
644 };
645
646 /* Delete mirror rule - direct(0x0261) */
647 struct ice_aqc_delete_mir_rule {
648         __le16 rule_id;
649         __le16 rsvd;
650
651         /* Byte.bit: 20.0 = Keep allocation. If set VSI stays part of
652          * the PF allocated resources, otherwise it is returned to the
653          * shared pool
654          */
655 #define ICE_AQC_FLAG_KEEP_ALLOCD_S      0
656 #define ICE_AQC_FLAG_KEEP_ALLOCD_M      (0x1 << ICE_AQC_FLAG_KEEP_ALLOCD_S)
657         __le16 flags;
658
659         u8 reserved[10];
660 };
661
662 /* Set/Get storm config - (direct 0x0280, 0x0281) */
663 /* This structure holds get storm configuration response and same structure
664  * is used to perform set_storm_cfg
665  */
666 struct ice_aqc_storm_cfg {
667         __le32 bcast_thresh_size;
668         __le32 mcast_thresh_size;
669         /* Bit 18:0 - Traffic upper threshold size
670          * Bit 31:19 - Reserved
671          */
672 #define ICE_AQ_THRESHOLD_S      0
673 #define ICE_AQ_THRESHOLD_M      (0x7FFFF << ICE_AQ_THRESHOLD_S)
674
675         __le32 storm_ctrl_ctrl;
676         /* Bit 0: MDIPW - Drop Multicast packets in previous window
677          * Bit 1: MDICW - Drop multicast packets in current window
678          * Bit 2: BDIPW - Drop broadcast packets in previous window
679          * Bit 3: BDICW - Drop broadcast packets in current window
680          */
681 #define ICE_AQ_STORM_CTRL_MDIPW_DROP_MULTICAST  BIT(0)
682 #define ICE_AQ_STORM_CTRL_MDICW_DROP_MULTICAST  BIT(1)
683 #define ICE_AQ_STORM_CTRL_BDIPW_DROP_MULTICAST  BIT(2)
684 #define ICE_AQ_STORM_CTRL_BDICW_DROP_MULTICAST  BIT(3)
685         /* Bit 7:5 : Reserved */
686         /* Bit 27:8 : Interval - BSC/MSC Time-interval specification: The
687          * interval size for applying ingress broadcast or multicast storm
688          * control.
689          */
690 #define ICE_AQ_STORM_BSC_MSC_TIME_INTERVAL_S    8
691 #define ICE_AQ_STORM_BSC_MSC_TIME_INTERVAL_M    \
692                         (0xFFFFF << ICE_AQ_STORM_BSC_MSC_TIME_INTERVAL_S)
693         __le32 reserved;
694 };
695
696
697 #define ICE_MAX_NUM_RECIPES 64
698
699 /* Add/Get Recipe (indirect 0x0290/0x0292)*/
700 struct ice_aqc_add_get_recipe {
701         __le16 num_sub_recipes; /* Input in Add cmd, Output in Get cmd */
702         __le16 return_index;    /* Input, used for Get cmd only */
703         u8 reserved[4];
704         __le32 addr_high;
705         __le32 addr_low;
706 };
707
708 struct ice_aqc_recipe_content {
709         u8 rid;
710 #define ICE_AQ_RECIPE_ID_S              0
711 #define ICE_AQ_RECIPE_ID_M              (0x3F << ICE_AQ_RECIPE_ID_S)
712 #define ICE_AQ_RECIPE_ID_IS_ROOT        BIT(7)
713 #define ICE_AQ_SW_ID_LKUP_IDX           0
714         u8 lkup_indx[5];
715 #define ICE_AQ_RECIPE_LKUP_DATA_S       0
716 #define ICE_AQ_RECIPE_LKUP_DATA_M       (0x3F << ICE_AQ_RECIPE_LKUP_DATA_S)
717 #define ICE_AQ_RECIPE_LKUP_IGNORE       BIT(7)
718 #define ICE_AQ_SW_ID_LKUP_MASK          0x00FF
719         __le16 mask[5];
720         u8 result_indx;
721 #define ICE_AQ_RECIPE_RESULT_DATA_S     0
722 #define ICE_AQ_RECIPE_RESULT_DATA_M     (0x3F << ICE_AQ_RECIPE_RESULT_DATA_S)
723 #define ICE_AQ_RECIPE_RESULT_EN         BIT(7)
724         u8 rsvd0[3];
725         u8 act_ctrl_join_priority;
726         u8 act_ctrl_fwd_priority;
727 #define ICE_AQ_RECIPE_FWD_PRIORITY_S    0
728 #define ICE_AQ_RECIPE_FWD_PRIORITY_M    (0xF << ICE_AQ_RECIPE_FWD_PRIORITY_S)
729         u8 act_ctrl;
730 #define ICE_AQ_RECIPE_ACT_NEED_PASS_L2  BIT(0)
731 #define ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2 BIT(1)
732 #define ICE_AQ_RECIPE_ACT_INV_ACT       BIT(2)
733 #define ICE_AQ_RECIPE_ACT_PRUNE_INDX_S  4
734 #define ICE_AQ_RECIPE_ACT_PRUNE_INDX_M  (0x3 << ICE_AQ_RECIPE_ACT_PRUNE_INDX_S)
735         u8 rsvd1;
736         __le32 dflt_act;
737 #define ICE_AQ_RECIPE_DFLT_ACT_S        0
738 #define ICE_AQ_RECIPE_DFLT_ACT_M        (0x7FFFF << ICE_AQ_RECIPE_DFLT_ACT_S)
739 #define ICE_AQ_RECIPE_DFLT_ACT_VALID    BIT(31)
740 };
741
742 struct ice_aqc_recipe_data_elem {
743         u8 recipe_indx;
744         u8 resp_bits;
745 #define ICE_AQ_RECIPE_WAS_UPDATED       BIT(0)
746         u8 rsvd0[2];
747         u8 recipe_bitmap[8];
748         u8 rsvd1[4];
749         struct ice_aqc_recipe_content content;
750         u8 rsvd2[20];
751 };
752
753 /* This struct contains a number of entries as per the
754  * num_sub_recipes in the command
755  */
756 struct ice_aqc_add_get_recipe_data {
757         struct ice_aqc_recipe_data_elem recipe[1];
758 };
759
760 /* Set/Get Recipes to Profile Association (direct 0x0291/0x0293) */
761 struct ice_aqc_recipe_to_profile {
762         __le16 profile_id;
763         u8 rsvd[6];
764         ice_declare_bitmap(recipe_assoc, ICE_MAX_NUM_RECIPES);
765 };
766
767 /* Add/Update/Remove/Get switch rules (indirect 0x02A0, 0x02A1, 0x02A2, 0x02A3)
768  */
769 struct ice_aqc_sw_rules {
770         /* ops: add switch rules, referring the number of rules.
771          * ops: update switch rules, referring the number of filters
772          * ops: remove switch rules, referring the entry index.
773          * ops: get switch rules, referring to the number of filters.
774          */
775         __le16 num_rules_fltr_entry_index;
776         u8 reserved[6];
777         __le32 addr_high;
778         __le32 addr_low;
779 };
780
781
782 #pragma pack(1)
783 /* Add/Update/Get/Remove lookup Rx/Tx command/response entry
784  * This structures describes the lookup rules and associated actions. "index"
785  * is returned as part of a response to a successful Add command, and can be
786  * used to identify the rule for Update/Get/Remove commands.
787  */
788 struct ice_sw_rule_lkup_rx_tx {
789         __le16 recipe_id;
790 #define ICE_SW_RECIPE_LOGICAL_PORT_FWD          10
791         /* Source port for LOOKUP_RX and source VSI in case of LOOKUP_TX */
792         __le16 src;
793         __le32 act;
794
795         /* Bit 0:1 - Action type */
796 #define ICE_SINGLE_ACT_TYPE_S   0x00
797 #define ICE_SINGLE_ACT_TYPE_M   (0x3 << ICE_SINGLE_ACT_TYPE_S)
798
799         /* Bit 2 - Loop back enable
800          * Bit 3 - LAN enable
801          */
802 #define ICE_SINGLE_ACT_LB_ENABLE        BIT(2)
803 #define ICE_SINGLE_ACT_LAN_ENABLE       BIT(3)
804
805         /* Action type = 0 - Forward to VSI or VSI list */
806 #define ICE_SINGLE_ACT_VSI_FORWARDING   0x0
807
808 #define ICE_SINGLE_ACT_VSI_ID_S         4
809 #define ICE_SINGLE_ACT_VSI_ID_M         (0x3FF << ICE_SINGLE_ACT_VSI_ID_S)
810 #define ICE_SINGLE_ACT_VSI_LIST_ID_S    4
811 #define ICE_SINGLE_ACT_VSI_LIST_ID_M    (0x3FF << ICE_SINGLE_ACT_VSI_LIST_ID_S)
812         /* This bit needs to be set if action is forward to VSI list */
813 #define ICE_SINGLE_ACT_VSI_LIST         BIT(14)
814 #define ICE_SINGLE_ACT_VALID_BIT        BIT(17)
815 #define ICE_SINGLE_ACT_DROP             BIT(18)
816
817         /* Action type = 1 - Forward to Queue of Queue group */
818 #define ICE_SINGLE_ACT_TO_Q             0x1
819 #define ICE_SINGLE_ACT_Q_INDEX_S        4
820 #define ICE_SINGLE_ACT_Q_INDEX_M        (0x7FF << ICE_SINGLE_ACT_Q_INDEX_S)
821 #define ICE_SINGLE_ACT_Q_REGION_S       15
822 #define ICE_SINGLE_ACT_Q_REGION_M       (0x7 << ICE_SINGLE_ACT_Q_REGION_S)
823 #define ICE_SINGLE_ACT_Q_PRIORITY       BIT(18)
824
825         /* Action type = 2 - Prune */
826 #define ICE_SINGLE_ACT_PRUNE            0x2
827 #define ICE_SINGLE_ACT_EGRESS           BIT(15)
828 #define ICE_SINGLE_ACT_INGRESS          BIT(16)
829 #define ICE_SINGLE_ACT_PRUNET           BIT(17)
830         /* Bit 18 should be set to 0 for this action */
831
832         /* Action type = 2 - Pointer */
833 #define ICE_SINGLE_ACT_PTR              0x2
834 #define ICE_SINGLE_ACT_PTR_VAL_S        4
835 #define ICE_SINGLE_ACT_PTR_VAL_M        (0x1FFF << ICE_SINGLE_ACT_PTR_VAL_S)
836         /* Bit 18 should be set to 1 */
837 #define ICE_SINGLE_ACT_PTR_BIT          BIT(18)
838
839         /* Action type = 3 - Other actions. Last two bits
840          * are other action identifier
841          */
842 #define ICE_SINGLE_ACT_OTHER_ACTS               0x3
843 #define ICE_SINGLE_OTHER_ACT_IDENTIFIER_S       17
844 #define ICE_SINGLE_OTHER_ACT_IDENTIFIER_M       \
845                                 (0x3 << \ ICE_SINGLE_OTHER_ACT_IDENTIFIER_S)
846
847         /* Bit 17:18 - Defines other actions */
848         /* Other action = 0 - Mirror VSI */
849 #define ICE_SINGLE_OTHER_ACT_MIRROR             0
850 #define ICE_SINGLE_ACT_MIRROR_VSI_ID_S  4
851 #define ICE_SINGLE_ACT_MIRROR_VSI_ID_M  \
852                                 (0x3FF << ICE_SINGLE_ACT_MIRROR_VSI_ID_S)
853
854         /* Other action = 3 - Set Stat count */
855 #define ICE_SINGLE_OTHER_ACT_STAT_COUNT         3
856 #define ICE_SINGLE_ACT_STAT_COUNT_INDEX_S       4
857 #define ICE_SINGLE_ACT_STAT_COUNT_INDEX_M       \
858                                 (0x7F << ICE_SINGLE_ACT_STAT_COUNT_INDEX_S)
859
860         __le16 index; /* The index of the rule in the lookup table */
861         /* Length and values of the header to be matched per recipe or
862          * lookup-type
863          */
864         __le16 hdr_len;
865         u8 hdr[1];
866 };
867 #pragma pack()
868
869
870 /* Add/Update/Remove large action command/response entry
871  * "index" is returned as part of a response to a successful Add command, and
872  * can be used to identify the action for Update/Get/Remove commands.
873  */
874 struct ice_sw_rule_lg_act {
875         __le16 index; /* Index in large action table */
876         __le16 size;
877         __le32 act[1]; /* array of size for actions */
878         /* Max number of large actions */
879 #define ICE_MAX_LG_ACT  4
880         /* Bit 0:1 - Action type */
881 #define ICE_LG_ACT_TYPE_S       0
882 #define ICE_LG_ACT_TYPE_M       (0x7 << ICE_LG_ACT_TYPE_S)
883
884         /* Action type = 0 - Forward to VSI or VSI list */
885 #define ICE_LG_ACT_VSI_FORWARDING       0
886 #define ICE_LG_ACT_VSI_ID_S             3
887 #define ICE_LG_ACT_VSI_ID_M             (0x3FF << ICE_LG_ACT_VSI_ID_S)
888 #define ICE_LG_ACT_VSI_LIST_ID_S        3
889 #define ICE_LG_ACT_VSI_LIST_ID_M        (0x3FF << ICE_LG_ACT_VSI_LIST_ID_S)
890         /* This bit needs to be set if action is forward to VSI list */
891 #define ICE_LG_ACT_VSI_LIST             BIT(13)
892
893 #define ICE_LG_ACT_VALID_BIT            BIT(16)
894
895         /* Action type = 1 - Forward to Queue of Queue group */
896 #define ICE_LG_ACT_TO_Q                 0x1
897 #define ICE_LG_ACT_Q_INDEX_S            3
898 #define ICE_LG_ACT_Q_INDEX_M            (0x7FF << ICE_LG_ACT_Q_INDEX_S)
899 #define ICE_LG_ACT_Q_REGION_S           14
900 #define ICE_LG_ACT_Q_REGION_M           (0x7 << ICE_LG_ACT_Q_REGION_S)
901 #define ICE_LG_ACT_Q_PRIORITY_SET       BIT(17)
902
903         /* Action type = 2 - Prune */
904 #define ICE_LG_ACT_PRUNE                0x2
905 #define ICE_LG_ACT_EGRESS               BIT(14)
906 #define ICE_LG_ACT_INGRESS              BIT(15)
907 #define ICE_LG_ACT_PRUNET               BIT(16)
908
909         /* Action type = 3 - Mirror VSI */
910 #define ICE_LG_OTHER_ACT_MIRROR         0x3
911 #define ICE_LG_ACT_MIRROR_VSI_ID_S      3
912 #define ICE_LG_ACT_MIRROR_VSI_ID_M      (0x3FF << ICE_LG_ACT_MIRROR_VSI_ID_S)
913
914         /* Action type = 5 - Generic Value */
915 #define ICE_LG_ACT_GENERIC              0x5
916 #define ICE_LG_ACT_GENERIC_VALUE_S      3
917 #define ICE_LG_ACT_GENERIC_VALUE_M      (0xFFFF << ICE_LG_ACT_GENERIC_VALUE_S)
918 #define ICE_LG_ACT_GENERIC_OFFSET_S     19
919 #define ICE_LG_ACT_GENERIC_OFFSET_M     (0x7 << ICE_LG_ACT_GENERIC_OFFSET_S)
920 #define ICE_LG_ACT_GENERIC_PRIORITY_S   22
921 #define ICE_LG_ACT_GENERIC_PRIORITY_M   (0x7 << ICE_LG_ACT_GENERIC_PRIORITY_S)
922 #define ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX 7
923
924         /* Action = 7 - Set Stat count */
925 #define ICE_LG_ACT_STAT_COUNT           0x7
926 #define ICE_LG_ACT_STAT_COUNT_S         3
927 #define ICE_LG_ACT_STAT_COUNT_M         (0x7F << ICE_LG_ACT_STAT_COUNT_S)
928 };
929
930
931 /* Add/Update/Remove VSI list command/response entry
932  * "index" is returned as part of a response to a successful Add command, and
933  * can be used to identify the VSI list for Update/Get/Remove commands.
934  */
935 struct ice_sw_rule_vsi_list {
936         __le16 index; /* Index of VSI/Prune list */
937         __le16 number_vsi;
938         __le16 vsi[1]; /* Array of number_vsi VSI numbers */
939 };
940
941
942 #pragma pack(1)
943 /* Query VSI list command/response entry */
944 struct ice_sw_rule_vsi_list_query {
945         __le16 index;
946         ice_declare_bitmap(vsi_list, ICE_MAX_VSI);
947 };
948 #pragma pack()
949
950
951 #pragma pack(1)
952 /* Add switch rule response:
953  * Content of return buffer is same as the input buffer. The status field and
954  * LUT index are updated as part of the response
955  */
956 struct ice_aqc_sw_rules_elem {
957         __le16 type; /* Switch rule type, one of T_... */
958 #define ICE_AQC_SW_RULES_T_LKUP_RX              0x0
959 #define ICE_AQC_SW_RULES_T_LKUP_TX              0x1
960 #define ICE_AQC_SW_RULES_T_LG_ACT               0x2
961 #define ICE_AQC_SW_RULES_T_VSI_LIST_SET         0x3
962 #define ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR       0x4
963 #define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET       0x5
964 #define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR     0x6
965         __le16 status;
966         union {
967                 struct ice_sw_rule_lkup_rx_tx lkup_tx_rx;
968                 struct ice_sw_rule_lg_act lg_act;
969                 struct ice_sw_rule_vsi_list vsi_list;
970                 struct ice_sw_rule_vsi_list_query vsi_list_query;
971         } pdata;
972 };
973
974 #pragma pack()
975
976
977 /* PFC Ignore (direct 0x0301)
978  * The command and response use the same descriptor structure
979  */
980 struct ice_aqc_pfc_ignore {
981         u8      tc_bitmap;
982         u8      cmd_flags; /* unused in response */
983 #define ICE_AQC_PFC_IGNORE_SET          BIT(7)
984 #define ICE_AQC_PFC_IGNORE_CLEAR        0
985         u8      reserved[14];
986 };
987
988 /* Set PFC Mode (direct 0x0303)
989  * Query PFC Mode (direct 0x0302)
990  */
991 struct ice_aqc_set_query_pfc_mode {
992         u8      pfc_mode;
993 /* For Set Command response, reserved in all other cases */
994 #define ICE_AQC_PFC_NOT_CONFIGURED      0
995 /* For Query Command response, reserved in all other cases */
996 #define ICE_AQC_DCB_DIS         0
997 #define ICE_AQC_PFC_VLAN_BASED_PFC      1
998 #define ICE_AQC_PFC_DSCP_BASED_PFC      2
999         u8      rsvd[15];
1000 };
1001
1002 /* Set DCB Parameters (direct 0x0306) */
1003 struct ice_aqc_set_dcb_params {
1004         u8 cmd_flags; /* unused in response */
1005 #define ICE_AQC_LINK_UP_DCB_CFG    BIT(0)
1006         u8 valid_flags; /* unused in response */
1007 #define ICE_AQC_LINK_UP_DCB_CFG_VALID    BIT(0)
1008         u8 rsvd[14];
1009 };
1010
1011
1012 /* Get Default Topology (indirect 0x0400) */
1013 struct ice_aqc_get_topo {
1014         u8 port_num;
1015         u8 num_branches;
1016         __le16 reserved1;
1017         __le32 reserved2;
1018         __le32 addr_high;
1019         __le32 addr_low;
1020 };
1021
1022
1023 /* Update TSE (indirect 0x0403)
1024  * Get TSE (indirect 0x0404)
1025  * Add TSE (indirect 0x0401)
1026  * Delete TSE (indirect 0x040F)
1027  * Move TSE (indirect 0x0408)
1028  * Suspend Nodes (indirect 0x0409)
1029  * Resume Nodes (indirect 0x040A)
1030  */
1031 struct ice_aqc_sched_elem_cmd {
1032         __le16 num_elem_req;    /* Used by commands */
1033         __le16 num_elem_resp;   /* Used by responses */
1034         __le32 reserved;
1035         __le32 addr_high;
1036         __le32 addr_low;
1037 };
1038
1039
1040 /* This is the buffer for:
1041  * Suspend Nodes (indirect 0x0409)
1042  * Resume Nodes (indirect 0x040A)
1043  */
1044 struct ice_aqc_suspend_resume_elem {
1045         __le32 teid[1];
1046 };
1047
1048
1049 struct ice_aqc_txsched_move_grp_info_hdr {
1050         __le32 src_parent_teid;
1051         __le32 dest_parent_teid;
1052         __le16 num_elems;
1053         __le16 reserved;
1054 };
1055
1056
1057 struct ice_aqc_move_elem {
1058         struct ice_aqc_txsched_move_grp_info_hdr hdr;
1059         __le32 teid[1];
1060 };
1061
1062
1063 struct ice_aqc_elem_info_bw {
1064         __le16 bw_profile_idx;
1065         __le16 bw_alloc;
1066 };
1067
1068
1069 struct ice_aqc_txsched_elem {
1070         u8 elem_type; /* Special field, reserved for some aq calls */
1071 #define ICE_AQC_ELEM_TYPE_UNDEFINED             0x0
1072 #define ICE_AQC_ELEM_TYPE_ROOT_PORT             0x1
1073 #define ICE_AQC_ELEM_TYPE_TC                    0x2
1074 #define ICE_AQC_ELEM_TYPE_SE_GENERIC            0x3
1075 #define ICE_AQC_ELEM_TYPE_ENTRY_POINT           0x4
1076 #define ICE_AQC_ELEM_TYPE_LEAF                  0x5
1077 #define ICE_AQC_ELEM_TYPE_SE_PADDED             0x6
1078         u8 valid_sections;
1079 #define ICE_AQC_ELEM_VALID_GENERIC              BIT(0)
1080 #define ICE_AQC_ELEM_VALID_CIR                  BIT(1)
1081 #define ICE_AQC_ELEM_VALID_EIR                  BIT(2)
1082 #define ICE_AQC_ELEM_VALID_SHARED               BIT(3)
1083         u8 generic;
1084 #define ICE_AQC_ELEM_GENERIC_MODE_M             0x1
1085 #define ICE_AQC_ELEM_GENERIC_PRIO_S             0x1
1086 #define ICE_AQC_ELEM_GENERIC_PRIO_M     (0x7 << ICE_AQC_ELEM_GENERIC_PRIO_S)
1087 #define ICE_AQC_ELEM_GENERIC_SP_S               0x4
1088 #define ICE_AQC_ELEM_GENERIC_SP_M       (0x1 << ICE_AQC_ELEM_GENERIC_SP_S)
1089 #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S       0x5
1090 #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_M       \
1091         (0x3 << ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S)
1092         u8 flags; /* Special field, reserved for some aq calls */
1093 #define ICE_AQC_ELEM_FLAG_SUSPEND_M             0x1
1094         struct ice_aqc_elem_info_bw cir_bw;
1095         struct ice_aqc_elem_info_bw eir_bw;
1096         __le16 srl_id;
1097         __le16 reserved2;
1098 };
1099
1100
1101 struct ice_aqc_txsched_elem_data {
1102         __le32 parent_teid;
1103         __le32 node_teid;
1104         struct ice_aqc_txsched_elem data;
1105 };
1106
1107
1108 struct ice_aqc_txsched_topo_grp_info_hdr {
1109         __le32 parent_teid;
1110         __le16 num_elems;
1111         __le16 reserved2;
1112 };
1113
1114
1115 struct ice_aqc_add_elem {
1116         struct ice_aqc_txsched_topo_grp_info_hdr hdr;
1117         struct ice_aqc_txsched_elem_data generic[1];
1118 };
1119
1120
1121 struct ice_aqc_conf_elem {
1122         struct ice_aqc_txsched_elem_data generic[1];
1123 };
1124
1125
1126 struct ice_aqc_get_elem {
1127         struct ice_aqc_txsched_elem_data generic[1];
1128 };
1129
1130
1131 struct ice_aqc_get_topo_elem {
1132         struct ice_aqc_txsched_topo_grp_info_hdr hdr;
1133         struct ice_aqc_txsched_elem_data
1134                 generic[ICE_AQC_TOPO_MAX_LEVEL_NUM];
1135 };
1136
1137
1138 struct ice_aqc_delete_elem {
1139         struct ice_aqc_txsched_topo_grp_info_hdr hdr;
1140         __le32 teid[1];
1141 };
1142
1143
1144 /* Query Port ETS (indirect 0x040E)
1145  *
1146  * This indirect command is used to query port TC node configuration.
1147  */
1148 struct ice_aqc_query_port_ets {
1149         __le32 port_teid;
1150         __le32 reserved;
1151         __le32 addr_high;
1152         __le32 addr_low;
1153 };
1154
1155 struct ice_aqc_port_ets_elem {
1156         u8 tc_valid_bits;
1157         u8 reserved[3];
1158         /* 3 bits for UP per TC 0-7, 4th byte reserved */
1159         __le32 up2tc;
1160         u8 tc_bw_share[8];
1161         __le32 port_eir_prof_id;
1162         __le32 port_cir_prof_id;
1163         /* 3 bits per Node priority to TC 0-7, 4th byte reserved */
1164         __le32 tc_node_prio;
1165 #define ICE_TC_NODE_PRIO_S      0x4
1166         u8 reserved1[4];
1167         __le32 tc_node_teid[8]; /* Used for response, reserved in command */
1168 };
1169
1170
1171 /* Rate limiting profile for
1172  * Add RL profile (indirect 0x0410)
1173  * Query RL profile (indirect 0x0411)
1174  * Remove RL profile (indirect 0x0415)
1175  * These indirect commands acts on single or multiple
1176  * RL profiles with specified data.
1177  */
1178 struct ice_aqc_rl_profile {
1179         __le16 num_profiles;
1180         __le16 num_processed; /* Only for response. Reserved in Command. */
1181         u8 reserved[4];
1182         __le32 addr_high;
1183         __le32 addr_low;
1184 };
1185
1186
1187 struct ice_aqc_rl_profile_elem {
1188         u8 level;
1189         u8 flags;
1190 #define ICE_AQC_RL_PROFILE_TYPE_S       0x0
1191 #define ICE_AQC_RL_PROFILE_TYPE_M       (0x3 << ICE_AQC_RL_PROFILE_TYPE_S)
1192 #define ICE_AQC_RL_PROFILE_TYPE_CIR     0
1193 #define ICE_AQC_RL_PROFILE_TYPE_EIR     1
1194 #define ICE_AQC_RL_PROFILE_TYPE_SRL     2
1195 /* The following flag is used for Query RL Profile Data */
1196 #define ICE_AQC_RL_PROFILE_INVAL_S      0x7
1197 #define ICE_AQC_RL_PROFILE_INVAL_M      (0x1 << ICE_AQC_RL_PROFILE_INVAL_S)
1198
1199         __le16 profile_id;
1200         __le16 max_burst_size;
1201         __le16 rl_multiply;
1202         __le16 wake_up_calc;
1203         __le16 rl_encode;
1204 };
1205
1206
1207 struct ice_aqc_rl_profile_generic_elem {
1208         struct ice_aqc_rl_profile_elem generic[1];
1209 };
1210
1211
1212
1213 /* Configure L2 Node CGD (indirect 0x0414)
1214  * This indirect command allows configuring a congestion domain for given L2
1215  * node TEIDs in the scheduler topology.
1216  */
1217 struct ice_aqc_cfg_l2_node_cgd {
1218         __le16 num_l2_nodes;
1219         u8 reserved[6];
1220         __le32 addr_high;
1221         __le32 addr_low;
1222 };
1223
1224
1225 struct ice_aqc_cfg_l2_node_cgd_elem {
1226         __le32 node_teid;
1227         u8 cgd;
1228         u8 reserved[3];
1229 };
1230
1231
1232 struct ice_aqc_cfg_l2_node_cgd_data {
1233         struct ice_aqc_cfg_l2_node_cgd_elem elem[1];
1234 };
1235
1236
1237 /* Query Scheduler Resource Allocation (indirect 0x0412)
1238  * This indirect command retrieves the scheduler resources allocated by
1239  * EMP Firmware to the given PF.
1240  */
1241 struct ice_aqc_query_txsched_res {
1242         u8 reserved[8];
1243         __le32 addr_high;
1244         __le32 addr_low;
1245 };
1246
1247
1248 struct ice_aqc_generic_sched_props {
1249         __le16 phys_levels;
1250         __le16 logical_levels;
1251         u8 flattening_bitmap;
1252         u8 max_device_cgds;
1253         u8 max_pf_cgds;
1254         u8 rsvd0;
1255         __le16 rdma_qsets;
1256         u8 rsvd1[22];
1257 };
1258
1259
1260 struct ice_aqc_layer_props {
1261         u8 logical_layer;
1262         u8 chunk_size;
1263         __le16 max_device_nodes;
1264         __le16 max_pf_nodes;
1265         u8 rsvd0[4];
1266         __le16 max_sibl_grp_sz;
1267         __le16 max_cir_rl_profiles;
1268         __le16 max_eir_rl_profiles;
1269         __le16 max_srl_profiles;
1270         u8 rsvd1[14];
1271 };
1272
1273
1274 struct ice_aqc_query_txsched_res_resp {
1275         struct ice_aqc_generic_sched_props sched_props;
1276         struct ice_aqc_layer_props layer_props[ICE_AQC_TOPO_MAX_LEVEL_NUM];
1277 };
1278
1279
1280 /* Query Node to Root Topology (indirect 0x0413)
1281  * This command uses ice_aqc_get_elem as its data buffer.
1282  */
1283 struct ice_aqc_query_node_to_root {
1284         __le32 teid;
1285         __le32 num_nodes; /* Response only */
1286         __le32 addr_high;
1287         __le32 addr_low;
1288 };
1289
1290
1291 /* Get PHY capabilities (indirect 0x0600) */
1292 struct ice_aqc_get_phy_caps {
1293         u8 lport_num;
1294         u8 reserved;
1295         __le16 param0;
1296         /* 18.0 - Report qualified modules */
1297 #define ICE_AQC_GET_PHY_RQM             BIT(0)
1298         /* 18.1 - 18.2 : Report mode
1299          * 00b - Report NVM capabilities
1300          * 01b - Report topology capabilities
1301          * 10b - Report SW configured
1302          */
1303 #define ICE_AQC_REPORT_MODE_S           1
1304 #define ICE_AQC_REPORT_MODE_M           (3 << ICE_AQC_REPORT_MODE_S)
1305 #define ICE_AQC_REPORT_NVM_CAP          0
1306 #define ICE_AQC_REPORT_TOPO_CAP         BIT(1)
1307 #define ICE_AQC_REPORT_SW_CFG           BIT(2)
1308         __le32 reserved1;
1309         __le32 addr_high;
1310         __le32 addr_low;
1311 };
1312
1313
1314 /* This is #define of PHY type (Extended):
1315  * The first set of defines is for phy_type_low.
1316  */
1317 #define ICE_PHY_TYPE_LOW_100BASE_TX             BIT_ULL(0)
1318 #define ICE_PHY_TYPE_LOW_100M_SGMII             BIT_ULL(1)
1319 #define ICE_PHY_TYPE_LOW_1000BASE_T             BIT_ULL(2)
1320 #define ICE_PHY_TYPE_LOW_1000BASE_SX            BIT_ULL(3)
1321 #define ICE_PHY_TYPE_LOW_1000BASE_LX            BIT_ULL(4)
1322 #define ICE_PHY_TYPE_LOW_1000BASE_KX            BIT_ULL(5)
1323 #define ICE_PHY_TYPE_LOW_1G_SGMII               BIT_ULL(6)
1324 #define ICE_PHY_TYPE_LOW_2500BASE_T             BIT_ULL(7)
1325 #define ICE_PHY_TYPE_LOW_2500BASE_X             BIT_ULL(8)
1326 #define ICE_PHY_TYPE_LOW_2500BASE_KX            BIT_ULL(9)
1327 #define ICE_PHY_TYPE_LOW_5GBASE_T               BIT_ULL(10)
1328 #define ICE_PHY_TYPE_LOW_5GBASE_KR              BIT_ULL(11)
1329 #define ICE_PHY_TYPE_LOW_10GBASE_T              BIT_ULL(12)
1330 #define ICE_PHY_TYPE_LOW_10G_SFI_DA             BIT_ULL(13)
1331 #define ICE_PHY_TYPE_LOW_10GBASE_SR             BIT_ULL(14)
1332 #define ICE_PHY_TYPE_LOW_10GBASE_LR             BIT_ULL(15)
1333 #define ICE_PHY_TYPE_LOW_10GBASE_KR_CR1         BIT_ULL(16)
1334 #define ICE_PHY_TYPE_LOW_10G_SFI_AOC_ACC        BIT_ULL(17)
1335 #define ICE_PHY_TYPE_LOW_10G_SFI_C2C            BIT_ULL(18)
1336 #define ICE_PHY_TYPE_LOW_25GBASE_T              BIT_ULL(19)
1337 #define ICE_PHY_TYPE_LOW_25GBASE_CR             BIT_ULL(20)
1338 #define ICE_PHY_TYPE_LOW_25GBASE_CR_S           BIT_ULL(21)
1339 #define ICE_PHY_TYPE_LOW_25GBASE_CR1            BIT_ULL(22)
1340 #define ICE_PHY_TYPE_LOW_25GBASE_SR             BIT_ULL(23)
1341 #define ICE_PHY_TYPE_LOW_25GBASE_LR             BIT_ULL(24)
1342 #define ICE_PHY_TYPE_LOW_25GBASE_KR             BIT_ULL(25)
1343 #define ICE_PHY_TYPE_LOW_25GBASE_KR_S           BIT_ULL(26)
1344 #define ICE_PHY_TYPE_LOW_25GBASE_KR1            BIT_ULL(27)
1345 #define ICE_PHY_TYPE_LOW_25G_AUI_AOC_ACC        BIT_ULL(28)
1346 #define ICE_PHY_TYPE_LOW_25G_AUI_C2C            BIT_ULL(29)
1347 #define ICE_PHY_TYPE_LOW_40GBASE_CR4            BIT_ULL(30)
1348 #define ICE_PHY_TYPE_LOW_40GBASE_SR4            BIT_ULL(31)
1349 #define ICE_PHY_TYPE_LOW_40GBASE_LR4            BIT_ULL(32)
1350 #define ICE_PHY_TYPE_LOW_40GBASE_KR4            BIT_ULL(33)
1351 #define ICE_PHY_TYPE_LOW_40G_XLAUI_AOC_ACC      BIT_ULL(34)
1352 #define ICE_PHY_TYPE_LOW_40G_XLAUI              BIT_ULL(35)
1353 #define ICE_PHY_TYPE_LOW_50GBASE_CR2            BIT_ULL(36)
1354 #define ICE_PHY_TYPE_LOW_50GBASE_SR2            BIT_ULL(37)
1355 #define ICE_PHY_TYPE_LOW_50GBASE_LR2            BIT_ULL(38)
1356 #define ICE_PHY_TYPE_LOW_50GBASE_KR2            BIT_ULL(39)
1357 #define ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC      BIT_ULL(40)
1358 #define ICE_PHY_TYPE_LOW_50G_LAUI2              BIT_ULL(41)
1359 #define ICE_PHY_TYPE_LOW_50G_AUI2_AOC_ACC       BIT_ULL(42)
1360 #define ICE_PHY_TYPE_LOW_50G_AUI2               BIT_ULL(43)
1361 #define ICE_PHY_TYPE_LOW_50GBASE_CP             BIT_ULL(44)
1362 #define ICE_PHY_TYPE_LOW_50GBASE_SR             BIT_ULL(45)
1363 #define ICE_PHY_TYPE_LOW_50GBASE_FR             BIT_ULL(46)
1364 #define ICE_PHY_TYPE_LOW_50GBASE_LR             BIT_ULL(47)
1365 #define ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4        BIT_ULL(48)
1366 #define ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC       BIT_ULL(49)
1367 #define ICE_PHY_TYPE_LOW_50G_AUI1               BIT_ULL(50)
1368 #define ICE_PHY_TYPE_LOW_100GBASE_CR4           BIT_ULL(51)
1369 #define ICE_PHY_TYPE_LOW_100GBASE_SR4           BIT_ULL(52)
1370 #define ICE_PHY_TYPE_LOW_100GBASE_LR4           BIT_ULL(53)
1371 #define ICE_PHY_TYPE_LOW_100GBASE_KR4           BIT_ULL(54)
1372 #define ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC     BIT_ULL(55)
1373 #define ICE_PHY_TYPE_LOW_100G_CAUI4             BIT_ULL(56)
1374 #define ICE_PHY_TYPE_LOW_100G_AUI4_AOC_ACC      BIT_ULL(57)
1375 #define ICE_PHY_TYPE_LOW_100G_AUI4              BIT_ULL(58)
1376 #define ICE_PHY_TYPE_LOW_100GBASE_CR_PAM4       BIT_ULL(59)
1377 #define ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4       BIT_ULL(60)
1378 #define ICE_PHY_TYPE_LOW_100GBASE_CP2           BIT_ULL(61)
1379 #define ICE_PHY_TYPE_LOW_100GBASE_SR2           BIT_ULL(62)
1380 #define ICE_PHY_TYPE_LOW_100GBASE_DR            BIT_ULL(63)
1381 #define ICE_PHY_TYPE_LOW_MAX_INDEX              63
1382 /* The second set of defines is for phy_type_high. */
1383 #define ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4     BIT_ULL(0)
1384 #define ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC    BIT_ULL(1)
1385 #define ICE_PHY_TYPE_HIGH_100G_CAUI2            BIT_ULL(2)
1386 #define ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC     BIT_ULL(3)
1387 #define ICE_PHY_TYPE_HIGH_100G_AUI2             BIT_ULL(4)
1388 #define ICE_PHY_TYPE_HIGH_MAX_INDEX             19
1389
1390 struct ice_aqc_get_phy_caps_data {
1391         __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
1392         __le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
1393         u8 caps;
1394 #define ICE_AQC_PHY_EN_TX_LINK_PAUSE                    BIT(0)
1395 #define ICE_AQC_PHY_EN_RX_LINK_PAUSE                    BIT(1)
1396 #define ICE_AQC_PHY_LOW_POWER_MODE                      BIT(2)
1397 #define ICE_AQC_PHY_EN_LINK                             BIT(3)
1398 #define ICE_AQC_PHY_AN_MODE                             BIT(4)
1399 #define ICE_AQC_PHY_EN_MOD_QUAL                         BIT(5)
1400 #define ICE_AQC_PHY_EN_LESM                             BIT(6)
1401 #define ICE_AQC_PHY_EN_AUTO_FEC                         BIT(7)
1402 #define ICE_AQC_PHY_CAPS_MASK                           MAKEMASK(0xff, 0)
1403         u8 low_power_ctrl;
1404 #define ICE_AQC_PHY_EN_D3COLD_LOW_POWER_AUTONEG         BIT(0)
1405         __le16 eee_cap;
1406 #define ICE_AQC_PHY_EEE_EN_100BASE_TX                   BIT(0)
1407 #define ICE_AQC_PHY_EEE_EN_1000BASE_T                   BIT(1)
1408 #define ICE_AQC_PHY_EEE_EN_10GBASE_T                    BIT(2)
1409 #define ICE_AQC_PHY_EEE_EN_1000BASE_KX                  BIT(3)
1410 #define ICE_AQC_PHY_EEE_EN_10GBASE_KR                   BIT(4)
1411 #define ICE_AQC_PHY_EEE_EN_25GBASE_KR                   BIT(5)
1412 #define ICE_AQC_PHY_EEE_EN_40GBASE_KR4                  BIT(6)
1413 #define ICE_AQC_PHY_EEE_EN_50GBASE_KR2                  BIT(7)
1414 #define ICE_AQC_PHY_EEE_EN_50GBASE_KR_PAM4              BIT(8)
1415 #define ICE_AQC_PHY_EEE_EN_100GBASE_KR4                 BIT(9)
1416 #define ICE_AQC_PHY_EEE_EN_100GBASE_KR2_PAM4            BIT(10)
1417         __le16 eeer_value;
1418         u8 phy_id_oui[4]; /* PHY/Module ID connected on the port */
1419         u8 phy_fw_ver[8];
1420         u8 link_fec_options;
1421 #define ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN               BIT(0)
1422 #define ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ              BIT(1)
1423 #define ICE_AQC_PHY_FEC_25G_RS_528_REQ                  BIT(2)
1424 #define ICE_AQC_PHY_FEC_25G_KR_REQ                      BIT(3)
1425 #define ICE_AQC_PHY_FEC_25G_RS_544_REQ                  BIT(4)
1426 #define ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN              BIT(6)
1427 #define ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN              BIT(7)
1428 #define ICE_AQC_PHY_FEC_MASK                            MAKEMASK(0xdf, 0)
1429         u8 extended_compliance_code;
1430 #define ICE_MODULE_TYPE_TOTAL_BYTE                      3
1431         u8 module_type[ICE_MODULE_TYPE_TOTAL_BYTE];
1432 #define ICE_AQC_MOD_TYPE_BYTE0_SFP_PLUS                 0xA0
1433 #define ICE_AQC_MOD_TYPE_BYTE0_QSFP_PLUS                0x80
1434 #define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_PASSIVE      BIT(0)
1435 #define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_ACTIVE       BIT(1)
1436 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_SR              BIT(4)
1437 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_LR              BIT(5)
1438 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_LRM             BIT(6)
1439 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_ER              BIT(7)
1440 #define ICE_AQC_MOD_TYPE_BYTE2_SFP_PLUS                 0xA0
1441 #define ICE_AQC_MOD_TYPE_BYTE2_QSFP_PLUS                0x86
1442         u8 qualified_module_count;
1443 #define ICE_AQC_QUAL_MOD_COUNT_MAX                      16
1444         struct {
1445                 u8 v_oui[3];
1446                 u8 rsvd3;
1447                 u8 v_part[16];
1448                 __le32 v_rev;
1449                 __le64 rsvd8;
1450         } qual_modules[ICE_AQC_QUAL_MOD_COUNT_MAX];
1451 };
1452
1453
1454 /* Set PHY capabilities (direct 0x0601)
1455  * NOTE: This command must be followed by setup link and restart auto-neg
1456  */
1457 struct ice_aqc_set_phy_cfg {
1458         u8 lport_num;
1459         u8 reserved[7];
1460         __le32 addr_high;
1461         __le32 addr_low;
1462 };
1463
1464
1465 /* Set PHY config command data structure */
1466 struct ice_aqc_set_phy_cfg_data {
1467         __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
1468         __le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
1469         u8 caps;
1470 #define ICE_AQ_PHY_ENA_VALID_MASK       MAKEMASK(0xef, 0)
1471 #define ICE_AQ_PHY_ENA_TX_PAUSE_ABILITY BIT(0)
1472 #define ICE_AQ_PHY_ENA_RX_PAUSE_ABILITY BIT(1)
1473 #define ICE_AQ_PHY_ENA_LOW_POWER        BIT(2)
1474 #define ICE_AQ_PHY_ENA_LINK             BIT(3)
1475 #define ICE_AQ_PHY_ENA_AUTO_LINK_UPDT   BIT(5)
1476 #define ICE_AQ_PHY_ENA_LESM             BIT(6)
1477 #define ICE_AQ_PHY_ENA_AUTO_FEC         BIT(7)
1478         u8 low_power_ctrl;
1479         __le16 eee_cap; /* Value from ice_aqc_get_phy_caps */
1480         __le16 eeer_value;
1481         u8 link_fec_opt; /* Use defines from ice_aqc_get_phy_caps */
1482         u8 rsvd1;
1483 };
1484
1485
1486 /* Set MAC Config command data structure (direct 0x0603) */
1487 struct ice_aqc_set_mac_cfg {
1488         __le16 max_frame_size;
1489         u8 params;
1490 #define ICE_AQ_SET_MAC_PACE_S           3
1491 #define ICE_AQ_SET_MAC_PACE_M           (0xF << ICE_AQ_SET_MAC_PACE_S)
1492 #define ICE_AQ_SET_MAC_PACE_TYPE_M      BIT(7)
1493 #define ICE_AQ_SET_MAC_PACE_TYPE_RATE   0
1494 #define ICE_AQ_SET_MAC_PACE_TYPE_FIXED  ICE_AQ_SET_MAC_PACE_TYPE_M
1495         u8 tx_tmr_priority;
1496         __le16 tx_tmr_value;
1497         __le16 fc_refresh_threshold;
1498         u8 drop_opts;
1499 #define ICE_AQ_SET_MAC_AUTO_DROP_MASK           BIT(0)
1500 #define ICE_AQ_SET_MAC_AUTO_DROP_NONE           0
1501 #define ICE_AQ_SET_MAC_AUTO_DROP_BLOCKING_PKTS  BIT(0)
1502         u8 reserved[7];
1503 };
1504
1505
1506 /* Restart AN command data structure (direct 0x0605)
1507  * Also used for response, with only the lport_num field present.
1508  */
1509 struct ice_aqc_restart_an {
1510         u8 lport_num;
1511         u8 reserved;
1512         u8 cmd_flags;
1513 #define ICE_AQC_RESTART_AN_LINK_RESTART BIT(1)
1514 #define ICE_AQC_RESTART_AN_LINK_ENABLE  BIT(2)
1515         u8 reserved2[13];
1516 };
1517
1518
1519 /* Get link status (indirect 0x0607), also used for Link Status Event */
1520 struct ice_aqc_get_link_status {
1521         u8 lport_num;
1522         u8 reserved;
1523         __le16 cmd_flags;
1524 #define ICE_AQ_LSE_M                    0x3
1525 #define ICE_AQ_LSE_NOP                  0x0
1526 #define ICE_AQ_LSE_DIS                  0x2
1527 #define ICE_AQ_LSE_ENA                  0x3
1528         /* only response uses this flag */
1529 #define ICE_AQ_LSE_IS_ENABLED           0x1
1530         __le32 reserved2;
1531         __le32 addr_high;
1532         __le32 addr_low;
1533 };
1534
1535
1536 /* Get link status response data structure, also used for Link Status Event */
1537 struct ice_aqc_get_link_status_data {
1538         u8 topo_media_conflict;
1539 #define ICE_AQ_LINK_TOPO_CONFLICT       BIT(0)
1540 #define ICE_AQ_LINK_MEDIA_CONFLICT      BIT(1)
1541 #define ICE_AQ_LINK_TOPO_CORRUPT        BIT(2)
1542 #define ICE_AQ_LINK_TOPO_UNREACH_PRT    BIT(4)
1543 #define ICE_AQ_LINK_TOPO_UNDRUTIL_PRT   BIT(5)
1544 #define ICE_AQ_LINK_TOPO_UNDRUTIL_MEDIA BIT(6)
1545 #define ICE_AQ_LINK_TOPO_UNSUPP_MEDIA   BIT(7)
1546         u8 link_cfg_err;
1547 #define ICE_AQ_LINK_CFG_ERR             BIT(0)
1548         u8 link_info;
1549 #define ICE_AQ_LINK_UP                  BIT(0)  /* Link Status */
1550 #define ICE_AQ_LINK_FAULT               BIT(1)
1551 #define ICE_AQ_LINK_FAULT_TX            BIT(2)
1552 #define ICE_AQ_LINK_FAULT_RX            BIT(3)
1553 #define ICE_AQ_LINK_FAULT_REMOTE        BIT(4)
1554 #define ICE_AQ_LINK_UP_PORT             BIT(5)  /* External Port Link Status */
1555 #define ICE_AQ_MEDIA_AVAILABLE          BIT(6)
1556 #define ICE_AQ_SIGNAL_DETECT            BIT(7)
1557         u8 an_info;
1558 #define ICE_AQ_AN_COMPLETED             BIT(0)
1559 #define ICE_AQ_LP_AN_ABILITY            BIT(1)
1560 #define ICE_AQ_PD_FAULT                 BIT(2)  /* Parallel Detection Fault */
1561 #define ICE_AQ_FEC_EN                   BIT(3)
1562 #define ICE_AQ_PHY_LOW_POWER            BIT(4)  /* Low Power State */
1563 #define ICE_AQ_LINK_PAUSE_TX            BIT(5)
1564 #define ICE_AQ_LINK_PAUSE_RX            BIT(6)
1565 #define ICE_AQ_QUALIFIED_MODULE         BIT(7)
1566         u8 ext_info;
1567 #define ICE_AQ_LINK_PHY_TEMP_ALARM      BIT(0)
1568 #define ICE_AQ_LINK_EXCESSIVE_ERRORS    BIT(1)  /* Excessive Link Errors */
1569         /* Port Tx Suspended */
1570 #define ICE_AQ_LINK_TX_S                2
1571 #define ICE_AQ_LINK_TX_M                (0x03 << ICE_AQ_LINK_TX_S)
1572 #define ICE_AQ_LINK_TX_ACTIVE           0
1573 #define ICE_AQ_LINK_TX_DRAINED          1
1574 #define ICE_AQ_LINK_TX_FLUSHED          3
1575         u8 reserved2;
1576         __le16 max_frame_size;
1577         u8 cfg;
1578 #define ICE_AQ_LINK_25G_KR_FEC_EN       BIT(0)
1579 #define ICE_AQ_LINK_25G_RS_528_FEC_EN   BIT(1)
1580 #define ICE_AQ_LINK_25G_RS_544_FEC_EN   BIT(2)
1581 #define ICE_AQ_FEC_MASK                 MAKEMASK(0x7, 0)
1582         /* Pacing Config */
1583 #define ICE_AQ_CFG_PACING_S             3
1584 #define ICE_AQ_CFG_PACING_M             (0xF << ICE_AQ_CFG_PACING_S)
1585 #define ICE_AQ_CFG_PACING_TYPE_M        BIT(7)
1586 #define ICE_AQ_CFG_PACING_TYPE_AVG      0
1587 #define ICE_AQ_CFG_PACING_TYPE_FIXED    ICE_AQ_CFG_PACING_TYPE_M
1588         /* External Device Power Ability */
1589         u8 power_desc;
1590 #define ICE_AQ_PWR_CLASS_M              0x3
1591 #define ICE_AQ_LINK_PWR_BASET_LOW_HIGH  0
1592 #define ICE_AQ_LINK_PWR_BASET_HIGH      1
1593 #define ICE_AQ_LINK_PWR_QSFP_CLASS_1    0
1594 #define ICE_AQ_LINK_PWR_QSFP_CLASS_2    1
1595 #define ICE_AQ_LINK_PWR_QSFP_CLASS_3    2
1596 #define ICE_AQ_LINK_PWR_QSFP_CLASS_4    3
1597         __le16 link_speed;
1598 #define ICE_AQ_LINK_SPEED_10MB          BIT(0)
1599 #define ICE_AQ_LINK_SPEED_100MB         BIT(1)
1600 #define ICE_AQ_LINK_SPEED_1000MB        BIT(2)
1601 #define ICE_AQ_LINK_SPEED_2500MB        BIT(3)
1602 #define ICE_AQ_LINK_SPEED_5GB           BIT(4)
1603 #define ICE_AQ_LINK_SPEED_10GB          BIT(5)
1604 #define ICE_AQ_LINK_SPEED_20GB          BIT(6)
1605 #define ICE_AQ_LINK_SPEED_25GB          BIT(7)
1606 #define ICE_AQ_LINK_SPEED_40GB          BIT(8)
1607 #define ICE_AQ_LINK_SPEED_50GB          BIT(9)
1608 #define ICE_AQ_LINK_SPEED_100GB         BIT(10)
1609 #define ICE_AQ_LINK_SPEED_UNKNOWN       BIT(15)
1610         __le32 reserved3; /* Aligns next field to 8-byte boundary */
1611         __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
1612         __le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
1613 };
1614
1615
1616 /* Set event mask command (direct 0x0613) */
1617 struct ice_aqc_set_event_mask {
1618         u8      lport_num;
1619         u8      reserved[7];
1620         __le16  event_mask;
1621 #define ICE_AQ_LINK_EVENT_UPDOWN                BIT(1)
1622 #define ICE_AQ_LINK_EVENT_MEDIA_NA              BIT(2)
1623 #define ICE_AQ_LINK_EVENT_LINK_FAULT            BIT(3)
1624 #define ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM        BIT(4)
1625 #define ICE_AQ_LINK_EVENT_EXCESSIVE_ERRORS      BIT(5)
1626 #define ICE_AQ_LINK_EVENT_SIGNAL_DETECT         BIT(6)
1627 #define ICE_AQ_LINK_EVENT_AN_COMPLETED          BIT(7)
1628 #define ICE_AQ_LINK_EVENT_MODULE_QUAL_FAIL      BIT(8)
1629 #define ICE_AQ_LINK_EVENT_PORT_TX_SUSPENDED     BIT(9)
1630         u8      reserved1[6];
1631 };
1632
1633
1634
1635 /* Set MAC Loopback command (direct 0x0620) */
1636 struct ice_aqc_set_mac_lb {
1637         u8 lb_mode;
1638 #define ICE_AQ_MAC_LB_EN                BIT(0)
1639 #define ICE_AQ_MAC_LB_OSC_CLK           BIT(1)
1640         u8 reserved[15];
1641 };
1642
1643
1644
1645
1646
1647 /* Set Port Identification LED (direct, 0x06E9) */
1648 struct ice_aqc_set_port_id_led {
1649         u8 lport_num;
1650         u8 lport_num_valid;
1651 #define ICE_AQC_PORT_ID_PORT_NUM_VALID  BIT(0)
1652         u8 ident_mode;
1653 #define ICE_AQC_PORT_IDENT_LED_BLINK    BIT(0)
1654 #define ICE_AQC_PORT_IDENT_LED_ORIG     0
1655         u8 rsvd[13];
1656 };
1657
1658
1659
1660 /* NVM Read command (indirect 0x0701)
1661  * NVM Erase commands (direct 0x0702)
1662  * NVM Update commands (indirect 0x0703)
1663  */
1664 struct ice_aqc_nvm {
1665         __le16 offset_low;
1666         u8 offset_high;
1667         u8 cmd_flags;
1668 #define ICE_AQC_NVM_LAST_CMD            BIT(0)
1669 #define ICE_AQC_NVM_PCIR_REQ            BIT(0)  /* Used by NVM Update reply */
1670 #define ICE_AQC_NVM_PRESERVATION_S      1
1671 #define ICE_AQC_NVM_PRESERVATION_M      (3 << ICE_AQC_NVM_PRESERVATION_S)
1672 #define ICE_AQC_NVM_NO_PRESERVATION     (0 << ICE_AQC_NVM_PRESERVATION_S)
1673 #define ICE_AQC_NVM_PRESERVE_ALL        BIT(1)
1674 #define ICE_AQC_NVM_FACTORY_DEFAULT     (2 << ICE_AQC_NVM_PRESERVATION_S)
1675 #define ICE_AQC_NVM_PRESERVE_SELECTED   (3 << ICE_AQC_NVM_PRESERVATION_S)
1676 #define ICE_AQC_NVM_FLASH_ONLY          BIT(7)
1677         __le16 module_typeid;
1678         __le16 length;
1679 #define ICE_AQC_NVM_ERASE_LEN   0xFFFF
1680         __le32 addr_high;
1681         __le32 addr_low;
1682 };
1683
1684
1685 /* Used for 0x0704 as well as for 0x0705 commands */
1686 struct ice_aqc_nvm_cfg {
1687         u8      cmd_flags;
1688 #define ICE_AQC_ANVM_MULTIPLE_ELEMS     BIT(0)
1689 #define ICE_AQC_ANVM_IMMEDIATE_FIELD    BIT(1)
1690 #define ICE_AQC_ANVM_NEW_CFG            BIT(2)
1691         u8      reserved;
1692         __le16 count;
1693         __le16 id;
1694         u8 reserved1[2];
1695         __le32 addr_high;
1696         __le32 addr_low;
1697 };
1698
1699
1700 struct ice_aqc_nvm_cfg_data {
1701         __le16 field_id;
1702         __le16 field_options;
1703         __le16 field_value;
1704 };
1705
1706
1707 /* NVM Checksum Command (direct, 0x0706) */
1708 struct ice_aqc_nvm_checksum {
1709         u8 flags;
1710 #define ICE_AQC_NVM_CHECKSUM_VERIFY     BIT(0)
1711 #define ICE_AQC_NVM_CHECKSUM_RECALC     BIT(1)
1712         u8 rsvd;
1713         __le16 checksum; /* Used only by response */
1714 #define ICE_AQC_NVM_CHECKSUM_CORRECT    0xBABA
1715         u8 rsvd2[12];
1716 };
1717
1718
1719
1720
1721 /* Get LLDP MIB (indirect 0x0A00)
1722  * Note: This is also used by the LLDP MIB Change Event (0x0A01)
1723  * as the format is the same.
1724  */
1725 struct ice_aqc_lldp_get_mib {
1726         u8 type;
1727 #define ICE_AQ_LLDP_MIB_TYPE_S                  0
1728 #define ICE_AQ_LLDP_MIB_TYPE_M                  (0x3 << ICE_AQ_LLDP_MIB_TYPE_S)
1729 #define ICE_AQ_LLDP_MIB_LOCAL                   0
1730 #define ICE_AQ_LLDP_MIB_REMOTE                  1
1731 #define ICE_AQ_LLDP_MIB_LOCAL_AND_REMOTE        2
1732 #define ICE_AQ_LLDP_BRID_TYPE_S                 2
1733 #define ICE_AQ_LLDP_BRID_TYPE_M                 (0x3 << ICE_AQ_LLDP_BRID_TYPE_S)
1734 #define ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID      0
1735 #define ICE_AQ_LLDP_BRID_TYPE_NON_TPMR          1
1736 /* Tx pause flags in the 0xA01 event use ICE_AQ_LLDP_TX_* */
1737 #define ICE_AQ_LLDP_TX_S                        0x4
1738 #define ICE_AQ_LLDP_TX_M                        (0x03 << ICE_AQ_LLDP_TX_S)
1739 #define ICE_AQ_LLDP_TX_ACTIVE                   0
1740 #define ICE_AQ_LLDP_TX_SUSPENDED                1
1741 #define ICE_AQ_LLDP_TX_FLUSHED                  3
1742 /* The following bytes are reserved for the Get LLDP MIB command (0x0A00)
1743  * and in the LLDP MIB Change Event (0x0A01). They are valid for the
1744  * Get LLDP MIB (0x0A00) response only.
1745  */
1746         u8 reserved1;
1747         __le16 local_len;
1748         __le16 remote_len;
1749         u8 reserved2[2];
1750         __le32 addr_high;
1751         __le32 addr_low;
1752 };
1753
1754 /* Configure LLDP MIB Change Event (direct 0x0A01) */
1755 /* For MIB Change Event use ice_aqc_lldp_get_mib structure above */
1756 struct ice_aqc_lldp_set_mib_change {
1757         u8 command;
1758 #define ICE_AQ_LLDP_MIB_UPDATE_ENABLE           0x0
1759 #define ICE_AQ_LLDP_MIB_UPDATE_DIS              0x1
1760         u8 reserved[15];
1761 };
1762
1763 /* Add LLDP TLV (indirect 0x0A02)
1764  * Delete LLDP TLV (indirect 0x0A04)
1765  */
1766 struct ice_aqc_lldp_add_delete_tlv {
1767         u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
1768         u8 reserved1[1];
1769         __le16 len;
1770         u8 reserved2[4];
1771         __le32 addr_high;
1772         __le32 addr_low;
1773 };
1774
1775 /* Update LLDP TLV (indirect 0x0A03) */
1776 struct ice_aqc_lldp_update_tlv {
1777         u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
1778         u8 reserved;
1779         __le16 old_len;
1780         __le16 new_offset;
1781         __le16 new_len;
1782         __le32 addr_high;
1783         __le32 addr_low;
1784 };
1785
1786 /* Stop LLDP (direct 0x0A05) */
1787 struct ice_aqc_lldp_stop {
1788         u8 command;
1789 #define ICE_AQ_LLDP_AGENT_STATE_MASK    BIT(0)
1790 #define ICE_AQ_LLDP_AGENT_STOP          0x0
1791 #define ICE_AQ_LLDP_AGENT_SHUTDOWN      ICE_AQ_LLDP_AGENT_STATE_MASK
1792 #define ICE_AQ_LLDP_AGENT_PERSIST_DIS   BIT(1)
1793         u8 reserved[15];
1794 };
1795
1796 /* Start LLDP (direct 0x0A06) */
1797 struct ice_aqc_lldp_start {
1798         u8 command;
1799 #define ICE_AQ_LLDP_AGENT_START         BIT(0)
1800 #define ICE_AQ_LLDP_AGENT_PERSIST_ENA   BIT(1)
1801         u8 reserved[15];
1802 };
1803
1804 /* Get CEE DCBX Oper Config (0x0A07)
1805  * The command uses the generic descriptor struct and
1806  * returns the struct below as an indirect response.
1807  */
1808 struct ice_aqc_get_cee_dcb_cfg_resp {
1809         u8 oper_num_tc;
1810         u8 oper_prio_tc[4];
1811         u8 oper_tc_bw[8];
1812         u8 oper_pfc_en;
1813         __le16 oper_app_prio;
1814 #define ICE_AQC_CEE_APP_FCOE_S          0
1815 #define ICE_AQC_CEE_APP_FCOE_M          (0x7 << ICE_AQC_CEE_APP_FCOE_S)
1816 #define ICE_AQC_CEE_APP_ISCSI_S         3
1817 #define ICE_AQC_CEE_APP_ISCSI_M         (0x7 << ICE_AQC_CEE_APP_ISCSI_S)
1818 #define ICE_AQC_CEE_APP_FIP_S           8
1819 #define ICE_AQC_CEE_APP_FIP_M           (0x7 << ICE_AQC_CEE_APP_FIP_S)
1820         __le32 tlv_status;
1821 #define ICE_AQC_CEE_PG_STATUS_S         0
1822 #define ICE_AQC_CEE_PG_STATUS_M         (0x7 << ICE_AQC_CEE_PG_STATUS_S)
1823 #define ICE_AQC_CEE_PFC_STATUS_S        3
1824 #define ICE_AQC_CEE_PFC_STATUS_M        (0x7 << ICE_AQC_CEE_PFC_STATUS_S)
1825 #define ICE_AQC_CEE_FCOE_STATUS_S       8
1826 #define ICE_AQC_CEE_FCOE_STATUS_M       (0x7 << ICE_AQC_CEE_FCOE_STATUS_S)
1827 #define ICE_AQC_CEE_ISCSI_STATUS_S      11
1828 #define ICE_AQC_CEE_ISCSI_STATUS_M      (0x7 << ICE_AQC_CEE_ISCSI_STATUS_S)
1829 #define ICE_AQC_CEE_FIP_STATUS_S        16
1830 #define ICE_AQC_CEE_FIP_STATUS_M        (0x7 << ICE_AQC_CEE_FIP_STATUS_S)
1831         u8 reserved[12];
1832 };
1833
1834 /* Set Local LLDP MIB (indirect 0x0A08)
1835  * Used to replace the local MIB of a given LLDP agent. e.g. DCBx
1836  */
1837 struct ice_aqc_lldp_set_local_mib {
1838         u8 type;
1839 #define SET_LOCAL_MIB_TYPE_DCBX_M               BIT(0)
1840 #define SET_LOCAL_MIB_TYPE_LOCAL_MIB            0
1841 #define SET_LOCAL_MIB_TYPE_CEE_M                BIT(1)
1842 #define SET_LOCAL_MIB_TYPE_CEE_WILLING          0
1843 #define SET_LOCAL_MIB_TYPE_CEE_NON_WILLING      SET_LOCAL_MIB_TYPE_CEE_M
1844         u8 reserved0;
1845         __le16 length;
1846         u8 reserved1[4];
1847         __le32 addr_high;
1848         __le32 addr_low;
1849 };
1850
1851 struct ice_aqc_lldp_set_local_mib_resp {
1852         u8 status;
1853 #define SET_LOCAL_MIB_RESP_EVENT_M              BIT(0)
1854 #define SET_LOCAL_MIB_RESP_MIB_CHANGE_SILENT    0
1855 #define SET_LOCAL_MIB_RESP_MIB_CHANGE_EVENT     SET_LOCAL_MIB_RESP_EVENT_M
1856         u8 reserved[15];
1857 };
1858
1859 /* Stop/Start LLDP Agent (direct 0x0A09)
1860  * Used for stopping/starting specific LLDP agent. e.g. DCBx.
1861  * The same structure is used for the response, with the command field
1862  * being used as the status field.
1863  */
1864 struct ice_aqc_lldp_stop_start_specific_agent {
1865         u8 command;
1866 #define ICE_AQC_START_STOP_AGENT_M              BIT(0)
1867 #define ICE_AQC_START_STOP_AGENT_STOP_DCBX      0
1868 #define ICE_AQC_START_STOP_AGENT_START_DCBX     ICE_AQC_START_STOP_AGENT_M
1869         u8 reserved[15];
1870 };
1871
1872
1873 /* Get/Set RSS key (indirect 0x0B04/0x0B02) */
1874 struct ice_aqc_get_set_rss_key {
1875 #define ICE_AQC_GSET_RSS_KEY_VSI_VALID  BIT(15)
1876 #define ICE_AQC_GSET_RSS_KEY_VSI_ID_S   0
1877 #define ICE_AQC_GSET_RSS_KEY_VSI_ID_M   (0x3FF << ICE_AQC_GSET_RSS_KEY_VSI_ID_S)
1878         __le16 vsi_id;
1879         u8 reserved[6];
1880         __le32 addr_high;
1881         __le32 addr_low;
1882 };
1883
1884
1885 #define ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE       0x28
1886 #define ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE      0xC
1887 #define ICE_GET_SET_RSS_KEY_EXTEND_KEY_SIZE \
1888                                 (ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE + \
1889                                  ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE)
1890
1891 /**
1892  * struct ice_aqc_get_set_rss_keys - Get/Set RSS hash key command buffer
1893  * @standard_rss_key: 40 most significant bytes of hash key
1894  * @extended_hash_key: 12 least significant bytes of hash key
1895  *
1896  * Set/Get 40 byte hash key using standard_rss_key field, and set
1897  * extended_hash_key field to zero. Set/Get 52 byte hash key using
1898  * standard_rss_key field for 40 most significant bytes and the
1899  * extended_hash_key field for the 12 least significant bytes of hash key.
1900  */
1901 struct ice_aqc_get_set_rss_keys {
1902         u8 standard_rss_key[ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE];
1903         u8 extended_hash_key[ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE];
1904 };
1905
1906
1907 /* Get/Set RSS LUT (indirect 0x0B05/0x0B03) */
1908 struct ice_aqc_get_set_rss_lut {
1909 #define ICE_AQC_GSET_RSS_LUT_VSI_VALID  BIT(15)
1910 #define ICE_AQC_GSET_RSS_LUT_VSI_ID_S   0
1911 #define ICE_AQC_GSET_RSS_LUT_VSI_ID_M   (0x1FF << ICE_AQC_GSET_RSS_LUT_VSI_ID_S)
1912         __le16 vsi_id;
1913 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S       0
1914 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M       \
1915                                 (0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
1916
1917 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI      0
1918 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF       1
1919 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL   2
1920
1921 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S        2
1922 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M        \
1923                                 (0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
1924
1925 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128      128
1926 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
1927 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512      512
1928 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG 1
1929 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K       2048
1930 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG  2
1931
1932 #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S        4
1933 #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_M        \
1934                                 (0xF << ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S)
1935
1936         __le16 flags;
1937         __le32 reserved;
1938         __le32 addr_high;
1939         __le32 addr_low;
1940 };
1941
1942
1943 /* Clear FD Table Command (direct, 0x0B06) */
1944 struct ice_aqc_clear_fd_table {
1945         u8 clear_type;
1946 #define CL_FD_VM_VF_TYPE_VSI_IDX        1
1947 #define CL_FD_VM_VF_TYPE_PF_IDX         2
1948         u8 rsvd;
1949         __le16 vsi_index;
1950         u8 reserved[12];
1951 };
1952
1953
1954
1955
1956 /* Add Tx LAN Queues (indirect 0x0C30) */
1957 struct ice_aqc_add_txqs {
1958         u8 num_qgrps;
1959         u8 reserved[3];
1960         __le32 reserved1;
1961         __le32 addr_high;
1962         __le32 addr_low;
1963 };
1964
1965
1966 /* This is the descriptor of each queue entry for the Add Tx LAN Queues
1967  * command (0x0C30). Only used within struct ice_aqc_add_tx_qgrp.
1968  */
1969 struct ice_aqc_add_txqs_perq {
1970         __le16 txq_id;
1971         u8 rsvd[2];
1972         __le32 q_teid;
1973         u8 txq_ctx[22];
1974         u8 rsvd2[2];
1975         struct ice_aqc_txsched_elem info;
1976 };
1977
1978
1979 /* The format of the command buffer for Add Tx LAN Queues (0x0C30)
1980  * is an array of the following structs. Please note that the length of
1981  * each struct ice_aqc_add_tx_qgrp is variable due
1982  * to the variable number of queues in each group!
1983  */
1984 struct ice_aqc_add_tx_qgrp {
1985         __le32 parent_teid;
1986         u8 num_txqs;
1987         u8 rsvd[3];
1988         struct ice_aqc_add_txqs_perq txqs[1];
1989 };
1990
1991
1992 /* Disable Tx LAN Queues (indirect 0x0C31) */
1993 struct ice_aqc_dis_txqs {
1994         u8 cmd_type;
1995 #define ICE_AQC_Q_DIS_CMD_S             0
1996 #define ICE_AQC_Q_DIS_CMD_M             (0x3 << ICE_AQC_Q_DIS_CMD_S)
1997 #define ICE_AQC_Q_DIS_CMD_NO_FUNC_RESET (0 << ICE_AQC_Q_DIS_CMD_S)
1998 #define ICE_AQC_Q_DIS_CMD_VM_RESET      BIT(ICE_AQC_Q_DIS_CMD_S)
1999 #define ICE_AQC_Q_DIS_CMD_VF_RESET      (2 << ICE_AQC_Q_DIS_CMD_S)
2000 #define ICE_AQC_Q_DIS_CMD_PF_RESET      (3 << ICE_AQC_Q_DIS_CMD_S)
2001 #define ICE_AQC_Q_DIS_CMD_SUBSEQ_CALL   BIT(2)
2002 #define ICE_AQC_Q_DIS_CMD_FLUSH_PIPE    BIT(3)
2003         u8 num_entries;
2004         __le16 vmvf_and_timeout;
2005 #define ICE_AQC_Q_DIS_VMVF_NUM_S        0
2006 #define ICE_AQC_Q_DIS_VMVF_NUM_M        (0x3FF << ICE_AQC_Q_DIS_VMVF_NUM_S)
2007 #define ICE_AQC_Q_DIS_TIMEOUT_S         10
2008 #define ICE_AQC_Q_DIS_TIMEOUT_M         (0x3F << ICE_AQC_Q_DIS_TIMEOUT_S)
2009         __le32 blocked_cgds;
2010         __le32 addr_high;
2011         __le32 addr_low;
2012 };
2013
2014
2015 /* The buffer for Disable Tx LAN Queues (indirect 0x0C31)
2016  * contains the following structures, arrayed one after the
2017  * other.
2018  * Note: Since the q_id is 16 bits wide, if the
2019  * number of queues is even, then 2 bytes of alignment MUST be
2020  * added before the start of the next group, to allow correct
2021  * alignment of the parent_teid field.
2022  */
2023 struct ice_aqc_dis_txq_item {
2024         __le32 parent_teid;
2025         u8 num_qs;
2026         u8 rsvd;
2027         /* The length of the q_id array varies according to num_qs */
2028         __le16 q_id[1];
2029         /* This only applies from F8 onward */
2030 #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S           15
2031 #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_LAN_Q       \
2032                         (0 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
2033 #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_RDMA_QSET   \
2034                         (1 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
2035 };
2036
2037
2038 struct ice_aqc_dis_txq {
2039         struct ice_aqc_dis_txq_item qgrps[1];
2040 };
2041
2042
2043 /* Tx LAN Queues Cleanup Event (0x0C31) */
2044 struct ice_aqc_txqs_cleanup {
2045         __le16 caller_opc;
2046         __le16 cmd_tag;
2047         u8 reserved[12];
2048 };
2049
2050
2051 /* Move / Reconfigure Tx Queues (indirect 0x0C32) */
2052 struct ice_aqc_move_txqs {
2053         u8 cmd_type;
2054 #define ICE_AQC_Q_CMD_TYPE_S            0
2055 #define ICE_AQC_Q_CMD_TYPE_M            (0x3 << ICE_AQC_Q_CMD_TYPE_S)
2056 #define ICE_AQC_Q_CMD_TYPE_MOVE         1
2057 #define ICE_AQC_Q_CMD_TYPE_TC_CHANGE    2
2058 #define ICE_AQC_Q_CMD_TYPE_MOVE_AND_TC  3
2059 #define ICE_AQC_Q_CMD_SUBSEQ_CALL       BIT(2)
2060 #define ICE_AQC_Q_CMD_FLUSH_PIPE        BIT(3)
2061         u8 num_qs;
2062         u8 rsvd;
2063         u8 timeout;
2064 #define ICE_AQC_Q_CMD_TIMEOUT_S         2
2065 #define ICE_AQC_Q_CMD_TIMEOUT_M         (0x3F << ICE_AQC_Q_CMD_TIMEOUT_S)
2066         __le32 blocked_cgds;
2067         __le32 addr_high;
2068         __le32 addr_low;
2069 };
2070
2071
2072 /* This is the descriptor of each queue entry for the move Tx LAN Queues
2073  * command (0x0C32).
2074  */
2075 struct ice_aqc_move_txqs_elem {
2076         __le16 txq_id;
2077         u8 q_cgd;
2078         u8 rsvd;
2079         __le32 q_teid;
2080 };
2081
2082
2083 struct ice_aqc_move_txqs_data {
2084         __le32 src_teid;
2085         __le32 dest_teid;
2086         struct ice_aqc_move_txqs_elem txqs[1];
2087 };
2088
2089
2090
2091 /* Download Package (indirect 0x0C40) */
2092 /* Also used for Update Package (indirect 0x0C42) */
2093 struct ice_aqc_download_pkg {
2094         u8 flags;
2095 #define ICE_AQC_DOWNLOAD_PKG_LAST_BUF   0x01
2096         u8 reserved[3];
2097         __le32 reserved1;
2098         __le32 addr_high;
2099         __le32 addr_low;
2100 };
2101
2102 struct ice_aqc_download_pkg_resp {
2103         __le32 error_offset;
2104         __le32 error_info;
2105         __le32 addr_high;
2106         __le32 addr_low;
2107 };
2108
2109 /* Get Package Info List (indirect 0x0C43) */
2110 struct ice_aqc_get_pkg_info_list {
2111         __le32 reserved1;
2112         __le32 reserved2;
2113         __le32 addr_high;
2114         __le32 addr_low;
2115 };
2116
2117 /* Version format for packages */
2118 struct ice_pkg_ver {
2119         u8 major;
2120         u8 minor;
2121         u8 update;
2122         u8 draft;
2123 };
2124
2125 #define ICE_PKG_NAME_SIZE       32
2126
2127 struct ice_aqc_get_pkg_info {
2128         struct ice_pkg_ver ver;
2129         char name[ICE_PKG_NAME_SIZE];
2130         u8 is_in_nvm;
2131         u8 is_active;
2132         u8 is_active_at_boot;
2133         u8 is_modified;
2134 };
2135
2136 /* Get Package Info List response buffer format (0x0C43) */
2137 struct ice_aqc_get_pkg_info_resp {
2138         __le32 count;
2139         struct ice_aqc_get_pkg_info pkg_info[1];
2140 };
2141
2142
2143
2144
2145 /* Lan Queue Overflow Event (direct, 0x1001) */
2146 struct ice_aqc_event_lan_overflow {
2147         __le32 prtdcb_ruptq;
2148         __le32 qtx_ctl;
2149         u8 reserved[8];
2150 };
2151
2152
2153
2154 /* Configure Firmware Logging Command (indirect 0xFF09)
2155  * Logging Information Read Response (indirect 0xFF10)
2156  * Note: The 0xFF10 command has no input parameters.
2157  */
2158 struct ice_aqc_fw_logging {
2159         u8 log_ctrl;
2160 #define ICE_AQC_FW_LOG_AQ_EN            BIT(0)
2161 #define ICE_AQC_FW_LOG_UART_EN          BIT(1)
2162         u8 rsvd0;
2163         u8 log_ctrl_valid; /* Not used by 0xFF10 Response */
2164 #define ICE_AQC_FW_LOG_AQ_VALID         BIT(0)
2165 #define ICE_AQC_FW_LOG_UART_VALID       BIT(1)
2166         u8 rsvd1[5];
2167         __le32 addr_high;
2168         __le32 addr_low;
2169 };
2170
2171
2172 enum ice_aqc_fw_logging_mod {
2173         ICE_AQC_FW_LOG_ID_GENERAL = 0,
2174         ICE_AQC_FW_LOG_ID_CTRL,
2175         ICE_AQC_FW_LOG_ID_LINK,
2176         ICE_AQC_FW_LOG_ID_LINK_TOPO,
2177         ICE_AQC_FW_LOG_ID_DNL,
2178         ICE_AQC_FW_LOG_ID_I2C,
2179         ICE_AQC_FW_LOG_ID_SDP,
2180         ICE_AQC_FW_LOG_ID_MDIO,
2181         ICE_AQC_FW_LOG_ID_ADMINQ,
2182         ICE_AQC_FW_LOG_ID_HDMA,
2183         ICE_AQC_FW_LOG_ID_LLDP,
2184         ICE_AQC_FW_LOG_ID_DCBX,
2185         ICE_AQC_FW_LOG_ID_DCB,
2186         ICE_AQC_FW_LOG_ID_NETPROXY,
2187         ICE_AQC_FW_LOG_ID_NVM,
2188         ICE_AQC_FW_LOG_ID_AUTH,
2189         ICE_AQC_FW_LOG_ID_VPD,
2190         ICE_AQC_FW_LOG_ID_IOSF,
2191         ICE_AQC_FW_LOG_ID_PARSER,
2192         ICE_AQC_FW_LOG_ID_SW,
2193         ICE_AQC_FW_LOG_ID_SCHEDULER,
2194         ICE_AQC_FW_LOG_ID_TXQ,
2195         ICE_AQC_FW_LOG_ID_RSVD,
2196         ICE_AQC_FW_LOG_ID_POST,
2197         ICE_AQC_FW_LOG_ID_WATCHDOG,
2198         ICE_AQC_FW_LOG_ID_TASK_DISPATCH,
2199         ICE_AQC_FW_LOG_ID_MNG,
2200         ICE_AQC_FW_LOG_ID_MAX,
2201 };
2202
2203 /* This is the buffer for both of the logging commands.
2204  * The entry array size depends on the datalen parameter in the descriptor.
2205  * There will be a total of datalen / 2 entries.
2206  */
2207 struct ice_aqc_fw_logging_data {
2208         __le16 entry[1];
2209 #define ICE_AQC_FW_LOG_ID_S             0
2210 #define ICE_AQC_FW_LOG_ID_M             (0xFFF << ICE_AQC_FW_LOG_ID_S)
2211
2212 #define ICE_AQC_FW_LOG_CONF_SUCCESS     0       /* Used by response */
2213 #define ICE_AQC_FW_LOG_CONF_BAD_INDX    BIT(12) /* Used by response */
2214
2215 #define ICE_AQC_FW_LOG_EN_S             12
2216 #define ICE_AQC_FW_LOG_EN_M             (0xF << ICE_AQC_FW_LOG_EN_S)
2217 #define ICE_AQC_FW_LOG_INFO_EN          BIT(12) /* Used by command */
2218 #define ICE_AQC_FW_LOG_INIT_EN          BIT(13) /* Used by command */
2219 #define ICE_AQC_FW_LOG_FLOW_EN          BIT(14) /* Used by command */
2220 #define ICE_AQC_FW_LOG_ERR_EN           BIT(15) /* Used by command */
2221 };
2222
2223
2224 /* Get/Clear FW Log (indirect 0xFF11) */
2225 struct ice_aqc_get_clear_fw_log {
2226         u8 flags;
2227 #define ICE_AQC_FW_LOG_CLEAR            BIT(0)
2228 #define ICE_AQC_FW_LOG_MORE_DATA_AVAIL  BIT(1)
2229         u8 rsvd1[7];
2230         __le32 addr_high;
2231         __le32 addr_low;
2232 };
2233
2234
2235 /**
2236  * struct ice_aq_desc - Admin Queue (AQ) descriptor
2237  * @flags: ICE_AQ_FLAG_* flags
2238  * @opcode: AQ command opcode
2239  * @datalen: length in bytes of indirect/external data buffer
2240  * @retval: return value from firmware
2241  * @cookie_h: opaque data high-half
2242  * @cookie_l: opaque data low-half
2243  * @params: command-specific parameters
2244  *
2245  * Descriptor format for commands the driver posts on the Admin Transmit Queue
2246  * (ATQ). The firmware writes back onto the command descriptor and returns
2247  * the result of the command. Asynchronous events that are not an immediate
2248  * result of the command are written to the Admin Receive Queue (ARQ) using
2249  * the same descriptor format. Descriptors are in little-endian notation with
2250  * 32-bit words.
2251  */
2252 struct ice_aq_desc {
2253         __le16 flags;
2254         __le16 opcode;
2255         __le16 datalen;
2256         __le16 retval;
2257         __le32 cookie_high;
2258         __le32 cookie_low;
2259         union {
2260                 u8 raw[16];
2261                 struct ice_aqc_generic generic;
2262                 struct ice_aqc_get_ver get_ver;
2263                 struct ice_aqc_driver_ver driver_ver;
2264                 struct ice_aqc_q_shutdown q_shutdown;
2265                 struct ice_aqc_req_res res_owner;
2266                 struct ice_aqc_manage_mac_read mac_read;
2267                 struct ice_aqc_manage_mac_write mac_write;
2268                 struct ice_aqc_clear_pxe clear_pxe;
2269                 struct ice_aqc_config_no_drop_policy no_drop;
2270                 struct ice_aqc_add_update_mir_rule add_update_rule;
2271                 struct ice_aqc_delete_mir_rule del_rule;
2272                 struct ice_aqc_list_caps get_cap;
2273                 struct ice_aqc_get_phy_caps get_phy;
2274                 struct ice_aqc_set_phy_cfg set_phy;
2275                 struct ice_aqc_restart_an restart_an;
2276                 struct ice_aqc_set_port_id_led set_port_id_led;
2277                 struct ice_aqc_get_sw_cfg get_sw_conf;
2278                 struct ice_aqc_sw_rules sw_rules;
2279                 struct ice_aqc_storm_cfg storm_conf;
2280                 struct ice_aqc_add_get_recipe add_get_recipe;
2281                 struct ice_aqc_recipe_to_profile recipe_to_profile;
2282                 struct ice_aqc_get_topo get_topo;
2283                 struct ice_aqc_sched_elem_cmd sched_elem_cmd;
2284                 struct ice_aqc_query_txsched_res query_sched_res;
2285                 struct ice_aqc_query_node_to_root query_node_to_root;
2286                 struct ice_aqc_cfg_l2_node_cgd cfg_l2_node_cgd;
2287                 struct ice_aqc_query_port_ets port_ets;
2288                 struct ice_aqc_rl_profile rl_profile;
2289                 struct ice_aqc_nvm nvm;
2290                 struct ice_aqc_nvm_cfg nvm_cfg;
2291                 struct ice_aqc_nvm_checksum nvm_checksum;
2292                 struct ice_aqc_pfc_ignore pfc_ignore;
2293                 struct ice_aqc_set_query_pfc_mode set_query_pfc_mode;
2294                 struct ice_aqc_set_dcb_params set_dcb_params;
2295                 struct ice_aqc_lldp_get_mib lldp_get_mib;
2296                 struct ice_aqc_lldp_set_mib_change lldp_set_event;
2297                 struct ice_aqc_lldp_add_delete_tlv lldp_add_delete_tlv;
2298                 struct ice_aqc_lldp_update_tlv lldp_update_tlv;
2299                 struct ice_aqc_lldp_stop lldp_stop;
2300                 struct ice_aqc_lldp_start lldp_start;
2301                 struct ice_aqc_lldp_set_local_mib lldp_set_mib;
2302                 struct ice_aqc_lldp_stop_start_specific_agent lldp_agent_ctrl;
2303                 struct ice_aqc_get_set_rss_lut get_set_rss_lut;
2304                 struct ice_aqc_get_set_rss_key get_set_rss_key;
2305                 struct ice_aqc_clear_fd_table clear_fd_table;
2306                 struct ice_aqc_add_txqs add_txqs;
2307                 struct ice_aqc_dis_txqs dis_txqs;
2308                 struct ice_aqc_txqs_cleanup txqs_cleanup;
2309                 struct ice_aqc_add_get_update_free_vsi vsi_cmd;
2310                 struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
2311                 struct ice_aqc_get_vsi_resp get_vsi_resp;
2312                 struct ice_aqc_download_pkg download_pkg;
2313                 struct ice_aqc_get_pkg_info_list get_pkg_info_list;
2314                 struct ice_aqc_fw_logging fw_logging;
2315                 struct ice_aqc_get_clear_fw_log get_clear_fw_log;
2316                 struct ice_aqc_set_mac_lb set_mac_lb;
2317                 struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
2318                 struct ice_aqc_get_res_alloc get_res;
2319                 struct ice_aqc_get_allocd_res_desc get_res_desc;
2320                 struct ice_aqc_set_mac_cfg set_mac_cfg;
2321                 struct ice_aqc_set_event_mask set_event_mask;
2322                 struct ice_aqc_get_link_status get_link_status;
2323         } params;
2324 };
2325
2326
2327 /* FW defined boundary for a large buffer, 4k >= Large buffer > 512 bytes */
2328 #define ICE_AQ_LG_BUF   512
2329
2330 /* Flags sub-structure
2331  * |0  |1  |2  |3  |4  |5  |6  |7  |8  |9  |10 |11 |12 |13 |14 |15 |
2332  * |DD |CMP|ERR|VFE| * *  RESERVED * * |LB |RD |VFC|BUF|SI |EI |FE |
2333  */
2334
2335 /* command flags and offsets */
2336 #define ICE_AQ_FLAG_DD_S        0
2337 #define ICE_AQ_FLAG_CMP_S       1
2338 #define ICE_AQ_FLAG_ERR_S       2
2339 #define ICE_AQ_FLAG_VFE_S       3
2340 #define ICE_AQ_FLAG_LB_S        9
2341 #define ICE_AQ_FLAG_RD_S        10
2342 #define ICE_AQ_FLAG_VFC_S       11
2343 #define ICE_AQ_FLAG_BUF_S       12
2344 #define ICE_AQ_FLAG_SI_S        13
2345 #define ICE_AQ_FLAG_EI_S        14
2346 #define ICE_AQ_FLAG_FE_S        15
2347
2348 #define ICE_AQ_FLAG_DD          BIT(ICE_AQ_FLAG_DD_S)  /* 0x1    */
2349 #define ICE_AQ_FLAG_CMP         BIT(ICE_AQ_FLAG_CMP_S) /* 0x2    */
2350 #define ICE_AQ_FLAG_ERR         BIT(ICE_AQ_FLAG_ERR_S) /* 0x4    */
2351 #define ICE_AQ_FLAG_VFE         BIT(ICE_AQ_FLAG_VFE_S) /* 0x8    */
2352 #define ICE_AQ_FLAG_LB          BIT(ICE_AQ_FLAG_LB_S)  /* 0x200  */
2353 #define ICE_AQ_FLAG_RD          BIT(ICE_AQ_FLAG_RD_S)  /* 0x400  */
2354 #define ICE_AQ_FLAG_VFC         BIT(ICE_AQ_FLAG_VFC_S) /* 0x800  */
2355 #define ICE_AQ_FLAG_BUF         BIT(ICE_AQ_FLAG_BUF_S) /* 0x1000 */
2356 #define ICE_AQ_FLAG_SI          BIT(ICE_AQ_FLAG_SI_S)  /* 0x2000 */
2357 #define ICE_AQ_FLAG_EI          BIT(ICE_AQ_FLAG_EI_S)  /* 0x4000 */
2358 #define ICE_AQ_FLAG_FE          BIT(ICE_AQ_FLAG_FE_S)  /* 0x8000 */
2359
2360 /* error codes */
2361 enum ice_aq_err {
2362         ICE_AQ_RC_OK            = 0,  /* Success */
2363         ICE_AQ_RC_EPERM         = 1,  /* Operation not permitted */
2364         ICE_AQ_RC_ENOENT        = 2,  /* No such element */
2365         ICE_AQ_RC_ESRCH         = 3,  /* Bad opcode */
2366         ICE_AQ_RC_EINTR         = 4,  /* Operation interrupted */
2367         ICE_AQ_RC_EIO           = 5,  /* I/O error */
2368         ICE_AQ_RC_ENXIO         = 6,  /* No such resource */
2369         ICE_AQ_RC_E2BIG         = 7,  /* Arg too long */
2370         ICE_AQ_RC_EAGAIN        = 8,  /* Try again */
2371         ICE_AQ_RC_ENOMEM        = 9,  /* Out of memory */
2372         ICE_AQ_RC_EACCES        = 10, /* Permission denied */
2373         ICE_AQ_RC_EFAULT        = 11, /* Bad address */
2374         ICE_AQ_RC_EBUSY         = 12, /* Device or resource busy */
2375         ICE_AQ_RC_EEXIST        = 13, /* Object already exists */
2376         ICE_AQ_RC_EINVAL        = 14, /* Invalid argument */
2377         ICE_AQ_RC_ENOTTY        = 15, /* Not a typewriter */
2378         ICE_AQ_RC_ENOSPC        = 16, /* No space left or allocation failure */
2379         ICE_AQ_RC_ENOSYS        = 17, /* Function not implemented */
2380         ICE_AQ_RC_ERANGE        = 18, /* Parameter out of range */
2381         ICE_AQ_RC_EFLUSHED      = 19, /* Cmd flushed due to prev cmd error */
2382         ICE_AQ_RC_BAD_ADDR      = 20, /* Descriptor contains a bad pointer */
2383         ICE_AQ_RC_EMODE         = 21, /* Op not allowed in current dev mode */
2384         ICE_AQ_RC_EFBIG         = 22, /* File too big */
2385         ICE_AQ_RC_ESBCOMP       = 23, /* SB-IOSF completion unsuccessful */
2386         ICE_AQ_RC_ENOSEC        = 24, /* Missing security manifest */
2387         ICE_AQ_RC_EBADSIG       = 25, /* Bad RSA signature */
2388         ICE_AQ_RC_ESVN          = 26, /* SVN number prohibits this package */
2389         ICE_AQ_RC_EBADMAN       = 27, /* Manifest hash mismatch */
2390         ICE_AQ_RC_EBADBUF       = 28, /* Buffer hash mismatches manifest */
2391 };
2392
2393 /* Admin Queue command opcodes */
2394 enum ice_adminq_opc {
2395         /* AQ commands */
2396         ice_aqc_opc_get_ver                             = 0x0001,
2397         ice_aqc_opc_driver_ver                          = 0x0002,
2398         ice_aqc_opc_q_shutdown                          = 0x0003,
2399         ice_aqc_opc_get_exp_err                         = 0x0005,
2400
2401         /* resource ownership */
2402         ice_aqc_opc_req_res                             = 0x0008,
2403         ice_aqc_opc_release_res                         = 0x0009,
2404
2405         /* device/function capabilities */
2406         ice_aqc_opc_list_func_caps                      = 0x000A,
2407         ice_aqc_opc_list_dev_caps                       = 0x000B,
2408
2409         /* manage MAC address */
2410         ice_aqc_opc_manage_mac_read                     = 0x0107,
2411         ice_aqc_opc_manage_mac_write                    = 0x0108,
2412
2413         /* PXE */
2414         ice_aqc_opc_clear_pxe_mode                      = 0x0110,
2415
2416         ice_aqc_opc_config_no_drop_policy               = 0x0112,
2417
2418         /* internal switch commands */
2419         ice_aqc_opc_get_sw_cfg                          = 0x0200,
2420
2421         /* Alloc/Free/Get Resources */
2422         ice_aqc_opc_get_res_alloc                       = 0x0204,
2423         ice_aqc_opc_alloc_res                           = 0x0208,
2424         ice_aqc_opc_free_res                            = 0x0209,
2425         ice_aqc_opc_get_allocd_res_desc                 = 0x020A,
2426
2427         /* VSI commands */
2428         ice_aqc_opc_add_vsi                             = 0x0210,
2429         ice_aqc_opc_update_vsi                          = 0x0211,
2430         ice_aqc_opc_get_vsi_params                      = 0x0212,
2431         ice_aqc_opc_free_vsi                            = 0x0213,
2432
2433         /* Mirroring rules - add/update, delete */
2434         ice_aqc_opc_add_update_mir_rule                 = 0x0260,
2435         ice_aqc_opc_del_mir_rule                        = 0x0261,
2436
2437         /* storm configuration */
2438         ice_aqc_opc_set_storm_cfg                       = 0x0280,
2439         ice_aqc_opc_get_storm_cfg                       = 0x0281,
2440
2441         /* recipe commands */
2442         ice_aqc_opc_add_recipe                          = 0x0290,
2443         ice_aqc_opc_recipe_to_profile                   = 0x0291,
2444         ice_aqc_opc_get_recipe                          = 0x0292,
2445         ice_aqc_opc_get_recipe_to_profile               = 0x0293,
2446
2447         /* switch rules population commands */
2448         ice_aqc_opc_add_sw_rules                        = 0x02A0,
2449         ice_aqc_opc_update_sw_rules                     = 0x02A1,
2450         ice_aqc_opc_remove_sw_rules                     = 0x02A2,
2451         ice_aqc_opc_get_sw_rules                        = 0x02A3,
2452         ice_aqc_opc_clear_pf_cfg                        = 0x02A4,
2453
2454         /* DCB commands */
2455         ice_aqc_opc_pfc_ignore                          = 0x0301,
2456         ice_aqc_opc_query_pfc_mode                      = 0x0302,
2457         ice_aqc_opc_set_pfc_mode                        = 0x0303,
2458         ice_aqc_opc_set_dcb_params                      = 0x0306,
2459
2460         /* transmit scheduler commands */
2461         ice_aqc_opc_get_dflt_topo                       = 0x0400,
2462         ice_aqc_opc_add_sched_elems                     = 0x0401,
2463         ice_aqc_opc_cfg_sched_elems                     = 0x0403,
2464         ice_aqc_opc_get_sched_elems                     = 0x0404,
2465         ice_aqc_opc_move_sched_elems                    = 0x0408,
2466         ice_aqc_opc_suspend_sched_elems                 = 0x0409,
2467         ice_aqc_opc_resume_sched_elems                  = 0x040A,
2468         ice_aqc_opc_query_port_ets                      = 0x040E,
2469         ice_aqc_opc_delete_sched_elems                  = 0x040F,
2470         ice_aqc_opc_add_rl_profiles                     = 0x0410,
2471         ice_aqc_opc_query_rl_profiles                   = 0x0411,
2472         ice_aqc_opc_query_sched_res                     = 0x0412,
2473         ice_aqc_opc_query_node_to_root                  = 0x0413,
2474         ice_aqc_opc_cfg_l2_node_cgd                     = 0x0414,
2475         ice_aqc_opc_remove_rl_profiles                  = 0x0415,
2476
2477         /* PHY commands */
2478         ice_aqc_opc_get_phy_caps                        = 0x0600,
2479         ice_aqc_opc_set_phy_cfg                         = 0x0601,
2480         ice_aqc_opc_set_mac_cfg                         = 0x0603,
2481         ice_aqc_opc_restart_an                          = 0x0605,
2482         ice_aqc_opc_get_link_status                     = 0x0607,
2483         ice_aqc_opc_set_event_mask                      = 0x0613,
2484         ice_aqc_opc_set_mac_lb                          = 0x0620,
2485         ice_aqc_opc_set_port_id_led                     = 0x06E9,
2486         ice_aqc_opc_get_port_options                    = 0x06EA,
2487         ice_aqc_opc_set_port_option                     = 0x06EB,
2488         ice_aqc_opc_set_gpio                            = 0x06EC,
2489         ice_aqc_opc_get_gpio                            = 0x06ED,
2490
2491         /* NVM commands */
2492         ice_aqc_opc_nvm_read                            = 0x0701,
2493         ice_aqc_opc_nvm_erase                           = 0x0702,
2494         ice_aqc_opc_nvm_update                          = 0x0703,
2495         ice_aqc_opc_nvm_cfg_read                        = 0x0704,
2496         ice_aqc_opc_nvm_cfg_write                       = 0x0705,
2497         ice_aqc_opc_nvm_checksum                        = 0x0706,
2498
2499         /* LLDP commands */
2500         ice_aqc_opc_lldp_get_mib                        = 0x0A00,
2501         ice_aqc_opc_lldp_set_mib_change                 = 0x0A01,
2502         ice_aqc_opc_lldp_add_tlv                        = 0x0A02,
2503         ice_aqc_opc_lldp_update_tlv                     = 0x0A03,
2504         ice_aqc_opc_lldp_delete_tlv                     = 0x0A04,
2505         ice_aqc_opc_lldp_stop                           = 0x0A05,
2506         ice_aqc_opc_lldp_start                          = 0x0A06,
2507         ice_aqc_opc_get_cee_dcb_cfg                     = 0x0A07,
2508         ice_aqc_opc_lldp_set_local_mib                  = 0x0A08,
2509         ice_aqc_opc_lldp_stop_start_specific_agent      = 0x0A09,
2510
2511         /* RSS commands */
2512         ice_aqc_opc_set_rss_key                         = 0x0B02,
2513         ice_aqc_opc_set_rss_lut                         = 0x0B03,
2514         ice_aqc_opc_get_rss_key                         = 0x0B04,
2515         ice_aqc_opc_get_rss_lut                         = 0x0B05,
2516         ice_aqc_opc_clear_fd_table                      = 0x0B06,
2517
2518         /* Tx queue handling commands/events */
2519         ice_aqc_opc_add_txqs                            = 0x0C30,
2520         ice_aqc_opc_dis_txqs                            = 0x0C31,
2521         ice_aqc_opc_txqs_cleanup                        = 0x0C31,
2522         ice_aqc_opc_move_recfg_txqs                     = 0x0C32,
2523
2524         /* package commands */
2525         ice_aqc_opc_download_pkg                        = 0x0C40,
2526         ice_aqc_opc_upload_section                      = 0x0C41,
2527         ice_aqc_opc_update_pkg                          = 0x0C42,
2528         ice_aqc_opc_get_pkg_info_list                   = 0x0C43,
2529
2530
2531
2532         /* Standalone Commands/Events */
2533         ice_aqc_opc_event_lan_overflow                  = 0x1001,
2534
2535         /* debug commands */
2536         ice_aqc_opc_fw_logging                          = 0xFF09,
2537         ice_aqc_opc_fw_logging_info                     = 0xFF10,
2538         ice_aqc_opc_get_clear_fw_log                    = 0xFF11
2539 };
2540
2541 #endif /* _ICE_ADMINQ_CMD_H_ */