xref: /dpdk/drivers/net/ice/base/ice_adminq_cmd.h (revision e253c33d)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2020 Intel Corporation
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 #define ICE_MAX_VSI			768
13 #define ICE_AQC_TOPO_MAX_LEVEL_NUM	0x9
14 #define ICE_AQ_SET_MAC_FRAME_SIZE_MAX	9728
15 
16 struct ice_aqc_generic {
17 	__le32 param0;
18 	__le32 param1;
19 	__le32 addr_high;
20 	__le32 addr_low;
21 };
22 
23 /* Get version (direct 0x0001) */
24 struct ice_aqc_get_ver {
25 	__le32 rom_ver;
26 	__le32 fw_build;
27 	u8 fw_branch;
28 	u8 fw_major;
29 	u8 fw_minor;
30 	u8 fw_patch;
31 	u8 api_branch;
32 	u8 api_major;
33 	u8 api_minor;
34 	u8 api_patch;
35 };
36 
37 /* Send driver version (indirect 0x0002) */
38 struct ice_aqc_driver_ver {
39 	u8 major_ver;
40 	u8 minor_ver;
41 	u8 build_ver;
42 	u8 subbuild_ver;
43 	u8 reserved[4];
44 	__le32 addr_high;
45 	__le32 addr_low;
46 };
47 
48 /* Queue Shutdown (direct 0x0003) */
49 struct ice_aqc_q_shutdown {
50 	u8 driver_unloading;
51 #define ICE_AQC_DRIVER_UNLOADING	BIT(0)
52 	u8 reserved[15];
53 };
54 
55 /* Request resource ownership (direct 0x0008)
56  * Release resource ownership (direct 0x0009)
57  */
58 struct ice_aqc_req_res {
59 	__le16 res_id;
60 #define ICE_AQC_RES_ID_NVM		1
61 #define ICE_AQC_RES_ID_SDP		2
62 #define ICE_AQC_RES_ID_CHNG_LOCK	3
63 #define ICE_AQC_RES_ID_GLBL_LOCK	4
64 	__le16 access_type;
65 #define ICE_AQC_RES_ACCESS_READ		1
66 #define ICE_AQC_RES_ACCESS_WRITE	2
67 
68 	/* Upon successful completion, FW writes this value and driver is
69 	 * expected to release resource before timeout. This value is provided
70 	 * in milliseconds.
71 	 */
72 	__le32 timeout;
73 #define ICE_AQ_RES_NVM_READ_DFLT_TIMEOUT_MS	3000
74 #define ICE_AQ_RES_NVM_WRITE_DFLT_TIMEOUT_MS	180000
75 #define ICE_AQ_RES_CHNG_LOCK_DFLT_TIMEOUT_MS	1000
76 #define ICE_AQ_RES_GLBL_LOCK_DFLT_TIMEOUT_MS	3000
77 	/* For SDP: pin ID of the SDP */
78 	__le32 res_number;
79 	/* Status is only used for ICE_AQC_RES_ID_GLBL_LOCK */
80 	__le16 status;
81 #define ICE_AQ_RES_GLBL_SUCCESS		0
82 #define ICE_AQ_RES_GLBL_IN_PROG		1
83 #define ICE_AQ_RES_GLBL_DONE		2
84 	u8 reserved[2];
85 };
86 
87 /* Get function capabilities (indirect 0x000A)
88  * Get device capabilities (indirect 0x000B)
89  */
90 struct ice_aqc_list_caps {
91 	u8 cmd_flags;
92 	u8 pf_index;
93 	u8 reserved[2];
94 	__le32 count;
95 	__le32 addr_high;
96 	__le32 addr_low;
97 };
98 
99 /* Device/Function buffer entry, repeated per reported capability */
100 struct ice_aqc_list_caps_elem {
101 	__le16 cap;
102 #define ICE_AQC_CAPS_VALID_FUNCTIONS			0x0005
103 #define ICE_AQC_MAX_VALID_FUNCTIONS			0x8
104 #define ICE_AQC_CAPS_VSI				0x0017
105 #define ICE_AQC_CAPS_DCB				0x0018
106 #define ICE_AQC_CAPS_RSS				0x0040
107 #define ICE_AQC_CAPS_RXQS				0x0041
108 #define ICE_AQC_CAPS_TXQS				0x0042
109 #define ICE_AQC_CAPS_MSIX				0x0043
110 #define ICE_AQC_CAPS_FD					0x0045
111 #define ICE_AQC_CAPS_MAX_MTU				0x0047
112 #define ICE_AQC_CAPS_IWARP				0x0051
113 #define ICE_AQC_CAPS_PCIE_RESET_AVOIDANCE		0x0076
114 #define ICE_AQC_CAPS_NVM_MGMT				0x0080
115 
116 	u8 major_ver;
117 	u8 minor_ver;
118 	/* Number of resources described by this capability */
119 	__le32 number;
120 	/* Only meaningful for some types of resources */
121 	__le32 logical_id;
122 	/* Only meaningful for some types of resources */
123 	__le32 phys_id;
124 	__le64 rsvd1;
125 	__le64 rsvd2;
126 };
127 
128 /* Manage MAC address, read command - indirect (0x0107)
129  * This struct is also used for the response
130  */
131 struct ice_aqc_manage_mac_read {
132 	__le16 flags; /* Zeroed by device driver */
133 #define ICE_AQC_MAN_MAC_LAN_ADDR_VALID		BIT(4)
134 #define ICE_AQC_MAN_MAC_SAN_ADDR_VALID		BIT(5)
135 #define ICE_AQC_MAN_MAC_PORT_ADDR_VALID		BIT(6)
136 #define ICE_AQC_MAN_MAC_WOL_ADDR_VALID		BIT(7)
137 #define ICE_AQC_MAN_MAC_MC_MAG_EN		BIT(8)
138 #define ICE_AQC_MAN_MAC_WOL_PRESERVE_ON_PFR	BIT(9)
139 #define ICE_AQC_MAN_MAC_READ_S			4
140 #define ICE_AQC_MAN_MAC_READ_M			(0xF << ICE_AQC_MAN_MAC_READ_S)
141 	u8 rsvd[2];
142 	u8 num_addr; /* Used in response */
143 	u8 rsvd1[3];
144 	__le32 addr_high;
145 	__le32 addr_low;
146 };
147 
148 /* Response buffer format for manage MAC read command */
149 struct ice_aqc_manage_mac_read_resp {
150 	u8 lport_num;
151 	u8 addr_type;
152 #define ICE_AQC_MAN_MAC_ADDR_TYPE_LAN		0
153 #define ICE_AQC_MAN_MAC_ADDR_TYPE_WOL		1
154 	u8 mac_addr[ETH_ALEN];
155 };
156 
157 /* Manage MAC address, write command - direct (0x0108) */
158 struct ice_aqc_manage_mac_write {
159 	u8 rsvd;
160 	u8 flags;
161 #define ICE_AQC_MAN_MAC_WR_MC_MAG_EN		BIT(0)
162 #define ICE_AQC_MAN_MAC_WR_WOL_LAA_PFR_KEEP	BIT(1)
163 #define ICE_AQC_MAN_MAC_WR_S		6
164 #define ICE_AQC_MAN_MAC_WR_M		MAKEMASK(3, ICE_AQC_MAN_MAC_WR_S)
165 #define ICE_AQC_MAN_MAC_UPDATE_LAA	0
166 #define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL	BIT(ICE_AQC_MAN_MAC_WR_S)
167 	/* byte stream in network order */
168 	u8 mac_addr[ETH_ALEN];
169 	__le32 addr_high;
170 	__le32 addr_low;
171 };
172 
173 /* Clear PXE Command and response (direct 0x0110) */
174 struct ice_aqc_clear_pxe {
175 	u8 rx_cnt;
176 #define ICE_AQC_CLEAR_PXE_RX_CNT		0x2
177 	u8 reserved[15];
178 };
179 
180 /* Configure No-Drop Policy Command (direct 0x0112) */
181 struct ice_aqc_config_no_drop_policy {
182 	u8 opts;
183 #define ICE_AQC_FORCE_NO_DROP			BIT(0)
184 	u8 rsvd[15];
185 };
186 
187 /* Get switch configuration (0x0200) */
188 struct ice_aqc_get_sw_cfg {
189 	/* Reserved for command and copy of request flags for response */
190 	__le16 flags;
191 	/* First desc in case of command and next_elem in case of response
192 	 * In case of response, if it is not zero, means all the configuration
193 	 * was not returned and new command shall be sent with this value in
194 	 * the 'first desc' field
195 	 */
196 	__le16 element;
197 	/* Reserved for command, only used for response */
198 	__le16 num_elems;
199 	__le16 rsvd;
200 	__le32 addr_high;
201 	__le32 addr_low;
202 };
203 
204 /* Each entry in the response buffer is of the following type: */
205 struct ice_aqc_get_sw_cfg_resp_elem {
206 	/* VSI/Port Number */
207 	__le16 vsi_port_num;
208 #define ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_S	0
209 #define ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_M	\
210 			(0x3FF << ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_S)
211 #define ICE_AQC_GET_SW_CONF_RESP_TYPE_S	14
212 #define ICE_AQC_GET_SW_CONF_RESP_TYPE_M	(0x3 << ICE_AQC_GET_SW_CONF_RESP_TYPE_S)
213 #define ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT	0
214 #define ICE_AQC_GET_SW_CONF_RESP_VIRT_PORT	1
215 #define ICE_AQC_GET_SW_CONF_RESP_VSI		2
216 
217 	/* SWID VSI/Port belongs to */
218 	__le16 swid;
219 
220 	/* Bit 14..0 : PF/VF number VSI belongs to
221 	 * Bit 15 : VF indication bit
222 	 */
223 	__le16 pf_vf_num;
224 #define ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_S	0
225 #define ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_M	\
226 				(0x7FFF << ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_S)
227 #define ICE_AQC_GET_SW_CONF_RESP_IS_VF		BIT(15)
228 };
229 
230 /* Set Port parameters, (direct, 0x0203) */
231 struct ice_aqc_set_port_params {
232 	__le16 cmd_flags;
233 #define ICE_AQC_SET_P_PARAMS_SAVE_BAD_PACKETS	BIT(0)
234 #define ICE_AQC_SET_P_PARAMS_PAD_SHORT_PACKETS	BIT(1)
235 #define ICE_AQC_SET_P_PARAMS_DOUBLE_VLAN_ENA	BIT(2)
236 	__le16 bad_frame_vsi;
237 #define ICE_AQC_SET_P_PARAMS_VSI_S	0
238 #define ICE_AQC_SET_P_PARAMS_VSI_M	(0x3FF << ICE_AQC_SET_P_PARAMS_VSI_S)
239 #define ICE_AQC_SET_P_PARAMS_VSI_VALID	BIT(15)
240 	__le16 swid;
241 #define ICE_AQC_SET_P_PARAMS_SWID_S	0
242 #define ICE_AQC_SET_P_PARAMS_SWID_M	(0xFF << ICE_AQC_SET_P_PARAMS_SWID_S)
243 #define ICE_AQC_SET_P_PARAMS_LOGI_PORT_ID_S	8
244 #define ICE_AQC_SET_P_PARAMS_LOGI_PORT_ID_M	\
245 				(0x3F << ICE_AQC_SET_P_PARAMS_LOGI_PORT_ID_S)
246 #define ICE_AQC_SET_P_PARAMS_IS_LOGI_PORT	BIT(14)
247 #define ICE_AQC_SET_P_PARAMS_SWID_VALID		BIT(15)
248 	u8 reserved[10];
249 };
250 
251 /* These resource type defines are used for all switch resource
252  * commands where a resource type is required, such as:
253  * Get Resource Allocation command (indirect 0x0204)
254  * Allocate Resources command (indirect 0x0208)
255  * Free Resources command (indirect 0x0209)
256  * Get Allocated Resource Descriptors Command (indirect 0x020A)
257  */
258 #define ICE_AQC_RES_TYPE_VEB_COUNTER			0x00
259 #define ICE_AQC_RES_TYPE_VLAN_COUNTER			0x01
260 #define ICE_AQC_RES_TYPE_MIRROR_RULE			0x02
261 #define ICE_AQC_RES_TYPE_VSI_LIST_REP			0x03
262 #define ICE_AQC_RES_TYPE_VSI_LIST_PRUNE			0x04
263 #define ICE_AQC_RES_TYPE_RECIPE				0x05
264 #define ICE_AQC_RES_TYPE_PROFILE			0x06
265 #define ICE_AQC_RES_TYPE_SWID				0x07
266 #define ICE_AQC_RES_TYPE_VSI				0x08
267 #define ICE_AQC_RES_TYPE_FLU				0x09
268 #define ICE_AQC_RES_TYPE_WIDE_TABLE_1			0x0A
269 #define ICE_AQC_RES_TYPE_WIDE_TABLE_2			0x0B
270 #define ICE_AQC_RES_TYPE_WIDE_TABLE_4			0x0C
271 #define ICE_AQC_RES_TYPE_GLOBAL_RSS_HASH		0x20
272 #define ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK		0x21
273 #define ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES	0x22
274 #define ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES		0x23
275 #define ICE_AQC_RES_TYPE_FLEX_DESC_PROG			0x30
276 #define ICE_AQC_RES_TYPE_SWITCH_PROF_BLDR_PROFID	0x48
277 #define ICE_AQC_RES_TYPE_SWITCH_PROF_BLDR_TCAM		0x49
278 #define ICE_AQC_RES_TYPE_ACL_PROF_BLDR_PROFID		0x50
279 #define ICE_AQC_RES_TYPE_ACL_PROF_BLDR_TCAM		0x51
280 #define ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID		0x58
281 #define ICE_AQC_RES_TYPE_FD_PROF_BLDR_TCAM		0x59
282 #define ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID		0x60
283 #define ICE_AQC_RES_TYPE_HASH_PROF_BLDR_TCAM		0x61
284 /* Resource types 0x62-67 are reserved for Hash profile builder */
285 #define ICE_AQC_RES_TYPE_QHASH_PROF_BLDR_PROFID		0x68
286 #define ICE_AQC_RES_TYPE_QHASH_PROF_BLDR_TCAM		0x69
287 
288 #define ICE_AQC_RES_TYPE_FLAG_SHARED			BIT(7)
289 #define ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM		BIT(12)
290 #define ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX		BIT(13)
291 
292 #define ICE_AQC_RES_TYPE_FLAG_DEDICATED			0x00
293 
294 #define ICE_AQC_RES_TYPE_S	0
295 #define ICE_AQC_RES_TYPE_M	(0x07F << ICE_AQC_RES_TYPE_S)
296 
297 /* Get Resource Allocation command (indirect 0x0204) */
298 struct ice_aqc_get_res_alloc {
299 	__le16 resp_elem_num; /* Used in response, reserved in command */
300 	u8 reserved[6];
301 	__le32 addr_high;
302 	__le32 addr_low;
303 };
304 
305 /* Get Resource Allocation Response Buffer per response */
306 struct ice_aqc_get_res_resp_elem {
307 	__le16 res_type; /* Types defined above cmd 0x0204 */
308 	__le16 total_capacity; /* Resources available to all PF's */
309 	__le16 total_function; /* Resources allocated for a PF */
310 	__le16 total_shared; /* Resources allocated as shared */
311 	__le16 total_free; /* Resources un-allocated/not reserved by any PF */
312 };
313 
314 /* Allocate Resources command (indirect 0x0208)
315  * Free Resources command (indirect 0x0209)
316  */
317 struct ice_aqc_alloc_free_res_cmd {
318 	__le16 num_entries; /* Number of Resource entries */
319 	u8 reserved[6];
320 	__le32 addr_high;
321 	__le32 addr_low;
322 };
323 
324 /* Resource descriptor */
325 struct ice_aqc_res_elem {
326 	union {
327 		__le16 sw_resp;
328 		__le16 flu_resp;
329 	} e;
330 };
331 
332 /* Buffer for Allocate/Free Resources commands */
333 struct ice_aqc_alloc_free_res_elem {
334 	__le16 res_type; /* Types defined above cmd 0x0204 */
335 #define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S	8
336 #define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_M	\
337 				(0xF << ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S)
338 	__le16 num_elems;
339 	struct ice_aqc_res_elem elem[STRUCT_HACK_VAR_LEN];
340 };
341 
342 /* Get Allocated Resource Descriptors Command (indirect 0x020A) */
343 struct ice_aqc_get_allocd_res_desc {
344 	union {
345 		struct {
346 			__le16 res; /* Types defined above cmd 0x0204 */
347 			__le16 first_desc;
348 			__le32 reserved;
349 		} cmd;
350 		struct {
351 			__le16 res;
352 			__le16 next_desc;
353 			__le16 num_desc;
354 			__le16 reserved;
355 		} resp;
356 	} ops;
357 	__le32 addr_high;
358 	__le32 addr_low;
359 };
360 
361 /* Add VSI (indirect 0x0210)
362  * Update VSI (indirect 0x0211)
363  * Get VSI (indirect 0x0212)
364  * Free VSI (indirect 0x0213)
365  */
366 struct ice_aqc_add_get_update_free_vsi {
367 	__le16 vsi_num;
368 #define ICE_AQ_VSI_NUM_S	0
369 #define ICE_AQ_VSI_NUM_M	(0x03FF << ICE_AQ_VSI_NUM_S)
370 #define ICE_AQ_VSI_IS_VALID	BIT(15)
371 	__le16 cmd_flags;
372 #define ICE_AQ_VSI_KEEP_ALLOC	0x1
373 	u8 vf_id;
374 	u8 reserved;
375 	__le16 vsi_flags;
376 #define ICE_AQ_VSI_TYPE_S	0
377 #define ICE_AQ_VSI_TYPE_M	(0x3 << ICE_AQ_VSI_TYPE_S)
378 #define ICE_AQ_VSI_TYPE_VF	0x0
379 #define ICE_AQ_VSI_TYPE_VMDQ2	0x1
380 #define ICE_AQ_VSI_TYPE_PF	0x2
381 #define ICE_AQ_VSI_TYPE_EMP_MNG	0x3
382 	__le32 addr_high;
383 	__le32 addr_low;
384 };
385 
386 /* Response descriptor for:
387  * Add VSI (indirect 0x0210)
388  * Update VSI (indirect 0x0211)
389  * Free VSI (indirect 0x0213)
390  */
391 struct ice_aqc_add_update_free_vsi_resp {
392 	__le16 vsi_num;
393 	__le16 ext_status;
394 	__le16 vsi_used;
395 	__le16 vsi_free;
396 	__le32 addr_high;
397 	__le32 addr_low;
398 };
399 
400 struct ice_aqc_get_vsi_resp {
401 	__le16 vsi_num;
402 	u8 vf_id;
403 	/* The vsi_flags field uses the ICE_AQ_VSI_TYPE_* defines for values.
404 	 * These are found above in struct ice_aqc_add_get_update_free_vsi.
405 	 */
406 	u8 vsi_flags;
407 	__le16 vsi_used;
408 	__le16 vsi_free;
409 	__le32 addr_high;
410 	__le32 addr_low;
411 };
412 
413 struct ice_aqc_vsi_props {
414 	__le16 valid_sections;
415 #define ICE_AQ_VSI_PROP_SW_VALID		BIT(0)
416 #define ICE_AQ_VSI_PROP_SECURITY_VALID		BIT(1)
417 #define ICE_AQ_VSI_PROP_VLAN_VALID		BIT(2)
418 #define ICE_AQ_VSI_PROP_OUTER_TAG_VALID		BIT(3)
419 #define ICE_AQ_VSI_PROP_INGRESS_UP_VALID	BIT(4)
420 #define ICE_AQ_VSI_PROP_EGRESS_UP_VALID		BIT(5)
421 #define ICE_AQ_VSI_PROP_RXQ_MAP_VALID		BIT(6)
422 #define ICE_AQ_VSI_PROP_Q_OPT_VALID		BIT(7)
423 #define ICE_AQ_VSI_PROP_OUTER_UP_VALID		BIT(8)
424 #define ICE_AQ_VSI_PROP_ACL_VALID		BIT(10)
425 #define ICE_AQ_VSI_PROP_FLOW_DIR_VALID		BIT(11)
426 #define ICE_AQ_VSI_PROP_PASID_VALID		BIT(12)
427 	/* switch section */
428 	u8 sw_id;
429 	u8 sw_flags;
430 #define ICE_AQ_VSI_SW_FLAG_ALLOW_LB		BIT(5)
431 #define ICE_AQ_VSI_SW_FLAG_LOCAL_LB		BIT(6)
432 #define ICE_AQ_VSI_SW_FLAG_SRC_PRUNE		BIT(7)
433 	u8 sw_flags2;
434 #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S	0
435 #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_M	\
436 				(0xF << ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S)
437 #define ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA	BIT(0)
438 #define ICE_AQ_VSI_SW_FLAG_LAN_ENA		BIT(4)
439 	u8 veb_stat_id;
440 #define ICE_AQ_VSI_SW_VEB_STAT_ID_S		0
441 #define ICE_AQ_VSI_SW_VEB_STAT_ID_M	(0x1F << ICE_AQ_VSI_SW_VEB_STAT_ID_S)
442 #define ICE_AQ_VSI_SW_VEB_STAT_ID_VALID		BIT(5)
443 	/* security section */
444 	u8 sec_flags;
445 #define ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD	BIT(0)
446 #define ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF	BIT(2)
447 #define ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S	4
448 #define ICE_AQ_VSI_SEC_TX_PRUNE_ENA_M	(0xF << ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S)
449 #define ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA	BIT(0)
450 	u8 sec_reserved;
451 	/* VLAN section */
452 	__le16 pvid; /* VLANS include priority bits */
453 	u8 pvlan_reserved[2];
454 	u8 vlan_flags;
455 #define ICE_AQ_VSI_VLAN_MODE_S	0
456 #define ICE_AQ_VSI_VLAN_MODE_M	(0x3 << ICE_AQ_VSI_VLAN_MODE_S)
457 #define ICE_AQ_VSI_VLAN_MODE_UNTAGGED	0x1
458 #define ICE_AQ_VSI_VLAN_MODE_TAGGED	0x2
459 #define ICE_AQ_VSI_VLAN_MODE_ALL	0x3
460 #define ICE_AQ_VSI_PVLAN_INSERT_PVID	BIT(2)
461 #define ICE_AQ_VSI_VLAN_EMOD_S		3
462 #define ICE_AQ_VSI_VLAN_EMOD_M		(0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
463 #define ICE_AQ_VSI_VLAN_EMOD_STR_BOTH	(0x0 << ICE_AQ_VSI_VLAN_EMOD_S)
464 #define ICE_AQ_VSI_VLAN_EMOD_STR_UP	(0x1 << ICE_AQ_VSI_VLAN_EMOD_S)
465 #define ICE_AQ_VSI_VLAN_EMOD_STR	(0x2 << ICE_AQ_VSI_VLAN_EMOD_S)
466 #define ICE_AQ_VSI_VLAN_EMOD_NOTHING	(0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
467 	u8 pvlan_reserved2[3];
468 	/* ingress egress up sections */
469 	__le32 ingress_table; /* bitmap, 3 bits per up */
470 #define ICE_AQ_VSI_UP_TABLE_UP0_S	0
471 #define ICE_AQ_VSI_UP_TABLE_UP0_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP0_S)
472 #define ICE_AQ_VSI_UP_TABLE_UP1_S	3
473 #define ICE_AQ_VSI_UP_TABLE_UP1_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP1_S)
474 #define ICE_AQ_VSI_UP_TABLE_UP2_S	6
475 #define ICE_AQ_VSI_UP_TABLE_UP2_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP2_S)
476 #define ICE_AQ_VSI_UP_TABLE_UP3_S	9
477 #define ICE_AQ_VSI_UP_TABLE_UP3_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP3_S)
478 #define ICE_AQ_VSI_UP_TABLE_UP4_S	12
479 #define ICE_AQ_VSI_UP_TABLE_UP4_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP4_S)
480 #define ICE_AQ_VSI_UP_TABLE_UP5_S	15
481 #define ICE_AQ_VSI_UP_TABLE_UP5_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP5_S)
482 #define ICE_AQ_VSI_UP_TABLE_UP6_S	18
483 #define ICE_AQ_VSI_UP_TABLE_UP6_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP6_S)
484 #define ICE_AQ_VSI_UP_TABLE_UP7_S	21
485 #define ICE_AQ_VSI_UP_TABLE_UP7_M	(0x7 << ICE_AQ_VSI_UP_TABLE_UP7_S)
486 	__le32 egress_table;   /* same defines as for ingress table */
487 	/* outer tags section */
488 	__le16 outer_tag;
489 	u8 outer_tag_flags;
490 #define ICE_AQ_VSI_OUTER_TAG_MODE_S	0
491 #define ICE_AQ_VSI_OUTER_TAG_MODE_M	(0x3 << ICE_AQ_VSI_OUTER_TAG_MODE_S)
492 #define ICE_AQ_VSI_OUTER_TAG_NOTHING	0x0
493 #define ICE_AQ_VSI_OUTER_TAG_REMOVE	0x1
494 #define ICE_AQ_VSI_OUTER_TAG_COPY	0x2
495 #define ICE_AQ_VSI_OUTER_TAG_TYPE_S	2
496 #define ICE_AQ_VSI_OUTER_TAG_TYPE_M	(0x3 << ICE_AQ_VSI_OUTER_TAG_TYPE_S)
497 #define ICE_AQ_VSI_OUTER_TAG_NONE	0x0
498 #define ICE_AQ_VSI_OUTER_TAG_STAG	0x1
499 #define ICE_AQ_VSI_OUTER_TAG_VLAN_8100	0x2
500 #define ICE_AQ_VSI_OUTER_TAG_VLAN_9100	0x3
501 #define ICE_AQ_VSI_OUTER_TAG_INSERT	BIT(4)
502 #define ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST BIT(6)
503 	u8 outer_tag_reserved;
504 	/* queue mapping section */
505 	__le16 mapping_flags;
506 #define ICE_AQ_VSI_Q_MAP_CONTIG	0x0
507 #define ICE_AQ_VSI_Q_MAP_NONCONTIG	BIT(0)
508 	__le16 q_mapping[16];
509 #define ICE_AQ_VSI_Q_S		0
510 #define ICE_AQ_VSI_Q_M		(0x7FF << ICE_AQ_VSI_Q_S)
511 	__le16 tc_mapping[8];
512 #define ICE_AQ_VSI_TC_Q_OFFSET_S	0
513 #define ICE_AQ_VSI_TC_Q_OFFSET_M	(0x7FF << ICE_AQ_VSI_TC_Q_OFFSET_S)
514 #define ICE_AQ_VSI_TC_Q_NUM_S		11
515 #define ICE_AQ_VSI_TC_Q_NUM_M		(0xF << ICE_AQ_VSI_TC_Q_NUM_S)
516 	/* queueing option section */
517 	u8 q_opt_rss;
518 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_S	0
519 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_M	(0x3 << ICE_AQ_VSI_Q_OPT_RSS_LUT_S)
520 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI	0x0
521 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_PF	0x2
522 #define ICE_AQ_VSI_Q_OPT_RSS_LUT_GBL	0x3
523 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S	2
524 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M	(0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
525 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S	6
526 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_M	(0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
527 #define ICE_AQ_VSI_Q_OPT_RSS_TPLZ	(0x0 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
528 #define ICE_AQ_VSI_Q_OPT_RSS_SYM_TPLZ	(0x1 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
529 #define ICE_AQ_VSI_Q_OPT_RSS_XOR	(0x2 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
530 #define ICE_AQ_VSI_Q_OPT_RSS_JHASH	(0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
531 	u8 q_opt_tc;
532 #define ICE_AQ_VSI_Q_OPT_TC_OVR_S	0
533 #define ICE_AQ_VSI_Q_OPT_TC_OVR_M	(0x1F << ICE_AQ_VSI_Q_OPT_TC_OVR_S)
534 #define ICE_AQ_VSI_Q_OPT_PROF_TC_OVR	BIT(7)
535 	u8 q_opt_flags;
536 #define ICE_AQ_VSI_Q_OPT_PE_FLTR_EN	BIT(0)
537 	u8 q_opt_reserved[3];
538 	/* outer up section */
539 	__le32 outer_up_table; /* same structure and defines as ingress tbl */
540 	/* ACL section */
541 	__le16 acl_def_act;
542 #define ICE_AQ_VSI_ACL_DEF_RX_PROF_S	0
543 #define ICE_AQ_VSI_ACL_DEF_RX_PROF_M	(0xF << ICE_AQ_VSI_ACL_DEF_RX_PROF_S)
544 #define ICE_AQ_VSI_ACL_DEF_RX_TABLE_S	4
545 #define ICE_AQ_VSI_ACL_DEF_RX_TABLE_M	(0xF << ICE_AQ_VSI_ACL_DEF_RX_TABLE_S)
546 #define ICE_AQ_VSI_ACL_DEF_TX_PROF_S	8
547 #define ICE_AQ_VSI_ACL_DEF_TX_PROF_M	(0xF << ICE_AQ_VSI_ACL_DEF_TX_PROF_S)
548 #define ICE_AQ_VSI_ACL_DEF_TX_TABLE_S	12
549 #define ICE_AQ_VSI_ACL_DEF_TX_TABLE_M	(0xF << ICE_AQ_VSI_ACL_DEF_TX_TABLE_S)
550 	/* flow director section */
551 	__le16 fd_options;
552 #define ICE_AQ_VSI_FD_ENABLE		BIT(0)
553 #define ICE_AQ_VSI_FD_TX_AUTO_ENABLE	BIT(1)
554 #define ICE_AQ_VSI_FD_PROG_ENABLE	BIT(3)
555 	__le16 max_fd_fltr_dedicated;
556 	__le16 max_fd_fltr_shared;
557 	__le16 fd_def_q;
558 #define ICE_AQ_VSI_FD_DEF_Q_S		0
559 #define ICE_AQ_VSI_FD_DEF_Q_M		(0x7FF << ICE_AQ_VSI_FD_DEF_Q_S)
560 #define ICE_AQ_VSI_FD_DEF_GRP_S	12
561 #define ICE_AQ_VSI_FD_DEF_GRP_M	(0x7 << ICE_AQ_VSI_FD_DEF_GRP_S)
562 	__le16 fd_report_opt;
563 #define ICE_AQ_VSI_FD_REPORT_Q_S	0
564 #define ICE_AQ_VSI_FD_REPORT_Q_M	(0x7FF << ICE_AQ_VSI_FD_REPORT_Q_S)
565 #define ICE_AQ_VSI_FD_DEF_PRIORITY_S	12
566 #define ICE_AQ_VSI_FD_DEF_PRIORITY_M	(0x7 << ICE_AQ_VSI_FD_DEF_PRIORITY_S)
567 #define ICE_AQ_VSI_FD_DEF_DROP		BIT(15)
568 	/* PASID section */
569 	__le32 pasid_id;
570 #define ICE_AQ_VSI_PASID_ID_S		0
571 #define ICE_AQ_VSI_PASID_ID_M		(0xFFFFF << ICE_AQ_VSI_PASID_ID_S)
572 #define ICE_AQ_VSI_PASID_ID_VALID	BIT(31)
573 	u8 reserved[24];
574 };
575 
576 /* Add/update mirror rule - direct (0x0260) */
577 #define ICE_AQC_RULE_ID_VALID_S		7
578 #define ICE_AQC_RULE_ID_VALID_M		(0x1 << ICE_AQC_RULE_ID_VALID_S)
579 #define ICE_AQC_RULE_ID_S		0
580 #define ICE_AQC_RULE_ID_M		(0x3F << ICE_AQC_RULE_ID_S)
581 
582 /* Following defines to be used while processing caller specified mirror list
583  * of VSI indexes.
584  */
585 /* Action: Byte.bit (1.7)
586  *	0 = Remove VSI from mirror rule
587  *	1 = Add VSI to mirror rule
588  */
589 #define ICE_AQC_RULE_ACT_S	15
590 #define ICE_AQC_RULE_ACT_M	(0x1 << ICE_AQC_RULE_ACT_S)
591 /* Action: 1.2:0.0 = Mirrored VSI */
592 #define ICE_AQC_RULE_MIRRORED_VSI_S	0
593 #define ICE_AQC_RULE_MIRRORED_VSI_M	(0x7FF << ICE_AQC_RULE_MIRRORED_VSI_S)
594 
595 /* This is to be used by add/update mirror rule Admin Queue command.
596  * In case of add mirror rule - if rule ID is specified as
597  * INVAL_MIRROR_RULE_ID, new rule ID is allocated from shared pool.
598  * If specified rule_id is valid, then it is used. If specified rule_id
599  * is in use then new mirroring rule is added.
600  */
601 #define ICE_INVAL_MIRROR_RULE_ID	0xFFFF
602 
603 struct ice_aqc_add_update_mir_rule {
604 	__le16 rule_id;
605 
606 	__le16 rule_type;
607 #define ICE_AQC_RULE_TYPE_S		0
608 #define ICE_AQC_RULE_TYPE_M		(0x7 << ICE_AQC_RULE_TYPE_S)
609 	/* VPORT ingress/egress */
610 #define ICE_AQC_RULE_TYPE_VPORT_INGRESS	0x1
611 #define ICE_AQC_RULE_TYPE_VPORT_EGRESS	0x2
612 	/* Physical port ingress mirroring.
613 	 * All traffic received by this port
614 	 */
615 #define ICE_AQC_RULE_TYPE_PPORT_INGRESS	0x6
616 	/* Physical port egress mirroring. All traffic sent by this port */
617 #define ICE_AQC_RULE_TYPE_PPORT_EGRESS	0x7
618 
619 	/* Number of mirrored entries.
620 	 * The values are in the command buffer
621 	 */
622 	__le16 num_entries;
623 
624 	/* Destination VSI */
625 	__le16 dest;
626 	__le32 addr_high;
627 	__le32 addr_low;
628 };
629 
630 /* Delete mirror rule - direct(0x0261) */
631 struct ice_aqc_delete_mir_rule {
632 	__le16 rule_id;
633 	__le16 rsvd;
634 
635 	/* Byte.bit: 20.0 = Keep allocation. If set VSI stays part of
636 	 * the PF allocated resources, otherwise it is returned to the
637 	 * shared pool
638 	 */
639 #define ICE_AQC_FLAG_KEEP_ALLOCD_S	0
640 #define ICE_AQC_FLAG_KEEP_ALLOCD_M	(0x1 << ICE_AQC_FLAG_KEEP_ALLOCD_S)
641 	__le16 flags;
642 
643 	u8 reserved[10];
644 };
645 
646 /* Set/Get storm config - (direct 0x0280, 0x0281) */
647 /* This structure holds get storm configuration response and same structure
648  * is used to perform set_storm_cfg
649  */
650 struct ice_aqc_storm_cfg {
651 	__le32 bcast_thresh_size;
652 	__le32 mcast_thresh_size;
653 	/* Bit 18:0 - Traffic upper threshold size
654 	 * Bit 31:19 - Reserved
655 	 */
656 #define ICE_AQ_THRESHOLD_S	0
657 #define ICE_AQ_THRESHOLD_M	(0x7FFFF << ICE_AQ_THRESHOLD_S)
658 
659 	__le32 storm_ctrl_ctrl;
660 	/* Bit 0: MDIPW - Drop Multicast packets in previous window
661 	 * Bit 1: MDICW - Drop multicast packets in current window
662 	 * Bit 2: BDIPW - Drop broadcast packets in previous window
663 	 * Bit 3: BDICW - Drop broadcast packets in current window
664 	 */
665 #define ICE_AQ_STORM_CTRL_MDIPW_DROP_MULTICAST	BIT(0)
666 #define ICE_AQ_STORM_CTRL_MDICW_DROP_MULTICAST	BIT(1)
667 #define ICE_AQ_STORM_CTRL_BDIPW_DROP_MULTICAST	BIT(2)
668 #define ICE_AQ_STORM_CTRL_BDICW_DROP_MULTICAST	BIT(3)
669 	/* Bit 7:5 : Reserved */
670 	/* Bit 27:8 : Interval - BSC/MSC Time-interval specification: The
671 	 * interval size for applying ingress broadcast or multicast storm
672 	 * control.
673 	 */
674 #define ICE_AQ_STORM_BSC_MSC_TIME_INTERVAL_S	8
675 #define ICE_AQ_STORM_BSC_MSC_TIME_INTERVAL_M	\
676 			(0xFFFFF << ICE_AQ_STORM_BSC_MSC_TIME_INTERVAL_S)
677 	__le32 reserved;
678 };
679 
680 #define ICE_MAX_NUM_RECIPES 64
681 
682 /* Add/Get Recipe (indirect 0x0290/0x0292) */
683 struct ice_aqc_add_get_recipe {
684 	__le16 num_sub_recipes;	/* Input in Add cmd, Output in Get cmd */
685 	__le16 return_index;	/* Input, used for Get cmd only */
686 	u8 reserved[4];
687 	__le32 addr_high;
688 	__le32 addr_low;
689 };
690 
691 struct ice_aqc_recipe_content {
692 	u8 rid;
693 #define ICE_AQ_RECIPE_ID_S		0
694 #define ICE_AQ_RECIPE_ID_M		(0x3F << ICE_AQ_RECIPE_ID_S)
695 #define ICE_AQ_RECIPE_ID_IS_ROOT	BIT(7)
696 #define	ICE_AQ_SW_ID_LKUP_IDX		0
697 	u8 lkup_indx[5];
698 #define ICE_AQ_RECIPE_LKUP_DATA_S	0
699 #define ICE_AQ_RECIPE_LKUP_DATA_M	(0x3F << ICE_AQ_RECIPE_LKUP_DATA_S)
700 #define ICE_AQ_RECIPE_LKUP_IGNORE	BIT(7)
701 #define ICE_AQ_SW_ID_LKUP_MASK		0x00FF
702 	__le16 mask[5];
703 	u8 result_indx;
704 #define ICE_AQ_RECIPE_RESULT_DATA_S	0
705 #define ICE_AQ_RECIPE_RESULT_DATA_M	(0x3F << ICE_AQ_RECIPE_RESULT_DATA_S)
706 #define ICE_AQ_RECIPE_RESULT_EN		BIT(7)
707 	u8 rsvd0[3];
708 	u8 act_ctrl_join_priority;
709 	u8 act_ctrl_fwd_priority;
710 #define ICE_AQ_RECIPE_FWD_PRIORITY_S	0
711 #define ICE_AQ_RECIPE_FWD_PRIORITY_M	(0xF << ICE_AQ_RECIPE_FWD_PRIORITY_S)
712 	u8 act_ctrl;
713 #define ICE_AQ_RECIPE_ACT_NEED_PASS_L2	BIT(0)
714 #define ICE_AQ_RECIPE_ACT_ALLOW_PASS_L2	BIT(1)
715 #define ICE_AQ_RECIPE_ACT_INV_ACT	BIT(2)
716 #define ICE_AQ_RECIPE_ACT_PRUNE_INDX_S	4
717 #define ICE_AQ_RECIPE_ACT_PRUNE_INDX_M	(0x3 << ICE_AQ_RECIPE_ACT_PRUNE_INDX_S)
718 	u8 rsvd1;
719 	__le32 dflt_act;
720 #define ICE_AQ_RECIPE_DFLT_ACT_S	0
721 #define ICE_AQ_RECIPE_DFLT_ACT_M	(0x7FFFF << ICE_AQ_RECIPE_DFLT_ACT_S)
722 #define ICE_AQ_RECIPE_DFLT_ACT_VALID	BIT(31)
723 };
724 
725 struct ice_aqc_recipe_data_elem {
726 	u8 recipe_indx;
727 	u8 resp_bits;
728 #define ICE_AQ_RECIPE_WAS_UPDATED	BIT(0)
729 	u8 rsvd0[2];
730 	u8 recipe_bitmap[8];
731 	u8 rsvd1[4];
732 	struct ice_aqc_recipe_content content;
733 	u8 rsvd2[20];
734 };
735 
736 /* Set/Get Recipes to Profile Association (direct 0x0291/0x0293) */
737 struct ice_aqc_recipe_to_profile {
738 	__le16 profile_id;
739 	u8 rsvd[6];
740 	ice_declare_bitmap(recipe_assoc, ICE_MAX_NUM_RECIPES);
741 };
742 
743 /* Add/Update/Remove/Get switch rules (indirect 0x02A0, 0x02A1, 0x02A2, 0x02A3)
744  */
745 struct ice_aqc_sw_rules {
746 	/* ops: add switch rules, referring the number of rules.
747 	 * ops: update switch rules, referring the number of filters
748 	 * ops: remove switch rules, referring the entry index.
749 	 * ops: get switch rules, referring to the number of filters.
750 	 */
751 	__le16 num_rules_fltr_entry_index;
752 	u8 reserved[6];
753 	__le32 addr_high;
754 	__le32 addr_low;
755 };
756 
757 /* Add/Update/Get/Remove lookup Rx/Tx command/response entry
758  * This structures describes the lookup rules and associated actions. "index"
759  * is returned as part of a response to a successful Add command, and can be
760  * used to identify the rule for Update/Get/Remove commands.
761  */
762 struct ice_sw_rule_lkup_rx_tx {
763 	__le16 recipe_id;
764 #define ICE_SW_RECIPE_LOGICAL_PORT_FWD		10
765 	/* Source port for LOOKUP_RX and source VSI in case of LOOKUP_TX */
766 	__le16 src;
767 	__le32 act;
768 
769 	/* Bit 0:1 - Action type */
770 #define ICE_SINGLE_ACT_TYPE_S	0x00
771 #define ICE_SINGLE_ACT_TYPE_M	(0x3 << ICE_SINGLE_ACT_TYPE_S)
772 
773 	/* Bit 2 - Loop back enable
774 	 * Bit 3 - LAN enable
775 	 */
776 #define ICE_SINGLE_ACT_LB_ENABLE	BIT(2)
777 #define ICE_SINGLE_ACT_LAN_ENABLE	BIT(3)
778 
779 	/* Action type = 0 - Forward to VSI or VSI list */
780 #define ICE_SINGLE_ACT_VSI_FORWARDING	0x0
781 
782 #define ICE_SINGLE_ACT_VSI_ID_S		4
783 #define ICE_SINGLE_ACT_VSI_ID_M		(0x3FF << ICE_SINGLE_ACT_VSI_ID_S)
784 #define ICE_SINGLE_ACT_VSI_LIST_ID_S	4
785 #define ICE_SINGLE_ACT_VSI_LIST_ID_M	(0x3FF << ICE_SINGLE_ACT_VSI_LIST_ID_S)
786 	/* This bit needs to be set if action is forward to VSI list */
787 #define ICE_SINGLE_ACT_VSI_LIST		BIT(14)
788 #define ICE_SINGLE_ACT_VALID_BIT	BIT(17)
789 #define ICE_SINGLE_ACT_DROP		BIT(18)
790 
791 	/* Action type = 1 - Forward to Queue of Queue group */
792 #define ICE_SINGLE_ACT_TO_Q		0x1
793 #define ICE_SINGLE_ACT_Q_INDEX_S	4
794 #define ICE_SINGLE_ACT_Q_INDEX_M	(0x7FF << ICE_SINGLE_ACT_Q_INDEX_S)
795 #define ICE_SINGLE_ACT_Q_REGION_S	15
796 #define ICE_SINGLE_ACT_Q_REGION_M	(0x7 << ICE_SINGLE_ACT_Q_REGION_S)
797 #define ICE_SINGLE_ACT_Q_PRIORITY	BIT(18)
798 
799 	/* Action type = 2 - Prune */
800 #define ICE_SINGLE_ACT_PRUNE		0x2
801 #define ICE_SINGLE_ACT_EGRESS		BIT(15)
802 #define ICE_SINGLE_ACT_INGRESS		BIT(16)
803 #define ICE_SINGLE_ACT_PRUNET		BIT(17)
804 	/* Bit 18 should be set to 0 for this action */
805 
806 	/* Action type = 2 - Pointer */
807 #define ICE_SINGLE_ACT_PTR		0x2
808 #define ICE_SINGLE_ACT_PTR_VAL_S	4
809 #define ICE_SINGLE_ACT_PTR_VAL_M	(0x1FFF << ICE_SINGLE_ACT_PTR_VAL_S)
810 	/* Bit 18 should be set to 1 */
811 #define ICE_SINGLE_ACT_PTR_BIT		BIT(18)
812 
813 	/* Action type = 3 - Other actions. Last two bits
814 	 * are other action identifier
815 	 */
816 #define ICE_SINGLE_ACT_OTHER_ACTS		0x3
817 #define ICE_SINGLE_OTHER_ACT_IDENTIFIER_S	17
818 #define ICE_SINGLE_OTHER_ACT_IDENTIFIER_M	\
819 				(0x3 << ICE_SINGLE_OTHER_ACT_IDENTIFIER_S)
820 
821 	/* Bit 17:18 - Defines other actions */
822 	/* Other action = 0 - Mirror VSI */
823 #define ICE_SINGLE_OTHER_ACT_MIRROR		0
824 #define ICE_SINGLE_ACT_MIRROR_VSI_ID_S	4
825 #define ICE_SINGLE_ACT_MIRROR_VSI_ID_M	\
826 				(0x3FF << ICE_SINGLE_ACT_MIRROR_VSI_ID_S)
827 
828 	/* Other action = 3 - Set Stat count */
829 #define ICE_SINGLE_OTHER_ACT_STAT_COUNT		3
830 #define ICE_SINGLE_ACT_STAT_COUNT_INDEX_S	4
831 #define ICE_SINGLE_ACT_STAT_COUNT_INDEX_M	\
832 				(0x7F << ICE_SINGLE_ACT_STAT_COUNT_INDEX_S)
833 
834 	__le16 index; /* The index of the rule in the lookup table */
835 	/* Length and values of the header to be matched per recipe or
836 	 * lookup-type
837 	 */
838 	__le16 hdr_len;
839 	u8 hdr[STRUCT_HACK_VAR_LEN];
840 };
841 
842 /* Add/Update/Remove large action command/response entry
843  * "index" is returned as part of a response to a successful Add command, and
844  * can be used to identify the action for Update/Get/Remove commands.
845  */
846 struct ice_sw_rule_lg_act {
847 	__le16 index; /* Index in large action table */
848 	__le16 size;
849 	/* Max number of large actions */
850 #define ICE_MAX_LG_ACT	4
851 	/* Bit 0:1 - Action type */
852 #define ICE_LG_ACT_TYPE_S	0
853 #define ICE_LG_ACT_TYPE_M	(0x7 << ICE_LG_ACT_TYPE_S)
854 
855 	/* Action type = 0 - Forward to VSI or VSI list */
856 #define ICE_LG_ACT_VSI_FORWARDING	0
857 #define ICE_LG_ACT_VSI_ID_S		3
858 #define ICE_LG_ACT_VSI_ID_M		(0x3FF << ICE_LG_ACT_VSI_ID_S)
859 #define ICE_LG_ACT_VSI_LIST_ID_S	3
860 #define ICE_LG_ACT_VSI_LIST_ID_M	(0x3FF << ICE_LG_ACT_VSI_LIST_ID_S)
861 	/* This bit needs to be set if action is forward to VSI list */
862 #define ICE_LG_ACT_VSI_LIST		BIT(13)
863 
864 #define ICE_LG_ACT_VALID_BIT		BIT(16)
865 
866 	/* Action type = 1 - Forward to Queue of Queue group */
867 #define ICE_LG_ACT_TO_Q			0x1
868 #define ICE_LG_ACT_Q_INDEX_S		3
869 #define ICE_LG_ACT_Q_INDEX_M		(0x7FF << ICE_LG_ACT_Q_INDEX_S)
870 #define ICE_LG_ACT_Q_REGION_S		14
871 #define ICE_LG_ACT_Q_REGION_M		(0x7 << ICE_LG_ACT_Q_REGION_S)
872 #define ICE_LG_ACT_Q_PRIORITY_SET	BIT(17)
873 
874 	/* Action type = 2 - Prune */
875 #define ICE_LG_ACT_PRUNE		0x2
876 #define ICE_LG_ACT_EGRESS		BIT(14)
877 #define ICE_LG_ACT_INGRESS		BIT(15)
878 #define ICE_LG_ACT_PRUNET		BIT(16)
879 
880 	/* Action type = 3 - Mirror VSI */
881 #define ICE_LG_OTHER_ACT_MIRROR		0x3
882 #define ICE_LG_ACT_MIRROR_VSI_ID_S	3
883 #define ICE_LG_ACT_MIRROR_VSI_ID_M	(0x3FF << ICE_LG_ACT_MIRROR_VSI_ID_S)
884 
885 	/* Action type = 5 - Generic Value */
886 #define ICE_LG_ACT_GENERIC		0x5
887 #define ICE_LG_ACT_GENERIC_VALUE_S	3
888 #define ICE_LG_ACT_GENERIC_VALUE_M	(0xFFFF << ICE_LG_ACT_GENERIC_VALUE_S)
889 #define ICE_LG_ACT_GENERIC_OFFSET_S	19
890 #define ICE_LG_ACT_GENERIC_OFFSET_M	(0x7 << ICE_LG_ACT_GENERIC_OFFSET_S)
891 #define ICE_LG_ACT_GENERIC_PRIORITY_S	22
892 #define ICE_LG_ACT_GENERIC_PRIORITY_M	(0x7 << ICE_LG_ACT_GENERIC_PRIORITY_S)
893 #define ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX	7
894 
895 	/* Action = 7 - Set Stat count */
896 #define ICE_LG_ACT_STAT_COUNT		0x7
897 #define ICE_LG_ACT_STAT_COUNT_S		3
898 #define ICE_LG_ACT_STAT_COUNT_M		(0x7F << ICE_LG_ACT_STAT_COUNT_S)
899 	__le32 act[STRUCT_HACK_VAR_LEN]; /* array of size for actions */
900 };
901 
902 /* Add/Update/Remove VSI list command/response entry
903  * "index" is returned as part of a response to a successful Add command, and
904  * can be used to identify the VSI list for Update/Get/Remove commands.
905  */
906 struct ice_sw_rule_vsi_list {
907 	__le16 index; /* Index of VSI/Prune list */
908 	__le16 number_vsi;
909 	__le16 vsi[STRUCT_HACK_VAR_LEN]; /* Array of number_vsi VSI numbers */
910 };
911 
912 #pragma pack(1)
913 /* Query VSI list command/response entry */
914 struct ice_sw_rule_vsi_list_query {
915 	__le16 index;
916 	ice_declare_bitmap(vsi_list, ICE_MAX_VSI);
917 };
918 #pragma pack()
919 
920 #pragma pack(1)
921 /* Add switch rule response:
922  * Content of return buffer is same as the input buffer. The status field and
923  * LUT index are updated as part of the response
924  */
925 struct ice_aqc_sw_rules_elem {
926 	__le16 type; /* Switch rule type, one of T_... */
927 #define ICE_AQC_SW_RULES_T_LKUP_RX		0x0
928 #define ICE_AQC_SW_RULES_T_LKUP_TX		0x1
929 #define ICE_AQC_SW_RULES_T_LG_ACT		0x2
930 #define ICE_AQC_SW_RULES_T_VSI_LIST_SET		0x3
931 #define ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR	0x4
932 #define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET	0x5
933 #define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR	0x6
934 	__le16 status;
935 	union {
936 		struct ice_sw_rule_lkup_rx_tx lkup_tx_rx;
937 		struct ice_sw_rule_lg_act lg_act;
938 		struct ice_sw_rule_vsi_list vsi_list;
939 		struct ice_sw_rule_vsi_list_query vsi_list_query;
940 	} pdata;
941 };
942 
943 #pragma pack()
944 
945 /* PFC Ignore (direct 0x0301)
946  * The command and response use the same descriptor structure
947  */
948 struct ice_aqc_pfc_ignore {
949 	u8	tc_bitmap;
950 	u8	cmd_flags; /* unused in response */
951 #define ICE_AQC_PFC_IGNORE_SET		BIT(7)
952 #define ICE_AQC_PFC_IGNORE_CLEAR	0
953 	u8	reserved[14];
954 };
955 
956 /* Set PFC Mode (direct 0x0303)
957  * Query PFC Mode (direct 0x0302)
958  */
959 struct ice_aqc_set_query_pfc_mode {
960 	u8	pfc_mode;
961 /* For Set Command response, reserved in all other cases */
962 #define ICE_AQC_PFC_NOT_CONFIGURED	0
963 /* For Query Command response, reserved in all other cases */
964 #define ICE_AQC_DCB_DIS		0
965 #define ICE_AQC_PFC_VLAN_BASED_PFC	1
966 #define ICE_AQC_PFC_DSCP_BASED_PFC	2
967 	u8	rsvd[15];
968 };
969 
970 /* Set DCB Parameters (direct 0x0306) */
971 struct ice_aqc_set_dcb_params {
972 	u8 cmd_flags; /* unused in response */
973 #define ICE_AQC_LINK_UP_DCB_CFG    BIT(0)
974 #define ICE_AQC_PERSIST_DCB_CFG    BIT(1)
975 	u8 valid_flags; /* unused in response */
976 #define ICE_AQC_LINK_UP_DCB_CFG_VALID    BIT(0)
977 #define ICE_AQC_PERSIST_DCB_CFG_VALID    BIT(1)
978 	u8 rsvd[14];
979 };
980 
981 /* Get Default Topology (indirect 0x0400) */
982 struct ice_aqc_get_topo {
983 	u8 port_num;
984 	u8 num_branches;
985 	__le16 reserved1;
986 	__le32 reserved2;
987 	__le32 addr_high;
988 	__le32 addr_low;
989 };
990 
991 /* Update TSE (indirect 0x0403)
992  * Get TSE (indirect 0x0404)
993  * Add TSE (indirect 0x0401)
994  * Delete TSE (indirect 0x040F)
995  * Move TSE (indirect 0x0408)
996  * Suspend Nodes (indirect 0x0409)
997  * Resume Nodes (indirect 0x040A)
998  */
999 struct ice_aqc_sched_elem_cmd {
1000 	__le16 num_elem_req;	/* Used by commands */
1001 	__le16 num_elem_resp;	/* Used by responses */
1002 	__le32 reserved;
1003 	__le32 addr_high;
1004 	__le32 addr_low;
1005 };
1006 
1007 struct ice_aqc_txsched_move_grp_info_hdr {
1008 	__le32 src_parent_teid;
1009 	__le32 dest_parent_teid;
1010 	__le16 num_elems;
1011 	u8 flags;
1012 	u8 reserved;
1013 };
1014 
1015 struct ice_aqc_move_elem {
1016 	struct ice_aqc_txsched_move_grp_info_hdr hdr;
1017 	__le32 teid[STRUCT_HACK_VAR_LEN];
1018 };
1019 
1020 struct ice_aqc_elem_info_bw {
1021 	__le16 bw_profile_idx;
1022 	__le16 bw_alloc;
1023 };
1024 
1025 struct ice_aqc_txsched_elem {
1026 	u8 elem_type; /* Special field, reserved for some aq calls */
1027 #define ICE_AQC_ELEM_TYPE_UNDEFINED		0x0
1028 #define ICE_AQC_ELEM_TYPE_ROOT_PORT		0x1
1029 #define ICE_AQC_ELEM_TYPE_TC			0x2
1030 #define ICE_AQC_ELEM_TYPE_SE_GENERIC		0x3
1031 #define ICE_AQC_ELEM_TYPE_ENTRY_POINT		0x4
1032 #define ICE_AQC_ELEM_TYPE_LEAF			0x5
1033 #define ICE_AQC_ELEM_TYPE_SE_PADDED		0x6
1034 	u8 valid_sections;
1035 #define ICE_AQC_ELEM_VALID_GENERIC		BIT(0)
1036 #define ICE_AQC_ELEM_VALID_CIR			BIT(1)
1037 #define ICE_AQC_ELEM_VALID_EIR			BIT(2)
1038 #define ICE_AQC_ELEM_VALID_SHARED		BIT(3)
1039 	u8 generic;
1040 #define ICE_AQC_ELEM_GENERIC_MODE_M		0x1
1041 #define ICE_AQC_ELEM_GENERIC_PRIO_S		0x1
1042 #define ICE_AQC_ELEM_GENERIC_PRIO_M	(0x7 << ICE_AQC_ELEM_GENERIC_PRIO_S)
1043 #define ICE_AQC_ELEM_GENERIC_SP_S		0x4
1044 #define ICE_AQC_ELEM_GENERIC_SP_M	(0x1 << ICE_AQC_ELEM_GENERIC_SP_S)
1045 #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S	0x5
1046 #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_M	\
1047 	(0x3 << ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S)
1048 	u8 flags; /* Special field, reserved for some aq calls */
1049 #define ICE_AQC_ELEM_FLAG_SUSPEND_M		0x1
1050 	struct ice_aqc_elem_info_bw cir_bw;
1051 	struct ice_aqc_elem_info_bw eir_bw;
1052 	__le16 srl_id;
1053 	__le16 reserved2;
1054 };
1055 
1056 struct ice_aqc_txsched_elem_data {
1057 	__le32 parent_teid;
1058 	__le32 node_teid;
1059 	struct ice_aqc_txsched_elem data;
1060 };
1061 
1062 struct ice_aqc_txsched_topo_grp_info_hdr {
1063 	__le32 parent_teid;
1064 	__le16 num_elems;
1065 	__le16 reserved2;
1066 };
1067 
1068 struct ice_aqc_add_elem {
1069 	struct ice_aqc_txsched_topo_grp_info_hdr hdr;
1070 	struct ice_aqc_txsched_elem_data generic[STRUCT_HACK_VAR_LEN];
1071 };
1072 
1073 struct ice_aqc_get_topo_elem {
1074 	struct ice_aqc_txsched_topo_grp_info_hdr hdr;
1075 	struct ice_aqc_txsched_elem_data
1076 		generic[ICE_AQC_TOPO_MAX_LEVEL_NUM];
1077 };
1078 
1079 struct ice_aqc_delete_elem {
1080 	struct ice_aqc_txsched_topo_grp_info_hdr hdr;
1081 	__le32 teid[STRUCT_HACK_VAR_LEN];
1082 };
1083 
1084 /* Query Port ETS (indirect 0x040E)
1085  *
1086  * This indirect command is used to query port TC node configuration.
1087  */
1088 struct ice_aqc_query_port_ets {
1089 	__le32 port_teid;
1090 	__le32 reserved;
1091 	__le32 addr_high;
1092 	__le32 addr_low;
1093 };
1094 
1095 struct ice_aqc_port_ets_elem {
1096 	u8 tc_valid_bits;
1097 	u8 reserved[3];
1098 	/* 3 bits for UP per TC 0-7, 4th byte reserved */
1099 	__le32 up2tc;
1100 	u8 tc_bw_share[8];
1101 	__le32 port_eir_prof_id;
1102 	__le32 port_cir_prof_id;
1103 	/* 3 bits per Node priority to TC 0-7, 4th byte reserved */
1104 	__le32 tc_node_prio;
1105 #define ICE_TC_NODE_PRIO_S	0x4
1106 	u8 reserved1[4];
1107 	__le32 tc_node_teid[8]; /* Used for response, reserved in command */
1108 };
1109 
1110 /* Rate limiting profile for
1111  * Add RL profile (indirect 0x0410)
1112  * Query RL profile (indirect 0x0411)
1113  * Remove RL profile (indirect 0x0415)
1114  * These indirect commands acts on single or multiple
1115  * RL profiles with specified data.
1116  */
1117 struct ice_aqc_rl_profile {
1118 	__le16 num_profiles;
1119 	__le16 num_processed; /* Only for response. Reserved in Command. */
1120 	u8 reserved[4];
1121 	__le32 addr_high;
1122 	__le32 addr_low;
1123 };
1124 
1125 struct ice_aqc_rl_profile_elem {
1126 	u8 level;
1127 	u8 flags;
1128 #define ICE_AQC_RL_PROFILE_TYPE_S	0x0
1129 #define ICE_AQC_RL_PROFILE_TYPE_M	(0x3 << ICE_AQC_RL_PROFILE_TYPE_S)
1130 #define ICE_AQC_RL_PROFILE_TYPE_CIR	0
1131 #define ICE_AQC_RL_PROFILE_TYPE_EIR	1
1132 #define ICE_AQC_RL_PROFILE_TYPE_SRL	2
1133 /* The following flag is used for Query RL Profile Data */
1134 #define ICE_AQC_RL_PROFILE_INVAL_S	0x7
1135 #define ICE_AQC_RL_PROFILE_INVAL_M	(0x1 << ICE_AQC_RL_PROFILE_INVAL_S)
1136 
1137 	__le16 profile_id;
1138 	__le16 max_burst_size;
1139 	__le16 rl_multiply;
1140 	__le16 wake_up_calc;
1141 	__le16 rl_encode;
1142 };
1143 
1144 /* Configure L2 Node CGD (indirect 0x0414)
1145  * This indirect command allows configuring a congestion domain for given L2
1146  * node TEIDs in the scheduler topology.
1147  */
1148 struct ice_aqc_cfg_l2_node_cgd {
1149 	__le16 num_l2_nodes;
1150 	u8 reserved[6];
1151 	__le32 addr_high;
1152 	__le32 addr_low;
1153 };
1154 
1155 struct ice_aqc_cfg_l2_node_cgd_elem {
1156 	__le32 node_teid;
1157 	u8 cgd;
1158 	u8 reserved[3];
1159 };
1160 
1161 /* Query Scheduler Resource Allocation (indirect 0x0412)
1162  * This indirect command retrieves the scheduler resources allocated by
1163  * EMP Firmware to the given PF.
1164  */
1165 struct ice_aqc_query_txsched_res {
1166 	u8 reserved[8];
1167 	__le32 addr_high;
1168 	__le32 addr_low;
1169 };
1170 
1171 struct ice_aqc_generic_sched_props {
1172 	__le16 phys_levels;
1173 	__le16 logical_levels;
1174 	u8 flattening_bitmap;
1175 	u8 max_device_cgds;
1176 	u8 max_pf_cgds;
1177 	u8 rsvd0;
1178 	__le16 rdma_qsets;
1179 	u8 rsvd1[22];
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 struct ice_aqc_query_txsched_res_resp {
1196 	struct ice_aqc_generic_sched_props sched_props;
1197 	struct ice_aqc_layer_props layer_props[ICE_AQC_TOPO_MAX_LEVEL_NUM];
1198 };
1199 
1200 /* Query Node to Root Topology (indirect 0x0413)
1201  * This command uses ice_aqc_get_elem as its data buffer.
1202  */
1203 struct ice_aqc_query_node_to_root {
1204 	__le32 teid;
1205 	__le32 num_nodes; /* Response only */
1206 	__le32 addr_high;
1207 	__le32 addr_low;
1208 };
1209 
1210 /* Get PHY capabilities (indirect 0x0600) */
1211 struct ice_aqc_get_phy_caps {
1212 	u8 lport_num;
1213 	u8 reserved;
1214 	__le16 param0;
1215 	/* 18.0 - Report qualified modules */
1216 #define ICE_AQC_GET_PHY_RQM		BIT(0)
1217 	/* 18.1 - 18.3 : Report mode
1218 	 * 000b - Report NVM capabilities
1219 	 * 001b - Report topology capabilities
1220 	 * 010b - Report SW configured
1221 	 * 100b - Report default capabilities
1222 	 */
1223 #define ICE_AQC_REPORT_MODE_S			1
1224 #define ICE_AQC_REPORT_MODE_M			(7 << ICE_AQC_REPORT_MODE_S)
1225 #define ICE_AQC_REPORT_TOPO_CAP_NO_MEDIA	0
1226 #define ICE_AQC_REPORT_TOPO_CAP_MEDIA		BIT(1)
1227 #define ICE_AQC_REPORT_ACTIVE_CFG		BIT(2)
1228 #define ICE_AQC_REPORT_DFLT_CFG			BIT(3)
1229 	__le32 reserved1;
1230 	__le32 addr_high;
1231 	__le32 addr_low;
1232 };
1233 
1234 /* This is #define of PHY type (Extended):
1235  * The first set of defines is for phy_type_low.
1236  */
1237 #define ICE_PHY_TYPE_LOW_100BASE_TX		BIT_ULL(0)
1238 #define ICE_PHY_TYPE_LOW_100M_SGMII		BIT_ULL(1)
1239 #define ICE_PHY_TYPE_LOW_1000BASE_T		BIT_ULL(2)
1240 #define ICE_PHY_TYPE_LOW_1000BASE_SX		BIT_ULL(3)
1241 #define ICE_PHY_TYPE_LOW_1000BASE_LX		BIT_ULL(4)
1242 #define ICE_PHY_TYPE_LOW_1000BASE_KX		BIT_ULL(5)
1243 #define ICE_PHY_TYPE_LOW_1G_SGMII		BIT_ULL(6)
1244 #define ICE_PHY_TYPE_LOW_2500BASE_T		BIT_ULL(7)
1245 #define ICE_PHY_TYPE_LOW_2500BASE_X		BIT_ULL(8)
1246 #define ICE_PHY_TYPE_LOW_2500BASE_KX		BIT_ULL(9)
1247 #define ICE_PHY_TYPE_LOW_5GBASE_T		BIT_ULL(10)
1248 #define ICE_PHY_TYPE_LOW_5GBASE_KR		BIT_ULL(11)
1249 #define ICE_PHY_TYPE_LOW_10GBASE_T		BIT_ULL(12)
1250 #define ICE_PHY_TYPE_LOW_10G_SFI_DA		BIT_ULL(13)
1251 #define ICE_PHY_TYPE_LOW_10GBASE_SR		BIT_ULL(14)
1252 #define ICE_PHY_TYPE_LOW_10GBASE_LR		BIT_ULL(15)
1253 #define ICE_PHY_TYPE_LOW_10GBASE_KR_CR1		BIT_ULL(16)
1254 #define ICE_PHY_TYPE_LOW_10G_SFI_AOC_ACC	BIT_ULL(17)
1255 #define ICE_PHY_TYPE_LOW_10G_SFI_C2C		BIT_ULL(18)
1256 #define ICE_PHY_TYPE_LOW_25GBASE_T		BIT_ULL(19)
1257 #define ICE_PHY_TYPE_LOW_25GBASE_CR		BIT_ULL(20)
1258 #define ICE_PHY_TYPE_LOW_25GBASE_CR_S		BIT_ULL(21)
1259 #define ICE_PHY_TYPE_LOW_25GBASE_CR1		BIT_ULL(22)
1260 #define ICE_PHY_TYPE_LOW_25GBASE_SR		BIT_ULL(23)
1261 #define ICE_PHY_TYPE_LOW_25GBASE_LR		BIT_ULL(24)
1262 #define ICE_PHY_TYPE_LOW_25GBASE_KR		BIT_ULL(25)
1263 #define ICE_PHY_TYPE_LOW_25GBASE_KR_S		BIT_ULL(26)
1264 #define ICE_PHY_TYPE_LOW_25GBASE_KR1		BIT_ULL(27)
1265 #define ICE_PHY_TYPE_LOW_25G_AUI_AOC_ACC	BIT_ULL(28)
1266 #define ICE_PHY_TYPE_LOW_25G_AUI_C2C		BIT_ULL(29)
1267 #define ICE_PHY_TYPE_LOW_40GBASE_CR4		BIT_ULL(30)
1268 #define ICE_PHY_TYPE_LOW_40GBASE_SR4		BIT_ULL(31)
1269 #define ICE_PHY_TYPE_LOW_40GBASE_LR4		BIT_ULL(32)
1270 #define ICE_PHY_TYPE_LOW_40GBASE_KR4		BIT_ULL(33)
1271 #define ICE_PHY_TYPE_LOW_40G_XLAUI_AOC_ACC	BIT_ULL(34)
1272 #define ICE_PHY_TYPE_LOW_40G_XLAUI		BIT_ULL(35)
1273 #define ICE_PHY_TYPE_LOW_50GBASE_CR2		BIT_ULL(36)
1274 #define ICE_PHY_TYPE_LOW_50GBASE_SR2		BIT_ULL(37)
1275 #define ICE_PHY_TYPE_LOW_50GBASE_LR2		BIT_ULL(38)
1276 #define ICE_PHY_TYPE_LOW_50GBASE_KR2		BIT_ULL(39)
1277 #define ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC	BIT_ULL(40)
1278 #define ICE_PHY_TYPE_LOW_50G_LAUI2		BIT_ULL(41)
1279 #define ICE_PHY_TYPE_LOW_50G_AUI2_AOC_ACC	BIT_ULL(42)
1280 #define ICE_PHY_TYPE_LOW_50G_AUI2		BIT_ULL(43)
1281 #define ICE_PHY_TYPE_LOW_50GBASE_CP		BIT_ULL(44)
1282 #define ICE_PHY_TYPE_LOW_50GBASE_SR		BIT_ULL(45)
1283 #define ICE_PHY_TYPE_LOW_50GBASE_FR		BIT_ULL(46)
1284 #define ICE_PHY_TYPE_LOW_50GBASE_LR		BIT_ULL(47)
1285 #define ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4	BIT_ULL(48)
1286 #define ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC	BIT_ULL(49)
1287 #define ICE_PHY_TYPE_LOW_50G_AUI1		BIT_ULL(50)
1288 #define ICE_PHY_TYPE_LOW_100GBASE_CR4		BIT_ULL(51)
1289 #define ICE_PHY_TYPE_LOW_100GBASE_SR4		BIT_ULL(52)
1290 #define ICE_PHY_TYPE_LOW_100GBASE_LR4		BIT_ULL(53)
1291 #define ICE_PHY_TYPE_LOW_100GBASE_KR4		BIT_ULL(54)
1292 #define ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC	BIT_ULL(55)
1293 #define ICE_PHY_TYPE_LOW_100G_CAUI4		BIT_ULL(56)
1294 #define ICE_PHY_TYPE_LOW_100G_AUI4_AOC_ACC	BIT_ULL(57)
1295 #define ICE_PHY_TYPE_LOW_100G_AUI4		BIT_ULL(58)
1296 #define ICE_PHY_TYPE_LOW_100GBASE_CR_PAM4	BIT_ULL(59)
1297 #define ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4	BIT_ULL(60)
1298 #define ICE_PHY_TYPE_LOW_100GBASE_CP2		BIT_ULL(61)
1299 #define ICE_PHY_TYPE_LOW_100GBASE_SR2		BIT_ULL(62)
1300 #define ICE_PHY_TYPE_LOW_100GBASE_DR		BIT_ULL(63)
1301 #define ICE_PHY_TYPE_LOW_MAX_INDEX		63
1302 /* The second set of defines is for phy_type_high. */
1303 #define ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4	BIT_ULL(0)
1304 #define ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC	BIT_ULL(1)
1305 #define ICE_PHY_TYPE_HIGH_100G_CAUI2		BIT_ULL(2)
1306 #define ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC	BIT_ULL(3)
1307 #define ICE_PHY_TYPE_HIGH_100G_AUI2		BIT_ULL(4)
1308 #define ICE_PHY_TYPE_HIGH_MAX_INDEX		5
1309 
1310 struct ice_aqc_get_phy_caps_data {
1311 	__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
1312 	__le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
1313 	u8 caps;
1314 #define ICE_AQC_PHY_EN_TX_LINK_PAUSE			BIT(0)
1315 #define ICE_AQC_PHY_EN_RX_LINK_PAUSE			BIT(1)
1316 #define ICE_AQC_PHY_LOW_POWER_MODE			BIT(2)
1317 #define ICE_AQC_PHY_EN_LINK				BIT(3)
1318 #define ICE_AQC_PHY_AN_MODE				BIT(4)
1319 #define ICE_AQC_PHY_EN_MOD_QUAL				BIT(5)
1320 #define ICE_AQC_PHY_EN_LESM				BIT(6)
1321 #define ICE_AQC_PHY_EN_AUTO_FEC				BIT(7)
1322 #define ICE_AQC_PHY_CAPS_MASK				MAKEMASK(0xff, 0)
1323 	u8 low_power_ctrl_an;
1324 #define ICE_AQC_PHY_EN_D3COLD_LOW_POWER_AUTONEG		BIT(0)
1325 #define ICE_AQC_PHY_AN_EN_CLAUSE28			BIT(1)
1326 #define ICE_AQC_PHY_AN_EN_CLAUSE73			BIT(2)
1327 #define ICE_AQC_PHY_AN_EN_CLAUSE37			BIT(3)
1328 	__le16 eee_cap;
1329 #define ICE_AQC_PHY_EEE_EN_100BASE_TX			BIT(0)
1330 #define ICE_AQC_PHY_EEE_EN_1000BASE_T			BIT(1)
1331 #define ICE_AQC_PHY_EEE_EN_10GBASE_T			BIT(2)
1332 #define ICE_AQC_PHY_EEE_EN_1000BASE_KX			BIT(3)
1333 #define ICE_AQC_PHY_EEE_EN_10GBASE_KR			BIT(4)
1334 #define ICE_AQC_PHY_EEE_EN_25GBASE_KR			BIT(5)
1335 #define ICE_AQC_PHY_EEE_EN_40GBASE_KR4			BIT(6)
1336 #define ICE_AQC_PHY_EEE_EN_50GBASE_KR2			BIT(7)
1337 #define ICE_AQC_PHY_EEE_EN_50GBASE_KR_PAM4		BIT(8)
1338 #define ICE_AQC_PHY_EEE_EN_100GBASE_KR4			BIT(9)
1339 #define ICE_AQC_PHY_EEE_EN_100GBASE_KR2_PAM4		BIT(10)
1340 	__le16 eeer_value;
1341 	u8 phy_id_oui[4]; /* PHY/Module ID connected on the port */
1342 	u8 phy_fw_ver[8];
1343 	u8 link_fec_options;
1344 #define ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN		BIT(0)
1345 #define ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ		BIT(1)
1346 #define ICE_AQC_PHY_FEC_25G_RS_528_REQ			BIT(2)
1347 #define ICE_AQC_PHY_FEC_25G_KR_REQ			BIT(3)
1348 #define ICE_AQC_PHY_FEC_25G_RS_544_REQ			BIT(4)
1349 #define ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN		BIT(6)
1350 #define ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN		BIT(7)
1351 #define ICE_AQC_PHY_FEC_MASK				MAKEMASK(0xdf, 0)
1352 	u8 module_compliance_enforcement;
1353 #define ICE_AQC_MOD_ENFORCE_STRICT_MODE			BIT(0)
1354 	u8 extended_compliance_code;
1355 #define ICE_MODULE_TYPE_TOTAL_BYTE			3
1356 	u8 module_type[ICE_MODULE_TYPE_TOTAL_BYTE];
1357 #define ICE_AQC_MOD_TYPE_BYTE0_SFP_PLUS			0xA0
1358 #define ICE_AQC_MOD_TYPE_BYTE0_QSFP_PLUS		0x80
1359 #define ICE_AQC_MOD_TYPE_IDENT				1
1360 #define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_PASSIVE	BIT(0)
1361 #define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_ACTIVE	BIT(1)
1362 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_SR		BIT(4)
1363 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_LR		BIT(5)
1364 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_LRM		BIT(6)
1365 #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_ER		BIT(7)
1366 #define ICE_AQC_MOD_TYPE_BYTE2_SFP_PLUS			0xA0
1367 #define ICE_AQC_MOD_TYPE_BYTE2_QSFP_PLUS		0x86
1368 	u8 qualified_module_count;
1369 	u8 rsvd2[7];	/* Bytes 47:41 reserved */
1370 #define ICE_AQC_QUAL_MOD_COUNT_MAX			16
1371 	struct {
1372 		u8 v_oui[3];
1373 		u8 rsvd3;
1374 		u8 v_part[16];
1375 		__le32 v_rev;
1376 		__le64 rsvd4;
1377 	} qual_modules[ICE_AQC_QUAL_MOD_COUNT_MAX];
1378 };
1379 
1380 /* Set PHY capabilities (direct 0x0601)
1381  * NOTE: This command must be followed by setup link and restart auto-neg
1382  */
1383 struct ice_aqc_set_phy_cfg {
1384 	u8 lport_num;
1385 	u8 reserved[7];
1386 	__le32 addr_high;
1387 	__le32 addr_low;
1388 };
1389 
1390 /* Set PHY config command data structure */
1391 struct ice_aqc_set_phy_cfg_data {
1392 	__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
1393 	__le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
1394 	u8 caps;
1395 #define ICE_AQ_PHY_ENA_VALID_MASK	MAKEMASK(0xef, 0)
1396 #define ICE_AQ_PHY_ENA_TX_PAUSE_ABILITY	BIT(0)
1397 #define ICE_AQ_PHY_ENA_RX_PAUSE_ABILITY	BIT(1)
1398 #define ICE_AQ_PHY_ENA_LOW_POWER	BIT(2)
1399 #define ICE_AQ_PHY_ENA_LINK		BIT(3)
1400 #define ICE_AQ_PHY_ENA_AUTO_LINK_UPDT	BIT(5)
1401 #define ICE_AQ_PHY_ENA_LESM		BIT(6)
1402 #define ICE_AQ_PHY_ENA_AUTO_FEC		BIT(7)
1403 	u8 low_power_ctrl_an;
1404 	__le16 eee_cap; /* Value from ice_aqc_get_phy_caps */
1405 	__le16 eeer_value;
1406 	u8 link_fec_opt; /* Use defines from ice_aqc_get_phy_caps */
1407 	u8 module_compliance_enforcement;
1408 };
1409 
1410 /* Set MAC Config command data structure (direct 0x0603) */
1411 struct ice_aqc_set_mac_cfg {
1412 	__le16 max_frame_size;
1413 	u8 params;
1414 #define ICE_AQ_SET_MAC_PACE_S		3
1415 #define ICE_AQ_SET_MAC_PACE_M		(0xF << ICE_AQ_SET_MAC_PACE_S)
1416 #define ICE_AQ_SET_MAC_PACE_TYPE_M	BIT(7)
1417 #define ICE_AQ_SET_MAC_PACE_TYPE_RATE	0
1418 #define ICE_AQ_SET_MAC_PACE_TYPE_FIXED	ICE_AQ_SET_MAC_PACE_TYPE_M
1419 	u8 tx_tmr_priority;
1420 	__le16 tx_tmr_value;
1421 	__le16 fc_refresh_threshold;
1422 	u8 drop_opts;
1423 #define ICE_AQ_SET_MAC_AUTO_DROP_MASK		BIT(0)
1424 #define ICE_AQ_SET_MAC_AUTO_DROP_NONE		0
1425 #define ICE_AQ_SET_MAC_AUTO_DROP_BLOCKING_PKTS	BIT(0)
1426 	u8 reserved[7];
1427 };
1428 
1429 /* Restart AN command data structure (direct 0x0605)
1430  * Also used for response, with only the lport_num field present.
1431  */
1432 struct ice_aqc_restart_an {
1433 	u8 lport_num;
1434 	u8 reserved;
1435 	u8 cmd_flags;
1436 #define ICE_AQC_RESTART_AN_LINK_RESTART	BIT(1)
1437 #define ICE_AQC_RESTART_AN_LINK_ENABLE	BIT(2)
1438 	u8 reserved2[13];
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 /* Get link status response data structure, also used for Link Status Event */
1458 struct ice_aqc_get_link_status_data {
1459 	u8 topo_media_conflict;
1460 #define ICE_AQ_LINK_TOPO_CONFLICT	BIT(0)
1461 #define ICE_AQ_LINK_MEDIA_CONFLICT	BIT(1)
1462 #define ICE_AQ_LINK_TOPO_CORRUPT	BIT(2)
1463 #define ICE_AQ_LINK_TOPO_UNREACH_PRT	BIT(4)
1464 #define ICE_AQ_LINK_TOPO_UNDRUTIL_PRT	BIT(5)
1465 #define ICE_AQ_LINK_TOPO_UNDRUTIL_MEDIA	BIT(6)
1466 #define ICE_AQ_LINK_TOPO_UNSUPP_MEDIA	BIT(7)
1467 	u8 link_cfg_err;
1468 #define ICE_AQ_LINK_CFG_ERR		BIT(0)
1469 #define ICE_AQ_LINK_ACT_PORT_OPT_INVAL	BIT(2)
1470 #define ICE_AQ_LINK_FEAT_ID_OR_CONFIG_ID_INVAL	BIT(3)
1471 #define ICE_AQ_LINK_TOPO_CRITICAL_SDP_ERR	BIT(4)
1472 #define ICE_AQ_LINK_MODULE_POWER_UNSUPPORTED	BIT(5)
1473 	u8 link_info;
1474 #define ICE_AQ_LINK_UP			BIT(0)	/* Link Status */
1475 #define ICE_AQ_LINK_FAULT		BIT(1)
1476 #define ICE_AQ_LINK_FAULT_TX		BIT(2)
1477 #define ICE_AQ_LINK_FAULT_RX		BIT(3)
1478 #define ICE_AQ_LINK_FAULT_REMOTE	BIT(4)
1479 #define ICE_AQ_LINK_UP_PORT		BIT(5)	/* External Port Link Status */
1480 #define ICE_AQ_MEDIA_AVAILABLE		BIT(6)
1481 #define ICE_AQ_SIGNAL_DETECT		BIT(7)
1482 	u8 an_info;
1483 #define ICE_AQ_AN_COMPLETED		BIT(0)
1484 #define ICE_AQ_LP_AN_ABILITY		BIT(1)
1485 #define ICE_AQ_PD_FAULT			BIT(2)	/* Parallel Detection Fault */
1486 #define ICE_AQ_FEC_EN			BIT(3)
1487 #define ICE_AQ_PHY_LOW_POWER		BIT(4)	/* Low Power State */
1488 #define ICE_AQ_LINK_PAUSE_TX		BIT(5)
1489 #define ICE_AQ_LINK_PAUSE_RX		BIT(6)
1490 #define ICE_AQ_QUALIFIED_MODULE		BIT(7)
1491 	u8 ext_info;
1492 #define ICE_AQ_LINK_PHY_TEMP_ALARM	BIT(0)
1493 #define ICE_AQ_LINK_EXCESSIVE_ERRORS	BIT(1)	/* Excessive Link Errors */
1494 	/* Port Tx Suspended */
1495 #define ICE_AQ_LINK_TX_S		2
1496 #define ICE_AQ_LINK_TX_M		(0x03 << ICE_AQ_LINK_TX_S)
1497 #define ICE_AQ_LINK_TX_ACTIVE		0
1498 #define ICE_AQ_LINK_TX_DRAINED		1
1499 #define ICE_AQ_LINK_TX_FLUSHED		3
1500 	u8 lb_status;
1501 #define ICE_AQ_LINK_LB_PHY_LCL		BIT(0)
1502 #define ICE_AQ_LINK_LB_PHY_RMT		BIT(1)
1503 #define ICE_AQ_LINK_LB_MAC_LCL		BIT(2)
1504 #define ICE_AQ_LINK_LB_PHY_IDX_S	3
1505 #define ICE_AQ_LINK_LB_PHY_IDX_M	(0x7 << ICE_AQ_LB_PHY_IDX_S)
1506 	__le16 max_frame_size;
1507 	u8 cfg;
1508 #define ICE_AQ_LINK_25G_KR_FEC_EN	BIT(0)
1509 #define ICE_AQ_LINK_25G_RS_528_FEC_EN	BIT(1)
1510 #define ICE_AQ_LINK_25G_RS_544_FEC_EN	BIT(2)
1511 #define ICE_AQ_FEC_MASK			MAKEMASK(0x7, 0)
1512 	/* Pacing Config */
1513 #define ICE_AQ_CFG_PACING_S		3
1514 #define ICE_AQ_CFG_PACING_M		(0xF << ICE_AQ_CFG_PACING_S)
1515 #define ICE_AQ_CFG_PACING_TYPE_M	BIT(7)
1516 #define ICE_AQ_CFG_PACING_TYPE_AVG	0
1517 #define ICE_AQ_CFG_PACING_TYPE_FIXED	ICE_AQ_CFG_PACING_TYPE_M
1518 	/* External Device Power Ability */
1519 	u8 power_desc;
1520 #define ICE_AQ_PWR_CLASS_M		0x3F
1521 #define ICE_AQ_LINK_PWR_BASET_LOW_HIGH	0
1522 #define ICE_AQ_LINK_PWR_BASET_HIGH	1
1523 #define ICE_AQ_LINK_PWR_QSFP_CLASS_1	0
1524 #define ICE_AQ_LINK_PWR_QSFP_CLASS_2	1
1525 #define ICE_AQ_LINK_PWR_QSFP_CLASS_3	2
1526 #define ICE_AQ_LINK_PWR_QSFP_CLASS_4	3
1527 	__le16 link_speed;
1528 #define ICE_AQ_LINK_SPEED_M		0x7FF
1529 #define ICE_AQ_LINK_SPEED_10MB		BIT(0)
1530 #define ICE_AQ_LINK_SPEED_100MB		BIT(1)
1531 #define ICE_AQ_LINK_SPEED_1000MB	BIT(2)
1532 #define ICE_AQ_LINK_SPEED_2500MB	BIT(3)
1533 #define ICE_AQ_LINK_SPEED_5GB		BIT(4)
1534 #define ICE_AQ_LINK_SPEED_10GB		BIT(5)
1535 #define ICE_AQ_LINK_SPEED_20GB		BIT(6)
1536 #define ICE_AQ_LINK_SPEED_25GB		BIT(7)
1537 #define ICE_AQ_LINK_SPEED_40GB		BIT(8)
1538 #define ICE_AQ_LINK_SPEED_50GB		BIT(9)
1539 #define ICE_AQ_LINK_SPEED_100GB		BIT(10)
1540 #define ICE_AQ_LINK_SPEED_UNKNOWN	BIT(15)
1541 	__le32 reserved3; /* Aligns next field to 8-byte boundary */
1542 	__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
1543 	__le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
1544 };
1545 
1546 /* Set event mask command (direct 0x0613) */
1547 struct ice_aqc_set_event_mask {
1548 	u8	lport_num;
1549 	u8	reserved[7];
1550 	__le16	event_mask;
1551 #define ICE_AQ_LINK_EVENT_UPDOWN		BIT(1)
1552 #define ICE_AQ_LINK_EVENT_MEDIA_NA		BIT(2)
1553 #define ICE_AQ_LINK_EVENT_LINK_FAULT		BIT(3)
1554 #define ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM	BIT(4)
1555 #define ICE_AQ_LINK_EVENT_EXCESSIVE_ERRORS	BIT(5)
1556 #define ICE_AQ_LINK_EVENT_SIGNAL_DETECT		BIT(6)
1557 #define ICE_AQ_LINK_EVENT_AN_COMPLETED		BIT(7)
1558 #define ICE_AQ_LINK_EVENT_MODULE_QUAL_FAIL	BIT(8)
1559 #define ICE_AQ_LINK_EVENT_PORT_TX_SUSPENDED	BIT(9)
1560 #define ICE_AQ_LINK_EVENT_TOPO_CONFLICT		BIT(10)
1561 #define ICE_AQ_LINK_EVENT_MEDIA_CONFLICT	BIT(11)
1562 	u8	reserved1[6];
1563 };
1564 
1565 /* Set MAC Loopback command (direct 0x0620) */
1566 struct ice_aqc_set_mac_lb {
1567 	u8 lb_mode;
1568 #define ICE_AQ_MAC_LB_EN		BIT(0)
1569 #define ICE_AQ_MAC_LB_OSC_CLK		BIT(1)
1570 	u8 reserved[15];
1571 };
1572 
1573 struct ice_aqc_link_topo_addr {
1574 	u8 lport_num;
1575 	u8 lport_num_valid;
1576 #define ICE_AQC_LINK_TOPO_PORT_NUM_VALID	BIT(0)
1577 	u8 node_type_ctx;
1578 #define ICE_AQC_LINK_TOPO_NODE_TYPE_S		0
1579 #define ICE_AQC_LINK_TOPO_NODE_TYPE_M	(0xF << ICE_AQC_LINK_TOPO_NODE_TYPE_S)
1580 #define ICE_AQC_LINK_TOPO_NODE_TYPE_PHY		0
1581 #define ICE_AQC_LINK_TOPO_NODE_TYPE_GPIO_CTRL	1
1582 #define ICE_AQC_LINK_TOPO_NODE_TYPE_MUX_CTRL	2
1583 #define ICE_AQC_LINK_TOPO_NODE_TYPE_LED_CTRL	3
1584 #define ICE_AQC_LINK_TOPO_NODE_TYPE_LED		4
1585 #define ICE_AQC_LINK_TOPO_NODE_TYPE_THERMAL	5
1586 #define ICE_AQC_LINK_TOPO_NODE_TYPE_CAGE	6
1587 #define ICE_AQC_LINK_TOPO_NODE_TYPE_MEZZ	7
1588 #define ICE_AQC_LINK_TOPO_NODE_TYPE_ID_EEPROM	8
1589 #define ICE_AQC_LINK_TOPO_NODE_CTX_S		4
1590 #define ICE_AQC_LINK_TOPO_NODE_CTX_M		\
1591 				(0xF << ICE_AQC_LINK_TOPO_NODE_CTX_S)
1592 #define ICE_AQC_LINK_TOPO_NODE_CTX_GLOBAL	0
1593 #define ICE_AQC_LINK_TOPO_NODE_CTX_BOARD	1
1594 #define ICE_AQC_LINK_TOPO_NODE_CTX_PORT		2
1595 #define ICE_AQC_LINK_TOPO_NODE_CTX_NODE		3
1596 #define ICE_AQC_LINK_TOPO_NODE_CTX_PROVIDED	4
1597 #define ICE_AQC_LINK_TOPO_NODE_CTX_OVERRIDE	5
1598 	u8 index;
1599 	__le16 handle;
1600 #define ICE_AQC_LINK_TOPO_HANDLE_S	0
1601 #define ICE_AQC_LINK_TOPO_HANDLE_M	(0x3FF << ICE_AQC_LINK_TOPO_HANDLE_S)
1602 /* Used to decode the handle field */
1603 #define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_M	BIT(9)
1604 #define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_LOM	BIT(9)
1605 #define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_MEZZ	0
1606 #define ICE_AQC_LINK_TOPO_HANDLE_NODE_S		0
1607 /* In case of a Mezzanine type */
1608 #define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_NODE_M	\
1609 				(0x3F << ICE_AQC_LINK_TOPO_HANDLE_NODE_S)
1610 #define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_S	6
1611 #define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_M	(0x7 << ICE_AQC_LINK_TOPO_HANDLE_MEZZ_S)
1612 /* In case of a LOM type */
1613 #define ICE_AQC_LINK_TOPO_HANDLE_LOM_NODE_M	\
1614 				(0x1FF << ICE_AQC_LINK_TOPO_HANDLE_NODE_S)
1615 };
1616 
1617 /* Get Link Topology Handle (direct, 0x06E0) */
1618 struct ice_aqc_get_link_topo {
1619 	struct ice_aqc_link_topo_addr addr;
1620 	u8 node_part_num;
1621 	u8 rsvd[9];
1622 };
1623 
1624 /* Set Port Identification LED (direct, 0x06E9) */
1625 struct ice_aqc_set_port_id_led {
1626 	u8 lport_num;
1627 	u8 lport_num_valid;
1628 #define ICE_AQC_PORT_ID_PORT_NUM_VALID	BIT(0)
1629 	u8 ident_mode;
1630 #define ICE_AQC_PORT_IDENT_LED_BLINK	BIT(0)
1631 #define ICE_AQC_PORT_IDENT_LED_ORIG	0
1632 	u8 rsvd[13];
1633 };
1634 
1635 /* Read/Write SFF EEPROM command (indirect 0x06EE) */
1636 struct ice_aqc_sff_eeprom {
1637 	u8 lport_num;
1638 	u8 lport_num_valid;
1639 #define ICE_AQC_SFF_PORT_NUM_VALID	BIT(0)
1640 	__le16 i2c_bus_addr;
1641 #define ICE_AQC_SFF_I2CBUS_7BIT_M	0x7F
1642 #define ICE_AQC_SFF_I2CBUS_10BIT_M	0x3FF
1643 #define ICE_AQC_SFF_I2CBUS_TYPE_M	BIT(10)
1644 #define ICE_AQC_SFF_I2CBUS_TYPE_7BIT	0
1645 #define ICE_AQC_SFF_I2CBUS_TYPE_10BIT	ICE_AQC_SFF_I2CBUS_TYPE_M
1646 #define ICE_AQC_SFF_SET_EEPROM_PAGE_S	11
1647 #define ICE_AQC_SFF_SET_EEPROM_PAGE_M	(0x3 << ICE_AQC_SFF_SET_EEPROM_PAGE_S)
1648 #define ICE_AQC_SFF_NO_PAGE_CHANGE	0
1649 #define ICE_AQC_SFF_SET_23_ON_MISMATCH	1
1650 #define ICE_AQC_SFF_SET_22_ON_MISMATCH	2
1651 #define ICE_AQC_SFF_IS_WRITE		BIT(15)
1652 	__le16 i2c_mem_addr;
1653 	__le16 eeprom_page;
1654 #define  ICE_AQC_SFF_EEPROM_BANK_S 0
1655 #define  ICE_AQC_SFF_EEPROM_BANK_M (0xFF << ICE_AQC_SFF_EEPROM_BANK_S)
1656 #define  ICE_AQC_SFF_EEPROM_PAGE_S 8
1657 #define  ICE_AQC_SFF_EEPROM_PAGE_M (0xFF << ICE_AQC_SFF_EEPROM_PAGE_S)
1658 	__le32 addr_high;
1659 	__le32 addr_low;
1660 };
1661 
1662 /* SW Set GPIO command (indirect 0x6EF)
1663  * SW Get GPIO command (indirect 0x6F0)
1664  */
1665 struct ice_aqc_sw_gpio {
1666 	__le16 gpio_ctrl_handle;
1667 #define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S	0
1668 #define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_M	(0x3FF << ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S)
1669 	u8 gpio_num;
1670 #define ICE_AQC_SW_GPIO_NUMBER_S	0
1671 #define ICE_AQC_SW_GPIO_NUMBER_M	(0x1F << ICE_AQC_SW_GPIO_NUMBER_S)
1672 	u8 gpio_params;
1673 #define ICE_AQC_SW_GPIO_PARAMS_DIRECTION    BIT(1)
1674 #define ICE_AQC_SW_GPIO_PARAMS_VALUE        BIT(0)
1675 	u8 rsvd[12];
1676 };
1677 
1678 /* NVM Read command (indirect 0x0701)
1679  * NVM Erase commands (direct 0x0702)
1680  * NVM Write commands (indirect 0x0703)
1681  * NVM Write Activate commands (direct 0x0707)
1682  * NVM Shadow RAM Dump commands (direct 0x0707)
1683  */
1684 struct ice_aqc_nvm {
1685 #define ICE_AQC_NVM_MAX_OFFSET		0xFFFFFF
1686 	__le16 offset_low;
1687 	u8 offset_high; /* For Write Activate offset_high is used as flags2 */
1688 	u8 cmd_flags;
1689 #define ICE_AQC_NVM_LAST_CMD		BIT(0)
1690 #define ICE_AQC_NVM_PCIR_REQ		BIT(0)	/* Used by NVM Write reply */
1691 #define ICE_AQC_NVM_PRESERVATION_S	1 /* Used by NVM Write Activate only */
1692 #define ICE_AQC_NVM_PRESERVATION_M	(3 << ICE_AQC_NVM_PRESERVATION_S)
1693 #define ICE_AQC_NVM_NO_PRESERVATION	(0 << ICE_AQC_NVM_PRESERVATION_S)
1694 #define ICE_AQC_NVM_PRESERVE_ALL	BIT(1)
1695 #define ICE_AQC_NVM_FACTORY_DEFAULT	(2 << ICE_AQC_NVM_PRESERVATION_S)
1696 #define ICE_AQC_NVM_PRESERVE_SELECTED	(3 << ICE_AQC_NVM_PRESERVATION_S)
1697 #define ICE_AQC_NVM_ACTIV_SEL_NVM	BIT(3) /* Write Activate/SR Dump only */
1698 #define ICE_AQC_NVM_ACTIV_SEL_OROM	BIT(4)
1699 #define ICE_AQC_NVM_ACTIV_SEL_NETLIST	BIT(5)
1700 #define ICE_AQC_NVM_SPECIAL_UPDATE	BIT(6)
1701 #define ICE_AQC_NVM_REVERT_LAST_ACTIV	BIT(6) /* Write Activate only */
1702 #define ICE_AQC_NVM_ACTIV_SEL_MASK	MAKEMASK(0x7, 3)
1703 #define ICE_AQC_NVM_FLASH_ONLY		BIT(7)
1704 #define ICE_AQC_NVM_POR_FLAG	0	/* Used by NVM Write completion on ARQ */
1705 #define ICE_AQC_NVM_PERST_FLAG	1
1706 #define ICE_AQC_NVM_EMPR_FLAG	2
1707 	__le16 module_typeid;
1708 	__le16 length;
1709 #define ICE_AQC_NVM_ERASE_LEN	0xFFFF
1710 	__le32 addr_high;
1711 	__le32 addr_low;
1712 };
1713 
1714 /* NVM Module_Type ID, needed offset and read_len for struct ice_aqc_nvm. */
1715 #define ICE_AQC_NVM_SECTOR_UNIT			4096 /* In Bytes */
1716 #define ICE_AQC_NVM_WORD_UNIT			2 /* In Bytes */
1717 
1718 #define ICE_AQC_NVM_START_POINT			0
1719 #define ICE_AQC_NVM_EMP_SR_PTR_OFFSET		0x90
1720 #define ICE_AQC_NVM_EMP_SR_PTR_RD_LEN		2 /* In Bytes */
1721 #define ICE_AQC_NVM_EMP_SR_PTR_M		MAKEMASK(0x7FFF, 0)
1722 #define ICE_AQC_NVM_EMP_SR_PTR_TYPE_S		15
1723 #define ICE_AQC_NVM_EMP_SR_PTR_TYPE_M		BIT(15)
1724 #define ICE_AQC_NVM_EMP_SR_PTR_TYPE_SECTOR	1
1725 
1726 #define ICE_AQC_NVM_LLDP_CFG_PTR_OFFSET		0x46
1727 #define ICE_AQC_NVM_LLDP_CFG_HEADER_LEN		2 /* In Bytes */
1728 #define ICE_AQC_NVM_LLDP_CFG_PTR_RD_LEN		2 /* In Bytes */
1729 
1730 #define ICE_AQC_NVM_LLDP_PRESERVED_MOD_ID	0x129
1731 #define ICE_AQC_NVM_CUR_LLDP_PERSIST_RD_OFFSET	2 /* In Bytes */
1732 #define ICE_AQC_NVM_LLDP_STATUS_M		MAKEMASK(0xF, 0)
1733 #define ICE_AQC_NVM_LLDP_STATUS_M_LEN		4 /* In Bits */
1734 #define ICE_AQC_NVM_LLDP_STATUS_RD_LEN		4 /* In Bytes */
1735 
1736 /* Used for 0x0704 as well as for 0x0705 commands */
1737 struct ice_aqc_nvm_cfg {
1738 	u8	cmd_flags;
1739 #define ICE_AQC_ANVM_MULTIPLE_ELEMS	BIT(0)
1740 #define ICE_AQC_ANVM_IMMEDIATE_FIELD	BIT(1)
1741 #define ICE_AQC_ANVM_NEW_CFG		BIT(2)
1742 	u8	reserved;
1743 	__le16 count;
1744 	__le16 id;
1745 	u8 reserved1[2];
1746 	__le32 addr_high;
1747 	__le32 addr_low;
1748 };
1749 
1750 struct ice_aqc_nvm_cfg_data {
1751 	__le16 field_id;
1752 	__le16 field_options;
1753 	__le16 field_value;
1754 };
1755 
1756 /* NVM Checksum Command (direct, 0x0706) */
1757 struct ice_aqc_nvm_checksum {
1758 	u8 flags;
1759 #define ICE_AQC_NVM_CHECKSUM_VERIFY	BIT(0)
1760 #define ICE_AQC_NVM_CHECKSUM_RECALC	BIT(1)
1761 	u8 rsvd;
1762 	__le16 checksum; /* Used only by response */
1763 #define ICE_AQC_NVM_CHECKSUM_CORRECT	0xBABA
1764 	u8 rsvd2[12];
1765 };
1766 
1767 /* Get LLDP MIB (indirect 0x0A00)
1768  * Note: This is also used by the LLDP MIB Change Event (0x0A01)
1769  * as the format is the same.
1770  */
1771 struct ice_aqc_lldp_get_mib {
1772 	u8 type;
1773 #define ICE_AQ_LLDP_MIB_TYPE_S			0
1774 #define ICE_AQ_LLDP_MIB_TYPE_M			(0x3 << ICE_AQ_LLDP_MIB_TYPE_S)
1775 #define ICE_AQ_LLDP_MIB_LOCAL			0
1776 #define ICE_AQ_LLDP_MIB_REMOTE			1
1777 #define ICE_AQ_LLDP_MIB_LOCAL_AND_REMOTE	2
1778 #define ICE_AQ_LLDP_BRID_TYPE_S			2
1779 #define ICE_AQ_LLDP_BRID_TYPE_M			(0x3 << ICE_AQ_LLDP_BRID_TYPE_S)
1780 #define ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID	0
1781 #define ICE_AQ_LLDP_BRID_TYPE_NON_TPMR		1
1782 /* Tx pause flags in the 0xA01 event use ICE_AQ_LLDP_TX_* */
1783 #define ICE_AQ_LLDP_TX_S			0x4
1784 #define ICE_AQ_LLDP_TX_M			(0x03 << ICE_AQ_LLDP_TX_S)
1785 #define ICE_AQ_LLDP_TX_ACTIVE			0
1786 #define ICE_AQ_LLDP_TX_SUSPENDED		1
1787 #define ICE_AQ_LLDP_TX_FLUSHED			3
1788 /* The following bytes are reserved for the Get LLDP MIB command (0x0A00)
1789  * and in the LLDP MIB Change Event (0x0A01). They are valid for the
1790  * Get LLDP MIB (0x0A00) response only.
1791  */
1792 	u8 reserved1;
1793 	__le16 local_len;
1794 	__le16 remote_len;
1795 	u8 reserved2[2];
1796 	__le32 addr_high;
1797 	__le32 addr_low;
1798 };
1799 
1800 /* Configure LLDP MIB Change Event (direct 0x0A01) */
1801 /* For MIB Change Event use ice_aqc_lldp_get_mib structure above */
1802 struct ice_aqc_lldp_set_mib_change {
1803 	u8 command;
1804 #define ICE_AQ_LLDP_MIB_UPDATE_ENABLE		0x0
1805 #define ICE_AQ_LLDP_MIB_UPDATE_DIS		0x1
1806 	u8 reserved[15];
1807 };
1808 
1809 /* Add LLDP TLV (indirect 0x0A02)
1810  * Delete LLDP TLV (indirect 0x0A04)
1811  */
1812 struct ice_aqc_lldp_add_delete_tlv {
1813 	u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
1814 	u8 reserved1[1];
1815 	__le16 len;
1816 	u8 reserved2[4];
1817 	__le32 addr_high;
1818 	__le32 addr_low;
1819 };
1820 
1821 /* Update LLDP TLV (indirect 0x0A03) */
1822 struct ice_aqc_lldp_update_tlv {
1823 	u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
1824 	u8 reserved;
1825 	__le16 old_len;
1826 	__le16 new_offset;
1827 	__le16 new_len;
1828 	__le32 addr_high;
1829 	__le32 addr_low;
1830 };
1831 
1832 /* Stop LLDP (direct 0x0A05) */
1833 struct ice_aqc_lldp_stop {
1834 	u8 command;
1835 #define ICE_AQ_LLDP_AGENT_STATE_MASK	BIT(0)
1836 #define ICE_AQ_LLDP_AGENT_STOP		0x0
1837 #define ICE_AQ_LLDP_AGENT_SHUTDOWN	ICE_AQ_LLDP_AGENT_STATE_MASK
1838 #define ICE_AQ_LLDP_AGENT_PERSIST_DIS	BIT(1)
1839 	u8 reserved[15];
1840 };
1841 
1842 /* Start LLDP (direct 0x0A06) */
1843 struct ice_aqc_lldp_start {
1844 	u8 command;
1845 #define ICE_AQ_LLDP_AGENT_START		BIT(0)
1846 #define ICE_AQ_LLDP_AGENT_PERSIST_ENA	BIT(1)
1847 	u8 reserved[15];
1848 };
1849 
1850 /* Get CEE DCBX Oper Config (0x0A07)
1851  * The command uses the generic descriptor struct and
1852  * returns the struct below as an indirect response.
1853  */
1854 struct ice_aqc_get_cee_dcb_cfg_resp {
1855 	u8 oper_num_tc;
1856 	u8 oper_prio_tc[4];
1857 	u8 oper_tc_bw[8];
1858 	u8 oper_pfc_en;
1859 	__le16 oper_app_prio;
1860 #define ICE_AQC_CEE_APP_FCOE_S		0
1861 #define ICE_AQC_CEE_APP_FCOE_M		(0x7 << ICE_AQC_CEE_APP_FCOE_S)
1862 #define ICE_AQC_CEE_APP_ISCSI_S		3
1863 #define ICE_AQC_CEE_APP_ISCSI_M		(0x7 << ICE_AQC_CEE_APP_ISCSI_S)
1864 #define ICE_AQC_CEE_APP_FIP_S		8
1865 #define ICE_AQC_CEE_APP_FIP_M		(0x7 << ICE_AQC_CEE_APP_FIP_S)
1866 	__le32 tlv_status;
1867 #define ICE_AQC_CEE_PG_STATUS_S		0
1868 #define ICE_AQC_CEE_PG_STATUS_M		(0x7 << ICE_AQC_CEE_PG_STATUS_S)
1869 #define ICE_AQC_CEE_PFC_STATUS_S	3
1870 #define ICE_AQC_CEE_PFC_STATUS_M	(0x7 << ICE_AQC_CEE_PFC_STATUS_S)
1871 #define ICE_AQC_CEE_FCOE_STATUS_S	8
1872 #define ICE_AQC_CEE_FCOE_STATUS_M	(0x7 << ICE_AQC_CEE_FCOE_STATUS_S)
1873 #define ICE_AQC_CEE_ISCSI_STATUS_S	11
1874 #define ICE_AQC_CEE_ISCSI_STATUS_M	(0x7 << ICE_AQC_CEE_ISCSI_STATUS_S)
1875 #define ICE_AQC_CEE_FIP_STATUS_S	16
1876 #define ICE_AQC_CEE_FIP_STATUS_M	(0x7 << ICE_AQC_CEE_FIP_STATUS_S)
1877 	u8 reserved[12];
1878 };
1879 
1880 /* Set Local LLDP MIB (indirect 0x0A08)
1881  * Used to replace the local MIB of a given LLDP agent. e.g. DCBX
1882  */
1883 struct ice_aqc_lldp_set_local_mib {
1884 	u8 type;
1885 #define SET_LOCAL_MIB_TYPE_DCBX_M		BIT(0)
1886 #define SET_LOCAL_MIB_TYPE_LOCAL_MIB		0
1887 #define SET_LOCAL_MIB_TYPE_CEE_M		BIT(1)
1888 #define SET_LOCAL_MIB_TYPE_CEE_WILLING		0
1889 #define SET_LOCAL_MIB_TYPE_CEE_NON_WILLING	SET_LOCAL_MIB_TYPE_CEE_M
1890 	u8 reserved0;
1891 	__le16 length;
1892 	u8 reserved1[4];
1893 	__le32 addr_high;
1894 	__le32 addr_low;
1895 };
1896 
1897 struct ice_aqc_lldp_set_local_mib_resp {
1898 	u8 status;
1899 #define SET_LOCAL_MIB_RESP_EVENT_M		BIT(0)
1900 #define SET_LOCAL_MIB_RESP_MIB_CHANGE_SILENT	0
1901 #define SET_LOCAL_MIB_RESP_MIB_CHANGE_EVENT	SET_LOCAL_MIB_RESP_EVENT_M
1902 	u8 reserved[15];
1903 };
1904 
1905 /* Stop/Start LLDP Agent (direct 0x0A09)
1906  * Used for stopping/starting specific LLDP agent. e.g. DCBX.
1907  * The same structure is used for the response, with the command field
1908  * being used as the status field.
1909  */
1910 struct ice_aqc_lldp_stop_start_specific_agent {
1911 	u8 command;
1912 #define ICE_AQC_START_STOP_AGENT_M		BIT(0)
1913 #define ICE_AQC_START_STOP_AGENT_STOP_DCBX	0
1914 #define ICE_AQC_START_STOP_AGENT_START_DCBX	ICE_AQC_START_STOP_AGENT_M
1915 	u8 reserved[15];
1916 };
1917 
1918 /* LLDP Filter Control (direct 0x0A0A) */
1919 struct ice_aqc_lldp_filter_ctrl {
1920 	u8 cmd_flags;
1921 #define ICE_AQC_LLDP_FILTER_ACTION_M		MAKEMASK(3, 0)
1922 #define ICE_AQC_LLDP_FILTER_ACTION_ADD		0x0
1923 #define ICE_AQC_LLDP_FILTER_ACTION_DELETE	0x1
1924 #define ICE_AQC_LLDP_FILTER_ACTION_UPDATE	0x2
1925 	u8 reserved1;
1926 	__le16 vsi_num;
1927 	u8 reserved2[12];
1928 };
1929 
1930 /* Get/Set RSS key (indirect 0x0B04/0x0B02) */
1931 struct ice_aqc_get_set_rss_key {
1932 #define ICE_AQC_GSET_RSS_KEY_VSI_VALID	BIT(15)
1933 #define ICE_AQC_GSET_RSS_KEY_VSI_ID_S	0
1934 #define ICE_AQC_GSET_RSS_KEY_VSI_ID_M	(0x3FF << ICE_AQC_GSET_RSS_KEY_VSI_ID_S)
1935 	__le16 vsi_id;
1936 	u8 reserved[6];
1937 	__le32 addr_high;
1938 	__le32 addr_low;
1939 };
1940 
1941 #define ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE	0x28
1942 #define ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE	0xC
1943 #define ICE_GET_SET_RSS_KEY_EXTEND_KEY_SIZE \
1944 				(ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE + \
1945 				 ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE)
1946 
1947 /**
1948  * struct ice_aqc_get_set_rss_keys - Get/Set RSS hash key command buffer
1949  * @standard_rss_key: 40 most significant bytes of hash key
1950  * @extended_hash_key: 12 least significant bytes of hash key
1951  *
1952  * Set/Get 40 byte hash key using standard_rss_key field, and set
1953  * extended_hash_key field to zero. Set/Get 52 byte hash key using
1954  * standard_rss_key field for 40 most significant bytes and the
1955  * extended_hash_key field for the 12 least significant bytes of hash key.
1956  */
1957 struct ice_aqc_get_set_rss_keys {
1958 	u8 standard_rss_key[ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE];
1959 	u8 extended_hash_key[ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE];
1960 };
1961 
1962 /* Get/Set RSS LUT (indirect 0x0B05/0x0B03) */
1963 struct ice_aqc_get_set_rss_lut {
1964 #define ICE_AQC_GSET_RSS_LUT_VSI_VALID	BIT(15)
1965 #define ICE_AQC_GSET_RSS_LUT_VSI_ID_S	0
1966 #define ICE_AQC_GSET_RSS_LUT_VSI_ID_M	(0x3FF << ICE_AQC_GSET_RSS_LUT_VSI_ID_S)
1967 	__le16 vsi_id;
1968 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S	0
1969 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M	\
1970 				(0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
1971 
1972 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI	 0
1973 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF	 1
1974 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL	 2
1975 
1976 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S	 2
1977 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M	 \
1978 				(0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
1979 
1980 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128	 128
1981 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
1982 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512	 512
1983 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG 1
1984 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K	 2048
1985 #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG	 2
1986 
1987 #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S	 4
1988 #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_M	 \
1989 				(0xF << ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S)
1990 
1991 	__le16 flags;
1992 	__le32 reserved;
1993 	__le32 addr_high;
1994 	__le32 addr_low;
1995 };
1996 
1997 /* Clear FD Table Command (direct, 0x0B06) */
1998 struct ice_aqc_clear_fd_table {
1999 	u8 clear_type;
2000 #define CL_FD_VM_VF_TYPE_VSI_IDX	1
2001 #define CL_FD_VM_VF_TYPE_PF_IDX		2
2002 	u8 rsvd;
2003 	__le16 vsi_index;
2004 	u8 reserved[12];
2005 };
2006 
2007 /* Allocate ACL table (indirect 0x0C10) */
2008 #define ICE_AQC_ACL_KEY_WIDTH		40
2009 #define ICE_AQC_ACL_KEY_WIDTH_BYTES	5
2010 #define ICE_AQC_ACL_TCAM_DEPTH		512
2011 #define ICE_ACL_ENTRY_ALLOC_UNIT	64
2012 #define ICE_AQC_MAX_CONCURRENT_ACL_TBL	15
2013 #define ICE_AQC_MAX_ACTION_MEMORIES	20
2014 #define ICE_AQC_MAX_ACTION_ENTRIES	512
2015 #define ICE_AQC_ACL_SLICES		16
2016 #define ICE_AQC_ALLOC_ID_LESS_THAN_4K	0x1000
2017 /* The ACL block supports up to 8 actions per a single output. */
2018 #define ICE_AQC_TBL_MAX_ACTION_PAIRS	4
2019 
2020 #define ICE_AQC_MAX_TCAM_ALLOC_UNITS	(ICE_AQC_ACL_TCAM_DEPTH / \
2021 					 ICE_ACL_ENTRY_ALLOC_UNIT)
2022 #define ICE_AQC_ACL_ALLOC_UNITS		(ICE_AQC_ACL_SLICES * \
2023 					 ICE_AQC_MAX_TCAM_ALLOC_UNITS)
2024 
2025 struct ice_aqc_acl_alloc_table {
2026 	__le16 table_width;
2027 	__le16 table_depth;
2028 	u8 act_pairs_per_entry;
2029 	/* For non-concurrent table allocation, this field needs
2030 	 * to be set to zero(0) otherwise it shall specify the
2031 	 * amount of concurrent tables whose AllocIDs are
2032 	 * specified in buffer. Thus the newly allocated table
2033 	 * is concurrent with table IDs specified in AllocIDs.
2034 	 */
2035 #define ICE_AQC_ACL_ALLOC_TABLE_TYPE_NONCONCURR	0
2036 	u8 table_type;
2037 	__le16 reserved;
2038 	__le32 addr_high;
2039 	__le32 addr_low;
2040 };
2041 
2042 /* Allocate ACL table command buffer format */
2043 struct ice_aqc_acl_alloc_table_data {
2044 	/* Dependent table AllocIDs. Each word in this 15 word array specifies
2045 	 * a dependent table AllocID according to the amount specified in the
2046 	 * "table_type" field. All unused words shall be set to 0xFFFF
2047 	 */
2048 #define ICE_AQC_CONCURR_ID_INVALID	0xffff
2049 	__le16 alloc_ids[ICE_AQC_MAX_CONCURRENT_ACL_TBL];
2050 };
2051 
2052 /* Deallocate ACL table (indirect 0x0C11)
2053  * Allocate ACL action-pair (indirect 0x0C12)
2054  * Deallocate ACL action-pair (indirect 0x0C13)
2055  */
2056 
2057 /* Following structure is common and used in case of deallocation
2058  * of ACL table and action-pair
2059  */
2060 struct ice_aqc_acl_tbl_actpair {
2061 	/* Alloc ID of the table being released */
2062 	__le16 alloc_id;
2063 	u8 reserved[6];
2064 	__le32 addr_high;
2065 	__le32 addr_low;
2066 };
2067 
2068 /* This response structure is same in case of alloc/dealloc table,
2069  * alloc/dealloc action-pair
2070  */
2071 struct ice_aqc_acl_generic {
2072 	/* if alloc_id is below 0x1000 then alllocation failed due to
2073 	 * unavailable resources, else this is set by FW to identify
2074 	 * table allocation
2075 	 */
2076 	__le16 alloc_id;
2077 
2078 	union {
2079 		/* to be used only in case of alloc/dealloc table */
2080 		struct {
2081 			/* Index of the first TCAM block, otherwise set to 0xFF
2082 			 * for a failed allocation
2083 			 */
2084 			u8 first_tcam;
2085 			/* Index of the last TCAM block. This index shall be
2086 			 * set to the value of first_tcam for single TCAM block
2087 			 * allocation, otherwise set to 0xFF for a failed
2088 			 * allocation
2089 			 */
2090 			u8 last_tcam;
2091 		} table;
2092 		/* reserved in case of alloc/dealloc action-pair */
2093 		struct {
2094 			__le16 reserved;
2095 		} act_pair;
2096 	} ops;
2097 
2098 	/* index of first entry (in both TCAM and action memories),
2099 	 * otherwise set to 0xFF for a failed allocation
2100 	 */
2101 	__le16 first_entry;
2102 	/* index of last entry (in both TCAM and action memories),
2103 	 * otherwise set to 0xFF for a failed allocation
2104 	 */
2105 	__le16 last_entry;
2106 
2107 	/* Each act_mem element specifies the order of the memory
2108 	 * otherwise 0xFF
2109 	 */
2110 	u8 act_mem[ICE_AQC_MAX_ACTION_MEMORIES];
2111 };
2112 
2113 /* Allocate ACL scenario (indirect 0x0C14). This command doesn't have separate
2114  * response buffer since original command buffer gets updated with
2115  * 'scen_id' in case of success
2116  */
2117 struct ice_aqc_acl_alloc_scen {
2118 	union {
2119 		struct {
2120 			u8 reserved[8];
2121 		} cmd;
2122 		struct {
2123 			__le16 scen_id;
2124 			u8 reserved[6];
2125 		} resp;
2126 	} ops;
2127 	__le32 addr_high;
2128 	__le32 addr_low;
2129 };
2130 
2131 /* De-allocate ACL scenario (direct 0x0C15). This command doesn't need
2132  * separate response buffer since nothing to be returned as a response
2133  * except status.
2134  */
2135 struct ice_aqc_acl_dealloc_scen {
2136 	__le16 scen_id;
2137 	u8 reserved[14];
2138 };
2139 
2140 /* Update ACL scenario (direct 0x0C1B)
2141  * Query ACL scenario (direct 0x0C23)
2142  */
2143 struct ice_aqc_acl_update_query_scen {
2144 	__le16 scen_id;
2145 	u8 reserved[6];
2146 	__le32 addr_high;
2147 	__le32 addr_low;
2148 };
2149 
2150 /* Input buffer format in case allocate/update ACL scenario and same format
2151  * is used for response buffer in case of query ACL scenario.
2152  * NOTE: de-allocate ACL scenario is direct command and doesn't require
2153  * "buffer", hence no buffer format.
2154  */
2155 struct ice_aqc_acl_scen {
2156 	struct {
2157 		/* Byte [x] selection for the TCAM key. This value must be
2158 		 * set to 0x0 for unusued TCAM.
2159 		 * Only Bit 6..0 is used in each byte and MSB is reserved
2160 		 */
2161 #define ICE_AQC_ACL_ALLOC_SCE_SELECT_M		0x7F
2162 #define ICE_AQC_ACL_BYTE_SEL_BASE		0x20
2163 #define ICE_AQC_ACL_BYTE_SEL_BASE_PID		0x3E
2164 #define ICE_AQC_ACL_BYTE_SEL_BASE_PKT_DIR	ICE_AQC_ACL_BYTE_SEL_BASE
2165 #define ICE_AQC_ACL_BYTE_SEL_BASE_RNG_CHK	0x3F
2166 		u8 tcam_select[5];
2167 		/* TCAM Block entry masking. This value should be set to 0x0 for
2168 		 * unused TCAM
2169 		 */
2170 		u8 chnk_msk;
2171 		/* Bit 0 : masks TCAM entries 0-63
2172 		 * Bit 1 : masks TCAM entries 64-127
2173 		 * Bit 2 to 7 : follow the pattern of bit 0 and 1
2174 		 */
2175 #define ICE_AQC_ACL_ALLOC_SCE_START_CMP		BIT(0)
2176 #define ICE_AQC_ACL_ALLOC_SCE_START_SET		BIT(1)
2177 		u8 start_cmp_set;
2178 
2179 	} tcam_cfg[ICE_AQC_ACL_SLICES];
2180 
2181 	/* Each byte, Bit 6..0: Action memory association to a TCAM block,
2182 	 * otherwise it shall be set to 0x0 for disabled memory action.
2183 	 * Bit 7 : Action memory enable for this scenario
2184 	 */
2185 #define ICE_AQC_ACL_SCE_ACT_MEM_TCAM_ASSOC_M	0x7F
2186 #define ICE_AQC_ACL_SCE_ACT_MEM_EN		BIT(7)
2187 	u8 act_mem_cfg[ICE_AQC_MAX_ACTION_MEMORIES];
2188 };
2189 
2190 /* Allocate ACL counters (indirect 0x0C16) */
2191 struct ice_aqc_acl_alloc_counters {
2192 	/* Amount of contiguous counters requested. Min value is 1 and
2193 	 * max value is 255
2194 	 */
2195 #define ICE_AQC_ACL_ALLOC_CNT_MIN_AMT	0x1
2196 #define ICE_AQC_ACL_ALLOC_CNT_MAX_AMT	0xFF
2197 	u8 counter_amount;
2198 
2199 	/* Counter type: 'single counter' which can be configured to count
2200 	 * either bytes or packets
2201 	 */
2202 #define ICE_AQC_ACL_CNT_TYPE_SINGLE	0x0
2203 
2204 	/* Counter type: 'counter pair' which counts number of bytes and number
2205 	 * of packets.
2206 	 */
2207 #define ICE_AQC_ACL_CNT_TYPE_DUAL	0x1
2208 	/* requested counter type, single/dual */
2209 	u8 counters_type;
2210 
2211 	/* counter bank allocation shall be 0-3 for 'byte or packet counter' */
2212 #define ICE_AQC_ACL_MAX_CNT_SINGLE	0x3
2213 /* counter bank allocation shall be 0-1 for 'byte and packet counter dual' */
2214 #define ICE_AQC_ACL_MAX_CNT_DUAL	0x1
2215 	/* requested counter bank allocation */
2216 	u8 bank_alloc;
2217 
2218 	u8 reserved;
2219 
2220 	union {
2221 		/* Applicable only in case of command */
2222 		struct {
2223 			u8 reserved[12];
2224 		} cmd;
2225 		/* Applicable only in case of response */
2226 #define ICE_AQC_ACL_ALLOC_CNT_INVAL	0xFFFF
2227 		struct {
2228 			/* Index of first allocated counter. 0xFFFF in case
2229 			 * of unsuccessful allocation
2230 			 */
2231 			__le16 first_counter;
2232 			/* Index of last allocated counter. 0xFFFF in case
2233 			 * of unsuccessful allocation
2234 			 */
2235 			__le16 last_counter;
2236 			u8 rsvd[8];
2237 		} resp;
2238 	} ops;
2239 };
2240 
2241 /* De-allocate ACL counters (direct 0x0C17) */
2242 struct ice_aqc_acl_dealloc_counters {
2243 	/* first counter being released */
2244 	__le16 first_counter;
2245 	/* last counter being released */
2246 	__le16 last_counter;
2247 	/* requested counter type, single/dual */
2248 	u8 counters_type;
2249 	/* requested counter bank allocation */
2250 	u8 bank_alloc;
2251 	u8 reserved[10];
2252 };
2253 
2254 /* De-allocate ACL resources (direct 0x0C1A). Used by SW to release all the
2255  * resources allocated for it using a single command
2256  */
2257 struct ice_aqc_acl_dealloc_res {
2258 	u8 reserved[16];
2259 };
2260 
2261 /* Program ACL actionpair (indirect 0x0C1C)
2262  * Query ACL actionpair (indirect 0x0C25)
2263  */
2264 struct ice_aqc_acl_actpair {
2265 	/* action mem index to program/update */
2266 	u8 act_mem_index;
2267 	u8 reserved;
2268 	/* The entry index in action memory to be programmed/updated */
2269 	__le16 act_entry_index;
2270 	__le32 reserved2;
2271 	__le32 addr_high;
2272 	__le32 addr_low;
2273 };
2274 
2275 /* Input buffer format for program/query action-pair admin command */
2276 struct ice_acl_act_entry {
2277 	/* Action priority, values must be between 0..7 */
2278 #define ICE_AQC_ACT_PRIO_VALID_MAX	7
2279 #define ICE_AQC_ACT_PRIO_MSK		MAKEMASK(0xff, 0)
2280 	u8 prio;
2281 	/* Action meta-data identifier. This field should be set to 0x0
2282 	 * for a NOP action
2283 	 */
2284 #define ICE_AQC_ACT_MDID_S		8
2285 #define ICE_AQC_ACT_MDID_MSK		MAKEMASK(0xff00, ICE_AQC_ACT_MDID_S)
2286 	u8 mdid;
2287 	/* Action value */
2288 #define ICE_AQC_ACT_VALUE_S		16
2289 #define ICE_AQC_ACT_VALUE_MSK		MAKEMASK(0xffff0000, 16)
2290 	__le16 value;
2291 };
2292 
2293 #define ICE_ACL_NUM_ACT_PER_ACT_PAIR 2
2294 struct ice_aqc_actpair {
2295 	struct ice_acl_act_entry act[ICE_ACL_NUM_ACT_PER_ACT_PAIR];
2296 };
2297 
2298 /* Generic format used to describe either input or response buffer
2299  * for admin commands related to ACL profile
2300  */
2301 struct ice_aqc_acl_prof_generic_frmt {
2302 	/* The first byte of the byte selection base is reserved to keep the
2303 	 * first byte of the field vector where the packet direction info is
2304 	 * available. Thus we should start at index 1 of the field vector to
2305 	 * map its entries to the byte selection base.
2306 	 */
2307 #define ICE_AQC_ACL_PROF_BYTE_SEL_START_IDX	1
2308 	/* In each byte:
2309 	 * Bit 0..5 = Byte selection for the byte selection base from the
2310 	 * extracted fields (expressed as byte offset in extracted fields).
2311 	 * Applicable values are 0..63
2312 	 * Bit 6..7 = Reserved
2313 	 */
2314 #define ICE_AQC_ACL_PROF_BYTE_SEL_ELEMS		30
2315 	u8 byte_selection[ICE_AQC_ACL_PROF_BYTE_SEL_ELEMS];
2316 	/* In each byte:
2317 	 * Bit 0..4 = Word selection for the word selection base from the
2318 	 * extracted fields (expressed as word offset in extracted fields).
2319 	 * Applicable values are 0..31
2320 	 * Bit 5..7 = Reserved
2321 	 */
2322 #define ICE_AQC_ACL_PROF_WORD_SEL_ELEMS		32
2323 	u8 word_selection[ICE_AQC_ACL_PROF_WORD_SEL_ELEMS];
2324 	/* In each byte:
2325 	 * Bit 0..3 = Double word selection for the double-word selection base
2326 	 * from the extracted fields (expressed as double-word offset in
2327 	 * extracted fields).
2328 	 * Applicable values are 0..15
2329 	 * Bit 4..7 = Reserved
2330 	 */
2331 #define ICE_AQC_ACL_PROF_DWORD_SEL_ELEMS	15
2332 	u8 dword_selection[ICE_AQC_ACL_PROF_DWORD_SEL_ELEMS];
2333 	/* Scenario numbers for individual Physical Function's */
2334 #define ICE_AQC_ACL_PROF_PF_SCEN_NUM_ELEMS	8
2335 	u8 pf_scenario_num[ICE_AQC_ACL_PROF_PF_SCEN_NUM_ELEMS];
2336 };
2337 
2338 /* Program ACL profile extraction (indirect 0x0C1D)
2339  * Program ACL profile ranges (indirect 0x0C1E)
2340  * Query ACL profile (indirect 0x0C21)
2341  * Query ACL profile ranges (indirect 0x0C22)
2342  */
2343 struct ice_aqc_acl_profile {
2344 	u8 profile_id; /* Programmed/Updated profile ID */
2345 	u8 reserved[7];
2346 	__le32 addr_high;
2347 	__le32 addr_low;
2348 };
2349 
2350 /* Input buffer format for program profile extraction admin command and
2351  * response buffer format for query profile admin command is as defined
2352  * in struct ice_aqc_acl_prof_generic_frmt
2353  */
2354 
2355 /* Input buffer format for program profile ranges and query profile ranges
2356  * admin commands. Same format is used for response buffer in case of query
2357  * profile ranges command
2358  */
2359 struct ice_acl_rng_data {
2360 	/* The range checker output shall be sent when the value
2361 	 * related to this range checker is lower than low boundary
2362 	 */
2363 	__be16 low_boundary;
2364 	/* The range checker output shall be sent when the value
2365 	 * related to this range checker is higher than high boundary
2366 	 */
2367 	__be16 high_boundary;
2368 	/* A value of '0' in bit shall clear the relevant bit input
2369 	 * to the range checker
2370 	 */
2371 	__be16 mask;
2372 };
2373 
2374 struct ice_aqc_acl_profile_ranges {
2375 #define ICE_AQC_ACL_PROF_RANGES_NUM_CFG 8
2376 	struct ice_acl_rng_data checker_cfg[ICE_AQC_ACL_PROF_RANGES_NUM_CFG];
2377 };
2378 
2379 /* Program ACL entry (indirect 0x0C20)
2380  * Query ACL entry (indirect 0x0C24)
2381  */
2382 struct ice_aqc_acl_entry {
2383 	u8 tcam_index; /* Updated TCAM block index */
2384 	u8 reserved;
2385 	__le16 entry_index; /* Updated entry index */
2386 	__le32 reserved2;
2387 	__le32 addr_high;
2388 	__le32 addr_low;
2389 };
2390 
2391 /* Input buffer format in case of program ACL entry and response buffer format
2392  * in case of query ACL entry
2393  */
2394 struct ice_aqc_acl_data {
2395 	/* Entry key and entry key invert are 40 bits wide.
2396 	 * Byte 0..4 : entry key and Byte 5..7 are reserved
2397 	 * Byte 8..12: entry key invert and Byte 13..15 are reserved
2398 	 */
2399 	struct {
2400 		u8 val[5];
2401 		u8 reserved[3];
2402 	} entry_key, entry_key_invert;
2403 };
2404 
2405 /* Query ACL counter (direct 0x0C27) */
2406 struct ice_aqc_acl_query_counter {
2407 	/* Queried counter index */
2408 	__le16 counter_index;
2409 	/* Queried counter bank */
2410 	u8 counter_bank;
2411 	union {
2412 		struct {
2413 			u8 reserved[13];
2414 		} cmd;
2415 		struct {
2416 			/* Holds counter value/packet counter value */
2417 			u8 val[5];
2418 			u8 reserved[8];
2419 		} resp;
2420 	} ops;
2421 };
2422 
2423 /* Add Tx LAN Queues (indirect 0x0C30) */
2424 struct ice_aqc_add_txqs {
2425 	u8 num_qgrps;
2426 	u8 reserved[3];
2427 	__le32 reserved1;
2428 	__le32 addr_high;
2429 	__le32 addr_low;
2430 };
2431 
2432 /* This is the descriptor of each queue entry for the Add Tx LAN Queues
2433  * command (0x0C30). Only used within struct ice_aqc_add_tx_qgrp.
2434  */
2435 struct ice_aqc_add_txqs_perq {
2436 	__le16 txq_id;
2437 	u8 rsvd[2];
2438 	__le32 q_teid;
2439 	u8 txq_ctx[22];
2440 	u8 rsvd2[2];
2441 	struct ice_aqc_txsched_elem info;
2442 };
2443 
2444 /* The format of the command buffer for Add Tx LAN Queues (0x0C30)
2445  * is an array of the following structs. Please note that the length of
2446  * each struct ice_aqc_add_tx_qgrp is variable due
2447  * to the variable number of queues in each group!
2448  */
2449 struct ice_aqc_add_tx_qgrp {
2450 	__le32 parent_teid;
2451 	u8 num_txqs;
2452 	u8 rsvd[3];
2453 	struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
2454 };
2455 
2456 /* Disable Tx LAN Queues (indirect 0x0C31) */
2457 struct ice_aqc_dis_txqs {
2458 	u8 cmd_type;
2459 #define ICE_AQC_Q_DIS_CMD_S		0
2460 #define ICE_AQC_Q_DIS_CMD_M		(0x3 << ICE_AQC_Q_DIS_CMD_S)
2461 #define ICE_AQC_Q_DIS_CMD_NO_FUNC_RESET	(0 << ICE_AQC_Q_DIS_CMD_S)
2462 #define ICE_AQC_Q_DIS_CMD_VM_RESET	BIT(ICE_AQC_Q_DIS_CMD_S)
2463 #define ICE_AQC_Q_DIS_CMD_VF_RESET	(2 << ICE_AQC_Q_DIS_CMD_S)
2464 #define ICE_AQC_Q_DIS_CMD_PF_RESET	(3 << ICE_AQC_Q_DIS_CMD_S)
2465 #define ICE_AQC_Q_DIS_CMD_SUBSEQ_CALL	BIT(2)
2466 #define ICE_AQC_Q_DIS_CMD_FLUSH_PIPE	BIT(3)
2467 	u8 num_entries;
2468 	__le16 vmvf_and_timeout;
2469 #define ICE_AQC_Q_DIS_VMVF_NUM_S	0
2470 #define ICE_AQC_Q_DIS_VMVF_NUM_M	(0x3FF << ICE_AQC_Q_DIS_VMVF_NUM_S)
2471 #define ICE_AQC_Q_DIS_TIMEOUT_S		10
2472 #define ICE_AQC_Q_DIS_TIMEOUT_M		(0x3F << ICE_AQC_Q_DIS_TIMEOUT_S)
2473 	__le32 blocked_cgds;
2474 	__le32 addr_high;
2475 	__le32 addr_low;
2476 };
2477 
2478 /* The buffer for Disable Tx LAN Queues (indirect 0x0C31)
2479  * contains the following structures, arrayed one after the
2480  * other.
2481  * Note: Since the q_id is 16 bits wide, if the
2482  * number of queues is even, then 2 bytes of alignment MUST be
2483  * added before the start of the next group, to allow correct
2484  * alignment of the parent_teid field.
2485  */
2486 #pragma pack(1)
2487 struct ice_aqc_dis_txq_item {
2488 	__le32 parent_teid;
2489 	u8 num_qs;
2490 	u8 rsvd;
2491 	/* The length of the q_id array varies according to num_qs */
2492 #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S		15
2493 #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_LAN_Q	\
2494 			(0 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
2495 #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_RDMA_QSET	\
2496 			(1 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
2497 	__le16 q_id[STRUCT_HACK_VAR_LEN];
2498 };
2499 
2500 #pragma pack()
2501 
2502 /* Tx LAN Queues Cleanup Event (0x0C31) */
2503 struct ice_aqc_txqs_cleanup {
2504 	__le16 caller_opc;
2505 	__le16 cmd_tag;
2506 	u8 reserved[12];
2507 };
2508 
2509 /* Move / Reconfigure Tx Queues (indirect 0x0C32) */
2510 struct ice_aqc_move_txqs {
2511 	u8 cmd_type;
2512 #define ICE_AQC_Q_CMD_TYPE_S		0
2513 #define ICE_AQC_Q_CMD_TYPE_M		(0x3 << ICE_AQC_Q_CMD_TYPE_S)
2514 #define ICE_AQC_Q_CMD_TYPE_MOVE		1
2515 #define ICE_AQC_Q_CMD_TYPE_TC_CHANGE	2
2516 #define ICE_AQC_Q_CMD_TYPE_MOVE_AND_TC	3
2517 #define ICE_AQC_Q_CMD_SUBSEQ_CALL	BIT(2)
2518 #define ICE_AQC_Q_CMD_FLUSH_PIPE	BIT(3)
2519 	u8 num_qs;
2520 	u8 rsvd;
2521 	u8 timeout;
2522 #define ICE_AQC_Q_CMD_TIMEOUT_S		2
2523 #define ICE_AQC_Q_CMD_TIMEOUT_M		(0x3F << ICE_AQC_Q_CMD_TIMEOUT_S)
2524 	__le32 blocked_cgds;
2525 	__le32 addr_high;
2526 	__le32 addr_low;
2527 };
2528 
2529 /* Per-queue data buffer for the Move Tx LAN Queues command/response */
2530 struct ice_aqc_move_txqs_elem {
2531 	__le16 txq_id;
2532 	u8 q_cgd;
2533 	u8 rsvd;
2534 	__le32 q_teid;
2535 };
2536 
2537 /* Indirect data buffer for the Move Tx LAN Queues command/response */
2538 struct ice_aqc_move_txqs_data {
2539 	__le32 src_teid;
2540 	__le32 dest_teid;
2541 	struct ice_aqc_move_txqs_elem txqs[STRUCT_HACK_VAR_LEN];
2542 };
2543 
2544 /* Download Package (indirect 0x0C40) */
2545 /* Also used for Update Package (indirect 0x0C42 and 0x0C41) */
2546 struct ice_aqc_download_pkg {
2547 	u8 flags;
2548 #define ICE_AQC_DOWNLOAD_PKG_LAST_BUF	0x01
2549 	u8 reserved[3];
2550 	__le32 reserved1;
2551 	__le32 addr_high;
2552 	__le32 addr_low;
2553 };
2554 
2555 struct ice_aqc_download_pkg_resp {
2556 	__le32 error_offset;
2557 	__le32 error_info;
2558 	__le32 addr_high;
2559 	__le32 addr_low;
2560 };
2561 
2562 /* Get Package Info List (indirect 0x0C43) */
2563 struct ice_aqc_get_pkg_info_list {
2564 	__le32 reserved1;
2565 	__le32 reserved2;
2566 	__le32 addr_high;
2567 	__le32 addr_low;
2568 };
2569 
2570 /* Version format for packages */
2571 struct ice_pkg_ver {
2572 	u8 major;
2573 	u8 minor;
2574 	u8 update;
2575 	u8 draft;
2576 };
2577 
2578 #define ICE_PKG_NAME_SIZE	32
2579 #define ICE_SEG_ID_SIZE	28
2580 #define ICE_SEG_NAME_SIZE	28
2581 
2582 struct ice_aqc_get_pkg_info {
2583 	struct ice_pkg_ver ver;
2584 	char name[ICE_SEG_NAME_SIZE];
2585 	__le32 track_id;
2586 	u8 is_in_nvm;
2587 	u8 is_active;
2588 	u8 is_active_at_boot;
2589 	u8 is_modified;
2590 };
2591 
2592 /* Get Package Info List response buffer format (0x0C43) */
2593 struct ice_aqc_get_pkg_info_resp {
2594 	__le32 count;
2595 	struct ice_aqc_get_pkg_info pkg_info[STRUCT_HACK_VAR_LEN];
2596 };
2597 
2598 /* Driver Shared Parameters (direct, 0x0C90) */
2599 struct ice_aqc_driver_shared_params {
2600 	u8 set_or_get_op;
2601 #define ICE_AQC_DRIVER_PARAM_OP_MASK		BIT(0)
2602 #define ICE_AQC_DRIVER_PARAM_SET		0
2603 #define ICE_AQC_DRIVER_PARAM_GET		1
2604 	u8 param_indx;
2605 #define ICE_AQC_DRIVER_PARAM_MAX_IDX		15
2606 	u8 rsvd[2];
2607 	__le32 param_val;
2608 	__le32 addr_high;
2609 	__le32 addr_low;
2610 };
2611 
2612 /* Lan Queue Overflow Event (direct, 0x1001) */
2613 struct ice_aqc_event_lan_overflow {
2614 	__le32 prtdcb_ruptq;
2615 	__le32 qtx_ctl;
2616 	u8 reserved[8];
2617 };
2618 
2619 /* Set Health Status (direct 0xFF20) */
2620 struct ice_aqc_set_health_status_config {
2621 	u8 event_source;
2622 #define ICE_AQC_HEALTH_STATUS_SET_PF_SPECIFIC_MASK	BIT(0)
2623 #define ICE_AQC_HEALTH_STATUS_SET_ALL_PF_MASK		BIT(1)
2624 #define ICE_AQC_HEALTH_STATUS_SET_GLOBAL_MASK		BIT(2)
2625 	u8 reserved[15];
2626 };
2627 
2628 #define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_STRICT		0x101
2629 #define ICE_AQC_HEALTH_STATUS_ERR_MOD_TYPE			0x102
2630 #define ICE_AQC_HEALTH_STATUS_ERR_MOD_QUAL			0x103
2631 #define ICE_AQC_HEALTH_STATUS_ERR_MOD_COMM			0x104
2632 #define ICE_AQC_HEALTH_STATUS_ERR_MOD_CONFLICT			0x105
2633 #define ICE_AQC_HEALTH_STATUS_ERR_MOD_NOT_PRESENT		0x106
2634 #define ICE_AQC_HEALTH_STATUS_INFO_MOD_UNDERUTILIZED		0x107
2635 #define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_LENIENT		0x108
2636 #define ICE_AQC_HEALTH_STATUS_ERR_INVALID_LINK_CFG		0x10B
2637 #define ICE_AQC_HEALTH_STATUS_ERR_PORT_ACCESS			0x10C
2638 #define ICE_AQC_HEALTH_STATUS_ERR_PORT_UNREACHABLE		0x10D
2639 #define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_MOD_LIMITED	0x10F
2640 #define ICE_AQC_HEALTH_STATUS_ERR_PARALLEL_FAULT		0x110
2641 #define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_PHY_LIMITED	0x111
2642 #define ICE_AQC_HEALTH_STATUS_ERR_NETLIST_TOPO			0x112
2643 #define ICE_AQC_HEALTH_STATUS_ERR_NETLIST			0x113
2644 #define ICE_AQC_HEALTH_STATUS_ERR_TOPO_CONFLICT			0x114
2645 #define ICE_AQC_HEALTH_STATUS_ERR_LINK_HW_ACCESS		0x115
2646 #define ICE_AQC_HEALTH_STATUS_ERR_LINK_RUNTIME			0x116
2647 #define ICE_AQC_HEALTH_STATUS_ERR_DNL_INIT			0x117
2648 #define ICE_AQC_HEALTH_STATUS_INFO_RECOVERY			0x500
2649 #define ICE_AQC_HEALTH_STATUS_ERR_FLASH_ACCESS			0x501
2650 #define ICE_AQC_HEALTH_STATUS_ERR_NVM_AUTH			0x502
2651 #define ICE_AQC_HEALTH_STATUS_ERR_OROM_AUTH			0x503
2652 #define ICE_AQC_HEALTH_STATUS_ERR_DDP_AUTH			0x504
2653 #define ICE_AQC_HEALTH_STATUS_ERR_NVM_COMPAT			0x505
2654 #define ICE_AQC_HEALTH_STATUS_ERR_OROM_COMPAT			0x506
2655 #define ICE_AQC_HEALTH_STATUS_ERR_DCB_MIB			0x509
2656 
2657 /* Get Health Status codes (indirect 0xFF21) */
2658 struct ice_aqc_get_supported_health_status_codes {
2659 	__le16 health_code_count;
2660 	u8 reserved[6];
2661 	__le32 addr_high;
2662 	__le32 addr_low;
2663 };
2664 
2665 /* Get Health Status (indirect 0xFF22) */
2666 struct ice_aqc_get_health_status {
2667 	__le16 health_status_count;
2668 	u8 reserved[6];
2669 	__le32 addr_high;
2670 	__le32 addr_low;
2671 };
2672 
2673 /* Get Health Status event buffer entry, (0xFF22)
2674  * repeated per reported health status
2675  */
2676 struct ice_aqc_health_status_elem {
2677 	__le16 health_status_code;
2678 	__le16 event_source;
2679 #define ICE_AQC_HEALTH_STATUS_PF			(0x1)
2680 #define ICE_AQC_HEALTH_STATUS_PORT			(0x2)
2681 #define ICE_AQC_HEALTH_STATUS_GLOBAL			(0x3)
2682 	__le32 internal_data1;
2683 #define ICE_AQC_HEALTH_STATUS_UNDEFINED_DATA	(0xDEADBEEF)
2684 	__le32 internal_data2;
2685 };
2686 
2687 /* Clear Health Status (direct 0xFF23) */
2688 struct ice_aqc_clear_health_status {
2689 	__le32 reserved[4];
2690 };
2691 
2692 /**
2693  * struct ice_aq_desc - Admin Queue (AQ) descriptor
2694  * @flags: ICE_AQ_FLAG_* flags
2695  * @opcode: AQ command opcode
2696  * @datalen: length in bytes of indirect/external data buffer
2697  * @retval: return value from firmware
2698  * @cookie_high: opaque data high-half
2699  * @cookie_low: opaque data low-half
2700  * @params: command-specific parameters
2701  *
2702  * Descriptor format for commands the driver posts on the Admin Transmit Queue
2703  * (ATQ). The firmware writes back onto the command descriptor and returns
2704  * the result of the command. Asynchronous events that are not an immediate
2705  * result of the command are written to the Admin Receive Queue (ARQ) using
2706  * the same descriptor format. Descriptors are in little-endian notation with
2707  * 32-bit words.
2708  */
2709 struct ice_aq_desc {
2710 	__le16 flags;
2711 	__le16 opcode;
2712 	__le16 datalen;
2713 	__le16 retval;
2714 	__le32 cookie_high;
2715 	__le32 cookie_low;
2716 	union {
2717 		u8 raw[16];
2718 		struct ice_aqc_generic generic;
2719 		struct ice_aqc_get_ver get_ver;
2720 		struct ice_aqc_driver_ver driver_ver;
2721 		struct ice_aqc_q_shutdown q_shutdown;
2722 		struct ice_aqc_req_res res_owner;
2723 		struct ice_aqc_manage_mac_read mac_read;
2724 		struct ice_aqc_manage_mac_write mac_write;
2725 		struct ice_aqc_clear_pxe clear_pxe;
2726 		struct ice_aqc_config_no_drop_policy no_drop;
2727 		struct ice_aqc_add_update_mir_rule add_update_rule;
2728 		struct ice_aqc_delete_mir_rule del_rule;
2729 		struct ice_aqc_list_caps get_cap;
2730 		struct ice_aqc_get_phy_caps get_phy;
2731 		struct ice_aqc_set_phy_cfg set_phy;
2732 		struct ice_aqc_restart_an restart_an;
2733 		struct ice_aqc_sff_eeprom read_write_sff_param;
2734 		struct ice_aqc_set_port_id_led set_port_id_led;
2735 		struct ice_aqc_get_sw_cfg get_sw_conf;
2736 		struct ice_aqc_set_port_params set_port_params;
2737 		struct ice_aqc_sw_rules sw_rules;
2738 		struct ice_aqc_storm_cfg storm_conf;
2739 		struct ice_aqc_add_get_recipe add_get_recipe;
2740 		struct ice_aqc_recipe_to_profile recipe_to_profile;
2741 		struct ice_aqc_get_topo get_topo;
2742 		struct ice_aqc_sched_elem_cmd sched_elem_cmd;
2743 		struct ice_aqc_query_txsched_res query_sched_res;
2744 		struct ice_aqc_query_node_to_root query_node_to_root;
2745 		struct ice_aqc_cfg_l2_node_cgd cfg_l2_node_cgd;
2746 		struct ice_aqc_query_port_ets port_ets;
2747 		struct ice_aqc_rl_profile rl_profile;
2748 		struct ice_aqc_nvm nvm;
2749 		struct ice_aqc_nvm_cfg nvm_cfg;
2750 		struct ice_aqc_nvm_checksum nvm_checksum;
2751 		struct ice_aqc_pfc_ignore pfc_ignore;
2752 		struct ice_aqc_set_query_pfc_mode set_query_pfc_mode;
2753 		struct ice_aqc_set_dcb_params set_dcb_params;
2754 		struct ice_aqc_lldp_get_mib lldp_get_mib;
2755 		struct ice_aqc_lldp_set_mib_change lldp_set_event;
2756 		struct ice_aqc_lldp_add_delete_tlv lldp_add_delete_tlv;
2757 		struct ice_aqc_lldp_update_tlv lldp_update_tlv;
2758 		struct ice_aqc_lldp_stop lldp_stop;
2759 		struct ice_aqc_lldp_start lldp_start;
2760 		struct ice_aqc_lldp_set_local_mib lldp_set_mib;
2761 		struct ice_aqc_lldp_stop_start_specific_agent lldp_agent_ctrl;
2762 		struct ice_aqc_lldp_filter_ctrl lldp_filter_ctrl;
2763 		struct ice_aqc_get_set_rss_lut get_set_rss_lut;
2764 		struct ice_aqc_get_set_rss_key get_set_rss_key;
2765 		struct ice_aqc_clear_fd_table clear_fd_table;
2766 		struct ice_aqc_acl_alloc_table alloc_table;
2767 		struct ice_aqc_acl_tbl_actpair tbl_actpair;
2768 		struct ice_aqc_acl_alloc_scen alloc_scen;
2769 		struct ice_aqc_acl_dealloc_scen dealloc_scen;
2770 		struct ice_aqc_acl_update_query_scen update_query_scen;
2771 		struct ice_aqc_acl_alloc_counters alloc_counters;
2772 		struct ice_aqc_acl_dealloc_counters dealloc_counters;
2773 		struct ice_aqc_acl_dealloc_res dealloc_res;
2774 		struct ice_aqc_acl_entry program_query_entry;
2775 		struct ice_aqc_acl_actpair program_query_actpair;
2776 		struct ice_aqc_acl_profile profile;
2777 		struct ice_aqc_acl_query_counter query_counter;
2778 		struct ice_aqc_add_txqs add_txqs;
2779 		struct ice_aqc_dis_txqs dis_txqs;
2780 		struct ice_aqc_move_txqs move_txqs;
2781 		struct ice_aqc_txqs_cleanup txqs_cleanup;
2782 		struct ice_aqc_add_get_update_free_vsi vsi_cmd;
2783 		struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
2784 		struct ice_aqc_get_vsi_resp get_vsi_resp;
2785 		struct ice_aqc_download_pkg download_pkg;
2786 		struct ice_aqc_get_pkg_info_list get_pkg_info_list;
2787 		struct ice_aqc_driver_shared_params drv_shared_params;
2788 		struct ice_aqc_set_mac_lb set_mac_lb;
2789 		struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
2790 		struct ice_aqc_get_res_alloc get_res;
2791 		struct ice_aqc_get_allocd_res_desc get_res_desc;
2792 		struct ice_aqc_set_mac_cfg set_mac_cfg;
2793 		struct ice_aqc_set_event_mask set_event_mask;
2794 		struct ice_aqc_get_link_status get_link_status;
2795 		struct ice_aqc_event_lan_overflow lan_overflow;
2796 		struct ice_aqc_get_link_topo get_link_topo;
2797 		struct ice_aqc_set_health_status_config
2798 			set_health_status_config;
2799 		struct ice_aqc_get_supported_health_status_codes
2800 			get_supported_health_status_codes;
2801 		struct ice_aqc_get_health_status get_health_status;
2802 		struct ice_aqc_clear_health_status clear_health_status;
2803 	} params;
2804 };
2805 
2806 /* FW defined boundary for a large buffer, 4k >= Large buffer > 512 bytes */
2807 #define ICE_AQ_LG_BUF	512
2808 
2809 /* Flags sub-structure
2810  * |0  |1  |2  |3  |4  |5  |6  |7  |8  |9  |10 |11 |12 |13 |14 |15 |
2811  * |DD |CMP|ERR|VFE| * *  RESERVED * * |LB |RD |VFC|BUF|SI |EI |FE |
2812  */
2813 
2814 /* command flags and offsets */
2815 #define ICE_AQ_FLAG_DD_S	0
2816 #define ICE_AQ_FLAG_CMP_S	1
2817 #define ICE_AQ_FLAG_ERR_S	2
2818 #define ICE_AQ_FLAG_VFE_S	3
2819 #define ICE_AQ_FLAG_LB_S	9
2820 #define ICE_AQ_FLAG_RD_S	10
2821 #define ICE_AQ_FLAG_VFC_S	11
2822 #define ICE_AQ_FLAG_BUF_S	12
2823 #define ICE_AQ_FLAG_SI_S	13
2824 #define ICE_AQ_FLAG_EI_S	14
2825 #define ICE_AQ_FLAG_FE_S	15
2826 
2827 #define ICE_AQ_FLAG_DD		BIT(ICE_AQ_FLAG_DD_S)  /* 0x1    */
2828 #define ICE_AQ_FLAG_CMP		BIT(ICE_AQ_FLAG_CMP_S) /* 0x2    */
2829 #define ICE_AQ_FLAG_ERR		BIT(ICE_AQ_FLAG_ERR_S) /* 0x4    */
2830 #define ICE_AQ_FLAG_VFE		BIT(ICE_AQ_FLAG_VFE_S) /* 0x8    */
2831 #define ICE_AQ_FLAG_LB		BIT(ICE_AQ_FLAG_LB_S)  /* 0x200  */
2832 #define ICE_AQ_FLAG_RD		BIT(ICE_AQ_FLAG_RD_S)  /* 0x400  */
2833 #define ICE_AQ_FLAG_VFC		BIT(ICE_AQ_FLAG_VFC_S) /* 0x800  */
2834 #define ICE_AQ_FLAG_BUF		BIT(ICE_AQ_FLAG_BUF_S) /* 0x1000 */
2835 #define ICE_AQ_FLAG_SI		BIT(ICE_AQ_FLAG_SI_S)  /* 0x2000 */
2836 #define ICE_AQ_FLAG_EI		BIT(ICE_AQ_FLAG_EI_S)  /* 0x4000 */
2837 #define ICE_AQ_FLAG_FE		BIT(ICE_AQ_FLAG_FE_S)  /* 0x8000 */
2838 
2839 /* error codes */
2840 enum ice_aq_err {
2841 	ICE_AQ_RC_OK		= 0,  /* Success */
2842 	ICE_AQ_RC_EPERM		= 1,  /* Operation not permitted */
2843 	ICE_AQ_RC_ENOENT	= 2,  /* No such element */
2844 	ICE_AQ_RC_ESRCH		= 3,  /* Bad opcode */
2845 	ICE_AQ_RC_EINTR		= 4,  /* Operation interrupted */
2846 	ICE_AQ_RC_EIO		= 5,  /* I/O error */
2847 	ICE_AQ_RC_ENXIO		= 6,  /* No such resource */
2848 	ICE_AQ_RC_E2BIG		= 7,  /* Arg too long */
2849 	ICE_AQ_RC_EAGAIN	= 8,  /* Try again */
2850 	ICE_AQ_RC_ENOMEM	= 9,  /* Out of memory */
2851 	ICE_AQ_RC_EACCES	= 10, /* Permission denied */
2852 	ICE_AQ_RC_EFAULT	= 11, /* Bad address */
2853 	ICE_AQ_RC_EBUSY		= 12, /* Device or resource busy */
2854 	ICE_AQ_RC_EEXIST	= 13, /* Object already exists */
2855 	ICE_AQ_RC_EINVAL	= 14, /* Invalid argument */
2856 	ICE_AQ_RC_ENOTTY	= 15, /* Not a typewriter */
2857 	ICE_AQ_RC_ENOSPC	= 16, /* No space left or allocation failure */
2858 	ICE_AQ_RC_ENOSYS	= 17, /* Function not implemented */
2859 	ICE_AQ_RC_ERANGE	= 18, /* Parameter out of range */
2860 	ICE_AQ_RC_EFLUSHED	= 19, /* Cmd flushed due to prev cmd error */
2861 	ICE_AQ_RC_BAD_ADDR	= 20, /* Descriptor contains a bad pointer */
2862 	ICE_AQ_RC_EMODE		= 21, /* Op not allowed in current dev mode */
2863 	ICE_AQ_RC_EFBIG		= 22, /* File too big */
2864 	ICE_AQ_RC_ESBCOMP	= 23, /* SB-IOSF completion unsuccessful */
2865 	ICE_AQ_RC_ENOSEC	= 24, /* Missing security manifest */
2866 	ICE_AQ_RC_EBADSIG	= 25, /* Bad RSA signature */
2867 	ICE_AQ_RC_ESVN		= 26, /* SVN number prohibits this package */
2868 	ICE_AQ_RC_EBADMAN	= 27, /* Manifest hash mismatch */
2869 	ICE_AQ_RC_EBADBUF	= 28, /* Buffer hash mismatches manifest */
2870 	ICE_AQ_RC_EACCES_BMCU	= 29, /* BMC Update in progress */
2871 };
2872 
2873 /* Admin Queue command opcodes */
2874 enum ice_adminq_opc {
2875 	/* AQ commands */
2876 	ice_aqc_opc_get_ver				= 0x0001,
2877 	ice_aqc_opc_driver_ver				= 0x0002,
2878 	ice_aqc_opc_q_shutdown				= 0x0003,
2879 	ice_aqc_opc_get_exp_err				= 0x0005,
2880 
2881 	/* resource ownership */
2882 	ice_aqc_opc_req_res				= 0x0008,
2883 	ice_aqc_opc_release_res				= 0x0009,
2884 
2885 	/* device/function capabilities */
2886 	ice_aqc_opc_list_func_caps			= 0x000A,
2887 	ice_aqc_opc_list_dev_caps			= 0x000B,
2888 
2889 	/* manage MAC address */
2890 	ice_aqc_opc_manage_mac_read			= 0x0107,
2891 	ice_aqc_opc_manage_mac_write			= 0x0108,
2892 
2893 	/* PXE */
2894 	ice_aqc_opc_clear_pxe_mode			= 0x0110,
2895 
2896 	ice_aqc_opc_config_no_drop_policy		= 0x0112,
2897 
2898 	/* internal switch commands */
2899 	ice_aqc_opc_get_sw_cfg				= 0x0200,
2900 	ice_aqc_opc_set_port_params			= 0x0203,
2901 
2902 	/* Alloc/Free/Get Resources */
2903 	ice_aqc_opc_get_res_alloc			= 0x0204,
2904 	ice_aqc_opc_alloc_res				= 0x0208,
2905 	ice_aqc_opc_free_res				= 0x0209,
2906 	ice_aqc_opc_get_allocd_res_desc			= 0x020A,
2907 
2908 	/* VSI commands */
2909 	ice_aqc_opc_add_vsi				= 0x0210,
2910 	ice_aqc_opc_update_vsi				= 0x0211,
2911 	ice_aqc_opc_get_vsi_params			= 0x0212,
2912 	ice_aqc_opc_free_vsi				= 0x0213,
2913 
2914 	/* Mirroring rules - add/update, delete */
2915 	ice_aqc_opc_add_update_mir_rule			= 0x0260,
2916 	ice_aqc_opc_del_mir_rule			= 0x0261,
2917 
2918 	/* storm configuration */
2919 	ice_aqc_opc_set_storm_cfg			= 0x0280,
2920 	ice_aqc_opc_get_storm_cfg			= 0x0281,
2921 
2922 	/* recipe commands */
2923 	ice_aqc_opc_add_recipe				= 0x0290,
2924 	ice_aqc_opc_recipe_to_profile			= 0x0291,
2925 	ice_aqc_opc_get_recipe				= 0x0292,
2926 	ice_aqc_opc_get_recipe_to_profile		= 0x0293,
2927 
2928 	/* switch rules population commands */
2929 	ice_aqc_opc_add_sw_rules			= 0x02A0,
2930 	ice_aqc_opc_update_sw_rules			= 0x02A1,
2931 	ice_aqc_opc_remove_sw_rules			= 0x02A2,
2932 	ice_aqc_opc_get_sw_rules			= 0x02A3,
2933 	ice_aqc_opc_clear_pf_cfg			= 0x02A4,
2934 
2935 	/* DCB commands */
2936 	ice_aqc_opc_pfc_ignore				= 0x0301,
2937 	ice_aqc_opc_query_pfc_mode			= 0x0302,
2938 	ice_aqc_opc_set_pfc_mode			= 0x0303,
2939 	ice_aqc_opc_set_dcb_params			= 0x0306,
2940 
2941 	/* transmit scheduler commands */
2942 	ice_aqc_opc_get_dflt_topo			= 0x0400,
2943 	ice_aqc_opc_add_sched_elems			= 0x0401,
2944 	ice_aqc_opc_cfg_sched_elems			= 0x0403,
2945 	ice_aqc_opc_get_sched_elems			= 0x0404,
2946 	ice_aqc_opc_move_sched_elems			= 0x0408,
2947 	ice_aqc_opc_suspend_sched_elems			= 0x0409,
2948 	ice_aqc_opc_resume_sched_elems			= 0x040A,
2949 	ice_aqc_opc_query_port_ets			= 0x040E,
2950 	ice_aqc_opc_delete_sched_elems			= 0x040F,
2951 	ice_aqc_opc_add_rl_profiles			= 0x0410,
2952 	ice_aqc_opc_query_rl_profiles			= 0x0411,
2953 	ice_aqc_opc_query_sched_res			= 0x0412,
2954 	ice_aqc_opc_query_node_to_root			= 0x0413,
2955 	ice_aqc_opc_cfg_l2_node_cgd			= 0x0414,
2956 	ice_aqc_opc_remove_rl_profiles			= 0x0415,
2957 
2958 	/* PHY commands */
2959 	ice_aqc_opc_get_phy_caps			= 0x0600,
2960 	ice_aqc_opc_set_phy_cfg				= 0x0601,
2961 	ice_aqc_opc_set_mac_cfg				= 0x0603,
2962 	ice_aqc_opc_restart_an				= 0x0605,
2963 	ice_aqc_opc_get_link_status			= 0x0607,
2964 	ice_aqc_opc_set_event_mask			= 0x0613,
2965 	ice_aqc_opc_set_mac_lb				= 0x0620,
2966 	ice_aqc_opc_get_link_topo			= 0x06E0,
2967 	ice_aqc_opc_set_port_id_led			= 0x06E9,
2968 	ice_aqc_opc_get_port_options			= 0x06EA,
2969 	ice_aqc_opc_set_port_option			= 0x06EB,
2970 	ice_aqc_opc_set_gpio				= 0x06EC,
2971 	ice_aqc_opc_get_gpio				= 0x06ED,
2972 	ice_aqc_opc_sff_eeprom				= 0x06EE,
2973 	ice_aqc_opc_sw_set_gpio				= 0x06EF,
2974 	ice_aqc_opc_sw_get_gpio				= 0x06F0,
2975 
2976 	/* NVM commands */
2977 	ice_aqc_opc_nvm_read				= 0x0701,
2978 	ice_aqc_opc_nvm_erase				= 0x0702,
2979 	ice_aqc_opc_nvm_write				= 0x0703,
2980 	ice_aqc_opc_nvm_cfg_read			= 0x0704,
2981 	ice_aqc_opc_nvm_cfg_write			= 0x0705,
2982 	ice_aqc_opc_nvm_checksum			= 0x0706,
2983 	ice_aqc_opc_nvm_write_activate			= 0x0707,
2984 	ice_aqc_opc_nvm_sr_dump				= 0x0707,
2985 	ice_aqc_opc_nvm_save_factory_settings		= 0x0708,
2986 	ice_aqc_opc_nvm_update_empr			= 0x0709,
2987 
2988 	/* LLDP commands */
2989 	ice_aqc_opc_lldp_get_mib			= 0x0A00,
2990 	ice_aqc_opc_lldp_set_mib_change			= 0x0A01,
2991 	ice_aqc_opc_lldp_add_tlv			= 0x0A02,
2992 	ice_aqc_opc_lldp_update_tlv			= 0x0A03,
2993 	ice_aqc_opc_lldp_delete_tlv			= 0x0A04,
2994 	ice_aqc_opc_lldp_stop				= 0x0A05,
2995 	ice_aqc_opc_lldp_start				= 0x0A06,
2996 	ice_aqc_opc_get_cee_dcb_cfg			= 0x0A07,
2997 	ice_aqc_opc_lldp_set_local_mib			= 0x0A08,
2998 	ice_aqc_opc_lldp_stop_start_specific_agent	= 0x0A09,
2999 	ice_aqc_opc_lldp_filter_ctrl			= 0x0A0A,
3000 
3001 	/* RSS commands */
3002 	ice_aqc_opc_set_rss_key				= 0x0B02,
3003 	ice_aqc_opc_set_rss_lut				= 0x0B03,
3004 	ice_aqc_opc_get_rss_key				= 0x0B04,
3005 	ice_aqc_opc_get_rss_lut				= 0x0B05,
3006 	ice_aqc_opc_clear_fd_table			= 0x0B06,
3007 	/* ACL commands */
3008 	ice_aqc_opc_alloc_acl_tbl			= 0x0C10,
3009 	ice_aqc_opc_dealloc_acl_tbl			= 0x0C11,
3010 	ice_aqc_opc_alloc_acl_actpair			= 0x0C12,
3011 	ice_aqc_opc_dealloc_acl_actpair			= 0x0C13,
3012 	ice_aqc_opc_alloc_acl_scen			= 0x0C14,
3013 	ice_aqc_opc_dealloc_acl_scen			= 0x0C15,
3014 	ice_aqc_opc_alloc_acl_counters			= 0x0C16,
3015 	ice_aqc_opc_dealloc_acl_counters		= 0x0C17,
3016 	ice_aqc_opc_dealloc_acl_res			= 0x0C1A,
3017 	ice_aqc_opc_update_acl_scen			= 0x0C1B,
3018 	ice_aqc_opc_program_acl_actpair			= 0x0C1C,
3019 	ice_aqc_opc_program_acl_prof_extraction		= 0x0C1D,
3020 	ice_aqc_opc_program_acl_prof_ranges		= 0x0C1E,
3021 	ice_aqc_opc_program_acl_entry			= 0x0C20,
3022 	ice_aqc_opc_query_acl_prof			= 0x0C21,
3023 	ice_aqc_opc_query_acl_prof_ranges		= 0x0C22,
3024 	ice_aqc_opc_query_acl_scen			= 0x0C23,
3025 	ice_aqc_opc_query_acl_entry			= 0x0C24,
3026 	ice_aqc_opc_query_acl_actpair			= 0x0C25,
3027 	ice_aqc_opc_query_acl_counter			= 0x0C27,
3028 
3029 	/* Tx queue handling commands/events */
3030 	ice_aqc_opc_add_txqs				= 0x0C30,
3031 	ice_aqc_opc_dis_txqs				= 0x0C31,
3032 	ice_aqc_opc_txqs_cleanup			= 0x0C31,
3033 	ice_aqc_opc_move_recfg_txqs			= 0x0C32,
3034 
3035 	/* package commands */
3036 	ice_aqc_opc_download_pkg			= 0x0C40,
3037 	ice_aqc_opc_upload_section			= 0x0C41,
3038 	ice_aqc_opc_update_pkg				= 0x0C42,
3039 	ice_aqc_opc_get_pkg_info_list			= 0x0C43,
3040 
3041 	ice_aqc_opc_driver_shared_params		= 0x0C90,
3042 
3043 	/* Standalone Commands/Events */
3044 	ice_aqc_opc_event_lan_overflow			= 0x1001,
3045 
3046 	/* SystemDiagnostic commands */
3047 	ice_aqc_opc_set_health_status_config		= 0xFF20,
3048 	ice_aqc_opc_get_supported_health_status_codes	= 0xFF21,
3049 	ice_aqc_opc_get_health_status			= 0xFF22,
3050 	ice_aqc_opc_clear_health_status			= 0xFF23
3051 };
3052 
3053 #endif /* _ICE_ADMINQ_CMD_H_ */
3054