xref: /freebsd/sys/dev/ixl/i40e_adminq_cmd.h (revision 6d011ad5f677a2d2c99eb1d848089000ea3f463c)
1 /******************************************************************************
2 
3   Copyright (c) 2013-2015, Intel Corporation
4   All rights reserved.
5 
6   Redistribution and use in source and binary forms, with or without
7   modification, are permitted provided that the following conditions are met:
8 
9    1. Redistributions of source code must retain the above copyright notice,
10       this list of conditions and the following disclaimer.
11 
12    2. Redistributions in binary form must reproduce the above copyright
13       notice, this list of conditions and the following disclaimer in the
14       documentation and/or other materials provided with the distribution.
15 
16    3. Neither the name of the Intel Corporation nor the names of its
17       contributors may be used to endorse or promote products derived from
18       this software without specific prior written permission.
19 
20   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   POSSIBILITY OF SUCH DAMAGE.
31 
32 ******************************************************************************/
33 /*$FreeBSD$*/
34 
35 #ifndef _I40E_ADMINQ_CMD_H_
36 #define _I40E_ADMINQ_CMD_H_
37 
38 /* This header file defines the i40e Admin Queue commands and is shared between
39  * i40e Firmware and Software.
40  *
41  * This file needs to comply with the Linux Kernel coding style.
42  */
43 
44 #define I40E_FW_API_VERSION_MAJOR	0x0001
45 #define I40E_FW_API_VERSION_MINOR	0x0005
46 
47 struct i40e_aq_desc {
48 	__le16 flags;
49 	__le16 opcode;
50 	__le16 datalen;
51 	__le16 retval;
52 	__le32 cookie_high;
53 	__le32 cookie_low;
54 	union {
55 		struct {
56 			__le32 param0;
57 			__le32 param1;
58 			__le32 param2;
59 			__le32 param3;
60 		} internal;
61 		struct {
62 			__le32 param0;
63 			__le32 param1;
64 			__le32 addr_high;
65 			__le32 addr_low;
66 		} external;
67 		u8 raw[16];
68 	} params;
69 };
70 
71 /* Flags sub-structure
72  * |0  |1  |2  |3  |4  |5  |6  |7  |8  |9  |10 |11 |12 |13 |14 |15 |
73  * |DD |CMP|ERR|VFE| * *  RESERVED * * |LB |RD |VFC|BUF|SI |EI |FE |
74  */
75 
76 /* command flags and offsets*/
77 #define I40E_AQ_FLAG_DD_SHIFT	0
78 #define I40E_AQ_FLAG_CMP_SHIFT	1
79 #define I40E_AQ_FLAG_ERR_SHIFT	2
80 #define I40E_AQ_FLAG_VFE_SHIFT	3
81 #define I40E_AQ_FLAG_LB_SHIFT	9
82 #define I40E_AQ_FLAG_RD_SHIFT	10
83 #define I40E_AQ_FLAG_VFC_SHIFT	11
84 #define I40E_AQ_FLAG_BUF_SHIFT	12
85 #define I40E_AQ_FLAG_SI_SHIFT	13
86 #define I40E_AQ_FLAG_EI_SHIFT	14
87 #define I40E_AQ_FLAG_FE_SHIFT	15
88 
89 #define I40E_AQ_FLAG_DD		(1 << I40E_AQ_FLAG_DD_SHIFT)  /* 0x1    */
90 #define I40E_AQ_FLAG_CMP	(1 << I40E_AQ_FLAG_CMP_SHIFT) /* 0x2    */
91 #define I40E_AQ_FLAG_ERR	(1 << I40E_AQ_FLAG_ERR_SHIFT) /* 0x4    */
92 #define I40E_AQ_FLAG_VFE	(1 << I40E_AQ_FLAG_VFE_SHIFT) /* 0x8    */
93 #define I40E_AQ_FLAG_LB		(1 << I40E_AQ_FLAG_LB_SHIFT)  /* 0x200  */
94 #define I40E_AQ_FLAG_RD		(1 << I40E_AQ_FLAG_RD_SHIFT)  /* 0x400  */
95 #define I40E_AQ_FLAG_VFC	(1 << I40E_AQ_FLAG_VFC_SHIFT) /* 0x800  */
96 #define I40E_AQ_FLAG_BUF	(1 << I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */
97 #define I40E_AQ_FLAG_SI		(1 << I40E_AQ_FLAG_SI_SHIFT)  /* 0x2000 */
98 #define I40E_AQ_FLAG_EI		(1 << I40E_AQ_FLAG_EI_SHIFT)  /* 0x4000 */
99 #define I40E_AQ_FLAG_FE		(1 << I40E_AQ_FLAG_FE_SHIFT)  /* 0x8000 */
100 
101 /* error codes */
102 enum i40e_admin_queue_err {
103 	I40E_AQ_RC_OK		= 0,  /* success */
104 	I40E_AQ_RC_EPERM	= 1,  /* Operation not permitted */
105 	I40E_AQ_RC_ENOENT	= 2,  /* No such element */
106 	I40E_AQ_RC_ESRCH	= 3,  /* Bad opcode */
107 	I40E_AQ_RC_EINTR	= 4,  /* operation interrupted */
108 	I40E_AQ_RC_EIO		= 5,  /* I/O error */
109 	I40E_AQ_RC_ENXIO	= 6,  /* No such resource */
110 	I40E_AQ_RC_E2BIG	= 7,  /* Arg too long */
111 	I40E_AQ_RC_EAGAIN	= 8,  /* Try again */
112 	I40E_AQ_RC_ENOMEM	= 9,  /* Out of memory */
113 	I40E_AQ_RC_EACCES	= 10, /* Permission denied */
114 	I40E_AQ_RC_EFAULT	= 11, /* Bad address */
115 	I40E_AQ_RC_EBUSY	= 12, /* Device or resource busy */
116 	I40E_AQ_RC_EEXIST	= 13, /* object already exists */
117 	I40E_AQ_RC_EINVAL	= 14, /* Invalid argument */
118 	I40E_AQ_RC_ENOTTY	= 15, /* Not a typewriter */
119 	I40E_AQ_RC_ENOSPC	= 16, /* No space left or alloc failure */
120 	I40E_AQ_RC_ENOSYS	= 17, /* Function not implemented */
121 	I40E_AQ_RC_ERANGE	= 18, /* Parameter out of range */
122 	I40E_AQ_RC_EFLUSHED	= 19, /* Cmd flushed due to prev cmd error */
123 	I40E_AQ_RC_BAD_ADDR	= 20, /* Descriptor contains a bad pointer */
124 	I40E_AQ_RC_EMODE	= 21, /* Op not allowed in current dev mode */
125 	I40E_AQ_RC_EFBIG	= 22, /* File too large */
126 };
127 
128 /* Admin Queue command opcodes */
129 enum i40e_admin_queue_opc {
130 	/* aq commands */
131 	i40e_aqc_opc_get_version	= 0x0001,
132 	i40e_aqc_opc_driver_version	= 0x0002,
133 	i40e_aqc_opc_queue_shutdown	= 0x0003,
134 	i40e_aqc_opc_set_pf_context	= 0x0004,
135 
136 	/* resource ownership */
137 	i40e_aqc_opc_request_resource	= 0x0008,
138 	i40e_aqc_opc_release_resource	= 0x0009,
139 
140 	i40e_aqc_opc_list_func_capabilities	= 0x000A,
141 	i40e_aqc_opc_list_dev_capabilities	= 0x000B,
142 
143 	/* LAA */
144 	i40e_aqc_opc_mac_address_read	= 0x0107,
145 	i40e_aqc_opc_mac_address_write	= 0x0108,
146 
147 	/* PXE */
148 	i40e_aqc_opc_clear_pxe_mode	= 0x0110,
149 
150 	/* internal switch commands */
151 	i40e_aqc_opc_get_switch_config		= 0x0200,
152 	i40e_aqc_opc_add_statistics		= 0x0201,
153 	i40e_aqc_opc_remove_statistics		= 0x0202,
154 	i40e_aqc_opc_set_port_parameters	= 0x0203,
155 	i40e_aqc_opc_get_switch_resource_alloc	= 0x0204,
156 	i40e_aqc_opc_set_switch_config		= 0x0205,
157 
158 	i40e_aqc_opc_add_vsi			= 0x0210,
159 	i40e_aqc_opc_update_vsi_parameters	= 0x0211,
160 	i40e_aqc_opc_get_vsi_parameters		= 0x0212,
161 
162 	i40e_aqc_opc_add_pv			= 0x0220,
163 	i40e_aqc_opc_update_pv_parameters	= 0x0221,
164 	i40e_aqc_opc_get_pv_parameters		= 0x0222,
165 
166 	i40e_aqc_opc_add_veb			= 0x0230,
167 	i40e_aqc_opc_update_veb_parameters	= 0x0231,
168 	i40e_aqc_opc_get_veb_parameters		= 0x0232,
169 
170 	i40e_aqc_opc_delete_element		= 0x0243,
171 
172 	i40e_aqc_opc_add_macvlan		= 0x0250,
173 	i40e_aqc_opc_remove_macvlan		= 0x0251,
174 	i40e_aqc_opc_add_vlan			= 0x0252,
175 	i40e_aqc_opc_remove_vlan		= 0x0253,
176 	i40e_aqc_opc_set_vsi_promiscuous_modes	= 0x0254,
177 	i40e_aqc_opc_add_tag			= 0x0255,
178 	i40e_aqc_opc_remove_tag			= 0x0256,
179 	i40e_aqc_opc_add_multicast_etag		= 0x0257,
180 	i40e_aqc_opc_remove_multicast_etag	= 0x0258,
181 	i40e_aqc_opc_update_tag			= 0x0259,
182 	i40e_aqc_opc_add_control_packet_filter	= 0x025A,
183 	i40e_aqc_opc_remove_control_packet_filter	= 0x025B,
184 	i40e_aqc_opc_add_cloud_filters		= 0x025C,
185 	i40e_aqc_opc_remove_cloud_filters	= 0x025D,
186 
187 	i40e_aqc_opc_add_mirror_rule	= 0x0260,
188 	i40e_aqc_opc_delete_mirror_rule	= 0x0261,
189 
190 	/* DCB commands */
191 	i40e_aqc_opc_dcb_ignore_pfc	= 0x0301,
192 	i40e_aqc_opc_dcb_updated	= 0x0302,
193 
194 	/* TX scheduler */
195 	i40e_aqc_opc_configure_vsi_bw_limit		= 0x0400,
196 	i40e_aqc_opc_configure_vsi_ets_sla_bw_limit	= 0x0406,
197 	i40e_aqc_opc_configure_vsi_tc_bw		= 0x0407,
198 	i40e_aqc_opc_query_vsi_bw_config		= 0x0408,
199 	i40e_aqc_opc_query_vsi_ets_sla_config		= 0x040A,
200 	i40e_aqc_opc_configure_switching_comp_bw_limit	= 0x0410,
201 
202 	i40e_aqc_opc_enable_switching_comp_ets			= 0x0413,
203 	i40e_aqc_opc_modify_switching_comp_ets			= 0x0414,
204 	i40e_aqc_opc_disable_switching_comp_ets			= 0x0415,
205 	i40e_aqc_opc_configure_switching_comp_ets_bw_limit	= 0x0416,
206 	i40e_aqc_opc_configure_switching_comp_bw_config		= 0x0417,
207 	i40e_aqc_opc_query_switching_comp_ets_config		= 0x0418,
208 	i40e_aqc_opc_query_port_ets_config			= 0x0419,
209 	i40e_aqc_opc_query_switching_comp_bw_config		= 0x041A,
210 	i40e_aqc_opc_suspend_port_tx				= 0x041B,
211 	i40e_aqc_opc_resume_port_tx				= 0x041C,
212 	i40e_aqc_opc_configure_partition_bw			= 0x041D,
213 
214 	/* hmc */
215 	i40e_aqc_opc_query_hmc_resource_profile	= 0x0500,
216 	i40e_aqc_opc_set_hmc_resource_profile	= 0x0501,
217 
218 	/* phy commands*/
219 	i40e_aqc_opc_get_phy_abilities		= 0x0600,
220 	i40e_aqc_opc_set_phy_config		= 0x0601,
221 	i40e_aqc_opc_set_mac_config		= 0x0603,
222 	i40e_aqc_opc_set_link_restart_an	= 0x0605,
223 	i40e_aqc_opc_get_link_status		= 0x0607,
224 	i40e_aqc_opc_set_phy_int_mask		= 0x0613,
225 	i40e_aqc_opc_get_local_advt_reg		= 0x0614,
226 	i40e_aqc_opc_set_local_advt_reg		= 0x0615,
227 	i40e_aqc_opc_get_partner_advt		= 0x0616,
228 	i40e_aqc_opc_set_lb_modes		= 0x0618,
229 	i40e_aqc_opc_get_phy_wol_caps		= 0x0621,
230 	i40e_aqc_opc_set_phy_debug		= 0x0622,
231 	i40e_aqc_opc_upload_ext_phy_fm		= 0x0625,
232 	i40e_aqc_opc_run_phy_activity		= 0x0626,
233 
234 	/* NVM commands */
235 	i40e_aqc_opc_nvm_read			= 0x0701,
236 	i40e_aqc_opc_nvm_erase			= 0x0702,
237 	i40e_aqc_opc_nvm_update			= 0x0703,
238 	i40e_aqc_opc_nvm_config_read		= 0x0704,
239 	i40e_aqc_opc_nvm_config_write		= 0x0705,
240 	i40e_aqc_opc_oem_post_update		= 0x0720,
241 	i40e_aqc_opc_thermal_sensor		= 0x0721,
242 
243 	/* virtualization commands */
244 	i40e_aqc_opc_send_msg_to_pf		= 0x0801,
245 	i40e_aqc_opc_send_msg_to_vf		= 0x0802,
246 	i40e_aqc_opc_send_msg_to_peer		= 0x0803,
247 
248 	/* alternate structure */
249 	i40e_aqc_opc_alternate_write		= 0x0900,
250 	i40e_aqc_opc_alternate_write_indirect	= 0x0901,
251 	i40e_aqc_opc_alternate_read		= 0x0902,
252 	i40e_aqc_opc_alternate_read_indirect	= 0x0903,
253 	i40e_aqc_opc_alternate_write_done	= 0x0904,
254 	i40e_aqc_opc_alternate_set_mode		= 0x0905,
255 	i40e_aqc_opc_alternate_clear_port	= 0x0906,
256 
257 	/* LLDP commands */
258 	i40e_aqc_opc_lldp_get_mib	= 0x0A00,
259 	i40e_aqc_opc_lldp_update_mib	= 0x0A01,
260 	i40e_aqc_opc_lldp_add_tlv	= 0x0A02,
261 	i40e_aqc_opc_lldp_update_tlv	= 0x0A03,
262 	i40e_aqc_opc_lldp_delete_tlv	= 0x0A04,
263 	i40e_aqc_opc_lldp_stop		= 0x0A05,
264 	i40e_aqc_opc_lldp_start		= 0x0A06,
265 	i40e_aqc_opc_get_cee_dcb_cfg	= 0x0A07,
266 	i40e_aqc_opc_lldp_set_local_mib	= 0x0A08,
267 	i40e_aqc_opc_lldp_stop_start_spec_agent	= 0x0A09,
268 
269 	/* Tunnel commands */
270 	i40e_aqc_opc_add_udp_tunnel	= 0x0B00,
271 	i40e_aqc_opc_del_udp_tunnel	= 0x0B01,
272 
273 	/* Async Events */
274 	i40e_aqc_opc_event_lan_overflow		= 0x1001,
275 
276 	/* OEM commands */
277 	i40e_aqc_opc_oem_parameter_change	= 0xFE00,
278 	i40e_aqc_opc_oem_device_status_change	= 0xFE01,
279 	i40e_aqc_opc_oem_ocsd_initialize	= 0xFE02,
280 	i40e_aqc_opc_oem_ocbb_initialize	= 0xFE03,
281 
282 	/* debug commands */
283 	i40e_aqc_opc_debug_read_reg		= 0xFF03,
284 	i40e_aqc_opc_debug_write_reg		= 0xFF04,
285 	i40e_aqc_opc_debug_modify_reg		= 0xFF07,
286 	i40e_aqc_opc_debug_dump_internals	= 0xFF08,
287 };
288 
289 /* command structures and indirect data structures */
290 
291 /* Structure naming conventions:
292  * - no suffix for direct command descriptor structures
293  * - _data for indirect sent data
294  * - _resp for indirect return data (data which is both will use _data)
295  * - _completion for direct return data
296  * - _element_ for repeated elements (may also be _data or _resp)
297  *
298  * Command structures are expected to overlay the params.raw member of the basic
299  * descriptor, and as such cannot exceed 16 bytes in length.
300  */
301 
302 /* This macro is used to generate a compilation error if a structure
303  * is not exactly the correct length. It gives a divide by zero error if the
304  * structure is not of the correct size, otherwise it creates an enum that is
305  * never used.
306  */
307 #define I40E_CHECK_STRUCT_LEN(n, X) enum i40e_static_assert_enum_##X \
308 	{ i40e_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
309 
310 /* This macro is used extensively to ensure that command structures are 16
311  * bytes in length as they have to map to the raw array of that size.
312  */
313 #define I40E_CHECK_CMD_LENGTH(X)	I40E_CHECK_STRUCT_LEN(16, X)
314 
315 /* internal (0x00XX) commands */
316 
317 /* Get version (direct 0x0001) */
318 struct i40e_aqc_get_version {
319 	__le32 rom_ver;
320 	__le32 fw_build;
321 	__le16 fw_major;
322 	__le16 fw_minor;
323 	__le16 api_major;
324 	__le16 api_minor;
325 };
326 
327 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_version);
328 
329 /* Send driver version (indirect 0x0002) */
330 struct i40e_aqc_driver_version {
331 	u8	driver_major_ver;
332 	u8	driver_minor_ver;
333 	u8	driver_build_ver;
334 	u8	driver_subbuild_ver;
335 	u8	reserved[4];
336 	__le32	address_high;
337 	__le32	address_low;
338 };
339 
340 I40E_CHECK_CMD_LENGTH(i40e_aqc_driver_version);
341 
342 /* Queue Shutdown (direct 0x0003) */
343 struct i40e_aqc_queue_shutdown {
344 	__le32	driver_unloading;
345 #define I40E_AQ_DRIVER_UNLOADING	0x1
346 	u8	reserved[12];
347 };
348 
349 I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown);
350 
351 /* Set PF context (0x0004, direct) */
352 struct i40e_aqc_set_pf_context {
353 	u8	pf_id;
354 	u8	reserved[15];
355 };
356 
357 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_pf_context);
358 
359 /* Request resource ownership (direct 0x0008)
360  * Release resource ownership (direct 0x0009)
361  */
362 #define I40E_AQ_RESOURCE_NVM			1
363 #define I40E_AQ_RESOURCE_SDP			2
364 #define I40E_AQ_RESOURCE_ACCESS_READ		1
365 #define I40E_AQ_RESOURCE_ACCESS_WRITE		2
366 #define I40E_AQ_RESOURCE_NVM_READ_TIMEOUT	3000
367 #define I40E_AQ_RESOURCE_NVM_WRITE_TIMEOUT	180000
368 
369 struct i40e_aqc_request_resource {
370 	__le16	resource_id;
371 	__le16	access_type;
372 	__le32	timeout;
373 	__le32	resource_number;
374 	u8	reserved[4];
375 };
376 
377 I40E_CHECK_CMD_LENGTH(i40e_aqc_request_resource);
378 
379 /* Get function capabilities (indirect 0x000A)
380  * Get device capabilities (indirect 0x000B)
381  */
382 struct i40e_aqc_list_capabilites {
383 	u8 command_flags;
384 #define I40E_AQ_LIST_CAP_PF_INDEX_EN	1
385 	u8 pf_index;
386 	u8 reserved[2];
387 	__le32 count;
388 	__le32 addr_high;
389 	__le32 addr_low;
390 };
391 
392 I40E_CHECK_CMD_LENGTH(i40e_aqc_list_capabilites);
393 
394 struct i40e_aqc_list_capabilities_element_resp {
395 	__le16	id;
396 	u8	major_rev;
397 	u8	minor_rev;
398 	__le32	number;
399 	__le32	logical_id;
400 	__le32	phys_id;
401 	u8	reserved[16];
402 };
403 
404 /* list of caps */
405 
406 #define I40E_AQ_CAP_ID_SWITCH_MODE	0x0001
407 #define I40E_AQ_CAP_ID_MNG_MODE		0x0002
408 #define I40E_AQ_CAP_ID_NPAR_ACTIVE	0x0003
409 #define I40E_AQ_CAP_ID_OS2BMC_CAP	0x0004
410 #define I40E_AQ_CAP_ID_FUNCTIONS_VALID	0x0005
411 #define I40E_AQ_CAP_ID_ALTERNATE_RAM	0x0006
412 #define I40E_AQ_CAP_ID_WOL_AND_PROXY	0x0008
413 #define I40E_AQ_CAP_ID_SRIOV		0x0012
414 #define I40E_AQ_CAP_ID_VF		0x0013
415 #define I40E_AQ_CAP_ID_VMDQ		0x0014
416 #define I40E_AQ_CAP_ID_8021QBG		0x0015
417 #define I40E_AQ_CAP_ID_8021QBR		0x0016
418 #define I40E_AQ_CAP_ID_VSI		0x0017
419 #define I40E_AQ_CAP_ID_DCB		0x0018
420 #define I40E_AQ_CAP_ID_FCOE		0x0021
421 #define I40E_AQ_CAP_ID_ISCSI		0x0022
422 #define I40E_AQ_CAP_ID_RSS		0x0040
423 #define I40E_AQ_CAP_ID_RXQ		0x0041
424 #define I40E_AQ_CAP_ID_TXQ		0x0042
425 #define I40E_AQ_CAP_ID_MSIX		0x0043
426 #define I40E_AQ_CAP_ID_VF_MSIX		0x0044
427 #define I40E_AQ_CAP_ID_FLOW_DIRECTOR	0x0045
428 #define I40E_AQ_CAP_ID_1588		0x0046
429 #define I40E_AQ_CAP_ID_IWARP		0x0051
430 #define I40E_AQ_CAP_ID_LED		0x0061
431 #define I40E_AQ_CAP_ID_SDP		0x0062
432 #define I40E_AQ_CAP_ID_MDIO		0x0063
433 #define I40E_AQ_CAP_ID_WSR_PROT		0x0064
434 #define I40E_AQ_CAP_ID_FLEX10		0x00F1
435 #define I40E_AQ_CAP_ID_CEM		0x00F2
436 
437 /* Set CPPM Configuration (direct 0x0103) */
438 struct i40e_aqc_cppm_configuration {
439 	__le16	command_flags;
440 #define I40E_AQ_CPPM_EN_LTRC	0x0800
441 #define I40E_AQ_CPPM_EN_DMCTH	0x1000
442 #define I40E_AQ_CPPM_EN_DMCTLX	0x2000
443 #define I40E_AQ_CPPM_EN_HPTC	0x4000
444 #define I40E_AQ_CPPM_EN_DMARC	0x8000
445 	__le16	ttlx;
446 	__le32	dmacr;
447 	__le16	dmcth;
448 	u8	hptc;
449 	u8	reserved;
450 	__le32	pfltrc;
451 };
452 
453 I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration);
454 
455 /* Set ARP Proxy command / response (indirect 0x0104) */
456 struct i40e_aqc_arp_proxy_data {
457 	__le16	command_flags;
458 #define I40E_AQ_ARP_INIT_IPV4	0x0008
459 #define I40E_AQ_ARP_UNSUP_CTL	0x0010
460 #define I40E_AQ_ARP_ENA		0x0020
461 #define I40E_AQ_ARP_ADD_IPV4	0x0040
462 #define I40E_AQ_ARP_DEL_IPV4	0x0080
463 	__le16	table_id;
464 	__le32	pfpm_proxyfc;
465 	__le32	ip_addr;
466 	u8	mac_addr[6];
467 	u8	reserved[2];
468 };
469 
470 I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_proxy_data);
471 
472 /* Set NS Proxy Table Entry Command (indirect 0x0105) */
473 struct i40e_aqc_ns_proxy_data {
474 	__le16	table_idx_mac_addr_0;
475 	__le16	table_idx_mac_addr_1;
476 	__le16	table_idx_ipv6_0;
477 	__le16	table_idx_ipv6_1;
478 	__le16	control;
479 #define I40E_AQ_NS_PROXY_ADD_0		0x0100
480 #define I40E_AQ_NS_PROXY_DEL_0		0x0200
481 #define I40E_AQ_NS_PROXY_ADD_1		0x0400
482 #define I40E_AQ_NS_PROXY_DEL_1		0x0800
483 #define I40E_AQ_NS_PROXY_ADD_IPV6_0	0x1000
484 #define I40E_AQ_NS_PROXY_DEL_IPV6_0	0x2000
485 #define I40E_AQ_NS_PROXY_ADD_IPV6_1	0x4000
486 #define I40E_AQ_NS_PROXY_DEL_IPV6_1	0x8000
487 #define I40E_AQ_NS_PROXY_COMMAND_SEQ	0x0001
488 #define I40E_AQ_NS_PROXY_INIT_IPV6_TBL	0x0002
489 #define I40E_AQ_NS_PROXY_INIT_MAC_TBL	0x0004
490 	u8	mac_addr_0[6];
491 	u8	mac_addr_1[6];
492 	u8	local_mac_addr[6];
493 	u8	ipv6_addr_0[16]; /* Warning! spec specifies BE byte order */
494 	u8	ipv6_addr_1[16];
495 };
496 
497 I40E_CHECK_STRUCT_LEN(0x3c, i40e_aqc_ns_proxy_data);
498 
499 /* Manage LAA Command (0x0106) - obsolete */
500 struct i40e_aqc_mng_laa {
501 	__le16	command_flags;
502 #define I40E_AQ_LAA_FLAG_WR	0x8000
503 	u8	reserved[2];
504 	__le32	sal;
505 	__le16	sah;
506 	u8	reserved2[6];
507 };
508 
509 I40E_CHECK_CMD_LENGTH(i40e_aqc_mng_laa);
510 
511 /* Manage MAC Address Read Command (indirect 0x0107) */
512 struct i40e_aqc_mac_address_read {
513 	__le16	command_flags;
514 #define I40E_AQC_LAN_ADDR_VALID		0x10
515 #define I40E_AQC_SAN_ADDR_VALID		0x20
516 #define I40E_AQC_PORT_ADDR_VALID	0x40
517 #define I40E_AQC_WOL_ADDR_VALID		0x80
518 #define I40E_AQC_MC_MAG_EN_VALID	0x100
519 #define I40E_AQC_ADDR_VALID_MASK	0x1F0
520 	u8	reserved[6];
521 	__le32	addr_high;
522 	__le32	addr_low;
523 };
524 
525 I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_read);
526 
527 struct i40e_aqc_mac_address_read_data {
528 	u8 pf_lan_mac[6];
529 	u8 pf_san_mac[6];
530 	u8 port_mac[6];
531 	u8 pf_wol_mac[6];
532 };
533 
534 I40E_CHECK_STRUCT_LEN(24, i40e_aqc_mac_address_read_data);
535 
536 /* Manage MAC Address Write Command (0x0108) */
537 struct i40e_aqc_mac_address_write {
538 	__le16	command_flags;
539 #define I40E_AQC_WRITE_TYPE_LAA_ONLY	0x0000
540 #define I40E_AQC_WRITE_TYPE_LAA_WOL	0x4000
541 #define I40E_AQC_WRITE_TYPE_PORT	0x8000
542 #define I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG	0xC000
543 #define I40E_AQC_WRITE_TYPE_MASK	0xC000
544 
545 	__le16	mac_sah;
546 	__le32	mac_sal;
547 	u8	reserved[8];
548 };
549 
550 I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_write);
551 
552 /* PXE commands (0x011x) */
553 
554 /* Clear PXE Command and response  (direct 0x0110) */
555 struct i40e_aqc_clear_pxe {
556 	u8	rx_cnt;
557 	u8	reserved[15];
558 };
559 
560 I40E_CHECK_CMD_LENGTH(i40e_aqc_clear_pxe);
561 
562 /* Switch configuration commands (0x02xx) */
563 
564 /* Used by many indirect commands that only pass an seid and a buffer in the
565  * command
566  */
567 struct i40e_aqc_switch_seid {
568 	__le16	seid;
569 	u8	reserved[6];
570 	__le32	addr_high;
571 	__le32	addr_low;
572 };
573 
574 I40E_CHECK_CMD_LENGTH(i40e_aqc_switch_seid);
575 
576 /* Get Switch Configuration command (indirect 0x0200)
577  * uses i40e_aqc_switch_seid for the descriptor
578  */
579 struct i40e_aqc_get_switch_config_header_resp {
580 	__le16	num_reported;
581 	__le16	num_total;
582 	u8	reserved[12];
583 };
584 
585 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_config_header_resp);
586 
587 struct i40e_aqc_switch_config_element_resp {
588 	u8	element_type;
589 #define I40E_AQ_SW_ELEM_TYPE_MAC	1
590 #define I40E_AQ_SW_ELEM_TYPE_PF		2
591 #define I40E_AQ_SW_ELEM_TYPE_VF		3
592 #define I40E_AQ_SW_ELEM_TYPE_EMP	4
593 #define I40E_AQ_SW_ELEM_TYPE_BMC	5
594 #define I40E_AQ_SW_ELEM_TYPE_PV		16
595 #define I40E_AQ_SW_ELEM_TYPE_VEB	17
596 #define I40E_AQ_SW_ELEM_TYPE_PA		18
597 #define I40E_AQ_SW_ELEM_TYPE_VSI	19
598 	u8	revision;
599 #define I40E_AQ_SW_ELEM_REV_1		1
600 	__le16	seid;
601 	__le16	uplink_seid;
602 	__le16	downlink_seid;
603 	u8	reserved[3];
604 	u8	connection_type;
605 #define I40E_AQ_CONN_TYPE_REGULAR	0x1
606 #define I40E_AQ_CONN_TYPE_DEFAULT	0x2
607 #define I40E_AQ_CONN_TYPE_CASCADED	0x3
608 	__le16	scheduler_id;
609 	__le16	element_info;
610 };
611 
612 I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_config_element_resp);
613 
614 /* Get Switch Configuration (indirect 0x0200)
615  *    an array of elements are returned in the response buffer
616  *    the first in the array is the header, remainder are elements
617  */
618 struct i40e_aqc_get_switch_config_resp {
619 	struct i40e_aqc_get_switch_config_header_resp	header;
620 	struct i40e_aqc_switch_config_element_resp	element[1];
621 };
622 
623 I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_switch_config_resp);
624 
625 /* Add Statistics (direct 0x0201)
626  * Remove Statistics (direct 0x0202)
627  */
628 struct i40e_aqc_add_remove_statistics {
629 	__le16	seid;
630 	__le16	vlan;
631 	__le16	stat_index;
632 	u8	reserved[10];
633 };
634 
635 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_statistics);
636 
637 /* Set Port Parameters command (direct 0x0203) */
638 struct i40e_aqc_set_port_parameters {
639 	__le16	command_flags;
640 #define I40E_AQ_SET_P_PARAMS_SAVE_BAD_PACKETS	1
641 #define I40E_AQ_SET_P_PARAMS_PAD_SHORT_PACKETS	2 /* must set! */
642 #define I40E_AQ_SET_P_PARAMS_DOUBLE_VLAN_ENA	4
643 	__le16	bad_frame_vsi;
644 	__le16	default_seid;        /* reserved for command */
645 	u8	reserved[10];
646 };
647 
648 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_port_parameters);
649 
650 /* Get Switch Resource Allocation (indirect 0x0204) */
651 struct i40e_aqc_get_switch_resource_alloc {
652 	u8	num_entries;         /* reserved for command */
653 	u8	reserved[7];
654 	__le32	addr_high;
655 	__le32	addr_low;
656 };
657 
658 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_resource_alloc);
659 
660 /* expect an array of these structs in the response buffer */
661 struct i40e_aqc_switch_resource_alloc_element_resp {
662 	u8	resource_type;
663 #define I40E_AQ_RESOURCE_TYPE_VEB		0x0
664 #define I40E_AQ_RESOURCE_TYPE_VSI		0x1
665 #define I40E_AQ_RESOURCE_TYPE_MACADDR		0x2
666 #define I40E_AQ_RESOURCE_TYPE_STAG		0x3
667 #define I40E_AQ_RESOURCE_TYPE_ETAG		0x4
668 #define I40E_AQ_RESOURCE_TYPE_MULTICAST_HASH	0x5
669 #define I40E_AQ_RESOURCE_TYPE_UNICAST_HASH	0x6
670 #define I40E_AQ_RESOURCE_TYPE_VLAN		0x7
671 #define I40E_AQ_RESOURCE_TYPE_VSI_LIST_ENTRY	0x8
672 #define I40E_AQ_RESOURCE_TYPE_ETAG_LIST_ENTRY	0x9
673 #define I40E_AQ_RESOURCE_TYPE_VLAN_STAT_POOL	0xA
674 #define I40E_AQ_RESOURCE_TYPE_MIRROR_RULE	0xB
675 #define I40E_AQ_RESOURCE_TYPE_QUEUE_SETS	0xC
676 #define I40E_AQ_RESOURCE_TYPE_VLAN_FILTERS	0xD
677 #define I40E_AQ_RESOURCE_TYPE_INNER_MAC_FILTERS	0xF
678 #define I40E_AQ_RESOURCE_TYPE_IP_FILTERS	0x10
679 #define I40E_AQ_RESOURCE_TYPE_GRE_VN_KEYS	0x11
680 #define I40E_AQ_RESOURCE_TYPE_VN2_KEYS		0x12
681 #define I40E_AQ_RESOURCE_TYPE_TUNNEL_PORTS	0x13
682 	u8	reserved1;
683 	__le16	guaranteed;
684 	__le16	total;
685 	__le16	used;
686 	__le16	total_unalloced;
687 	u8	reserved2[6];
688 };
689 
690 I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_resource_alloc_element_resp);
691 
692 /* Set Switch Configuration (direct 0x0205) */
693 struct i40e_aqc_set_switch_config {
694 	__le16	flags;
695 #define I40E_AQ_SET_SWITCH_CFG_PROMISC		0x0001
696 #define I40E_AQ_SET_SWITCH_CFG_L2_FILTER	0x0002
697 	__le16	valid_flags;
698 	u8	reserved[12];
699 };
700 
701 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_switch_config);
702 
703 /* Add VSI (indirect 0x0210)
704  *    this indirect command uses struct i40e_aqc_vsi_properties_data
705  *    as the indirect buffer (128 bytes)
706  *
707  * Update VSI (indirect 0x211)
708  *     uses the same data structure as Add VSI
709  *
710  * Get VSI (indirect 0x0212)
711  *     uses the same completion and data structure as Add VSI
712  */
713 struct i40e_aqc_add_get_update_vsi {
714 	__le16	uplink_seid;
715 	u8	connection_type;
716 #define I40E_AQ_VSI_CONN_TYPE_NORMAL	0x1
717 #define I40E_AQ_VSI_CONN_TYPE_DEFAULT	0x2
718 #define I40E_AQ_VSI_CONN_TYPE_CASCADED	0x3
719 	u8	reserved1;
720 	u8	vf_id;
721 	u8	reserved2;
722 	__le16	vsi_flags;
723 #define I40E_AQ_VSI_TYPE_SHIFT		0x0
724 #define I40E_AQ_VSI_TYPE_MASK		(0x3 << I40E_AQ_VSI_TYPE_SHIFT)
725 #define I40E_AQ_VSI_TYPE_VF		0x0
726 #define I40E_AQ_VSI_TYPE_VMDQ2		0x1
727 #define I40E_AQ_VSI_TYPE_PF		0x2
728 #define I40E_AQ_VSI_TYPE_EMP_MNG	0x3
729 #define I40E_AQ_VSI_FLAG_CASCADED_PV	0x4
730 	__le32	addr_high;
731 	__le32	addr_low;
732 };
733 
734 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi);
735 
736 struct i40e_aqc_add_get_update_vsi_completion {
737 	__le16 seid;
738 	__le16 vsi_number;
739 	__le16 vsi_used;
740 	__le16 vsi_free;
741 	__le32 addr_high;
742 	__le32 addr_low;
743 };
744 
745 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi_completion);
746 
747 struct i40e_aqc_vsi_properties_data {
748 	/* first 96 byte are written by SW */
749 	__le16	valid_sections;
750 #define I40E_AQ_VSI_PROP_SWITCH_VALID		0x0001
751 #define I40E_AQ_VSI_PROP_SECURITY_VALID		0x0002
752 #define I40E_AQ_VSI_PROP_VLAN_VALID		0x0004
753 #define I40E_AQ_VSI_PROP_CAS_PV_VALID		0x0008
754 #define I40E_AQ_VSI_PROP_INGRESS_UP_VALID	0x0010
755 #define I40E_AQ_VSI_PROP_EGRESS_UP_VALID	0x0020
756 #define I40E_AQ_VSI_PROP_QUEUE_MAP_VALID	0x0040
757 #define I40E_AQ_VSI_PROP_QUEUE_OPT_VALID	0x0080
758 #define I40E_AQ_VSI_PROP_OUTER_UP_VALID		0x0100
759 #define I40E_AQ_VSI_PROP_SCHED_VALID		0x0200
760 	/* switch section */
761 	__le16	switch_id; /* 12bit id combined with flags below */
762 #define I40E_AQ_VSI_SW_ID_SHIFT		0x0000
763 #define I40E_AQ_VSI_SW_ID_MASK		(0xFFF << I40E_AQ_VSI_SW_ID_SHIFT)
764 #define I40E_AQ_VSI_SW_ID_FLAG_NOT_STAG	0x1000
765 #define I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB	0x2000
766 #define I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB	0x4000
767 	u8	sw_reserved[2];
768 	/* security section */
769 	u8	sec_flags;
770 #define I40E_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD	0x01
771 #define I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK	0x02
772 #define I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK	0x04
773 	u8	sec_reserved;
774 	/* VLAN section */
775 	__le16	pvid; /* VLANS include priority bits */
776 	__le16	fcoe_pvid;
777 	u8	port_vlan_flags;
778 #define I40E_AQ_VSI_PVLAN_MODE_SHIFT	0x00
779 #define I40E_AQ_VSI_PVLAN_MODE_MASK	(0x03 << \
780 					 I40E_AQ_VSI_PVLAN_MODE_SHIFT)
781 #define I40E_AQ_VSI_PVLAN_MODE_TAGGED	0x01
782 #define I40E_AQ_VSI_PVLAN_MODE_UNTAGGED	0x02
783 #define I40E_AQ_VSI_PVLAN_MODE_ALL	0x03
784 #define I40E_AQ_VSI_PVLAN_INSERT_PVID	0x04
785 #define I40E_AQ_VSI_PVLAN_EMOD_SHIFT	0x03
786 #define I40E_AQ_VSI_PVLAN_EMOD_MASK	(0x3 << \
787 					 I40E_AQ_VSI_PVLAN_EMOD_SHIFT)
788 #define I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH	0x0
789 #define I40E_AQ_VSI_PVLAN_EMOD_STR_UP	0x08
790 #define I40E_AQ_VSI_PVLAN_EMOD_STR	0x10
791 #define I40E_AQ_VSI_PVLAN_EMOD_NOTHING	0x18
792 	u8	pvlan_reserved[3];
793 	/* ingress egress up sections */
794 	__le32	ingress_table; /* bitmap, 3 bits per up */
795 #define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT	0
796 #define I40E_AQ_VSI_UP_TABLE_UP0_MASK	(0x7 << \
797 					 I40E_AQ_VSI_UP_TABLE_UP0_SHIFT)
798 #define I40E_AQ_VSI_UP_TABLE_UP1_SHIFT	3
799 #define I40E_AQ_VSI_UP_TABLE_UP1_MASK	(0x7 << \
800 					 I40E_AQ_VSI_UP_TABLE_UP1_SHIFT)
801 #define I40E_AQ_VSI_UP_TABLE_UP2_SHIFT	6
802 #define I40E_AQ_VSI_UP_TABLE_UP2_MASK	(0x7 << \
803 					 I40E_AQ_VSI_UP_TABLE_UP2_SHIFT)
804 #define I40E_AQ_VSI_UP_TABLE_UP3_SHIFT	9
805 #define I40E_AQ_VSI_UP_TABLE_UP3_MASK	(0x7 << \
806 					 I40E_AQ_VSI_UP_TABLE_UP3_SHIFT)
807 #define I40E_AQ_VSI_UP_TABLE_UP4_SHIFT	12
808 #define I40E_AQ_VSI_UP_TABLE_UP4_MASK	(0x7 << \
809 					 I40E_AQ_VSI_UP_TABLE_UP4_SHIFT)
810 #define I40E_AQ_VSI_UP_TABLE_UP5_SHIFT	15
811 #define I40E_AQ_VSI_UP_TABLE_UP5_MASK	(0x7 << \
812 					 I40E_AQ_VSI_UP_TABLE_UP5_SHIFT)
813 #define I40E_AQ_VSI_UP_TABLE_UP6_SHIFT	18
814 #define I40E_AQ_VSI_UP_TABLE_UP6_MASK	(0x7 << \
815 					 I40E_AQ_VSI_UP_TABLE_UP6_SHIFT)
816 #define I40E_AQ_VSI_UP_TABLE_UP7_SHIFT	21
817 #define I40E_AQ_VSI_UP_TABLE_UP7_MASK	(0x7 << \
818 					 I40E_AQ_VSI_UP_TABLE_UP7_SHIFT)
819 	__le32	egress_table;   /* same defines as for ingress table */
820 	/* cascaded PV section */
821 	__le16	cas_pv_tag;
822 	u8	cas_pv_flags;
823 #define I40E_AQ_VSI_CAS_PV_TAGX_SHIFT		0x00
824 #define I40E_AQ_VSI_CAS_PV_TAGX_MASK		(0x03 << \
825 						 I40E_AQ_VSI_CAS_PV_TAGX_SHIFT)
826 #define I40E_AQ_VSI_CAS_PV_TAGX_LEAVE		0x00
827 #define I40E_AQ_VSI_CAS_PV_TAGX_REMOVE		0x01
828 #define I40E_AQ_VSI_CAS_PV_TAGX_COPY		0x02
829 #define I40E_AQ_VSI_CAS_PV_INSERT_TAG		0x10
830 #define I40E_AQ_VSI_CAS_PV_ETAG_PRUNE		0x20
831 #define I40E_AQ_VSI_CAS_PV_ACCEPT_HOST_TAG	0x40
832 	u8	cas_pv_reserved;
833 	/* queue mapping section */
834 	__le16	mapping_flags;
835 #define I40E_AQ_VSI_QUE_MAP_CONTIG	0x0
836 #define I40E_AQ_VSI_QUE_MAP_NONCONTIG	0x1
837 	__le16	queue_mapping[16];
838 #define I40E_AQ_VSI_QUEUE_SHIFT		0x0
839 #define I40E_AQ_VSI_QUEUE_MASK		(0x7FF << I40E_AQ_VSI_QUEUE_SHIFT)
840 	__le16	tc_mapping[8];
841 #define I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT	0
842 #define I40E_AQ_VSI_TC_QUE_OFFSET_MASK	(0x1FF << \
843 					 I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT)
844 #define I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT	9
845 #define I40E_AQ_VSI_TC_QUE_NUMBER_MASK	(0x7 << \
846 					 I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT)
847 	/* queueing option section */
848 	u8	queueing_opt_flags;
849 #define I40E_AQ_VSI_QUE_OPT_TCP_ENA	0x10
850 #define I40E_AQ_VSI_QUE_OPT_FCOE_ENA	0x20
851 	u8	queueing_opt_reserved[3];
852 	/* scheduler section */
853 	u8	up_enable_bits;
854 	u8	sched_reserved;
855 	/* outer up section */
856 	__le32	outer_up_table; /* same structure and defines as ingress table */
857 	u8	cmd_reserved[8];
858 	/* last 32 bytes are written by FW */
859 	__le16	qs_handle[8];
860 #define I40E_AQ_VSI_QS_HANDLE_INVALID	0xFFFF
861 	__le16	stat_counter_idx;
862 	__le16	sched_id;
863 	u8	resp_reserved[12];
864 };
865 
866 I40E_CHECK_STRUCT_LEN(128, i40e_aqc_vsi_properties_data);
867 
868 /* Add Port Virtualizer (direct 0x0220)
869  * also used for update PV (direct 0x0221) but only flags are used
870  * (IS_CTRL_PORT only works on add PV)
871  */
872 struct i40e_aqc_add_update_pv {
873 	__le16	command_flags;
874 #define I40E_AQC_PV_FLAG_PV_TYPE		0x1
875 #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_STAG_EN	0x2
876 #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_ETAG_EN	0x4
877 #define I40E_AQC_PV_FLAG_IS_CTRL_PORT		0x8
878 	__le16	uplink_seid;
879 	__le16	connected_seid;
880 	u8	reserved[10];
881 };
882 
883 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv);
884 
885 struct i40e_aqc_add_update_pv_completion {
886 	/* reserved for update; for add also encodes error if rc == ENOSPC */
887 	__le16	pv_seid;
888 #define I40E_AQC_PV_ERR_FLAG_NO_PV	0x1
889 #define I40E_AQC_PV_ERR_FLAG_NO_SCHED	0x2
890 #define I40E_AQC_PV_ERR_FLAG_NO_COUNTER	0x4
891 #define I40E_AQC_PV_ERR_FLAG_NO_ENTRY	0x8
892 	u8	reserved[14];
893 };
894 
895 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv_completion);
896 
897 /* Get PV Params (direct 0x0222)
898  * uses i40e_aqc_switch_seid for the descriptor
899  */
900 
901 struct i40e_aqc_get_pv_params_completion {
902 	__le16	seid;
903 	__le16	default_stag;
904 	__le16	pv_flags; /* same flags as add_pv */
905 #define I40E_AQC_GET_PV_PV_TYPE			0x1
906 #define I40E_AQC_GET_PV_FRWD_UNKNOWN_STAG	0x2
907 #define I40E_AQC_GET_PV_FRWD_UNKNOWN_ETAG	0x4
908 	u8	reserved[8];
909 	__le16	default_port_seid;
910 };
911 
912 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_pv_params_completion);
913 
914 /* Add VEB (direct 0x0230) */
915 struct i40e_aqc_add_veb {
916 	__le16	uplink_seid;
917 	__le16	downlink_seid;
918 	__le16	veb_flags;
919 #define I40E_AQC_ADD_VEB_FLOATING		0x1
920 #define I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT	1
921 #define I40E_AQC_ADD_VEB_PORT_TYPE_MASK		(0x3 << \
922 					I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT)
923 #define I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT	0x2
924 #define I40E_AQC_ADD_VEB_PORT_TYPE_DATA		0x4
925 #define I40E_AQC_ADD_VEB_ENABLE_L2_FILTER	0x8     /* deprecated */
926 #define I40E_AQC_ADD_VEB_ENABLE_DISABLE_STATS	0x10
927 	u8	enable_tcs;
928 	u8	reserved[9];
929 };
930 
931 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb);
932 
933 struct i40e_aqc_add_veb_completion {
934 	u8	reserved[6];
935 	__le16	switch_seid;
936 	/* also encodes error if rc == ENOSPC; codes are the same as add_pv */
937 	__le16	veb_seid;
938 #define I40E_AQC_VEB_ERR_FLAG_NO_VEB		0x1
939 #define I40E_AQC_VEB_ERR_FLAG_NO_SCHED		0x2
940 #define I40E_AQC_VEB_ERR_FLAG_NO_COUNTER	0x4
941 #define I40E_AQC_VEB_ERR_FLAG_NO_ENTRY		0x8
942 	__le16	statistic_index;
943 	__le16	vebs_used;
944 	__le16	vebs_free;
945 };
946 
947 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb_completion);
948 
949 /* Get VEB Parameters (direct 0x0232)
950  * uses i40e_aqc_switch_seid for the descriptor
951  */
952 struct i40e_aqc_get_veb_parameters_completion {
953 	__le16	seid;
954 	__le16	switch_id;
955 	__le16	veb_flags; /* only the first/last flags from 0x0230 is valid */
956 	__le16	statistic_index;
957 	__le16	vebs_used;
958 	__le16	vebs_free;
959 	u8	reserved[4];
960 };
961 
962 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_veb_parameters_completion);
963 
964 /* Delete Element (direct 0x0243)
965  * uses the generic i40e_aqc_switch_seid
966  */
967 
968 /* Add MAC-VLAN (indirect 0x0250) */
969 
970 /* used for the command for most vlan commands */
971 struct i40e_aqc_macvlan {
972 	__le16	num_addresses;
973 	__le16	seid[3];
974 #define I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT	0
975 #define I40E_AQC_MACVLAN_CMD_SEID_NUM_MASK	(0x3FF << \
976 					I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
977 #define I40E_AQC_MACVLAN_CMD_SEID_VALID		0x8000
978 	__le32	addr_high;
979 	__le32	addr_low;
980 };
981 
982 I40E_CHECK_CMD_LENGTH(i40e_aqc_macvlan);
983 
984 /* indirect data for command and response */
985 struct i40e_aqc_add_macvlan_element_data {
986 	u8	mac_addr[6];
987 	__le16	vlan_tag;
988 	__le16	flags;
989 #define I40E_AQC_MACVLAN_ADD_PERFECT_MATCH	0x0001
990 #define I40E_AQC_MACVLAN_ADD_HASH_MATCH		0x0002
991 #define I40E_AQC_MACVLAN_ADD_IGNORE_VLAN	0x0004
992 #define I40E_AQC_MACVLAN_ADD_TO_QUEUE		0x0008
993 #define I40E_AQC_MACVLAN_ADD_USE_SHARED_MAC	0x0010
994 	__le16	queue_number;
995 #define I40E_AQC_MACVLAN_CMD_QUEUE_SHIFT	0
996 #define I40E_AQC_MACVLAN_CMD_QUEUE_MASK		(0x7FF << \
997 					I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
998 	/* response section */
999 	u8	match_method;
1000 #define I40E_AQC_MM_PERFECT_MATCH	0x01
1001 #define I40E_AQC_MM_HASH_MATCH		0x02
1002 #define I40E_AQC_MM_ERR_NO_RES		0xFF
1003 	u8	reserved1[3];
1004 };
1005 
1006 struct i40e_aqc_add_remove_macvlan_completion {
1007 	__le16 perfect_mac_used;
1008 	__le16 perfect_mac_free;
1009 	__le16 unicast_hash_free;
1010 	__le16 multicast_hash_free;
1011 	__le32 addr_high;
1012 	__le32 addr_low;
1013 };
1014 
1015 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_macvlan_completion);
1016 
1017 /* Remove MAC-VLAN (indirect 0x0251)
1018  * uses i40e_aqc_macvlan for the descriptor
1019  * data points to an array of num_addresses of elements
1020  */
1021 
1022 struct i40e_aqc_remove_macvlan_element_data {
1023 	u8	mac_addr[6];
1024 	__le16	vlan_tag;
1025 	u8	flags;
1026 #define I40E_AQC_MACVLAN_DEL_PERFECT_MATCH	0x01
1027 #define I40E_AQC_MACVLAN_DEL_HASH_MATCH		0x02
1028 #define I40E_AQC_MACVLAN_DEL_IGNORE_VLAN	0x08
1029 #define I40E_AQC_MACVLAN_DEL_ALL_VSIS		0x10
1030 	u8	reserved[3];
1031 	/* reply section */
1032 	u8	error_code;
1033 #define I40E_AQC_REMOVE_MACVLAN_SUCCESS		0x0
1034 #define I40E_AQC_REMOVE_MACVLAN_FAIL		0xFF
1035 	u8	reply_reserved[3];
1036 };
1037 
1038 /* Add VLAN (indirect 0x0252)
1039  * Remove VLAN (indirect 0x0253)
1040  * use the generic i40e_aqc_macvlan for the command
1041  */
1042 struct i40e_aqc_add_remove_vlan_element_data {
1043 	__le16	vlan_tag;
1044 	u8	vlan_flags;
1045 /* flags for add VLAN */
1046 #define I40E_AQC_ADD_VLAN_LOCAL			0x1
1047 #define I40E_AQC_ADD_PVLAN_TYPE_SHIFT		1
1048 #define I40E_AQC_ADD_PVLAN_TYPE_MASK	(0x3 << I40E_AQC_ADD_PVLAN_TYPE_SHIFT)
1049 #define I40E_AQC_ADD_PVLAN_TYPE_REGULAR		0x0
1050 #define I40E_AQC_ADD_PVLAN_TYPE_PRIMARY		0x2
1051 #define I40E_AQC_ADD_PVLAN_TYPE_SECONDARY	0x4
1052 #define I40E_AQC_VLAN_PTYPE_SHIFT		3
1053 #define I40E_AQC_VLAN_PTYPE_MASK	(0x3 << I40E_AQC_VLAN_PTYPE_SHIFT)
1054 #define I40E_AQC_VLAN_PTYPE_REGULAR_VSI		0x0
1055 #define I40E_AQC_VLAN_PTYPE_PROMISC_VSI		0x8
1056 #define I40E_AQC_VLAN_PTYPE_COMMUNITY_VSI	0x10
1057 #define I40E_AQC_VLAN_PTYPE_ISOLATED_VSI	0x18
1058 /* flags for remove VLAN */
1059 #define I40E_AQC_REMOVE_VLAN_ALL	0x1
1060 	u8	reserved;
1061 	u8	result;
1062 /* flags for add VLAN */
1063 #define I40E_AQC_ADD_VLAN_SUCCESS	0x0
1064 #define I40E_AQC_ADD_VLAN_FAIL_REQUEST	0xFE
1065 #define I40E_AQC_ADD_VLAN_FAIL_RESOURCE	0xFF
1066 /* flags for remove VLAN */
1067 #define I40E_AQC_REMOVE_VLAN_SUCCESS	0x0
1068 #define I40E_AQC_REMOVE_VLAN_FAIL	0xFF
1069 	u8	reserved1[3];
1070 };
1071 
1072 struct i40e_aqc_add_remove_vlan_completion {
1073 	u8	reserved[4];
1074 	__le16	vlans_used;
1075 	__le16	vlans_free;
1076 	__le32	addr_high;
1077 	__le32	addr_low;
1078 };
1079 
1080 /* Set VSI Promiscuous Modes (direct 0x0254) */
1081 struct i40e_aqc_set_vsi_promiscuous_modes {
1082 	__le16	promiscuous_flags;
1083 	__le16	valid_flags;
1084 /* flags used for both fields above */
1085 #define I40E_AQC_SET_VSI_PROMISC_UNICAST	0x01
1086 #define I40E_AQC_SET_VSI_PROMISC_MULTICAST	0x02
1087 #define I40E_AQC_SET_VSI_PROMISC_BROADCAST	0x04
1088 #define I40E_AQC_SET_VSI_DEFAULT		0x08
1089 #define I40E_AQC_SET_VSI_PROMISC_VLAN		0x10
1090 #define I40E_AQC_SET_VSI_PROMISC_TX		0x8000
1091 	__le16	seid;
1092 #define I40E_AQC_VSI_PROM_CMD_SEID_MASK		0x3FF
1093 	__le16	vlan_tag;
1094 #define I40E_AQC_SET_VSI_VLAN_MASK		0x0FFF
1095 #define I40E_AQC_SET_VSI_VLAN_VALID		0x8000
1096 	u8	reserved[8];
1097 };
1098 
1099 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_vsi_promiscuous_modes);
1100 
1101 /* Add S/E-tag command (direct 0x0255)
1102  * Uses generic i40e_aqc_add_remove_tag_completion for completion
1103  */
1104 struct i40e_aqc_add_tag {
1105 	__le16	flags;
1106 #define I40E_AQC_ADD_TAG_FLAG_TO_QUEUE		0x0001
1107 	__le16	seid;
1108 #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT	0
1109 #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_MASK	(0x3FF << \
1110 					I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT)
1111 	__le16	tag;
1112 	__le16	queue_number;
1113 	u8	reserved[8];
1114 };
1115 
1116 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_tag);
1117 
1118 struct i40e_aqc_add_remove_tag_completion {
1119 	u8	reserved[12];
1120 	__le16	tags_used;
1121 	__le16	tags_free;
1122 };
1123 
1124 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_tag_completion);
1125 
1126 /* Remove S/E-tag command (direct 0x0256)
1127  * Uses generic i40e_aqc_add_remove_tag_completion for completion
1128  */
1129 struct i40e_aqc_remove_tag {
1130 	__le16	seid;
1131 #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT	0
1132 #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_MASK	(0x3FF << \
1133 					I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT)
1134 	__le16	tag;
1135 	u8	reserved[12];
1136 };
1137 
1138 I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_tag);
1139 
1140 /* Add multicast E-Tag (direct 0x0257)
1141  * del multicast E-Tag (direct 0x0258) only uses pv_seid and etag fields
1142  * and no external data
1143  */
1144 struct i40e_aqc_add_remove_mcast_etag {
1145 	__le16	pv_seid;
1146 	__le16	etag;
1147 	u8	num_unicast_etags;
1148 	u8	reserved[3];
1149 	__le32	addr_high;          /* address of array of 2-byte s-tags */
1150 	__le32	addr_low;
1151 };
1152 
1153 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag);
1154 
1155 struct i40e_aqc_add_remove_mcast_etag_completion {
1156 	u8	reserved[4];
1157 	__le16	mcast_etags_used;
1158 	__le16	mcast_etags_free;
1159 	__le32	addr_high;
1160 	__le32	addr_low;
1161 
1162 };
1163 
1164 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag_completion);
1165 
1166 /* Update S/E-Tag (direct 0x0259) */
1167 struct i40e_aqc_update_tag {
1168 	__le16	seid;
1169 #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT	0
1170 #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_MASK	(0x3FF << \
1171 					I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT)
1172 	__le16	old_tag;
1173 	__le16	new_tag;
1174 	u8	reserved[10];
1175 };
1176 
1177 I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag);
1178 
1179 struct i40e_aqc_update_tag_completion {
1180 	u8	reserved[12];
1181 	__le16	tags_used;
1182 	__le16	tags_free;
1183 };
1184 
1185 I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag_completion);
1186 
1187 /* Add Control Packet filter (direct 0x025A)
1188  * Remove Control Packet filter (direct 0x025B)
1189  * uses the i40e_aqc_add_oveb_cloud,
1190  * and the generic direct completion structure
1191  */
1192 struct i40e_aqc_add_remove_control_packet_filter {
1193 	u8	mac[6];
1194 	__le16	etype;
1195 	__le16	flags;
1196 #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC	0x0001
1197 #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP		0x0002
1198 #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE	0x0004
1199 #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX		0x0008
1200 #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX		0x0000
1201 	__le16	seid;
1202 #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT	0
1203 #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_MASK	(0x3FF << \
1204 				I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT)
1205 	__le16	queue;
1206 	u8	reserved[2];
1207 };
1208 
1209 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter);
1210 
1211 struct i40e_aqc_add_remove_control_packet_filter_completion {
1212 	__le16	mac_etype_used;
1213 	__le16	etype_used;
1214 	__le16	mac_etype_free;
1215 	__le16	etype_free;
1216 	u8	reserved[8];
1217 };
1218 
1219 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter_completion);
1220 
1221 /* Add Cloud filters (indirect 0x025C)
1222  * Remove Cloud filters (indirect 0x025D)
1223  * uses the i40e_aqc_add_remove_cloud_filters,
1224  * and the generic indirect completion structure
1225  */
1226 struct i40e_aqc_add_remove_cloud_filters {
1227 	u8	num_filters;
1228 	u8	reserved;
1229 	__le16	seid;
1230 #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT	0
1231 #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_MASK	(0x3FF << \
1232 					I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT)
1233 	u8	reserved2[4];
1234 	__le32	addr_high;
1235 	__le32	addr_low;
1236 };
1237 
1238 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_cloud_filters);
1239 
1240 struct i40e_aqc_add_remove_cloud_filters_element_data {
1241 	u8	outer_mac[6];
1242 	u8	inner_mac[6];
1243 	__le16	inner_vlan;
1244 	union {
1245 		struct {
1246 			u8 reserved[12];
1247 			u8 data[4];
1248 		} v4;
1249 		struct {
1250 			u8 data[16];
1251 		} v6;
1252 	} ipaddr;
1253 	__le16	flags;
1254 #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT			0
1255 #define I40E_AQC_ADD_CLOUD_FILTER_MASK	(0x3F << \
1256 					I40E_AQC_ADD_CLOUD_FILTER_SHIFT)
1257 /* 0x0000 reserved */
1258 #define I40E_AQC_ADD_CLOUD_FILTER_OIP			0x0001
1259 /* 0x0002 reserved */
1260 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN		0x0003
1261 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID	0x0004
1262 /* 0x0005 reserved */
1263 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID		0x0006
1264 /* 0x0007 reserved */
1265 /* 0x0008 reserved */
1266 #define I40E_AQC_ADD_CLOUD_FILTER_OMAC			0x0009
1267 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC			0x000A
1268 #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC	0x000B
1269 #define I40E_AQC_ADD_CLOUD_FILTER_IIP			0x000C
1270 
1271 #define I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE		0x0080
1272 #define I40E_AQC_ADD_CLOUD_VNK_SHIFT			6
1273 #define I40E_AQC_ADD_CLOUD_VNK_MASK			0x00C0
1274 #define I40E_AQC_ADD_CLOUD_FLAGS_IPV4			0
1275 #define I40E_AQC_ADD_CLOUD_FLAGS_IPV6			0x0100
1276 
1277 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT		9
1278 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK		0x1E00
1279 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN		0
1280 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC		1
1281 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE		2
1282 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_IP			3
1283 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_RESERVED		4
1284 #define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN_GPE		5
1285 
1286 #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_MAC	0x2000
1287 #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_INNER_MAC	0x4000
1288 #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_IP	0x8000
1289 
1290 	__le32	tenant_id;
1291 	u8	reserved[4];
1292 	__le16	queue_number;
1293 #define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT		0
1294 #define I40E_AQC_ADD_CLOUD_QUEUE_MASK		(0x7FF << \
1295 						 I40E_AQC_ADD_CLOUD_QUEUE_SHIFT)
1296 	u8	reserved2[14];
1297 	/* response section */
1298 	u8	allocation_result;
1299 #define I40E_AQC_ADD_CLOUD_FILTER_SUCCESS	0x0
1300 #define I40E_AQC_ADD_CLOUD_FILTER_FAIL		0xFF
1301 	u8	response_reserved[7];
1302 };
1303 
1304 struct i40e_aqc_remove_cloud_filters_completion {
1305 	__le16 perfect_ovlan_used;
1306 	__le16 perfect_ovlan_free;
1307 	__le16 vlan_used;
1308 	__le16 vlan_free;
1309 	__le32 addr_high;
1310 	__le32 addr_low;
1311 };
1312 
1313 I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_cloud_filters_completion);
1314 
1315 /* Add Mirror Rule (indirect or direct 0x0260)
1316  * Delete Mirror Rule (indirect or direct 0x0261)
1317  * note: some rule types (4,5) do not use an external buffer.
1318  *       take care to set the flags correctly.
1319  */
1320 struct i40e_aqc_add_delete_mirror_rule {
1321 	__le16 seid;
1322 	__le16 rule_type;
1323 #define I40E_AQC_MIRROR_RULE_TYPE_SHIFT		0
1324 #define I40E_AQC_MIRROR_RULE_TYPE_MASK		(0x7 << \
1325 						I40E_AQC_MIRROR_RULE_TYPE_SHIFT)
1326 #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_INGRESS	1
1327 #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_EGRESS	2
1328 #define I40E_AQC_MIRROR_RULE_TYPE_VLAN		3
1329 #define I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS	4
1330 #define I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS	5
1331 	__le16 num_entries;
1332 	__le16 destination;  /* VSI for add, rule id for delete */
1333 	__le32 addr_high;    /* address of array of 2-byte VSI or VLAN ids */
1334 	__le32 addr_low;
1335 };
1336 
1337 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule);
1338 
1339 struct i40e_aqc_add_delete_mirror_rule_completion {
1340 	u8	reserved[2];
1341 	__le16	rule_id;  /* only used on add */
1342 	__le16	mirror_rules_used;
1343 	__le16	mirror_rules_free;
1344 	__le32	addr_high;
1345 	__le32	addr_low;
1346 };
1347 
1348 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule_completion);
1349 
1350 /* DCB 0x03xx*/
1351 
1352 /* PFC Ignore (direct 0x0301)
1353  *    the command and response use the same descriptor structure
1354  */
1355 struct i40e_aqc_pfc_ignore {
1356 	u8	tc_bitmap;
1357 	u8	command_flags; /* unused on response */
1358 #define I40E_AQC_PFC_IGNORE_SET		0x80
1359 #define I40E_AQC_PFC_IGNORE_CLEAR	0x0
1360 	u8	reserved[14];
1361 };
1362 
1363 I40E_CHECK_CMD_LENGTH(i40e_aqc_pfc_ignore);
1364 
1365 /* DCB Update (direct 0x0302) uses the i40e_aq_desc structure
1366  * with no parameters
1367  */
1368 
1369 /* TX scheduler 0x04xx */
1370 
1371 /* Almost all the indirect commands use
1372  * this generic struct to pass the SEID in param0
1373  */
1374 struct i40e_aqc_tx_sched_ind {
1375 	__le16	vsi_seid;
1376 	u8	reserved[6];
1377 	__le32	addr_high;
1378 	__le32	addr_low;
1379 };
1380 
1381 I40E_CHECK_CMD_LENGTH(i40e_aqc_tx_sched_ind);
1382 
1383 /* Several commands respond with a set of queue set handles */
1384 struct i40e_aqc_qs_handles_resp {
1385 	__le16 qs_handles[8];
1386 };
1387 
1388 /* Configure VSI BW limits (direct 0x0400) */
1389 struct i40e_aqc_configure_vsi_bw_limit {
1390 	__le16	vsi_seid;
1391 	u8	reserved[2];
1392 	__le16	credit;
1393 	u8	reserved1[2];
1394 	u8	max_credit; /* 0-3, limit = 2^max */
1395 	u8	reserved2[7];
1396 };
1397 
1398 I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_vsi_bw_limit);
1399 
1400 /* Configure VSI Bandwidth Limit per Traffic Type (indirect 0x0406)
1401  *    responds with i40e_aqc_qs_handles_resp
1402  */
1403 struct i40e_aqc_configure_vsi_ets_sla_bw_data {
1404 	u8	tc_valid_bits;
1405 	u8	reserved[15];
1406 	__le16	tc_bw_credits[8]; /* FW writesback QS handles here */
1407 
1408 	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1409 	__le16	tc_bw_max[2];
1410 	u8	reserved1[28];
1411 };
1412 
1413 I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_configure_vsi_ets_sla_bw_data);
1414 
1415 /* Configure VSI Bandwidth Allocation per Traffic Type (indirect 0x0407)
1416  *    responds with i40e_aqc_qs_handles_resp
1417  */
1418 struct i40e_aqc_configure_vsi_tc_bw_data {
1419 	u8	tc_valid_bits;
1420 	u8	reserved[3];
1421 	u8	tc_bw_credits[8];
1422 	u8	reserved1[4];
1423 	__le16	qs_handles[8];
1424 };
1425 
1426 I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_vsi_tc_bw_data);
1427 
1428 /* Query vsi bw configuration (indirect 0x0408) */
1429 struct i40e_aqc_query_vsi_bw_config_resp {
1430 	u8	tc_valid_bits;
1431 	u8	tc_suspended_bits;
1432 	u8	reserved[14];
1433 	__le16	qs_handles[8];
1434 	u8	reserved1[4];
1435 	__le16	port_bw_limit;
1436 	u8	reserved2[2];
1437 	u8	max_bw; /* 0-3, limit = 2^max */
1438 	u8	reserved3[23];
1439 };
1440 
1441 I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_vsi_bw_config_resp);
1442 
1443 /* Query VSI Bandwidth Allocation per Traffic Type (indirect 0x040A) */
1444 struct i40e_aqc_query_vsi_ets_sla_config_resp {
1445 	u8	tc_valid_bits;
1446 	u8	reserved[3];
1447 	u8	share_credits[8];
1448 	__le16	credits[8];
1449 
1450 	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1451 	__le16	tc_bw_max[2];
1452 };
1453 
1454 I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_vsi_ets_sla_config_resp);
1455 
1456 /* Configure Switching Component Bandwidth Limit (direct 0x0410) */
1457 struct i40e_aqc_configure_switching_comp_bw_limit {
1458 	__le16	seid;
1459 	u8	reserved[2];
1460 	__le16	credit;
1461 	u8	reserved1[2];
1462 	u8	max_bw; /* 0-3, limit = 2^max */
1463 	u8	reserved2[7];
1464 };
1465 
1466 I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_switching_comp_bw_limit);
1467 
1468 /* Enable  Physical Port ETS (indirect 0x0413)
1469  * Modify  Physical Port ETS (indirect 0x0414)
1470  * Disable Physical Port ETS (indirect 0x0415)
1471  */
1472 struct i40e_aqc_configure_switching_comp_ets_data {
1473 	u8	reserved[4];
1474 	u8	tc_valid_bits;
1475 	u8	seepage;
1476 #define I40E_AQ_ETS_SEEPAGE_EN_MASK	0x1
1477 	u8	tc_strict_priority_flags;
1478 	u8	reserved1[17];
1479 	u8	tc_bw_share_credits[8];
1480 	u8	reserved2[96];
1481 };
1482 
1483 I40E_CHECK_STRUCT_LEN(0x80, i40e_aqc_configure_switching_comp_ets_data);
1484 
1485 /* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */
1486 struct i40e_aqc_configure_switching_comp_ets_bw_limit_data {
1487 	u8	tc_valid_bits;
1488 	u8	reserved[15];
1489 	__le16	tc_bw_credit[8];
1490 
1491 	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1492 	__le16	tc_bw_max[2];
1493 	u8	reserved1[28];
1494 };
1495 
1496 I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_configure_switching_comp_ets_bw_limit_data);
1497 
1498 /* Configure Switching Component Bandwidth Allocation per Tc
1499  * (indirect 0x0417)
1500  */
1501 struct i40e_aqc_configure_switching_comp_bw_config_data {
1502 	u8	tc_valid_bits;
1503 	u8	reserved[2];
1504 	u8	absolute_credits; /* bool */
1505 	u8	tc_bw_share_credits[8];
1506 	u8	reserved1[20];
1507 };
1508 
1509 I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_switching_comp_bw_config_data);
1510 
1511 /* Query Switching Component Configuration (indirect 0x0418) */
1512 struct i40e_aqc_query_switching_comp_ets_config_resp {
1513 	u8	tc_valid_bits;
1514 	u8	reserved[35];
1515 	__le16	port_bw_limit;
1516 	u8	reserved1[2];
1517 	u8	tc_bw_max; /* 0-3, limit = 2^max */
1518 	u8	reserved2[23];
1519 };
1520 
1521 I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_switching_comp_ets_config_resp);
1522 
1523 /* Query PhysicalPort ETS Configuration (indirect 0x0419) */
1524 struct i40e_aqc_query_port_ets_config_resp {
1525 	u8	reserved[4];
1526 	u8	tc_valid_bits;
1527 	u8	reserved1;
1528 	u8	tc_strict_priority_bits;
1529 	u8	reserved2;
1530 	u8	tc_bw_share_credits[8];
1531 	__le16	tc_bw_limits[8];
1532 
1533 	/* 4 bits per tc 0-7, 4th bit reserved, limit = 2^max */
1534 	__le16	tc_bw_max[2];
1535 	u8	reserved3[32];
1536 };
1537 
1538 I40E_CHECK_STRUCT_LEN(0x44, i40e_aqc_query_port_ets_config_resp);
1539 
1540 /* Query Switching Component Bandwidth Allocation per Traffic Type
1541  * (indirect 0x041A)
1542  */
1543 struct i40e_aqc_query_switching_comp_bw_config_resp {
1544 	u8	tc_valid_bits;
1545 	u8	reserved[2];
1546 	u8	absolute_credits_enable; /* bool */
1547 	u8	tc_bw_share_credits[8];
1548 	__le16	tc_bw_limits[8];
1549 
1550 	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1551 	__le16	tc_bw_max[2];
1552 };
1553 
1554 I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_switching_comp_bw_config_resp);
1555 
1556 /* Suspend/resume port TX traffic
1557  * (direct 0x041B and 0x041C) uses the generic SEID struct
1558  */
1559 
1560 /* Configure partition BW
1561  * (indirect 0x041D)
1562  */
1563 struct i40e_aqc_configure_partition_bw_data {
1564 	__le16	pf_valid_bits;
1565 	u8	min_bw[16];      /* guaranteed bandwidth */
1566 	u8	max_bw[16];      /* bandwidth limit */
1567 };
1568 
1569 I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data);
1570 
1571 /* Get and set the active HMC resource profile and status.
1572  * (direct 0x0500) and (direct 0x0501)
1573  */
1574 struct i40e_aq_get_set_hmc_resource_profile {
1575 	u8	pm_profile;
1576 	u8	pe_vf_enabled;
1577 	u8	reserved[14];
1578 };
1579 
1580 I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile);
1581 
1582 enum i40e_aq_hmc_profile {
1583 	/* I40E_HMC_PROFILE_NO_CHANGE    = 0, reserved */
1584 	I40E_HMC_PROFILE_DEFAULT	= 1,
1585 	I40E_HMC_PROFILE_FAVOR_VF	= 2,
1586 	I40E_HMC_PROFILE_EQUAL		= 3,
1587 };
1588 
1589 #define I40E_AQ_GET_HMC_RESOURCE_PROFILE_PM_MASK	0xF
1590 #define I40E_AQ_GET_HMC_RESOURCE_PROFILE_COUNT_MASK	0x3F
1591 
1592 /* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */
1593 
1594 /* set in param0 for get phy abilities to report qualified modules */
1595 #define I40E_AQ_PHY_REPORT_QUALIFIED_MODULES	0x0001
1596 #define I40E_AQ_PHY_REPORT_INITIAL_VALUES	0x0002
1597 
1598 enum i40e_aq_phy_type {
1599 	I40E_PHY_TYPE_SGMII			= 0x0,
1600 	I40E_PHY_TYPE_1000BASE_KX		= 0x1,
1601 	I40E_PHY_TYPE_10GBASE_KX4		= 0x2,
1602 	I40E_PHY_TYPE_10GBASE_KR		= 0x3,
1603 	I40E_PHY_TYPE_40GBASE_KR4		= 0x4,
1604 	I40E_PHY_TYPE_XAUI			= 0x5,
1605 	I40E_PHY_TYPE_XFI			= 0x6,
1606 	I40E_PHY_TYPE_SFI			= 0x7,
1607 	I40E_PHY_TYPE_XLAUI			= 0x8,
1608 	I40E_PHY_TYPE_XLPPI			= 0x9,
1609 	I40E_PHY_TYPE_40GBASE_CR4_CU		= 0xA,
1610 	I40E_PHY_TYPE_10GBASE_CR1_CU		= 0xB,
1611 	I40E_PHY_TYPE_10GBASE_AOC		= 0xC,
1612 	I40E_PHY_TYPE_40GBASE_AOC		= 0xD,
1613 	I40E_PHY_TYPE_100BASE_TX		= 0x11,
1614 	I40E_PHY_TYPE_1000BASE_T		= 0x12,
1615 	I40E_PHY_TYPE_10GBASE_T			= 0x13,
1616 	I40E_PHY_TYPE_10GBASE_SR		= 0x14,
1617 	I40E_PHY_TYPE_10GBASE_LR		= 0x15,
1618 	I40E_PHY_TYPE_10GBASE_SFPP_CU		= 0x16,
1619 	I40E_PHY_TYPE_10GBASE_CR1		= 0x17,
1620 	I40E_PHY_TYPE_40GBASE_CR4		= 0x18,
1621 	I40E_PHY_TYPE_40GBASE_SR4		= 0x19,
1622 	I40E_PHY_TYPE_40GBASE_LR4		= 0x1A,
1623 	I40E_PHY_TYPE_1000BASE_SX		= 0x1B,
1624 	I40E_PHY_TYPE_1000BASE_LX		= 0x1C,
1625 	I40E_PHY_TYPE_1000BASE_T_OPTICAL	= 0x1D,
1626 	I40E_PHY_TYPE_20GBASE_KR2		= 0x1E,
1627 	I40E_PHY_TYPE_MAX
1628 };
1629 
1630 #define I40E_LINK_SPEED_100MB_SHIFT	0x1
1631 #define I40E_LINK_SPEED_1000MB_SHIFT	0x2
1632 #define I40E_LINK_SPEED_10GB_SHIFT	0x3
1633 #define I40E_LINK_SPEED_40GB_SHIFT	0x4
1634 #define I40E_LINK_SPEED_20GB_SHIFT	0x5
1635 
1636 enum i40e_aq_link_speed {
1637 	I40E_LINK_SPEED_UNKNOWN	= 0,
1638 	I40E_LINK_SPEED_100MB	= (1 << I40E_LINK_SPEED_100MB_SHIFT),
1639 	I40E_LINK_SPEED_1GB	= (1 << I40E_LINK_SPEED_1000MB_SHIFT),
1640 	I40E_LINK_SPEED_10GB	= (1 << I40E_LINK_SPEED_10GB_SHIFT),
1641 	I40E_LINK_SPEED_40GB	= (1 << I40E_LINK_SPEED_40GB_SHIFT),
1642 	I40E_LINK_SPEED_20GB	= (1 << I40E_LINK_SPEED_20GB_SHIFT)
1643 };
1644 
1645 struct i40e_aqc_module_desc {
1646 	u8 oui[3];
1647 	u8 reserved1;
1648 	u8 part_number[16];
1649 	u8 revision[4];
1650 	u8 reserved2[8];
1651 };
1652 
1653 I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_module_desc);
1654 
1655 struct i40e_aq_get_phy_abilities_resp {
1656 	__le32	phy_type;       /* bitmap using the above enum for offsets */
1657 	u8	link_speed;     /* bitmap using the above enum bit patterns */
1658 	u8	abilities;
1659 #define I40E_AQ_PHY_FLAG_PAUSE_TX	0x01
1660 #define I40E_AQ_PHY_FLAG_PAUSE_RX	0x02
1661 #define I40E_AQ_PHY_FLAG_LOW_POWER	0x04
1662 #define I40E_AQ_PHY_LINK_ENABLED	0x08
1663 #define I40E_AQ_PHY_AN_ENABLED		0x10
1664 #define I40E_AQ_PHY_FLAG_MODULE_QUAL	0x20
1665 	__le16	eee_capability;
1666 #define I40E_AQ_EEE_100BASE_TX		0x0002
1667 #define I40E_AQ_EEE_1000BASE_T		0x0004
1668 #define I40E_AQ_EEE_10GBASE_T		0x0008
1669 #define I40E_AQ_EEE_1000BASE_KX		0x0010
1670 #define I40E_AQ_EEE_10GBASE_KX4		0x0020
1671 #define I40E_AQ_EEE_10GBASE_KR		0x0040
1672 	__le32	eeer_val;
1673 	u8	d3_lpan;
1674 #define I40E_AQ_SET_PHY_D3_LPAN_ENA	0x01
1675 	u8	reserved[3];
1676 	u8	phy_id[4];
1677 	u8	module_type[3];
1678 	u8	qualified_module_count;
1679 #define I40E_AQ_PHY_MAX_QMS		16
1680 	struct i40e_aqc_module_desc	qualified_module[I40E_AQ_PHY_MAX_QMS];
1681 };
1682 
1683 I40E_CHECK_STRUCT_LEN(0x218, i40e_aq_get_phy_abilities_resp);
1684 
1685 /* Set PHY Config (direct 0x0601) */
1686 struct i40e_aq_set_phy_config { /* same bits as above in all */
1687 	__le32	phy_type;
1688 	u8	link_speed;
1689 	u8	abilities;
1690 /* bits 0-2 use the values from get_phy_abilities_resp */
1691 #define I40E_AQ_PHY_ENABLE_LINK		0x08
1692 #define I40E_AQ_PHY_ENABLE_AN		0x10
1693 #define I40E_AQ_PHY_ENABLE_ATOMIC_LINK	0x20
1694 	__le16	eee_capability;
1695 	__le32	eeer;
1696 	u8	low_power_ctrl;
1697 	u8	reserved[3];
1698 };
1699 
1700 I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
1701 
1702 /* Set MAC Config command data structure (direct 0x0603) */
1703 struct i40e_aq_set_mac_config {
1704 	__le16	max_frame_size;
1705 	u8	params;
1706 #define I40E_AQ_SET_MAC_CONFIG_CRC_EN		0x04
1707 #define I40E_AQ_SET_MAC_CONFIG_PACING_MASK	0x78
1708 #define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT	3
1709 #define I40E_AQ_SET_MAC_CONFIG_PACING_NONE	0x0
1710 #define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX	0xF
1711 #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX	0x9
1712 #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX	0x8
1713 #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX	0x7
1714 #define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX	0x6
1715 #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX	0x5
1716 #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX	0x4
1717 #define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX	0x3
1718 #define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX	0x2
1719 #define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX	0x1
1720 	u8	tx_timer_priority; /* bitmap */
1721 	__le16	tx_timer_value;
1722 	__le16	fc_refresh_threshold;
1723 	u8	reserved[8];
1724 };
1725 
1726 I40E_CHECK_CMD_LENGTH(i40e_aq_set_mac_config);
1727 
1728 /* Restart Auto-Negotiation (direct 0x605) */
1729 struct i40e_aqc_set_link_restart_an {
1730 	u8	command;
1731 #define I40E_AQ_PHY_RESTART_AN	0x02
1732 #define I40E_AQ_PHY_LINK_ENABLE	0x04
1733 	u8	reserved[15];
1734 };
1735 
1736 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_link_restart_an);
1737 
1738 /* Get Link Status cmd & response data structure (direct 0x0607) */
1739 struct i40e_aqc_get_link_status {
1740 	__le16	command_flags; /* only field set on command */
1741 #define I40E_AQ_LSE_MASK		0x3
1742 #define I40E_AQ_LSE_NOP			0x0
1743 #define I40E_AQ_LSE_DISABLE		0x2
1744 #define I40E_AQ_LSE_ENABLE		0x3
1745 /* only response uses this flag */
1746 #define I40E_AQ_LSE_IS_ENABLED		0x1
1747 	u8	phy_type;    /* i40e_aq_phy_type   */
1748 	u8	link_speed;  /* i40e_aq_link_speed */
1749 	u8	link_info;
1750 #define I40E_AQ_LINK_UP			0x01    /* obsolete */
1751 #define I40E_AQ_LINK_UP_FUNCTION	0x01
1752 #define I40E_AQ_LINK_FAULT		0x02
1753 #define I40E_AQ_LINK_FAULT_TX		0x04
1754 #define I40E_AQ_LINK_FAULT_RX		0x08
1755 #define I40E_AQ_LINK_FAULT_REMOTE	0x10
1756 #define I40E_AQ_LINK_UP_PORT		0x20
1757 #define I40E_AQ_MEDIA_AVAILABLE		0x40
1758 #define I40E_AQ_SIGNAL_DETECT		0x80
1759 	u8	an_info;
1760 #define I40E_AQ_AN_COMPLETED		0x01
1761 #define I40E_AQ_LP_AN_ABILITY		0x02
1762 #define I40E_AQ_PD_FAULT		0x04
1763 #define I40E_AQ_FEC_EN			0x08
1764 #define I40E_AQ_PHY_LOW_POWER		0x10
1765 #define I40E_AQ_LINK_PAUSE_TX		0x20
1766 #define I40E_AQ_LINK_PAUSE_RX		0x40
1767 #define I40E_AQ_QUALIFIED_MODULE	0x80
1768 	u8	ext_info;
1769 #define I40E_AQ_LINK_PHY_TEMP_ALARM	0x01
1770 #define I40E_AQ_LINK_XCESSIVE_ERRORS	0x02
1771 #define I40E_AQ_LINK_TX_SHIFT		0x02
1772 #define I40E_AQ_LINK_TX_MASK		(0x03 << I40E_AQ_LINK_TX_SHIFT)
1773 #define I40E_AQ_LINK_TX_ACTIVE		0x00
1774 #define I40E_AQ_LINK_TX_DRAINED		0x01
1775 #define I40E_AQ_LINK_TX_FLUSHED		0x03
1776 #define I40E_AQ_LINK_FORCED_40G		0x10
1777 	u8	loopback; /* use defines from i40e_aqc_set_lb_mode */
1778 	__le16	max_frame_size;
1779 	u8	config;
1780 #define I40E_AQ_CONFIG_CRC_ENA		0x04
1781 #define I40E_AQ_CONFIG_PACING_MASK	0x78
1782 	u8	external_power_ability;
1783 #define I40E_AQ_LINK_POWER_CLASS_1	0x00
1784 #define I40E_AQ_LINK_POWER_CLASS_2	0x01
1785 #define I40E_AQ_LINK_POWER_CLASS_3	0x02
1786 #define I40E_AQ_LINK_POWER_CLASS_4	0x03
1787 	u8	reserved[4];
1788 };
1789 
1790 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_link_status);
1791 
1792 /* Set event mask command (direct 0x613) */
1793 struct i40e_aqc_set_phy_int_mask {
1794 	u8	reserved[8];
1795 	__le16	event_mask;
1796 #define I40E_AQ_EVENT_LINK_UPDOWN	0x0002
1797 #define I40E_AQ_EVENT_MEDIA_NA		0x0004
1798 #define I40E_AQ_EVENT_LINK_FAULT	0x0008
1799 #define I40E_AQ_EVENT_PHY_TEMP_ALARM	0x0010
1800 #define I40E_AQ_EVENT_EXCESSIVE_ERRORS	0x0020
1801 #define I40E_AQ_EVENT_SIGNAL_DETECT	0x0040
1802 #define I40E_AQ_EVENT_AN_COMPLETED	0x0080
1803 #define I40E_AQ_EVENT_MODULE_QUAL_FAIL	0x0100
1804 #define I40E_AQ_EVENT_PORT_TX_SUSPENDED	0x0200
1805 	u8	reserved1[6];
1806 };
1807 
1808 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_int_mask);
1809 
1810 /* Get Local AN advt register (direct 0x0614)
1811  * Set Local AN advt register (direct 0x0615)
1812  * Get Link Partner AN advt register (direct 0x0616)
1813  */
1814 struct i40e_aqc_an_advt_reg {
1815 	__le32	local_an_reg0;
1816 	__le16	local_an_reg1;
1817 	u8	reserved[10];
1818 };
1819 
1820 I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
1821 
1822 /* Set Loopback mode (0x0618) */
1823 struct i40e_aqc_set_lb_mode {
1824 	__le16	lb_mode;
1825 #define I40E_AQ_LB_PHY_LOCAL	0x01
1826 #define I40E_AQ_LB_PHY_REMOTE	0x02
1827 #define I40E_AQ_LB_MAC_LOCAL	0x04
1828 	u8	reserved[14];
1829 };
1830 
1831 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);
1832 
1833 /* Set PHY Debug command (0x0622) */
1834 struct i40e_aqc_set_phy_debug {
1835 	u8	command_flags;
1836 #define I40E_AQ_PHY_DEBUG_RESET_INTERNAL	0x02
1837 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT	2
1838 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_MASK	(0x03 << \
1839 					I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT)
1840 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE	0x00
1841 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD	0x01
1842 #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT	0x02
1843 #define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW	0x10
1844 	u8	reserved[15];
1845 };
1846 
1847 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_debug);
1848 
1849 enum i40e_aq_phy_reg_type {
1850 	I40E_AQC_PHY_REG_INTERNAL	= 0x1,
1851 	I40E_AQC_PHY_REG_EXERNAL_BASET	= 0x2,
1852 	I40E_AQC_PHY_REG_EXERNAL_MODULE	= 0x3
1853 };
1854 
1855 /* Run PHY Activity (0x0626) */
1856 struct i40e_aqc_run_phy_activity {
1857 	__le16  activity_id;
1858 	u8      flags;
1859 	u8      reserved1;
1860 	__le32  control;
1861 	__le32  data;
1862 	u8      reserved2[4];
1863 };
1864 
1865 I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
1866 
1867 /* NVM Read command (indirect 0x0701)
1868  * NVM Erase commands (direct 0x0702)
1869  * NVM Update commands (indirect 0x0703)
1870  */
1871 struct i40e_aqc_nvm_update {
1872 	u8	command_flags;
1873 #define I40E_AQ_NVM_LAST_CMD	0x01
1874 #define I40E_AQ_NVM_FLASH_ONLY	0x80
1875 	u8	module_pointer;
1876 	__le16	length;
1877 	__le32	offset;
1878 	__le32	addr_high;
1879 	__le32	addr_low;
1880 };
1881 
1882 I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update);
1883 
1884 /* NVM Config Read (indirect 0x0704) */
1885 struct i40e_aqc_nvm_config_read {
1886 	__le16	cmd_flags;
1887 #define I40E_AQ_ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK	1
1888 #define I40E_AQ_ANVM_READ_SINGLE_FEATURE		0
1889 #define I40E_AQ_ANVM_READ_MULTIPLE_FEATURES		1
1890 	__le16	element_count;
1891 	__le16	element_id;     /* Feature/field ID */
1892 	__le16	element_id_msw;	/* MSWord of field ID */
1893 	__le32	address_high;
1894 	__le32	address_low;
1895 };
1896 
1897 I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_read);
1898 
1899 /* NVM Config Write (indirect 0x0705) */
1900 struct i40e_aqc_nvm_config_write {
1901 	__le16	cmd_flags;
1902 	__le16	element_count;
1903 	u8	reserved[4];
1904 	__le32	address_high;
1905 	__le32	address_low;
1906 };
1907 
1908 I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write);
1909 
1910 /* Used for 0x0704 as well as for 0x0705 commands */
1911 #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT		1
1912 #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_MASK		(1 << I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT)
1913 #define I40E_AQ_ANVM_FEATURE				0
1914 #define I40E_AQ_ANVM_IMMEDIATE_FIELD			(1 << FEATURE_OR_IMMEDIATE_SHIFT)
1915 struct i40e_aqc_nvm_config_data_feature {
1916 	__le16 feature_id;
1917 #define I40E_AQ_ANVM_FEATURE_OPTION_OEM_ONLY		0x01
1918 #define I40E_AQ_ANVM_FEATURE_OPTION_DWORD_MAP		0x08
1919 #define I40E_AQ_ANVM_FEATURE_OPTION_POR_CSR		0x10
1920 	__le16 feature_options;
1921 	__le16 feature_selection;
1922 };
1923 
1924 I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature);
1925 
1926 struct i40e_aqc_nvm_config_data_immediate_field {
1927 	__le32 field_id;
1928 	__le32 field_value;
1929 	__le16 field_options;
1930 	__le16 reserved;
1931 };
1932 
1933 I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field);
1934 
1935 /* OEM Post Update (indirect 0x0720)
1936  * no command data struct used
1937  */
1938  struct i40e_aqc_nvm_oem_post_update {
1939 #define I40E_AQ_NVM_OEM_POST_UPDATE_EXTERNAL_DATA	0x01
1940 	u8 sel_data;
1941 	u8 reserved[7];
1942 };
1943 
1944 I40E_CHECK_STRUCT_LEN(0x8, i40e_aqc_nvm_oem_post_update);
1945 
1946 struct i40e_aqc_nvm_oem_post_update_buffer {
1947 	u8 str_len;
1948 	u8 dev_addr;
1949 	__le16 eeprom_addr;
1950 	u8 data[36];
1951 };
1952 
1953 I40E_CHECK_STRUCT_LEN(0x28, i40e_aqc_nvm_oem_post_update_buffer);
1954 
1955 /* Thermal Sensor (indirect 0x0721)
1956  *     read or set thermal sensor configs and values
1957  *     takes a sensor and command specific data buffer, not detailed here
1958  */
1959 struct i40e_aqc_thermal_sensor {
1960 	u8 sensor_action;
1961 #define I40E_AQ_THERMAL_SENSOR_READ_CONFIG	0
1962 #define I40E_AQ_THERMAL_SENSOR_SET_CONFIG	1
1963 #define I40E_AQ_THERMAL_SENSOR_READ_TEMP	2
1964 	u8 reserved[7];
1965 	__le32	addr_high;
1966 	__le32	addr_low;
1967 };
1968 
1969 I40E_CHECK_CMD_LENGTH(i40e_aqc_thermal_sensor);
1970 
1971 /* Send to PF command (indirect 0x0801) id is only used by PF
1972  * Send to VF command (indirect 0x0802) id is only used by PF
1973  * Send to Peer PF command (indirect 0x0803)
1974  */
1975 struct i40e_aqc_pf_vf_message {
1976 	__le32	id;
1977 	u8	reserved[4];
1978 	__le32	addr_high;
1979 	__le32	addr_low;
1980 };
1981 
1982 I40E_CHECK_CMD_LENGTH(i40e_aqc_pf_vf_message);
1983 
1984 /* Alternate structure */
1985 
1986 /* Direct write (direct 0x0900)
1987  * Direct read (direct 0x0902)
1988  */
1989 struct i40e_aqc_alternate_write {
1990 	__le32 address0;
1991 	__le32 data0;
1992 	__le32 address1;
1993 	__le32 data1;
1994 };
1995 
1996 I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write);
1997 
1998 /* Indirect write (indirect 0x0901)
1999  * Indirect read (indirect 0x0903)
2000  */
2001 
2002 struct i40e_aqc_alternate_ind_write {
2003 	__le32 address;
2004 	__le32 length;
2005 	__le32 addr_high;
2006 	__le32 addr_low;
2007 };
2008 
2009 I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_ind_write);
2010 
2011 /* Done alternate write (direct 0x0904)
2012  * uses i40e_aq_desc
2013  */
2014 struct i40e_aqc_alternate_write_done {
2015 	__le16	cmd_flags;
2016 #define I40E_AQ_ALTERNATE_MODE_BIOS_MASK	1
2017 #define I40E_AQ_ALTERNATE_MODE_BIOS_LEGACY	0
2018 #define I40E_AQ_ALTERNATE_MODE_BIOS_UEFI	1
2019 #define I40E_AQ_ALTERNATE_RESET_NEEDED		2
2020 	u8	reserved[14];
2021 };
2022 
2023 I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write_done);
2024 
2025 /* Set OEM mode (direct 0x0905) */
2026 struct i40e_aqc_alternate_set_mode {
2027 	__le32	mode;
2028 #define I40E_AQ_ALTERNATE_MODE_NONE	0
2029 #define I40E_AQ_ALTERNATE_MODE_OEM	1
2030 	u8	reserved[12];
2031 };
2032 
2033 I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_set_mode);
2034 
2035 /* Clear port Alternate RAM (direct 0x0906) uses i40e_aq_desc */
2036 
2037 /* async events 0x10xx */
2038 
2039 /* Lan Queue Overflow Event (direct, 0x1001) */
2040 struct i40e_aqc_lan_overflow {
2041 	__le32	prtdcb_rupto;
2042 	__le32	otx_ctl;
2043 	u8	reserved[8];
2044 };
2045 
2046 I40E_CHECK_CMD_LENGTH(i40e_aqc_lan_overflow);
2047 
2048 /* Get LLDP MIB (indirect 0x0A00) */
2049 struct i40e_aqc_lldp_get_mib {
2050 	u8	type;
2051 	u8	reserved1;
2052 #define I40E_AQ_LLDP_MIB_TYPE_MASK		0x3
2053 #define I40E_AQ_LLDP_MIB_LOCAL			0x0
2054 #define I40E_AQ_LLDP_MIB_REMOTE			0x1
2055 #define I40E_AQ_LLDP_MIB_LOCAL_AND_REMOTE	0x2
2056 #define I40E_AQ_LLDP_BRIDGE_TYPE_MASK		0xC
2057 #define I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT		0x2
2058 #define I40E_AQ_LLDP_BRIDGE_TYPE_NEAREST_BRIDGE	0x0
2059 #define I40E_AQ_LLDP_BRIDGE_TYPE_NON_TPMR	0x1
2060 #define I40E_AQ_LLDP_TX_SHIFT			0x4
2061 #define I40E_AQ_LLDP_TX_MASK			(0x03 << I40E_AQ_LLDP_TX_SHIFT)
2062 /* TX pause flags use I40E_AQ_LINK_TX_* above */
2063 	__le16	local_len;
2064 	__le16	remote_len;
2065 	u8	reserved2[2];
2066 	__le32	addr_high;
2067 	__le32	addr_low;
2068 };
2069 
2070 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_get_mib);
2071 
2072 /* Configure LLDP MIB Change Event (direct 0x0A01)
2073  * also used for the event (with type in the command field)
2074  */
2075 struct i40e_aqc_lldp_update_mib {
2076 	u8	command;
2077 #define I40E_AQ_LLDP_MIB_UPDATE_ENABLE	0x0
2078 #define I40E_AQ_LLDP_MIB_UPDATE_DISABLE	0x1
2079 	u8	reserved[7];
2080 	__le32	addr_high;
2081 	__le32	addr_low;
2082 };
2083 
2084 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_mib);
2085 
2086 /* Add LLDP TLV (indirect 0x0A02)
2087  * Delete LLDP TLV (indirect 0x0A04)
2088  */
2089 struct i40e_aqc_lldp_add_tlv {
2090 	u8	type; /* only nearest bridge and non-TPMR from 0x0A00 */
2091 	u8	reserved1[1];
2092 	__le16	len;
2093 	u8	reserved2[4];
2094 	__le32	addr_high;
2095 	__le32	addr_low;
2096 };
2097 
2098 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_add_tlv);
2099 
2100 /* Update LLDP TLV (indirect 0x0A03) */
2101 struct i40e_aqc_lldp_update_tlv {
2102 	u8	type; /* only nearest bridge and non-TPMR from 0x0A00 */
2103 	u8	reserved;
2104 	__le16	old_len;
2105 	__le16	new_offset;
2106 	__le16	new_len;
2107 	__le32	addr_high;
2108 	__le32	addr_low;
2109 };
2110 
2111 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
2112 
2113 /* Stop LLDP (direct 0x0A05) */
2114 struct i40e_aqc_lldp_stop {
2115 	u8	command;
2116 #define I40E_AQ_LLDP_AGENT_STOP		0x0
2117 #define I40E_AQ_LLDP_AGENT_SHUTDOWN	0x1
2118 	u8	reserved[15];
2119 };
2120 
2121 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
2122 
2123 /* Start LLDP (direct 0x0A06) */
2124 
2125 struct i40e_aqc_lldp_start {
2126 	u8	command;
2127 #define I40E_AQ_LLDP_AGENT_START	0x1
2128 	u8	reserved[15];
2129 };
2130 
2131 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_start);
2132 
2133 /* Get CEE DCBX Oper Config (0x0A07)
2134  * uses the generic descriptor struct
2135  * returns below as indirect response
2136  */
2137 
2138 #define I40E_AQC_CEE_APP_FCOE_SHIFT	0x0
2139 #define I40E_AQC_CEE_APP_FCOE_MASK	(0x7 << I40E_AQC_CEE_APP_FCOE_SHIFT)
2140 #define I40E_AQC_CEE_APP_ISCSI_SHIFT	0x3
2141 #define I40E_AQC_CEE_APP_ISCSI_MASK	(0x7 << I40E_AQC_CEE_APP_ISCSI_SHIFT)
2142 #define I40E_AQC_CEE_APP_FIP_SHIFT	0x8
2143 #define I40E_AQC_CEE_APP_FIP_MASK	(0x7 << I40E_AQC_CEE_APP_FIP_SHIFT)
2144 
2145 #define I40E_AQC_CEE_PG_STATUS_SHIFT	0x0
2146 #define I40E_AQC_CEE_PG_STATUS_MASK	(0x7 << I40E_AQC_CEE_PG_STATUS_SHIFT)
2147 #define I40E_AQC_CEE_PFC_STATUS_SHIFT	0x3
2148 #define I40E_AQC_CEE_PFC_STATUS_MASK	(0x7 << I40E_AQC_CEE_PFC_STATUS_SHIFT)
2149 #define I40E_AQC_CEE_APP_STATUS_SHIFT	0x8
2150 #define I40E_AQC_CEE_APP_STATUS_MASK	(0x7 << I40E_AQC_CEE_APP_STATUS_SHIFT)
2151 #define I40E_AQC_CEE_FCOE_STATUS_SHIFT	0x8
2152 #define I40E_AQC_CEE_FCOE_STATUS_MASK	(0x7 << I40E_AQC_CEE_FCOE_STATUS_SHIFT)
2153 #define I40E_AQC_CEE_ISCSI_STATUS_SHIFT	0xB
2154 #define I40E_AQC_CEE_ISCSI_STATUS_MASK	(0x7 << I40E_AQC_CEE_ISCSI_STATUS_SHIFT)
2155 #define I40E_AQC_CEE_FIP_STATUS_SHIFT	0x10
2156 #define I40E_AQC_CEE_FIP_STATUS_MASK	(0x7 << I40E_AQC_CEE_FIP_STATUS_SHIFT)
2157 
2158 /* struct i40e_aqc_get_cee_dcb_cfg_v1_resp was originally defined with
2159  * word boundary layout issues, which the Linux compilers silently deal
2160  * with by adding padding, making the actual struct larger than designed.
2161  * However, the FW compiler for the NIC is less lenient and complains
2162  * about the struct.  Hence, the struct defined here has an extra byte in
2163  * fields reserved3 and reserved4 to directly acknowledge that padding,
2164  * and the new length is used in the length check macro.
2165  */
2166 struct i40e_aqc_get_cee_dcb_cfg_v1_resp {
2167 	u8	reserved1;
2168 	u8	oper_num_tc;
2169 	u8	oper_prio_tc[4];
2170 	u8	reserved2;
2171 	u8	oper_tc_bw[8];
2172 	u8	oper_pfc_en;
2173 	u8	reserved3[2];
2174 	__le16	oper_app_prio;
2175 	u8	reserved4[2];
2176 	__le16	tlv_status;
2177 };
2178 
2179 I40E_CHECK_STRUCT_LEN(0x18, i40e_aqc_get_cee_dcb_cfg_v1_resp);
2180 
2181 struct i40e_aqc_get_cee_dcb_cfg_resp {
2182 	u8	oper_num_tc;
2183 	u8	oper_prio_tc[4];
2184 	u8	oper_tc_bw[8];
2185 	u8	oper_pfc_en;
2186 	__le16	oper_app_prio;
2187 	__le32	tlv_status;
2188 	u8	reserved[12];
2189 };
2190 
2191 I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_cee_dcb_cfg_resp);
2192 
2193 /*	Set Local LLDP MIB (indirect 0x0A08)
2194  *	Used to replace the local MIB of a given LLDP agent. e.g. DCBx
2195  */
2196 struct i40e_aqc_lldp_set_local_mib {
2197 #define SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT	0
2198 #define SET_LOCAL_MIB_AC_TYPE_DCBX_MASK	(1 << \
2199 					SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT)
2200 #define SET_LOCAL_MIB_AC_TYPE_LOCAL_MIB	0x0
2201 #define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT	(1)
2202 #define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_MASK	(1 << \
2203 				SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT)
2204 #define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS		0x1
2205 	u8	type;
2206 	u8	reserved0;
2207 	__le16	length;
2208 	u8	reserved1[4];
2209 	__le32	address_high;
2210 	__le32	address_low;
2211 };
2212 
2213 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_set_local_mib);
2214 
2215 struct i40e_aqc_lldp_set_local_mib_resp {
2216 #define SET_LOCAL_MIB_RESP_EVENT_TRIGGERED_MASK      0x01
2217 	u8  status;
2218 	u8  reserved[15];
2219 };
2220 
2221 I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_lldp_set_local_mib_resp);
2222 
2223 /*	Stop/Start LLDP Agent (direct 0x0A09)
2224  *	Used for stopping/starting specific LLDP agent. e.g. DCBx
2225  */
2226 struct i40e_aqc_lldp_stop_start_specific_agent {
2227 #define I40E_AQC_START_SPECIFIC_AGENT_SHIFT	0
2228 #define I40E_AQC_START_SPECIFIC_AGENT_MASK	(1 << I40E_AQC_START_SPECIFIC_AGENT_SHIFT)
2229 	u8	command;
2230 	u8	reserved[15];
2231 };
2232 
2233 I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent);
2234 
2235 /* Add Udp Tunnel command and completion (direct 0x0B00) */
2236 struct i40e_aqc_add_udp_tunnel {
2237 	__le16	udp_port;
2238 	u8	reserved0[3];
2239 	u8	protocol_type;
2240 #define I40E_AQC_TUNNEL_TYPE_VXLAN	0x00
2241 #define I40E_AQC_TUNNEL_TYPE_NGE	0x01
2242 #define I40E_AQC_TUNNEL_TYPE_TEREDO	0x10
2243 #define I40E_AQC_TUNNEL_TYPE_VXLAN_GPE	0x11
2244 	u8	reserved1[10];
2245 };
2246 
2247 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel);
2248 
2249 struct i40e_aqc_add_udp_tunnel_completion {
2250 	__le16 udp_port;
2251 	u8	filter_entry_index;
2252 	u8	multiple_pfs;
2253 #define I40E_AQC_SINGLE_PF		0x0
2254 #define I40E_AQC_MULTIPLE_PFS		0x1
2255 	u8	total_filters;
2256 	u8	reserved[11];
2257 };
2258 
2259 I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel_completion);
2260 
2261 /* remove UDP Tunnel command (0x0B01) */
2262 struct i40e_aqc_remove_udp_tunnel {
2263 	u8	reserved[2];
2264 	u8	index; /* 0 to 15 */
2265 	u8	reserved2[13];
2266 };
2267 
2268 I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_udp_tunnel);
2269 
2270 struct i40e_aqc_del_udp_tunnel_completion {
2271 	__le16	udp_port;
2272 	u8	index; /* 0 to 15 */
2273 	u8	multiple_pfs;
2274 	u8	total_filters_used;
2275 	u8	reserved1[11];
2276 };
2277 
2278 I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion);
2279 
2280 /* tunnel key structure 0x0B10 */
2281 
2282 struct i40e_aqc_tunnel_key_structure {
2283 	u8	key1_off;
2284 	u8	key2_off;
2285 	u8	key1_len;  /* 0 to 15 */
2286 	u8	key2_len;  /* 0 to 15 */
2287 	u8	flags;
2288 #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE	0x01
2289 /* response flags */
2290 #define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS	0x01
2291 #define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED	0x02
2292 #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN	0x03
2293 	u8	network_key_index;
2294 #define I40E_AQC_NETWORK_KEY_INDEX_VXLAN		0x0
2295 #define I40E_AQC_NETWORK_KEY_INDEX_NGE			0x1
2296 #define I40E_AQC_NETWORK_KEY_INDEX_FLEX_MAC_IN_UDP	0x2
2297 #define I40E_AQC_NETWORK_KEY_INDEX_GRE			0x3
2298 	u8	reserved[10];
2299 };
2300 
2301 I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure);
2302 
2303 /* OEM mode commands (direct 0xFE0x) */
2304 struct i40e_aqc_oem_param_change {
2305 	__le32	param_type;
2306 #define I40E_AQ_OEM_PARAM_TYPE_PF_CTL	0
2307 #define I40E_AQ_OEM_PARAM_TYPE_BW_CTL	1
2308 #define I40E_AQ_OEM_PARAM_MAC		2
2309 	__le32	param_value1;
2310 	__le16	param_value2;
2311 	u8	reserved[6];
2312 };
2313 
2314 I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change);
2315 
2316 struct i40e_aqc_oem_state_change {
2317 	__le32	state;
2318 #define I40E_AQ_OEM_STATE_LINK_DOWN	0x0
2319 #define I40E_AQ_OEM_STATE_LINK_UP	0x1
2320 	u8	reserved[12];
2321 };
2322 
2323 I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_state_change);
2324 
2325 /* Initialize OCSD (0xFE02, direct) */
2326 struct i40e_aqc_opc_oem_ocsd_initialize {
2327 	u8 type_status;
2328 	u8 reserved1[3];
2329 	__le32 ocsd_memory_block_addr_high;
2330 	__le32 ocsd_memory_block_addr_low;
2331 	__le32 requested_update_interval;
2332 };
2333 
2334 I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocsd_initialize);
2335 
2336 /* Initialize OCBB  (0xFE03, direct) */
2337 struct i40e_aqc_opc_oem_ocbb_initialize {
2338 	u8 type_status;
2339 	u8 reserved1[3];
2340 	__le32 ocbb_memory_block_addr_high;
2341 	__le32 ocbb_memory_block_addr_low;
2342 	u8 reserved2[4];
2343 };
2344 
2345 I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocbb_initialize);
2346 
2347 /* debug commands */
2348 
2349 /* get device id (0xFF00) uses the generic structure */
2350 
2351 /* set test more (0xFF01, internal) */
2352 
2353 struct i40e_acq_set_test_mode {
2354 	u8	mode;
2355 #define I40E_AQ_TEST_PARTIAL	0
2356 #define I40E_AQ_TEST_FULL	1
2357 #define I40E_AQ_TEST_NVM	2
2358 	u8	reserved[3];
2359 	u8	command;
2360 #define I40E_AQ_TEST_OPEN	0
2361 #define I40E_AQ_TEST_CLOSE	1
2362 #define I40E_AQ_TEST_INC	2
2363 	u8	reserved2[3];
2364 	__le32	address_high;
2365 	__le32	address_low;
2366 };
2367 
2368 I40E_CHECK_CMD_LENGTH(i40e_acq_set_test_mode);
2369 
2370 /* Debug Read Register command (0xFF03)
2371  * Debug Write Register command (0xFF04)
2372  */
2373 struct i40e_aqc_debug_reg_read_write {
2374 	__le32 reserved;
2375 	__le32 address;
2376 	__le32 value_high;
2377 	__le32 value_low;
2378 };
2379 
2380 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_reg_read_write);
2381 
2382 /* Scatter/gather Reg Read  (indirect 0xFF05)
2383  * Scatter/gather Reg Write (indirect 0xFF06)
2384  */
2385 
2386 /* i40e_aq_desc is used for the command */
2387 struct i40e_aqc_debug_reg_sg_element_data {
2388 	__le32 address;
2389 	__le32 value;
2390 };
2391 
2392 /* Debug Modify register (direct 0xFF07) */
2393 struct i40e_aqc_debug_modify_reg {
2394 	__le32 address;
2395 	__le32 value;
2396 	__le32 clear_mask;
2397 	__le32 set_mask;
2398 };
2399 
2400 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_reg);
2401 
2402 /* dump internal data (0xFF08, indirect) */
2403 
2404 #define I40E_AQ_CLUSTER_ID_AUX		0
2405 #define I40E_AQ_CLUSTER_ID_SWITCH_FLU	1
2406 #define I40E_AQ_CLUSTER_ID_TXSCHED	2
2407 #define I40E_AQ_CLUSTER_ID_HMC		3
2408 #define I40E_AQ_CLUSTER_ID_MAC0		4
2409 #define I40E_AQ_CLUSTER_ID_MAC1		5
2410 #define I40E_AQ_CLUSTER_ID_MAC2		6
2411 #define I40E_AQ_CLUSTER_ID_MAC3		7
2412 #define I40E_AQ_CLUSTER_ID_DCB		8
2413 #define I40E_AQ_CLUSTER_ID_EMP_MEM	9
2414 #define I40E_AQ_CLUSTER_ID_PKT_BUF	10
2415 #define I40E_AQ_CLUSTER_ID_ALTRAM	11
2416 
2417 struct i40e_aqc_debug_dump_internals {
2418 	u8	cluster_id;
2419 	u8	table_id;
2420 	__le16	data_size;
2421 	__le32	idx;
2422 	__le32	address_high;
2423 	__le32	address_low;
2424 };
2425 
2426 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_dump_internals);
2427 
2428 struct i40e_aqc_debug_modify_internals {
2429 	u8	cluster_id;
2430 	u8	cluster_specific_params[7];
2431 	__le32	address_high;
2432 	__le32	address_low;
2433 };
2434 
2435 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
2436 
2437 #endif /* _I40E_ADMINQ_CMD_H_ */
2438