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