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