i40e_adminq_cmd.h 64.2 KB
Newer Older
G
Greg Rose 已提交
1 2 3
/*******************************************************************************
 *
 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4
 * Copyright(c) 2013 - 2014 Intel Corporation.
G
Greg Rose 已提交
5 6 7 8 9 10 11 12 13 14
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
15 16 17
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
G
Greg Rose 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
 * The full GNU General Public License is included in this distribution in
 * the file called "COPYING".
 *
 * Contact Information:
 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 *
 ******************************************************************************/

#ifndef _I40E_ADMINQ_CMD_H_
#define _I40E_ADMINQ_CMD_H_

/* This header file defines the i40e Admin Queue commands and is shared between
 * i40e Firmware and Software.
 *
 * This file needs to comply with the Linux Kernel coding style.
 */

36 37
#define I40E_FW_API_VERSION_MAJOR	0x0001
#define I40E_FW_API_VERSION_MINOR	0x0002
G
Greg Rose 已提交
38
#define I40E_FW_API_VERSION_A0_MINOR  0x0000
G
Greg Rose 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

struct i40e_aq_desc {
	__le16 flags;
	__le16 opcode;
	__le16 datalen;
	__le16 retval;
	__le32 cookie_high;
	__le32 cookie_low;
	union {
		struct {
			__le32 param0;
			__le32 param1;
			__le32 param2;
			__le32 param3;
		} internal;
		struct {
			__le32 param0;
			__le32 param1;
			__le32 addr_high;
			__le32 addr_low;
		} external;
		u8 raw[16];
	} params;
};

/* Flags sub-structure
 * |0  |1  |2  |3  |4  |5  |6  |7  |8  |9  |10 |11 |12 |13 |14 |15 |
 * |DD |CMP|ERR|VFE| * *  RESERVED * * |LB |RD |VFC|BUF|SI |EI |FE |
 */

/* command flags and offsets*/
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
#define I40E_AQ_FLAG_DD_SHIFT	0
#define I40E_AQ_FLAG_CMP_SHIFT	1
#define I40E_AQ_FLAG_ERR_SHIFT	2
#define I40E_AQ_FLAG_VFE_SHIFT	3
#define I40E_AQ_FLAG_LB_SHIFT	9
#define I40E_AQ_FLAG_RD_SHIFT	10
#define I40E_AQ_FLAG_VFC_SHIFT	11
#define I40E_AQ_FLAG_BUF_SHIFT	12
#define I40E_AQ_FLAG_SI_SHIFT	13
#define I40E_AQ_FLAG_EI_SHIFT	14
#define I40E_AQ_FLAG_FE_SHIFT	15

#define I40E_AQ_FLAG_DD		(1 << I40E_AQ_FLAG_DD_SHIFT)  /* 0x1    */
#define I40E_AQ_FLAG_CMP	(1 << I40E_AQ_FLAG_CMP_SHIFT) /* 0x2    */
#define I40E_AQ_FLAG_ERR	(1 << I40E_AQ_FLAG_ERR_SHIFT) /* 0x4    */
#define I40E_AQ_FLAG_VFE	(1 << I40E_AQ_FLAG_VFE_SHIFT) /* 0x8    */
#define I40E_AQ_FLAG_LB		(1 << I40E_AQ_FLAG_LB_SHIFT)  /* 0x200  */
#define I40E_AQ_FLAG_RD		(1 << I40E_AQ_FLAG_RD_SHIFT)  /* 0x400  */
#define I40E_AQ_FLAG_VFC	(1 << I40E_AQ_FLAG_VFC_SHIFT) /* 0x800  */
#define I40E_AQ_FLAG_BUF	(1 << I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */
#define I40E_AQ_FLAG_SI		(1 << I40E_AQ_FLAG_SI_SHIFT)  /* 0x2000 */
#define I40E_AQ_FLAG_EI		(1 << I40E_AQ_FLAG_EI_SHIFT)  /* 0x4000 */
#define I40E_AQ_FLAG_FE		(1 << I40E_AQ_FLAG_FE_SHIFT)  /* 0x8000 */
G
Greg Rose 已提交
93 94 95

/* error codes */
enum i40e_admin_queue_err {
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
	I40E_AQ_RC_OK		= 0,  /* success */
	I40E_AQ_RC_EPERM	= 1,  /* Operation not permitted */
	I40E_AQ_RC_ENOENT	= 2,  /* No such element */
	I40E_AQ_RC_ESRCH	= 3,  /* Bad opcode */
	I40E_AQ_RC_EINTR	= 4,  /* operation interrupted */
	I40E_AQ_RC_EIO		= 5,  /* I/O error */
	I40E_AQ_RC_ENXIO	= 6,  /* No such resource */
	I40E_AQ_RC_E2BIG	= 7,  /* Arg too long */
	I40E_AQ_RC_EAGAIN	= 8,  /* Try again */
	I40E_AQ_RC_ENOMEM	= 9,  /* Out of memory */
	I40E_AQ_RC_EACCES	= 10, /* Permission denied */
	I40E_AQ_RC_EFAULT	= 11, /* Bad address */
	I40E_AQ_RC_EBUSY	= 12, /* Device or resource busy */
	I40E_AQ_RC_EEXIST	= 13, /* object already exists */
	I40E_AQ_RC_EINVAL	= 14, /* Invalid argument */
	I40E_AQ_RC_ENOTTY	= 15, /* Not a typewriter */
	I40E_AQ_RC_ENOSPC	= 16, /* No space left or alloc failure */
	I40E_AQ_RC_ENOSYS	= 17, /* Function not implemented */
	I40E_AQ_RC_ERANGE	= 18, /* Parameter out of range */
	I40E_AQ_RC_EFLUSHED	= 19, /* Cmd flushed due to prev cmd error */
	I40E_AQ_RC_BAD_ADDR	= 20, /* Descriptor contains a bad pointer */
	I40E_AQ_RC_EMODE	= 21, /* Op not allowed in current dev mode */
	I40E_AQ_RC_EFBIG	= 22, /* File too large */
G
Greg Rose 已提交
119 120 121 122 123
};

/* Admin Queue command opcodes */
enum i40e_admin_queue_opc {
	/* aq commands */
124 125 126 127
	i40e_aqc_opc_get_version	= 0x0001,
	i40e_aqc_opc_driver_version	= 0x0002,
	i40e_aqc_opc_queue_shutdown	= 0x0003,
	i40e_aqc_opc_set_pf_context	= 0x0004,
G
Greg Rose 已提交
128 129

	/* resource ownership */
130 131
	i40e_aqc_opc_request_resource	= 0x0008,
	i40e_aqc_opc_release_resource	= 0x0009,
G
Greg Rose 已提交
132

133 134
	i40e_aqc_opc_list_func_capabilities	= 0x000A,
	i40e_aqc_opc_list_dev_capabilities	= 0x000B,
G
Greg Rose 已提交
135

136 137 138
	i40e_aqc_opc_set_cppm_configuration	= 0x0103,
	i40e_aqc_opc_set_arp_proxy_entry	= 0x0104,
	i40e_aqc_opc_set_ns_proxy_entry		= 0x0105,
G
Greg Rose 已提交
139 140

	/* LAA */
141 142 143
	i40e_aqc_opc_mng_laa		= 0x0106,   /* AQ obsolete */
	i40e_aqc_opc_mac_address_read	= 0x0107,
	i40e_aqc_opc_mac_address_write	= 0x0108,
G
Greg Rose 已提交
144 145

	/* PXE */
146
	i40e_aqc_opc_clear_pxe_mode	= 0x0110,
G
Greg Rose 已提交
147 148

	/* internal switch commands */
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
	i40e_aqc_opc_get_switch_config		= 0x0200,
	i40e_aqc_opc_add_statistics		= 0x0201,
	i40e_aqc_opc_remove_statistics		= 0x0202,
	i40e_aqc_opc_set_port_parameters	= 0x0203,
	i40e_aqc_opc_get_switch_resource_alloc	= 0x0204,

	i40e_aqc_opc_add_vsi			= 0x0210,
	i40e_aqc_opc_update_vsi_parameters	= 0x0211,
	i40e_aqc_opc_get_vsi_parameters		= 0x0212,

	i40e_aqc_opc_add_pv			= 0x0220,
	i40e_aqc_opc_update_pv_parameters	= 0x0221,
	i40e_aqc_opc_get_pv_parameters		= 0x0222,

	i40e_aqc_opc_add_veb			= 0x0230,
	i40e_aqc_opc_update_veb_parameters	= 0x0231,
	i40e_aqc_opc_get_veb_parameters		= 0x0232,

	i40e_aqc_opc_delete_element		= 0x0243,

	i40e_aqc_opc_add_macvlan		= 0x0250,
	i40e_aqc_opc_remove_macvlan		= 0x0251,
	i40e_aqc_opc_add_vlan			= 0x0252,
	i40e_aqc_opc_remove_vlan		= 0x0253,
	i40e_aqc_opc_set_vsi_promiscuous_modes	= 0x0254,
	i40e_aqc_opc_add_tag			= 0x0255,
	i40e_aqc_opc_remove_tag			= 0x0256,
	i40e_aqc_opc_add_multicast_etag		= 0x0257,
	i40e_aqc_opc_remove_multicast_etag	= 0x0258,
	i40e_aqc_opc_update_tag			= 0x0259,
	i40e_aqc_opc_add_control_packet_filter	= 0x025A,
	i40e_aqc_opc_remove_control_packet_filter	= 0x025B,
	i40e_aqc_opc_add_cloud_filters		= 0x025C,
	i40e_aqc_opc_remove_cloud_filters	= 0x025D,

	i40e_aqc_opc_add_mirror_rule	= 0x0260,
	i40e_aqc_opc_delete_mirror_rule	= 0x0261,
G
Greg Rose 已提交
186 187

	/* DCB commands */
188 189
	i40e_aqc_opc_dcb_ignore_pfc	= 0x0301,
	i40e_aqc_opc_dcb_updated	= 0x0302,
G
Greg Rose 已提交
190 191

	/* TX scheduler */
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
	i40e_aqc_opc_configure_vsi_bw_limit		= 0x0400,
	i40e_aqc_opc_configure_vsi_ets_sla_bw_limit	= 0x0406,
	i40e_aqc_opc_configure_vsi_tc_bw		= 0x0407,
	i40e_aqc_opc_query_vsi_bw_config		= 0x0408,
	i40e_aqc_opc_query_vsi_ets_sla_config		= 0x040A,
	i40e_aqc_opc_configure_switching_comp_bw_limit	= 0x0410,

	i40e_aqc_opc_enable_switching_comp_ets			= 0x0413,
	i40e_aqc_opc_modify_switching_comp_ets			= 0x0414,
	i40e_aqc_opc_disable_switching_comp_ets			= 0x0415,
	i40e_aqc_opc_configure_switching_comp_ets_bw_limit	= 0x0416,
	i40e_aqc_opc_configure_switching_comp_bw_config		= 0x0417,
	i40e_aqc_opc_query_switching_comp_ets_config		= 0x0418,
	i40e_aqc_opc_query_port_ets_config			= 0x0419,
	i40e_aqc_opc_query_switching_comp_bw_config		= 0x041A,
	i40e_aqc_opc_suspend_port_tx				= 0x041B,
	i40e_aqc_opc_resume_port_tx				= 0x041C,
	i40e_aqc_opc_configure_partition_bw			= 0x041D,
G
Greg Rose 已提交
210 211

	/* hmc */
212 213
	i40e_aqc_opc_query_hmc_resource_profile	= 0x0500,
	i40e_aqc_opc_set_hmc_resource_profile	= 0x0501,
G
Greg Rose 已提交
214 215

	/* phy commands*/
216 217 218 219 220 221 222 223 224 225 226 227 228
	i40e_aqc_opc_get_phy_abilities		= 0x0600,
	i40e_aqc_opc_set_phy_config		= 0x0601,
	i40e_aqc_opc_set_mac_config		= 0x0603,
	i40e_aqc_opc_set_link_restart_an	= 0x0605,
	i40e_aqc_opc_get_link_status		= 0x0607,
	i40e_aqc_opc_set_phy_int_mask		= 0x0613,
	i40e_aqc_opc_get_local_advt_reg		= 0x0614,
	i40e_aqc_opc_set_local_advt_reg		= 0x0615,
	i40e_aqc_opc_get_partner_advt		= 0x0616,
	i40e_aqc_opc_set_lb_modes		= 0x0618,
	i40e_aqc_opc_get_phy_wol_caps		= 0x0621,
	i40e_aqc_opc_set_phy_debug		= 0x0622,
	i40e_aqc_opc_upload_ext_phy_fm		= 0x0625,
G
Greg Rose 已提交
229 230

	/* NVM commands */
231 232 233 234 235
	i40e_aqc_opc_nvm_read			= 0x0701,
	i40e_aqc_opc_nvm_erase			= 0x0702,
	i40e_aqc_opc_nvm_update			= 0x0703,
	i40e_aqc_opc_nvm_config_read		= 0x0704,
	i40e_aqc_opc_nvm_config_write		= 0x0705,
G
Greg Rose 已提交
236 237

	/* virtualization commands */
238 239 240
	i40e_aqc_opc_send_msg_to_pf		= 0x0801,
	i40e_aqc_opc_send_msg_to_vf		= 0x0802,
	i40e_aqc_opc_send_msg_to_peer		= 0x0803,
G
Greg Rose 已提交
241 242

	/* alternate structure */
243 244 245 246 247 248 249
	i40e_aqc_opc_alternate_write		= 0x0900,
	i40e_aqc_opc_alternate_write_indirect	= 0x0901,
	i40e_aqc_opc_alternate_read		= 0x0902,
	i40e_aqc_opc_alternate_read_indirect	= 0x0903,
	i40e_aqc_opc_alternate_write_done	= 0x0904,
	i40e_aqc_opc_alternate_set_mode		= 0x0905,
	i40e_aqc_opc_alternate_clear_port	= 0x0906,
G
Greg Rose 已提交
250 251

	/* LLDP commands */
252 253 254 255 256 257 258
	i40e_aqc_opc_lldp_get_mib	= 0x0A00,
	i40e_aqc_opc_lldp_update_mib	= 0x0A01,
	i40e_aqc_opc_lldp_add_tlv	= 0x0A02,
	i40e_aqc_opc_lldp_update_tlv	= 0x0A03,
	i40e_aqc_opc_lldp_delete_tlv	= 0x0A04,
	i40e_aqc_opc_lldp_stop		= 0x0A05,
	i40e_aqc_opc_lldp_start		= 0x0A06,
G
Greg Rose 已提交
259 260

	/* Tunnel commands */
261 262 263
	i40e_aqc_opc_add_udp_tunnel	= 0x0B00,
	i40e_aqc_opc_del_udp_tunnel	= 0x0B01,
	i40e_aqc_opc_tunnel_key_structure	= 0x0B10,
G
Greg Rose 已提交
264 265

	/* Async Events */
266
	i40e_aqc_opc_event_lan_overflow		= 0x1001,
G
Greg Rose 已提交
267 268

	/* OEM commands */
269 270
	i40e_aqc_opc_oem_parameter_change	= 0xFE00,
	i40e_aqc_opc_oem_device_status_change	= 0xFE01,
271 272
	i40e_aqc_opc_oem_ocsd_initialize	= 0xFE02,
	i40e_aqc_opc_oem_ocbb_initialize	= 0xFE03,
G
Greg Rose 已提交
273 274

	/* debug commands */
275 276 277 278 279 280
	i40e_aqc_opc_debug_get_deviceid		= 0xFF00,
	i40e_aqc_opc_debug_set_mode		= 0xFF01,
	i40e_aqc_opc_debug_read_reg		= 0xFF03,
	i40e_aqc_opc_debug_write_reg		= 0xFF04,
	i40e_aqc_opc_debug_modify_reg		= 0xFF07,
	i40e_aqc_opc_debug_dump_internals	= 0xFF08,
G
Greg Rose 已提交
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
};

/* command structures and indirect data structures */

/* Structure naming conventions:
 * - no suffix for direct command descriptor structures
 * - _data for indirect sent data
 * - _resp for indirect return data (data which is both will use _data)
 * - _completion for direct return data
 * - _element_ for repeated elements (may also be _data or _resp)
 *
 * Command structures are expected to overlay the params.raw member of the basic
 * descriptor, and as such cannot exceed 16 bytes in length.
 */

/* This macro is used to generate a compilation error if a structure
 * is not exactly the correct length. It gives a divide by zero error if the
 * structure is not of the correct size, otherwise it creates an enum that is
 * never used.
 */
#define I40E_CHECK_STRUCT_LEN(n, X) enum i40e_static_assert_enum_##X \
	{ i40e_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }

/* This macro is used extensively to ensure that command structures are 16
 * bytes in length as they have to map to the raw array of that size.
 */
307
#define I40E_CHECK_CMD_LENGTH(X)	I40E_CHECK_STRUCT_LEN(16, X)
G
Greg Rose 已提交
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324

/* internal (0x00XX) commands */

/* Get version (direct 0x0001) */
struct i40e_aqc_get_version {
	__le32 rom_ver;
	__le32 fw_build;
	__le16 fw_major;
	__le16 fw_minor;
	__le16 api_major;
	__le16 api_minor;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_get_version);

/* Send driver version (indirect 0x0002) */
struct i40e_aqc_driver_version {
325 326 327 328 329 330 331
	u8	driver_major_ver;
	u8	driver_minor_ver;
	u8	driver_build_ver;
	u8	driver_subbuild_ver;
	u8	reserved[4];
	__le32	address_high;
	__le32	address_low;
G
Greg Rose 已提交
332 333 334 335 336 337
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_driver_version);

/* Queue Shutdown (direct 0x0003) */
struct i40e_aqc_queue_shutdown {
338 339 340
	__le32	driver_unloading;
#define I40E_AQ_DRIVER_UNLOADING	0x1
	u8	reserved[12];
G
Greg Rose 已提交
341 342 343 344
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown);

345 346 347 348 349 350 351 352
/* Set PF context (0x0004, direct) */
struct i40e_aqc_set_pf_context {
	u8	pf_id;
	u8	reserved[15];
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_set_pf_context);

G
Greg Rose 已提交
353 354 355
/* Request resource ownership (direct 0x0008)
 * Release resource ownership (direct 0x0009)
 */
356 357 358 359 360 361
#define I40E_AQ_RESOURCE_NVM			1
#define I40E_AQ_RESOURCE_SDP			2
#define I40E_AQ_RESOURCE_ACCESS_READ		1
#define I40E_AQ_RESOURCE_ACCESS_WRITE		2
#define I40E_AQ_RESOURCE_NVM_READ_TIMEOUT	3000
#define I40E_AQ_RESOURCE_NVM_WRITE_TIMEOUT	180000
G
Greg Rose 已提交
362 363

struct i40e_aqc_request_resource {
364 365 366 367 368
	__le16	resource_id;
	__le16	access_type;
	__le32	timeout;
	__le32	resource_number;
	u8	reserved[4];
G
Greg Rose 已提交
369 370 371 372 373 374 375 376 377
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_request_resource);

/* Get function capabilities (indirect 0x000A)
 * Get device capabilities (indirect 0x000B)
 */
struct i40e_aqc_list_capabilites {
	u8 command_flags;
378
#define I40E_AQ_LIST_CAP_PF_INDEX_EN	1
G
Greg Rose 已提交
379 380 381 382 383 384 385 386 387 388
	u8 pf_index;
	u8 reserved[2];
	__le32 count;
	__le32 addr_high;
	__le32 addr_low;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_list_capabilites);

struct i40e_aqc_list_capabilities_element_resp {
389 390 391 392 393 394 395
	__le16	id;
	u8	major_rev;
	u8	minor_rev;
	__le32	number;
	__le32	logical_id;
	__le32	phys_id;
	u8	reserved[16];
G
Greg Rose 已提交
396 397 398 399
};

/* list of caps */

400 401 402 403 404 405 406 407 408 409 410 411 412 413
#define I40E_AQ_CAP_ID_SWITCH_MODE	0x0001
#define I40E_AQ_CAP_ID_MNG_MODE		0x0002
#define I40E_AQ_CAP_ID_NPAR_ACTIVE	0x0003
#define I40E_AQ_CAP_ID_OS2BMC_CAP	0x0004
#define I40E_AQ_CAP_ID_FUNCTIONS_VALID	0x0005
#define I40E_AQ_CAP_ID_ALTERNATE_RAM	0x0006
#define I40E_AQ_CAP_ID_SRIOV		0x0012
#define I40E_AQ_CAP_ID_VF		0x0013
#define I40E_AQ_CAP_ID_VMDQ		0x0014
#define I40E_AQ_CAP_ID_8021QBG		0x0015
#define I40E_AQ_CAP_ID_8021QBR		0x0016
#define I40E_AQ_CAP_ID_VSI		0x0017
#define I40E_AQ_CAP_ID_DCB		0x0018
#define I40E_AQ_CAP_ID_FCOE		0x0021
414
#define I40E_AQ_CAP_ID_ISCSI		0x0022
415 416 417 418 419 420 421 422 423 424 425 426 427
#define I40E_AQ_CAP_ID_RSS		0x0040
#define I40E_AQ_CAP_ID_RXQ		0x0041
#define I40E_AQ_CAP_ID_TXQ		0x0042
#define I40E_AQ_CAP_ID_MSIX		0x0043
#define I40E_AQ_CAP_ID_VF_MSIX		0x0044
#define I40E_AQ_CAP_ID_FLOW_DIRECTOR	0x0045
#define I40E_AQ_CAP_ID_1588		0x0046
#define I40E_AQ_CAP_ID_IWARP		0x0051
#define I40E_AQ_CAP_ID_LED		0x0061
#define I40E_AQ_CAP_ID_SDP		0x0062
#define I40E_AQ_CAP_ID_MDIO		0x0063
#define I40E_AQ_CAP_ID_FLEX10		0x00F1
#define I40E_AQ_CAP_ID_CEM		0x00F2
G
Greg Rose 已提交
428 429 430

/* Set CPPM Configuration (direct 0x0103) */
struct i40e_aqc_cppm_configuration {
431 432 433 434 435 436 437 438 439 440 441 442
	__le16	command_flags;
#define I40E_AQ_CPPM_EN_LTRC	0x0800
#define I40E_AQ_CPPM_EN_DMCTH	0x1000
#define I40E_AQ_CPPM_EN_DMCTLX	0x2000
#define I40E_AQ_CPPM_EN_HPTC	0x4000
#define I40E_AQ_CPPM_EN_DMARC	0x8000
	__le16	ttlx;
	__le32	dmacr;
	__le16	dmcth;
	u8	hptc;
	u8	reserved;
	__le32	pfltrc;
G
Greg Rose 已提交
443 444 445 446 447 448
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration);

/* Set ARP Proxy command / response (indirect 0x0104) */
struct i40e_aqc_arp_proxy_data {
449 450 451 452 453 454 455 456 457 458
	__le16	command_flags;
#define I40E_AQ_ARP_INIT_IPV4	0x0008
#define I40E_AQ_ARP_UNSUP_CTL	0x0010
#define I40E_AQ_ARP_ENA		0x0020
#define I40E_AQ_ARP_ADD_IPV4	0x0040
#define I40E_AQ_ARP_DEL_IPV4	0x0080
	__le16	table_id;
	__le32	pfpm_proxyfc;
	__le32	ip_addr;
	u8	mac_addr[6];
459
	u8	reserved[2];
G
Greg Rose 已提交
460 461
};

462 463
I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_proxy_data);

G
Greg Rose 已提交
464 465
/* Set NS Proxy Table Entry Command (indirect 0x0105) */
struct i40e_aqc_ns_proxy_data {
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486
	__le16	table_idx_mac_addr_0;
	__le16	table_idx_mac_addr_1;
	__le16	table_idx_ipv6_0;
	__le16	table_idx_ipv6_1;
	__le16	control;
#define I40E_AQ_NS_PROXY_ADD_0		0x0100
#define I40E_AQ_NS_PROXY_DEL_0		0x0200
#define I40E_AQ_NS_PROXY_ADD_1		0x0400
#define I40E_AQ_NS_PROXY_DEL_1		0x0800
#define I40E_AQ_NS_PROXY_ADD_IPV6_0	0x1000
#define I40E_AQ_NS_PROXY_DEL_IPV6_0	0x2000
#define I40E_AQ_NS_PROXY_ADD_IPV6_1	0x4000
#define I40E_AQ_NS_PROXY_DEL_IPV6_1	0x8000
#define I40E_AQ_NS_PROXY_COMMAND_SEQ	0x0001
#define I40E_AQ_NS_PROXY_INIT_IPV6_TBL	0x0002
#define I40E_AQ_NS_PROXY_INIT_MAC_TBL	0x0004
	u8	mac_addr_0[6];
	u8	mac_addr_1[6];
	u8	local_mac_addr[6];
	u8	ipv6_addr_0[16]; /* Warning! spec specifies BE byte order */
	u8	ipv6_addr_1[16];
G
Greg Rose 已提交
487 488
};

489 490
I40E_CHECK_STRUCT_LEN(0x3c, i40e_aqc_ns_proxy_data);

G
Greg Rose 已提交
491 492 493
/* Manage LAA Command (0x0106) - obsolete */
struct i40e_aqc_mng_laa {
	__le16	command_flags;
494 495 496 497 498
#define I40E_AQ_LAA_FLAG_WR	0x8000
	u8	reserved[2];
	__le32	sal;
	__le16	sah;
	u8	reserved2[6];
G
Greg Rose 已提交
499 500
};

501 502
I40E_CHECK_CMD_LENGTH(i40e_aqc_mng_laa);

G
Greg Rose 已提交
503 504 505
/* Manage MAC Address Read Command (indirect 0x0107) */
struct i40e_aqc_mac_address_read {
	__le16	command_flags;
506 507 508 509 510 511 512 513
#define I40E_AQC_LAN_ADDR_VALID		0x10
#define I40E_AQC_SAN_ADDR_VALID		0x20
#define I40E_AQC_PORT_ADDR_VALID	0x40
#define I40E_AQC_WOL_ADDR_VALID		0x80
#define I40E_AQC_ADDR_VALID_MASK	0xf0
	u8	reserved[6];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_read);

struct i40e_aqc_mac_address_read_data {
	u8 pf_lan_mac[6];
	u8 pf_san_mac[6];
	u8 port_mac[6];
	u8 pf_wol_mac[6];
};

I40E_CHECK_STRUCT_LEN(24, i40e_aqc_mac_address_read_data);

/* Manage MAC Address Write Command (0x0108) */
struct i40e_aqc_mac_address_write {
529 530 531 532 533 534 535 536
	__le16	command_flags;
#define I40E_AQC_WRITE_TYPE_LAA_ONLY	0x0000
#define I40E_AQC_WRITE_TYPE_LAA_WOL	0x4000
#define I40E_AQC_WRITE_TYPE_PORT	0x8000
#define I40E_AQC_WRITE_TYPE_MASK	0xc000
	__le16	mac_sah;
	__le32	mac_sal;
	u8	reserved[8];
G
Greg Rose 已提交
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_write);

/* PXE commands (0x011x) */

/* Clear PXE Command and response  (direct 0x0110) */
struct i40e_aqc_clear_pxe {
	u8	rx_cnt;
	u8	reserved[15];
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_clear_pxe);

/* Switch configuration commands (0x02xx) */

/* Used by many indirect commands that only pass an seid and a buffer in the
 * command
 */
struct i40e_aqc_switch_seid {
557 558 559 560
	__le16	seid;
	u8	reserved[6];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
561 562 563 564 565 566 567 568
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_switch_seid);

/* Get Switch Configuration command (indirect 0x0200)
 * uses i40e_aqc_switch_seid for the descriptor
 */
struct i40e_aqc_get_switch_config_header_resp {
569 570 571
	__le16	num_reported;
	__le16	num_total;
	u8	reserved[12];
G
Greg Rose 已提交
572 573
};

574 575
I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_config_header_resp);

G
Greg Rose 已提交
576
struct i40e_aqc_switch_config_element_resp {
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
	u8	element_type;
#define I40E_AQ_SW_ELEM_TYPE_MAC	1
#define I40E_AQ_SW_ELEM_TYPE_PF		2
#define I40E_AQ_SW_ELEM_TYPE_VF		3
#define I40E_AQ_SW_ELEM_TYPE_EMP	4
#define I40E_AQ_SW_ELEM_TYPE_BMC	5
#define I40E_AQ_SW_ELEM_TYPE_PV		16
#define I40E_AQ_SW_ELEM_TYPE_VEB	17
#define I40E_AQ_SW_ELEM_TYPE_PA		18
#define I40E_AQ_SW_ELEM_TYPE_VSI	19
	u8	revision;
#define I40E_AQ_SW_ELEM_REV_1		1
	__le16	seid;
	__le16	uplink_seid;
	__le16	downlink_seid;
	u8	reserved[3];
	u8	connection_type;
#define I40E_AQ_CONN_TYPE_REGULAR	0x1
#define I40E_AQ_CONN_TYPE_DEFAULT	0x2
#define I40E_AQ_CONN_TYPE_CASCADED	0x3
	__le16	scheduler_id;
	__le16	element_info;
G
Greg Rose 已提交
599 600
};

601 602
I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_config_element_resp);

G
Greg Rose 已提交
603 604 605 606 607
/* Get Switch Configuration (indirect 0x0200)
 *    an array of elements are returned in the response buffer
 *    the first in the array is the header, remainder are elements
 */
struct i40e_aqc_get_switch_config_resp {
608 609
	struct i40e_aqc_get_switch_config_header_resp	header;
	struct i40e_aqc_switch_config_element_resp	element[1];
G
Greg Rose 已提交
610 611
};

612 613
I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_switch_config_resp);

G
Greg Rose 已提交
614 615 616 617
/* Add Statistics (direct 0x0201)
 * Remove Statistics (direct 0x0202)
 */
struct i40e_aqc_add_remove_statistics {
618 619 620 621
	__le16	seid;
	__le16	vlan;
	__le16	stat_index;
	u8	reserved[10];
G
Greg Rose 已提交
622 623 624 625 626 627
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_statistics);

/* Set Port Parameters command (direct 0x0203) */
struct i40e_aqc_set_port_parameters {
628 629 630 631 632 633 634
	__le16	command_flags;
#define I40E_AQ_SET_P_PARAMS_SAVE_BAD_PACKETS	1
#define I40E_AQ_SET_P_PARAMS_PAD_SHORT_PACKETS	2 /* must set! */
#define I40E_AQ_SET_P_PARAMS_DOUBLE_VLAN_ENA	4
	__le16	bad_frame_vsi;
	__le16	default_seid;        /* reserved for command */
	u8	reserved[10];
G
Greg Rose 已提交
635 636 637 638 639 640
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_set_port_parameters);

/* Get Switch Resource Allocation (indirect 0x0204) */
struct i40e_aqc_get_switch_resource_alloc {
641 642 643 644
	u8	num_entries;         /* reserved for command */
	u8	reserved[7];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
645 646 647 648 649 650
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_resource_alloc);

/* expect an array of these structs in the response buffer */
struct i40e_aqc_switch_resource_alloc_element_resp {
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
	u8	resource_type;
#define I40E_AQ_RESOURCE_TYPE_VEB		0x0
#define I40E_AQ_RESOURCE_TYPE_VSI		0x1
#define I40E_AQ_RESOURCE_TYPE_MACADDR		0x2
#define I40E_AQ_RESOURCE_TYPE_STAG		0x3
#define I40E_AQ_RESOURCE_TYPE_ETAG		0x4
#define I40E_AQ_RESOURCE_TYPE_MULTICAST_HASH	0x5
#define I40E_AQ_RESOURCE_TYPE_UNICAST_HASH	0x6
#define I40E_AQ_RESOURCE_TYPE_VLAN		0x7
#define I40E_AQ_RESOURCE_TYPE_VSI_LIST_ENTRY	0x8
#define I40E_AQ_RESOURCE_TYPE_ETAG_LIST_ENTRY	0x9
#define I40E_AQ_RESOURCE_TYPE_VLAN_STAT_POOL	0xA
#define I40E_AQ_RESOURCE_TYPE_MIRROR_RULE	0xB
#define I40E_AQ_RESOURCE_TYPE_QUEUE_SETS	0xC
#define I40E_AQ_RESOURCE_TYPE_VLAN_FILTERS	0xD
#define I40E_AQ_RESOURCE_TYPE_INNER_MAC_FILTERS	0xF
#define I40E_AQ_RESOURCE_TYPE_IP_FILTERS	0x10
#define I40E_AQ_RESOURCE_TYPE_GRE_VN_KEYS	0x11
#define I40E_AQ_RESOURCE_TYPE_VN2_KEYS		0x12
#define I40E_AQ_RESOURCE_TYPE_TUNNEL_PORTS	0x13
	u8	reserved1;
	__le16	guaranteed;
	__le16	total;
	__le16	used;
	__le16	total_unalloced;
	u8	reserved2[6];
G
Greg Rose 已提交
677 678
};

679 680
I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_resource_alloc_element_resp);

G
Greg Rose 已提交
681 682 683 684 685 686 687 688 689 690 691
/* Add VSI (indirect 0x0210)
 *    this indirect command uses struct i40e_aqc_vsi_properties_data
 *    as the indirect buffer (128 bytes)
 *
 * Update VSI (indirect 0x211)
 *     uses the same data structure as Add VSI
 *
 * Get VSI (indirect 0x0212)
 *     uses the same completion and data structure as Add VSI
 */
struct i40e_aqc_add_get_update_vsi {
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
	__le16	uplink_seid;
	u8	connection_type;
#define I40E_AQ_VSI_CONN_TYPE_NORMAL	0x1
#define I40E_AQ_VSI_CONN_TYPE_DEFAULT	0x2
#define I40E_AQ_VSI_CONN_TYPE_CASCADED	0x3
	u8	reserved1;
	u8	vf_id;
	u8	reserved2;
	__le16	vsi_flags;
#define I40E_AQ_VSI_TYPE_SHIFT		0x0
#define I40E_AQ_VSI_TYPE_MASK		(0x3 << I40E_AQ_VSI_TYPE_SHIFT)
#define I40E_AQ_VSI_TYPE_VF		0x0
#define I40E_AQ_VSI_TYPE_VMDQ2		0x1
#define I40E_AQ_VSI_TYPE_PF		0x2
#define I40E_AQ_VSI_TYPE_EMP_MNG	0x3
#define I40E_AQ_VSI_FLAG_CASCADED_PV	0x4
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi);

struct i40e_aqc_add_get_update_vsi_completion {
	__le16 seid;
	__le16 vsi_number;
	__le16 vsi_used;
	__le16 vsi_free;
	__le32 addr_high;
	__le32 addr_low;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi_completion);

struct i40e_aqc_vsi_properties_data {
	/* first 96 byte are written by SW */
727 728 729 730 731 732 733 734 735 736 737
	__le16	valid_sections;
#define I40E_AQ_VSI_PROP_SWITCH_VALID		0x0001
#define I40E_AQ_VSI_PROP_SECURITY_VALID		0x0002
#define I40E_AQ_VSI_PROP_VLAN_VALID		0x0004
#define I40E_AQ_VSI_PROP_CAS_PV_VALID		0x0008
#define I40E_AQ_VSI_PROP_INGRESS_UP_VALID	0x0010
#define I40E_AQ_VSI_PROP_EGRESS_UP_VALID	0x0020
#define I40E_AQ_VSI_PROP_QUEUE_MAP_VALID	0x0040
#define I40E_AQ_VSI_PROP_QUEUE_OPT_VALID	0x0080
#define I40E_AQ_VSI_PROP_OUTER_UP_VALID		0x0100
#define I40E_AQ_VSI_PROP_SCHED_VALID		0x0200
G
Greg Rose 已提交
738
	/* switch section */
739 740 741 742 743 744 745
	__le16	switch_id; /* 12bit id combined with flags below */
#define I40E_AQ_VSI_SW_ID_SHIFT		0x0000
#define I40E_AQ_VSI_SW_ID_MASK		(0xFFF << I40E_AQ_VSI_SW_ID_SHIFT)
#define I40E_AQ_VSI_SW_ID_FLAG_NOT_STAG	0x1000
#define I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB	0x2000
#define I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB	0x4000
	u8	sw_reserved[2];
G
Greg Rose 已提交
746
	/* security section */
747 748 749 750 751
	u8	sec_flags;
#define I40E_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD	0x01
#define I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK	0x02
#define I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK	0x04
	u8	sec_reserved;
G
Greg Rose 已提交
752
	/* VLAN section */
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770
	__le16	pvid; /* VLANS include priority bits */
	__le16	fcoe_pvid;
	u8	port_vlan_flags;
#define I40E_AQ_VSI_PVLAN_MODE_SHIFT	0x00
#define I40E_AQ_VSI_PVLAN_MODE_MASK	(0x03 << \
					 I40E_AQ_VSI_PVLAN_MODE_SHIFT)
#define I40E_AQ_VSI_PVLAN_MODE_TAGGED	0x01
#define I40E_AQ_VSI_PVLAN_MODE_UNTAGGED	0x02
#define I40E_AQ_VSI_PVLAN_MODE_ALL	0x03
#define I40E_AQ_VSI_PVLAN_INSERT_PVID	0x04
#define I40E_AQ_VSI_PVLAN_EMOD_SHIFT	0x03
#define I40E_AQ_VSI_PVLAN_EMOD_MASK	(0x3 << \
					 I40E_AQ_VSI_PVLAN_EMOD_SHIFT)
#define I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH	0x0
#define I40E_AQ_VSI_PVLAN_EMOD_STR_UP	0x08
#define I40E_AQ_VSI_PVLAN_EMOD_STR	0x10
#define I40E_AQ_VSI_PVLAN_EMOD_NOTHING	0x18
	u8	pvlan_reserved[3];
G
Greg Rose 已提交
771
	/* ingress egress up sections */
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797
	__le32	ingress_table; /* bitmap, 3 bits per up */
#define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT	0
#define I40E_AQ_VSI_UP_TABLE_UP0_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP0_SHIFT)
#define I40E_AQ_VSI_UP_TABLE_UP1_SHIFT	3
#define I40E_AQ_VSI_UP_TABLE_UP1_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP1_SHIFT)
#define I40E_AQ_VSI_UP_TABLE_UP2_SHIFT	6
#define I40E_AQ_VSI_UP_TABLE_UP2_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP2_SHIFT)
#define I40E_AQ_VSI_UP_TABLE_UP3_SHIFT	9
#define I40E_AQ_VSI_UP_TABLE_UP3_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP3_SHIFT)
#define I40E_AQ_VSI_UP_TABLE_UP4_SHIFT	12
#define I40E_AQ_VSI_UP_TABLE_UP4_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP4_SHIFT)
#define I40E_AQ_VSI_UP_TABLE_UP5_SHIFT	15
#define I40E_AQ_VSI_UP_TABLE_UP5_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP5_SHIFT)
#define I40E_AQ_VSI_UP_TABLE_UP6_SHIFT	18
#define I40E_AQ_VSI_UP_TABLE_UP6_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP6_SHIFT)
#define I40E_AQ_VSI_UP_TABLE_UP7_SHIFT	21
#define I40E_AQ_VSI_UP_TABLE_UP7_MASK	(0x7 << \
					 I40E_AQ_VSI_UP_TABLE_UP7_SHIFT)
	__le32	egress_table;   /* same defines as for ingress table */
G
Greg Rose 已提交
798
	/* cascaded PV section */
799 800 801 802 803 804 805 806 807 808 809 810
	__le16	cas_pv_tag;
	u8	cas_pv_flags;
#define I40E_AQ_VSI_CAS_PV_TAGX_SHIFT		0x00
#define I40E_AQ_VSI_CAS_PV_TAGX_MASK		(0x03 << \
						 I40E_AQ_VSI_CAS_PV_TAGX_SHIFT)
#define I40E_AQ_VSI_CAS_PV_TAGX_LEAVE		0x00
#define I40E_AQ_VSI_CAS_PV_TAGX_REMOVE		0x01
#define I40E_AQ_VSI_CAS_PV_TAGX_COPY		0x02
#define I40E_AQ_VSI_CAS_PV_INSERT_TAG		0x10
#define I40E_AQ_VSI_CAS_PV_ETAG_PRUNE		0x20
#define I40E_AQ_VSI_CAS_PV_ACCEPT_HOST_TAG	0x40
	u8	cas_pv_reserved;
G
Greg Rose 已提交
811
	/* queue mapping section */
812 813 814 815 816 817 818 819 820 821 822 823 824
	__le16	mapping_flags;
#define I40E_AQ_VSI_QUE_MAP_CONTIG	0x0
#define I40E_AQ_VSI_QUE_MAP_NONCONTIG	0x1
	__le16	queue_mapping[16];
#define I40E_AQ_VSI_QUEUE_SHIFT		0x0
#define I40E_AQ_VSI_QUEUE_MASK		(0x7FF << I40E_AQ_VSI_QUEUE_SHIFT)
	__le16	tc_mapping[8];
#define I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT	0
#define I40E_AQ_VSI_TC_QUE_OFFSET_MASK	(0x1FF << \
					 I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT)
#define I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT	9
#define I40E_AQ_VSI_TC_QUE_NUMBER_MASK	(0x7 << \
					 I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT)
G
Greg Rose 已提交
825
	/* queueing option section */
826 827 828 829
	u8	queueing_opt_flags;
#define I40E_AQ_VSI_QUE_OPT_TCP_ENA	0x10
#define I40E_AQ_VSI_QUE_OPT_FCOE_ENA	0x20
	u8	queueing_opt_reserved[3];
G
Greg Rose 已提交
830
	/* scheduler section */
831 832
	u8	up_enable_bits;
	u8	sched_reserved;
G
Greg Rose 已提交
833
	/* outer up section */
834 835
	__le32	outer_up_table; /* same structure and defines as ingress tbl */
	u8	cmd_reserved[8];
G
Greg Rose 已提交
836
	/* last 32 bytes are written by FW */
837
	__le16	qs_handle[8];
G
Greg Rose 已提交
838
#define I40E_AQ_VSI_QS_HANDLE_INVALID	0xFFFF
839 840 841
	__le16	stat_counter_idx;
	__le16	sched_id;
	u8	resp_reserved[12];
G
Greg Rose 已提交
842 843 844 845 846 847 848 849 850
};

I40E_CHECK_STRUCT_LEN(128, i40e_aqc_vsi_properties_data);

/* Add Port Virtualizer (direct 0x0220)
 * also used for update PV (direct 0x0221) but only flags are used
 * (IS_CTRL_PORT only works on add PV)
 */
struct i40e_aqc_add_update_pv {
851 852 853 854 855 856 857 858
	__le16	command_flags;
#define I40E_AQC_PV_FLAG_PV_TYPE		0x1
#define I40E_AQC_PV_FLAG_FWD_UNKNOWN_STAG_EN	0x2
#define I40E_AQC_PV_FLAG_FWD_UNKNOWN_ETAG_EN	0x4
#define I40E_AQC_PV_FLAG_IS_CTRL_PORT		0x8
	__le16	uplink_seid;
	__le16	connected_seid;
	u8	reserved[10];
G
Greg Rose 已提交
859 860 861 862 863 864
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv);

struct i40e_aqc_add_update_pv_completion {
	/* reserved for update; for add also encodes error if rc == ENOSPC */
865 866 867 868 869 870
	__le16	pv_seid;
#define I40E_AQC_PV_ERR_FLAG_NO_PV	0x1
#define I40E_AQC_PV_ERR_FLAG_NO_SCHED	0x2
#define I40E_AQC_PV_ERR_FLAG_NO_COUNTER	0x4
#define I40E_AQC_PV_ERR_FLAG_NO_ENTRY	0x8
	u8	reserved[14];
G
Greg Rose 已提交
871 872 873 874 875 876 877 878 879
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv_completion);

/* Get PV Params (direct 0x0222)
 * uses i40e_aqc_switch_seid for the descriptor
 */

struct i40e_aqc_get_pv_params_completion {
880 881 882 883 884 885 886 887
	__le16	seid;
	__le16	default_stag;
	__le16	pv_flags; /* same flags as add_pv */
#define I40E_AQC_GET_PV_PV_TYPE			0x1
#define I40E_AQC_GET_PV_FRWD_UNKNOWN_STAG	0x2
#define I40E_AQC_GET_PV_FRWD_UNKNOWN_ETAG	0x4
	u8	reserved[8];
	__le16	default_port_seid;
G
Greg Rose 已提交
888 889 890 891 892 893
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_get_pv_params_completion);

/* Add VEB (direct 0x0230) */
struct i40e_aqc_add_veb {
894 895 896 897 898 899
	__le16	uplink_seid;
	__le16	downlink_seid;
	__le16	veb_flags;
#define I40E_AQC_ADD_VEB_FLOATING		0x1
#define I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT	1
#define I40E_AQC_ADD_VEB_PORT_TYPE_MASK		(0x3 << \
G
Greg Rose 已提交
900
					I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT)
901 902 903 904 905
#define I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT	0x2
#define I40E_AQC_ADD_VEB_PORT_TYPE_DATA		0x4
#define I40E_AQC_ADD_VEB_ENABLE_L2_FILTER	0x8
	u8	enable_tcs;
	u8	reserved[9];
G
Greg Rose 已提交
906 907 908 909 910
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb);

struct i40e_aqc_add_veb_completion {
911 912
	u8	reserved[6];
	__le16	switch_seid;
G
Greg Rose 已提交
913
	/* also encodes error if rc == ENOSPC; codes are the same as add_pv */
914 915 916 917 918 919 920 921
	__le16	veb_seid;
#define I40E_AQC_VEB_ERR_FLAG_NO_VEB		0x1
#define I40E_AQC_VEB_ERR_FLAG_NO_SCHED		0x2
#define I40E_AQC_VEB_ERR_FLAG_NO_COUNTER	0x4
#define I40E_AQC_VEB_ERR_FLAG_NO_ENTRY		0x8
	__le16	statistic_index;
	__le16	vebs_used;
	__le16	vebs_free;
G
Greg Rose 已提交
922 923 924 925 926 927 928 929
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb_completion);

/* Get VEB Parameters (direct 0x0232)
 * uses i40e_aqc_switch_seid for the descriptor
 */
struct i40e_aqc_get_veb_parameters_completion {
930 931 932 933 934 935 936
	__le16	seid;
	__le16	switch_id;
	__le16	veb_flags; /* only the first/last flags from 0x0230 is valid */
	__le16	statistic_index;
	__le16	vebs_used;
	__le16	vebs_free;
	u8	reserved[4];
G
Greg Rose 已提交
937 938 939 940 941 942 943 944 945 946 947 948
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_get_veb_parameters_completion);

/* Delete Element (direct 0x0243)
 * uses the generic i40e_aqc_switch_seid
 */

/* Add MAC-VLAN (indirect 0x0250) */

/* used for the command for most vlan commands */
struct i40e_aqc_macvlan {
949 950 951 952
	__le16	num_addresses;
	__le16	seid[3];
#define I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT	0
#define I40E_AQC_MACVLAN_CMD_SEID_NUM_MASK	(0x3FF << \
G
Greg Rose 已提交
953
					I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
954 955 956
#define I40E_AQC_MACVLAN_CMD_SEID_VALID		0x8000
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
957 958 959 960 961 962
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_macvlan);

/* indirect data for command and response */
struct i40e_aqc_add_macvlan_element_data {
963 964 965 966 967 968 969 970 971 972
	u8	mac_addr[6];
	__le16	vlan_tag;
	__le16	flags;
#define I40E_AQC_MACVLAN_ADD_PERFECT_MATCH	0x0001
#define I40E_AQC_MACVLAN_ADD_HASH_MATCH		0x0002
#define I40E_AQC_MACVLAN_ADD_IGNORE_VLAN	0x0004
#define I40E_AQC_MACVLAN_ADD_TO_QUEUE		0x0008
	__le16	queue_number;
#define I40E_AQC_MACVLAN_CMD_QUEUE_SHIFT	0
#define I40E_AQC_MACVLAN_CMD_QUEUE_MASK		(0x7FF << \
G
Greg Rose 已提交
973 974
					I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
	/* response section */
975 976 977 978 979
	u8	match_method;
#define I40E_AQC_MM_PERFECT_MATCH	0x01
#define I40E_AQC_MM_HASH_MATCH		0x02
#define I40E_AQC_MM_ERR_NO_RES		0xFF
	u8	reserved1[3];
G
Greg Rose 已提交
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998
};

struct i40e_aqc_add_remove_macvlan_completion {
	__le16 perfect_mac_used;
	__le16 perfect_mac_free;
	__le16 unicast_hash_free;
	__le16 multicast_hash_free;
	__le32 addr_high;
	__le32 addr_low;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_macvlan_completion);

/* Remove MAC-VLAN (indirect 0x0251)
 * uses i40e_aqc_macvlan for the descriptor
 * data points to an array of num_addresses of elements
 */

struct i40e_aqc_remove_macvlan_element_data {
999 1000 1001 1002 1003 1004 1005 1006
	u8	mac_addr[6];
	__le16	vlan_tag;
	u8	flags;
#define I40E_AQC_MACVLAN_DEL_PERFECT_MATCH	0x01
#define I40E_AQC_MACVLAN_DEL_HASH_MATCH		0x02
#define I40E_AQC_MACVLAN_DEL_IGNORE_VLAN	0x08
#define I40E_AQC_MACVLAN_DEL_ALL_VSIS		0x10
	u8	reserved[3];
G
Greg Rose 已提交
1007
	/* reply section */
1008 1009 1010 1011
	u8	error_code;
#define I40E_AQC_REMOVE_MACVLAN_SUCCESS		0x0
#define I40E_AQC_REMOVE_MACVLAN_FAIL		0xFF
	u8	reply_reserved[3];
G
Greg Rose 已提交
1012 1013 1014 1015 1016 1017 1018
};

/* Add VLAN (indirect 0x0252)
 * Remove VLAN (indirect 0x0253)
 * use the generic i40e_aqc_macvlan for the command
 */
struct i40e_aqc_add_remove_vlan_element_data {
1019 1020
	__le16	vlan_tag;
	u8	vlan_flags;
G
Greg Rose 已提交
1021
/* flags for add VLAN */
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
#define I40E_AQC_ADD_VLAN_LOCAL			0x1
#define I40E_AQC_ADD_PVLAN_TYPE_SHIFT		1
#define I40E_AQC_ADD_PVLAN_TYPE_MASK	(0x3 << I40E_AQC_ADD_PVLAN_TYPE_SHIFT)
#define I40E_AQC_ADD_PVLAN_TYPE_REGULAR		0x0
#define I40E_AQC_ADD_PVLAN_TYPE_PRIMARY		0x2
#define I40E_AQC_ADD_PVLAN_TYPE_SECONDARY	0x4
#define I40E_AQC_VLAN_PTYPE_SHIFT		3
#define I40E_AQC_VLAN_PTYPE_MASK	(0x3 << I40E_AQC_VLAN_PTYPE_SHIFT)
#define I40E_AQC_VLAN_PTYPE_REGULAR_VSI		0x0
#define I40E_AQC_VLAN_PTYPE_PROMISC_VSI		0x8
#define I40E_AQC_VLAN_PTYPE_COMMUNITY_VSI	0x10
#define I40E_AQC_VLAN_PTYPE_ISOLATED_VSI	0x18
G
Greg Rose 已提交
1034
/* flags for remove VLAN */
1035 1036 1037
#define I40E_AQC_REMOVE_VLAN_ALL	0x1
	u8	reserved;
	u8	result;
G
Greg Rose 已提交
1038
/* flags for add VLAN */
1039 1040 1041
#define I40E_AQC_ADD_VLAN_SUCCESS	0x0
#define I40E_AQC_ADD_VLAN_FAIL_REQUEST	0xFE
#define I40E_AQC_ADD_VLAN_FAIL_RESOURCE	0xFF
G
Greg Rose 已提交
1042
/* flags for remove VLAN */
1043 1044 1045
#define I40E_AQC_REMOVE_VLAN_SUCCESS	0x0
#define I40E_AQC_REMOVE_VLAN_FAIL	0xFF
	u8	reserved1[3];
G
Greg Rose 已提交
1046 1047 1048
};

struct i40e_aqc_add_remove_vlan_completion {
1049 1050 1051 1052 1053
	u8	reserved[4];
	__le16	vlans_used;
	__le16	vlans_free;
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1054 1055 1056 1057
};

/* Set VSI Promiscuous Modes (direct 0x0254) */
struct i40e_aqc_set_vsi_promiscuous_modes {
1058 1059
	__le16	promiscuous_flags;
	__le16	valid_flags;
G
Greg Rose 已提交
1060
/* flags used for both fields above */
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070
#define I40E_AQC_SET_VSI_PROMISC_UNICAST	0x01
#define I40E_AQC_SET_VSI_PROMISC_MULTICAST	0x02
#define I40E_AQC_SET_VSI_PROMISC_BROADCAST	0x04
#define I40E_AQC_SET_VSI_DEFAULT		0x08
#define I40E_AQC_SET_VSI_PROMISC_VLAN		0x10
	__le16	seid;
#define I40E_AQC_VSI_PROM_CMD_SEID_MASK		0x3FF
	__le16	vlan_tag;
#define I40E_AQC_SET_VSI_VLAN_VALID		0x8000
	u8	reserved[8];
G
Greg Rose 已提交
1071 1072 1073 1074 1075 1076 1077 1078
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_set_vsi_promiscuous_modes);

/* Add S/E-tag command (direct 0x0255)
 * Uses generic i40e_aqc_add_remove_tag_completion for completion
 */
struct i40e_aqc_add_tag {
1079 1080 1081 1082 1083
	__le16	flags;
#define I40E_AQC_ADD_TAG_FLAG_TO_QUEUE		0x0001
	__le16	seid;
#define I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT	0
#define I40E_AQC_ADD_TAG_CMD_SEID_NUM_MASK	(0x3FF << \
G
Greg Rose 已提交
1084
					I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT)
1085 1086 1087
	__le16	tag;
	__le16	queue_number;
	u8	reserved[8];
G
Greg Rose 已提交
1088 1089 1090 1091 1092
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_tag);

struct i40e_aqc_add_remove_tag_completion {
1093 1094 1095
	u8	reserved[12];
	__le16	tags_used;
	__le16	tags_free;
G
Greg Rose 已提交
1096 1097 1098 1099 1100 1101 1102 1103
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_tag_completion);

/* Remove S/E-tag command (direct 0x0256)
 * Uses generic i40e_aqc_add_remove_tag_completion for completion
 */
struct i40e_aqc_remove_tag {
1104 1105 1106
	__le16	seid;
#define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT	0
#define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_MASK	(0x3FF << \
G
Greg Rose 已提交
1107
					I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT)
1108 1109
	__le16	tag;
	u8	reserved[12];
G
Greg Rose 已提交
1110 1111
};

1112 1113
I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_tag);

G
Greg Rose 已提交
1114 1115 1116 1117 1118
/* Add multicast E-Tag (direct 0x0257)
 * del multicast E-Tag (direct 0x0258) only uses pv_seid and etag fields
 * and no external data
 */
struct i40e_aqc_add_remove_mcast_etag {
1119 1120 1121 1122 1123 1124
	__le16	pv_seid;
	__le16	etag;
	u8	num_unicast_etags;
	u8	reserved[3];
	__le32	addr_high;          /* address of array of 2-byte s-tags */
	__le32	addr_low;
G
Greg Rose 已提交
1125 1126 1127 1128 1129
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag);

struct i40e_aqc_add_remove_mcast_etag_completion {
1130 1131 1132 1133 1134
	u8	reserved[4];
	__le16	mcast_etags_used;
	__le16	mcast_etags_free;
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1135 1136 1137 1138 1139 1140 1141

};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag_completion);

/* Update S/E-Tag (direct 0x0259) */
struct i40e_aqc_update_tag {
1142 1143 1144
	__le16	seid;
#define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT	0
#define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_MASK	(0x3FF << \
G
Greg Rose 已提交
1145
					I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT)
1146 1147 1148
	__le16	old_tag;
	__le16	new_tag;
	u8	reserved[10];
G
Greg Rose 已提交
1149 1150 1151 1152 1153
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag);

struct i40e_aqc_update_tag_completion {
1154 1155 1156
	u8	reserved[12];
	__le16	tags_used;
	__le16	tags_free;
G
Greg Rose 已提交
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag_completion);

/* Add Control Packet filter (direct 0x025A)
 * Remove Control Packet filter (direct 0x025B)
 * uses the i40e_aqc_add_oveb_cloud,
 * and the generic direct completion structure
 */
struct i40e_aqc_add_remove_control_packet_filter {
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177
	u8	mac[6];
	__le16	etype;
	__le16	flags;
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC	0x0001
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP		0x0002
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE	0x0004
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX		0x0008
#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX		0x0000
	__le16	seid;
#define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT	0
#define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_MASK	(0x3FF << \
G
Greg Rose 已提交
1178
				I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT)
1179 1180
	__le16	queue;
	u8	reserved[2];
G
Greg Rose 已提交
1181 1182 1183 1184 1185
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter);

struct i40e_aqc_add_remove_control_packet_filter_completion {
1186 1187 1188 1189 1190
	__le16	mac_etype_used;
	__le16	etype_used;
	__le16	mac_etype_free;
	__le16	etype_free;
	u8	reserved[8];
G
Greg Rose 已提交
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter_completion);

/* Add Cloud filters (indirect 0x025C)
 * Remove Cloud filters (indirect 0x025D)
 * uses the i40e_aqc_add_remove_cloud_filters,
 * and the generic indirect completion structure
 */
struct i40e_aqc_add_remove_cloud_filters {
1201 1202 1203 1204 1205
	u8	num_filters;
	u8	reserved;
	__le16	seid;
#define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT	0
#define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_MASK	(0x3FF << \
G
Greg Rose 已提交
1206
					I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT)
1207 1208 1209
	u8	reserved2[4];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1210 1211 1212 1213 1214
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_cloud_filters);

struct i40e_aqc_add_remove_cloud_filters_element_data {
1215 1216 1217
	u8	outer_mac[6];
	u8	inner_mac[6];
	__le16	inner_vlan;
G
Greg Rose 已提交
1218 1219 1220 1221 1222 1223 1224 1225 1226
	union {
		struct {
			u8 reserved[12];
			u8 data[4];
		} v4;
		struct {
			u8 data[16];
		} v6;
	} ipaddr;
1227 1228
	__le16	flags;
#define I40E_AQC_ADD_CLOUD_FILTER_SHIFT			0
1229
#define I40E_AQC_ADD_CLOUD_FILTER_MASK	(0x3F << \
G
Greg Rose 已提交
1230 1231
					I40E_AQC_ADD_CLOUD_FILTER_SHIFT)
/* 0x0000 reserved */
1232
#define I40E_AQC_ADD_CLOUD_FILTER_OIP			0x0001
G
Greg Rose 已提交
1233
/* 0x0002 reserved */
1234 1235
#define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN		0x0003
#define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID	0x0004
G
Greg Rose 已提交
1236
/* 0x0005 reserved */
1237
#define I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID		0x0006
G
Greg Rose 已提交
1238 1239
/* 0x0007 reserved */
/* 0x0008 reserved */
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261
#define I40E_AQC_ADD_CLOUD_FILTER_OMAC			0x0009
#define I40E_AQC_ADD_CLOUD_FILTER_IMAC			0x000A
#define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC	0x000B
#define I40E_AQC_ADD_CLOUD_FILTER_IIP			0x000C

#define I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE		0x0080
#define I40E_AQC_ADD_CLOUD_VNK_SHIFT			6
#define I40E_AQC_ADD_CLOUD_VNK_MASK			0x00C0
#define I40E_AQC_ADD_CLOUD_FLAGS_IPV4			0
#define I40E_AQC_ADD_CLOUD_FLAGS_IPV6			0x0100

#define I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT		9
#define I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK		0x1E00
#define I40E_AQC_ADD_CLOUD_TNL_TYPE_XVLAN		0
#define I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC		1
#define I40E_AQC_ADD_CLOUD_TNL_TYPE_NGE			2
#define I40E_AQC_ADD_CLOUD_TNL_TYPE_IP			3

	__le32	tenant_id;
	u8	reserved[4];
	__le16	queue_number;
#define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT		0
1262
#define I40E_AQC_ADD_CLOUD_QUEUE_MASK		(0x7FF << \
1263 1264
						 I40E_AQC_ADD_CLOUD_QUEUE_SHIFT)
	u8	reserved2[14];
G
Greg Rose 已提交
1265
	/* response section */
1266 1267 1268 1269
	u8	allocation_result;
#define I40E_AQC_ADD_CLOUD_FILTER_SUCCESS	0x0
#define I40E_AQC_ADD_CLOUD_FILTER_FAIL		0xFF
	u8	response_reserved[7];
G
Greg Rose 已提交
1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290
};

struct i40e_aqc_remove_cloud_filters_completion {
	__le16 perfect_ovlan_used;
	__le16 perfect_ovlan_free;
	__le16 vlan_used;
	__le16 vlan_free;
	__le32 addr_high;
	__le32 addr_low;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_cloud_filters_completion);

/* Add Mirror Rule (indirect or direct 0x0260)
 * Delete Mirror Rule (indirect or direct 0x0261)
 * note: some rule types (4,5) do not use an external buffer.
 *       take care to set the flags correctly.
 */
struct i40e_aqc_add_delete_mirror_rule {
	__le16 seid;
	__le16 rule_type;
1291 1292
#define I40E_AQC_MIRROR_RULE_TYPE_SHIFT		0
#define I40E_AQC_MIRROR_RULE_TYPE_MASK		(0x7 << \
G
Greg Rose 已提交
1293
						I40E_AQC_MIRROR_RULE_TYPE_SHIFT)
1294 1295 1296 1297 1298
#define I40E_AQC_MIRROR_RULE_TYPE_VPORT_INGRESS	1
#define I40E_AQC_MIRROR_RULE_TYPE_VPORT_EGRESS	2
#define I40E_AQC_MIRROR_RULE_TYPE_VLAN		3
#define I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS	4
#define I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS	5
G
Greg Rose 已提交
1299 1300 1301 1302 1303 1304 1305 1306 1307
	__le16 num_entries;
	__le16 destination;  /* VSI for add, rule id for delete */
	__le32 addr_high;    /* address of array of 2-byte VSI or VLAN ids */
	__le32 addr_low;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule);

struct i40e_aqc_add_delete_mirror_rule_completion {
1308 1309 1310 1311 1312 1313
	u8	reserved[2];
	__le16	rule_id;  /* only used on add */
	__le16	mirror_rules_used;
	__le16	mirror_rules_free;
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule_completion);

/* DCB 0x03xx*/

/* PFC Ignore (direct 0x0301)
 *    the command and response use the same descriptor structure
 */
struct i40e_aqc_pfc_ignore {
1324 1325 1326 1327 1328
	u8	tc_bitmap;
	u8	command_flags; /* unused on response */
#define I40E_AQC_PFC_IGNORE_SET		0x80
#define I40E_AQC_PFC_IGNORE_CLEAR	0x0
	u8	reserved[14];
G
Greg Rose 已提交
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_pfc_ignore);

/* DCB Update (direct 0x0302) uses the i40e_aq_desc structure
 * with no parameters
 */

/* TX scheduler 0x04xx */

/* Almost all the indirect commands use
 * this generic struct to pass the SEID in param0
 */
struct i40e_aqc_tx_sched_ind {
1343 1344 1345 1346
	__le16	vsi_seid;
	u8	reserved[6];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_tx_sched_ind);

/* Several commands respond with a set of queue set handles */
struct i40e_aqc_qs_handles_resp {
	__le16 qs_handles[8];
};

/* Configure VSI BW limits (direct 0x0400) */
struct i40e_aqc_configure_vsi_bw_limit {
1358 1359 1360 1361 1362 1363
	__le16	vsi_seid;
	u8	reserved[2];
	__le16	credit;
	u8	reserved1[2];
	u8	max_credit; /* 0-3, limit = 2^max */
	u8	reserved2[7];
G
Greg Rose 已提交
1364 1365 1366 1367 1368 1369 1370 1371
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_vsi_bw_limit);

/* Configure VSI Bandwidth Limit per Traffic Type (indirect 0x0406)
 *    responds with i40e_aqc_qs_handles_resp
 */
struct i40e_aqc_configure_vsi_ets_sla_bw_data {
1372 1373 1374
	u8	tc_valid_bits;
	u8	reserved[15];
	__le16	tc_bw_credits[8]; /* FW writesback QS handles here */
G
Greg Rose 已提交
1375 1376

	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1377 1378
	__le16	tc_bw_max[2];
	u8	reserved1[28];
G
Greg Rose 已提交
1379 1380
};

1381 1382
I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_configure_vsi_ets_sla_bw_data);

G
Greg Rose 已提交
1383 1384 1385 1386
/* Configure VSI Bandwidth Allocation per Traffic Type (indirect 0x0407)
 *    responds with i40e_aqc_qs_handles_resp
 */
struct i40e_aqc_configure_vsi_tc_bw_data {
1387 1388 1389 1390 1391
	u8	tc_valid_bits;
	u8	reserved[3];
	u8	tc_bw_credits[8];
	u8	reserved1[4];
	__le16	qs_handles[8];
G
Greg Rose 已提交
1392 1393
};

1394 1395
I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_vsi_tc_bw_data);

G
Greg Rose 已提交
1396 1397
/* Query vsi bw configuration (indirect 0x0408) */
struct i40e_aqc_query_vsi_bw_config_resp {
1398 1399 1400 1401 1402 1403 1404 1405 1406
	u8	tc_valid_bits;
	u8	tc_suspended_bits;
	u8	reserved[14];
	__le16	qs_handles[8];
	u8	reserved1[4];
	__le16	port_bw_limit;
	u8	reserved2[2];
	u8	max_bw; /* 0-3, limit = 2^max */
	u8	reserved3[23];
G
Greg Rose 已提交
1407 1408
};

1409 1410
I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_vsi_bw_config_resp);

G
Greg Rose 已提交
1411 1412
/* Query VSI Bandwidth Allocation per Traffic Type (indirect 0x040A) */
struct i40e_aqc_query_vsi_ets_sla_config_resp {
1413 1414 1415 1416
	u8	tc_valid_bits;
	u8	reserved[3];
	u8	share_credits[8];
	__le16	credits[8];
G
Greg Rose 已提交
1417 1418

	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1419
	__le16	tc_bw_max[2];
G
Greg Rose 已提交
1420 1421
};

1422 1423
I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_vsi_ets_sla_config_resp);

G
Greg Rose 已提交
1424 1425
/* Configure Switching Component Bandwidth Limit (direct 0x0410) */
struct i40e_aqc_configure_switching_comp_bw_limit {
1426 1427 1428 1429 1430 1431
	__le16	seid;
	u8	reserved[2];
	__le16	credit;
	u8	reserved1[2];
	u8	max_bw; /* 0-3, limit = 2^max */
	u8	reserved2[7];
G
Greg Rose 已提交
1432 1433 1434 1435 1436 1437 1438 1439 1440
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_switching_comp_bw_limit);

/* Enable  Physical Port ETS (indirect 0x0413)
 * Modify  Physical Port ETS (indirect 0x0414)
 * Disable Physical Port ETS (indirect 0x0415)
 */
struct i40e_aqc_configure_switching_comp_ets_data {
1441 1442 1443 1444 1445 1446 1447 1448
	u8	reserved[4];
	u8	tc_valid_bits;
	u8	seepage;
#define I40E_AQ_ETS_SEEPAGE_EN_MASK	0x1
	u8	tc_strict_priority_flags;
	u8	reserved1[17];
	u8	tc_bw_share_credits[8];
	u8	reserved2[96];
G
Greg Rose 已提交
1449 1450
};

1451 1452
I40E_CHECK_STRUCT_LEN(0x80, i40e_aqc_configure_switching_comp_ets_data);

G
Greg Rose 已提交
1453 1454
/* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */
struct i40e_aqc_configure_switching_comp_ets_bw_limit_data {
1455 1456 1457
	u8	tc_valid_bits;
	u8	reserved[15];
	__le16	tc_bw_credit[8];
G
Greg Rose 已提交
1458 1459

	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1460 1461
	__le16	tc_bw_max[2];
	u8	reserved1[28];
G
Greg Rose 已提交
1462 1463
};

1464 1465 1466
I40E_CHECK_STRUCT_LEN(0x40,
		      i40e_aqc_configure_switching_comp_ets_bw_limit_data);

G
Greg Rose 已提交
1467 1468 1469 1470
/* Configure Switching Component Bandwidth Allocation per Tc
 * (indirect 0x0417)
 */
struct i40e_aqc_configure_switching_comp_bw_config_data {
1471 1472 1473 1474 1475
	u8	tc_valid_bits;
	u8	reserved[2];
	u8	absolute_credits; /* bool */
	u8	tc_bw_share_credits[8];
	u8	reserved1[20];
G
Greg Rose 已提交
1476 1477
};

1478 1479
I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_switching_comp_bw_config_data);

G
Greg Rose 已提交
1480 1481
/* Query Switching Component Configuration (indirect 0x0418) */
struct i40e_aqc_query_switching_comp_ets_config_resp {
1482 1483 1484 1485 1486 1487
	u8	tc_valid_bits;
	u8	reserved[35];
	__le16	port_bw_limit;
	u8	reserved1[2];
	u8	tc_bw_max; /* 0-3, limit = 2^max */
	u8	reserved2[23];
G
Greg Rose 已提交
1488 1489
};

1490 1491
I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_switching_comp_ets_config_resp);

G
Greg Rose 已提交
1492 1493
/* Query PhysicalPort ETS Configuration (indirect 0x0419) */
struct i40e_aqc_query_port_ets_config_resp {
1494 1495 1496 1497 1498 1499 1500
	u8	reserved[4];
	u8	tc_valid_bits;
	u8	reserved1;
	u8	tc_strict_priority_bits;
	u8	reserved2;
	u8	tc_bw_share_credits[8];
	__le16	tc_bw_limits[8];
G
Greg Rose 已提交
1501 1502

	/* 4 bits per tc 0-7, 4th bit reserved, limit = 2^max */
1503 1504
	__le16	tc_bw_max[2];
	u8	reserved3[32];
G
Greg Rose 已提交
1505 1506
};

1507 1508
I40E_CHECK_STRUCT_LEN(0x44, i40e_aqc_query_port_ets_config_resp);

G
Greg Rose 已提交
1509 1510 1511 1512
/* Query Switching Component Bandwidth Allocation per Traffic Type
 * (indirect 0x041A)
 */
struct i40e_aqc_query_switching_comp_bw_config_resp {
1513 1514 1515 1516 1517
	u8	tc_valid_bits;
	u8	reserved[2];
	u8	absolute_credits_enable; /* bool */
	u8	tc_bw_share_credits[8];
	__le16	tc_bw_limits[8];
G
Greg Rose 已提交
1518 1519

	/* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
1520
	__le16	tc_bw_max[2];
G
Greg Rose 已提交
1521 1522
};

1523 1524
I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_switching_comp_bw_config_resp);

G
Greg Rose 已提交
1525 1526 1527 1528
/* Suspend/resume port TX traffic
 * (direct 0x041B and 0x041C) uses the generic SEID struct
 */

S
Shannon Nelson 已提交
1529 1530 1531 1532
/* Configure partition BW
 * (indirect 0x041D)
 */
struct i40e_aqc_configure_partition_bw_data {
1533 1534 1535
	__le16	pf_valid_bits;
	u8	min_bw[16];      /* guaranteed bandwidth */
	u8	max_bw[16];      /* bandwidth limit */
S
Shannon Nelson 已提交
1536 1537
};

1538 1539
I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data);

G
Greg Rose 已提交
1540 1541 1542 1543
/* Get and set the active HMC resource profile and status.
 * (direct 0x0500) and (direct 0x0501)
 */
struct i40e_aq_get_set_hmc_resource_profile {
1544 1545 1546
	u8	pm_profile;
	u8	pe_vf_enabled;
	u8	reserved[14];
G
Greg Rose 已提交
1547 1548 1549 1550 1551 1552
};

I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile);

enum i40e_aq_hmc_profile {
	/* I40E_HMC_PROFILE_NO_CHANGE    = 0, reserved */
1553 1554 1555
	I40E_HMC_PROFILE_DEFAULT	= 1,
	I40E_HMC_PROFILE_FAVOR_VF	= 2,
	I40E_HMC_PROFILE_EQUAL		= 3,
G
Greg Rose 已提交
1556 1557
};

1558 1559
#define I40E_AQ_GET_HMC_RESOURCE_PROFILE_PM_MASK	0xF
#define I40E_AQ_GET_HMC_RESOURCE_PROFILE_COUNT_MASK	0x3F
G
Greg Rose 已提交
1560 1561 1562 1563

/* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */

/* set in param0 for get phy abilities to report qualified modules */
1564 1565
#define I40E_AQ_PHY_REPORT_QUALIFIED_MODULES	0x0001
#define I40E_AQ_PHY_REPORT_INITIAL_VALUES	0x0002
G
Greg Rose 已提交
1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579

enum i40e_aq_phy_type {
	I40E_PHY_TYPE_SGMII			= 0x0,
	I40E_PHY_TYPE_1000BASE_KX		= 0x1,
	I40E_PHY_TYPE_10GBASE_KX4		= 0x2,
	I40E_PHY_TYPE_10GBASE_KR		= 0x3,
	I40E_PHY_TYPE_40GBASE_KR4		= 0x4,
	I40E_PHY_TYPE_XAUI			= 0x5,
	I40E_PHY_TYPE_XFI			= 0x6,
	I40E_PHY_TYPE_SFI			= 0x7,
	I40E_PHY_TYPE_XLAUI			= 0x8,
	I40E_PHY_TYPE_XLPPI			= 0x9,
	I40E_PHY_TYPE_40GBASE_CR4_CU		= 0xA,
	I40E_PHY_TYPE_10GBASE_CR1_CU		= 0xB,
1580 1581
	I40E_PHY_TYPE_10GBASE_AOC		= 0xC,
	I40E_PHY_TYPE_40GBASE_AOC		= 0xD,
G
Greg Rose 已提交
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591
	I40E_PHY_TYPE_100BASE_TX		= 0x11,
	I40E_PHY_TYPE_1000BASE_T		= 0x12,
	I40E_PHY_TYPE_10GBASE_T			= 0x13,
	I40E_PHY_TYPE_10GBASE_SR		= 0x14,
	I40E_PHY_TYPE_10GBASE_LR		= 0x15,
	I40E_PHY_TYPE_10GBASE_SFPP_CU		= 0x16,
	I40E_PHY_TYPE_10GBASE_CR1		= 0x17,
	I40E_PHY_TYPE_40GBASE_CR4		= 0x18,
	I40E_PHY_TYPE_40GBASE_SR4		= 0x19,
	I40E_PHY_TYPE_40GBASE_LR4		= 0x1A,
1592 1593 1594 1595
	I40E_PHY_TYPE_1000BASE_SX		= 0x1B,
	I40E_PHY_TYPE_1000BASE_LX		= 0x1C,
	I40E_PHY_TYPE_1000BASE_T_OPTICAL	= 0x1D,
	I40E_PHY_TYPE_20GBASE_KR2		= 0x1E,
G
Greg Rose 已提交
1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621
	I40E_PHY_TYPE_MAX
};

#define I40E_LINK_SPEED_100MB_SHIFT	0x1
#define I40E_LINK_SPEED_1000MB_SHIFT	0x2
#define I40E_LINK_SPEED_10GB_SHIFT	0x3
#define I40E_LINK_SPEED_40GB_SHIFT	0x4
#define I40E_LINK_SPEED_20GB_SHIFT	0x5

enum i40e_aq_link_speed {
	I40E_LINK_SPEED_UNKNOWN	= 0,
	I40E_LINK_SPEED_100MB	= (1 << I40E_LINK_SPEED_100MB_SHIFT),
	I40E_LINK_SPEED_1GB	= (1 << I40E_LINK_SPEED_1000MB_SHIFT),
	I40E_LINK_SPEED_10GB	= (1 << I40E_LINK_SPEED_10GB_SHIFT),
	I40E_LINK_SPEED_40GB	= (1 << I40E_LINK_SPEED_40GB_SHIFT),
	I40E_LINK_SPEED_20GB	= (1 << I40E_LINK_SPEED_20GB_SHIFT)
};

struct i40e_aqc_module_desc {
	u8 oui[3];
	u8 reserved1;
	u8 part_number[16];
	u8 revision[4];
	u8 reserved2[8];
};

1622 1623
I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_module_desc);

G
Greg Rose 已提交
1624
struct i40e_aq_get_phy_abilities_resp {
1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649
	__le32	phy_type;       /* bitmap using the above enum for offsets */
	u8	link_speed;     /* bitmap using the above enum bit patterns */
	u8	abilities;
#define I40E_AQ_PHY_FLAG_PAUSE_TX	0x01
#define I40E_AQ_PHY_FLAG_PAUSE_RX	0x02
#define I40E_AQ_PHY_FLAG_LOW_POWER	0x04
#define I40E_AQ_PHY_LINK_ENABLED	0x08
#define I40E_AQ_PHY_AN_ENABLED		0x10
#define I40E_AQ_PHY_FLAG_MODULE_QUAL	0x20
	__le16	eee_capability;
#define I40E_AQ_EEE_100BASE_TX		0x0002
#define I40E_AQ_EEE_1000BASE_T		0x0004
#define I40E_AQ_EEE_10GBASE_T		0x0008
#define I40E_AQ_EEE_1000BASE_KX		0x0010
#define I40E_AQ_EEE_10GBASE_KX4		0x0020
#define I40E_AQ_EEE_10GBASE_KR		0x0040
	__le32	eeer_val;
	u8	d3_lpan;
#define I40E_AQ_SET_PHY_D3_LPAN_ENA	0x01
	u8	reserved[3];
	u8	phy_id[4];
	u8	module_type[3];
	u8	qualified_module_count;
#define I40E_AQ_PHY_MAX_QMS		16
	struct i40e_aqc_module_desc	qualified_module[I40E_AQ_PHY_MAX_QMS];
G
Greg Rose 已提交
1650 1651
};

1652 1653
I40E_CHECK_STRUCT_LEN(0x218, i40e_aq_get_phy_abilities_resp);

G
Greg Rose 已提交
1654 1655
/* Set PHY Config (direct 0x0601) */
struct i40e_aq_set_phy_config { /* same bits as above in all */
1656 1657 1658
	__le32	phy_type;
	u8	link_speed;
	u8	abilities;
G
Greg Rose 已提交
1659 1660 1661 1662
/* bits 0-2 use the values from get_phy_abilities_resp */
#define I40E_AQ_PHY_ENABLE_LINK		0x08
#define I40E_AQ_PHY_ENABLE_AN		0x10
#define I40E_AQ_PHY_ENABLE_ATOMIC_LINK	0x20
1663 1664 1665 1666
	__le16	eee_capability;
	__le32	eeer;
	u8	low_power_ctrl;
	u8	reserved[3];
G
Greg Rose 已提交
1667 1668 1669 1670 1671 1672
};

I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);

/* Set MAC Config command data structure (direct 0x0603) */
struct i40e_aq_set_mac_config {
1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692
	__le16	max_frame_size;
	u8	params;
#define I40E_AQ_SET_MAC_CONFIG_CRC_EN		0x04
#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK	0x78
#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT	3
#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE	0x0
#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX	0xF
#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX	0x9
#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX	0x8
#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX	0x7
#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX	0x6
#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX	0x5
#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX	0x4
#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX	0x3
#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX	0x2
#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX	0x1
	u8	tx_timer_priority; /* bitmap */
	__le16	tx_timer_value;
	__le16	fc_refresh_threshold;
	u8	reserved[8];
G
Greg Rose 已提交
1693 1694 1695 1696 1697 1698
};

I40E_CHECK_CMD_LENGTH(i40e_aq_set_mac_config);

/* Restart Auto-Negotiation (direct 0x605) */
struct i40e_aqc_set_link_restart_an {
1699 1700 1701 1702
	u8	command;
#define I40E_AQ_PHY_RESTART_AN	0x02
#define I40E_AQ_PHY_LINK_ENABLE	0x04
	u8	reserved[15];
G
Greg Rose 已提交
1703 1704 1705 1706 1707 1708
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_set_link_restart_an);

/* Get Link Status cmd & response data structure (direct 0x0607) */
struct i40e_aqc_get_link_status {
1709 1710 1711 1712 1713
	__le16	command_flags; /* only field set on command */
#define I40E_AQ_LSE_MASK		0x3
#define I40E_AQ_LSE_NOP			0x0
#define I40E_AQ_LSE_DISABLE		0x2
#define I40E_AQ_LSE_ENABLE		0x3
G
Greg Rose 已提交
1714
/* only response uses this flag */
1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749
#define I40E_AQ_LSE_IS_ENABLED		0x1
	u8	phy_type;    /* i40e_aq_phy_type   */
	u8	link_speed;  /* i40e_aq_link_speed */
	u8	link_info;
#define I40E_AQ_LINK_UP			0x01
#define I40E_AQ_LINK_FAULT		0x02
#define I40E_AQ_LINK_FAULT_TX		0x04
#define I40E_AQ_LINK_FAULT_RX		0x08
#define I40E_AQ_LINK_FAULT_REMOTE	0x10
#define I40E_AQ_MEDIA_AVAILABLE		0x40
#define I40E_AQ_SIGNAL_DETECT		0x80
	u8	an_info;
#define I40E_AQ_AN_COMPLETED		0x01
#define I40E_AQ_LP_AN_ABILITY		0x02
#define I40E_AQ_PD_FAULT		0x04
#define I40E_AQ_FEC_EN			0x08
#define I40E_AQ_PHY_LOW_POWER		0x10
#define I40E_AQ_LINK_PAUSE_TX		0x20
#define I40E_AQ_LINK_PAUSE_RX		0x40
#define I40E_AQ_QUALIFIED_MODULE	0x80
	u8	ext_info;
#define I40E_AQ_LINK_PHY_TEMP_ALARM	0x01
#define I40E_AQ_LINK_XCESSIVE_ERRORS	0x02
#define I40E_AQ_LINK_TX_SHIFT		0x02
#define I40E_AQ_LINK_TX_MASK		(0x03 << I40E_AQ_LINK_TX_SHIFT)
#define I40E_AQ_LINK_TX_ACTIVE		0x00
#define I40E_AQ_LINK_TX_DRAINED		0x01
#define I40E_AQ_LINK_TX_FLUSHED		0x03
#define I40E_AQ_LINK_FORCED_40G		0x10
	u8	loopback; /* use defines from i40e_aqc_set_lb_mode */
	__le16	max_frame_size;
	u8	config;
#define I40E_AQ_CONFIG_CRC_ENA		0x04
#define I40E_AQ_CONFIG_PACING_MASK	0x78
	u8	reserved[5];
G
Greg Rose 已提交
1750 1751 1752 1753 1754 1755
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_get_link_status);

/* Set event mask command (direct 0x613) */
struct i40e_aqc_set_phy_int_mask {
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767
	u8	reserved[8];
	__le16	event_mask;
#define I40E_AQ_EVENT_LINK_UPDOWN	0x0002
#define I40E_AQ_EVENT_MEDIA_NA		0x0004
#define I40E_AQ_EVENT_LINK_FAULT	0x0008
#define I40E_AQ_EVENT_PHY_TEMP_ALARM	0x0010
#define I40E_AQ_EVENT_EXCESSIVE_ERRORS	0x0020
#define I40E_AQ_EVENT_SIGNAL_DETECT	0x0040
#define I40E_AQ_EVENT_AN_COMPLETED	0x0080
#define I40E_AQ_EVENT_MODULE_QUAL_FAIL	0x0100
#define I40E_AQ_EVENT_PORT_TX_SUSPENDED	0x0200
	u8	reserved1[6];
G
Greg Rose 已提交
1768 1769 1770 1771 1772 1773 1774 1775 1776
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_int_mask);

/* Get Local AN advt register (direct 0x0614)
 * Set Local AN advt register (direct 0x0615)
 * Get Link Partner AN advt register (direct 0x0616)
 */
struct i40e_aqc_an_advt_reg {
1777 1778 1779
	__le32	local_an_reg0;
	__le16	local_an_reg1;
	u8	reserved[10];
G
Greg Rose 已提交
1780 1781 1782 1783 1784 1785
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);

/* Set Loopback mode (0x0618) */
struct i40e_aqc_set_lb_mode {
1786 1787 1788 1789 1790
	__le16	lb_mode;
#define I40E_AQ_LB_PHY_LOCAL	0x01
#define I40E_AQ_LB_PHY_REMOTE	0x02
#define I40E_AQ_LB_MAC_LOCAL	0x04
	u8	reserved[14];
G
Greg Rose 已提交
1791 1792 1793 1794
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);

1795 1796
/* Set PHY Debug command (0x0622) */
struct i40e_aqc_set_phy_debug {
1797
	u8	command_flags;
1798 1799 1800 1801 1802 1803 1804 1805
#define I40E_AQ_PHY_DEBUG_RESET_INTERNAL	0x02
#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT	2
#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_MASK	(0x03 << \
					I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT)
#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE	0x00
#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD	0x01
#define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT	0x02
#define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW	0x10
1806
	u8	reserved[15];
G
Greg Rose 已提交
1807 1808
};

1809
I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_debug);
G
Greg Rose 已提交
1810 1811

enum i40e_aq_phy_reg_type {
1812 1813 1814
	I40E_AQC_PHY_REG_INTERNAL	= 0x1,
	I40E_AQC_PHY_REG_EXERNAL_BASET	= 0x2,
	I40E_AQC_PHY_REG_EXERNAL_MODULE	= 0x3
G
Greg Rose 已提交
1815 1816 1817 1818 1819 1820 1821
};

/* NVM Read command (indirect 0x0701)
 * NVM Erase commands (direct 0x0702)
 * NVM Update commands (indirect 0x0703)
 */
struct i40e_aqc_nvm_update {
1822 1823 1824 1825 1826 1827 1828 1829
	u8	command_flags;
#define I40E_AQ_NVM_LAST_CMD	0x01
#define I40E_AQ_NVM_FLASH_ONLY	0x80
	u8	module_pointer;
	__le16	length;
	__le32	offset;
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1830 1831 1832 1833
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update);

1834 1835
/* NVM Config Read (indirect 0x0704) */
struct i40e_aqc_nvm_config_read {
1836
	__le16	cmd_flags;
J
Jeff Kirsher 已提交
1837 1838 1839
#define I40E_AQ_ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK	1
#define I40E_AQ_ANVM_READ_SINGLE_FEATURE		0
#define I40E_AQ_ANVM_READ_MULTIPLE_FEATURES		1
1840
	__le16	element_count;
J
Jeff Kirsher 已提交
1841 1842
	__le16	element_id;	/* Feature/field ID */
	__le16	element_id_msw;	/* MSWord of field ID */
1843 1844
	__le32	address_high;
	__le32	address_low;
1845 1846 1847 1848 1849 1850
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_read);

/* NVM Config Write (indirect 0x0705) */
struct i40e_aqc_nvm_config_write {
1851 1852 1853 1854 1855
	__le16	cmd_flags;
	__le16	element_count;
	u8	reserved[4];
	__le32	address_high;
	__le32	address_low;
1856 1857 1858 1859
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write);

1860 1861 1862 1863 1864 1865
/* Used for 0x0704 as well as for 0x0705 commands */
#define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT		1
#define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_MASK \
				(1 << I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT)
#define I40E_AQ_ANVM_FEATURE		0
#define I40E_AQ_ANVM_IMMEDIATE_FIELD	(1 << FEATURE_OR_IMMEDIATE_SHIFT)
1866 1867
struct i40e_aqc_nvm_config_data_feature {
	__le16 feature_id;
1868 1869 1870
#define I40E_AQ_ANVM_FEATURE_OPTION_OEM_ONLY		0x01
#define I40E_AQ_ANVM_FEATURE_OPTION_DWORD_MAP		0x08
#define I40E_AQ_ANVM_FEATURE_OPTION_POR_CSR		0x10
1871 1872 1873 1874
	__le16 feature_options;
	__le16 feature_selection;
};

1875 1876
I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature);

1877
struct i40e_aqc_nvm_config_data_immediate_field {
1878 1879
	__le32 field_id;
	__le32 field_value;
1880
	__le16 field_options;
1881
	__le16 reserved;
1882 1883
};

1884 1885
I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field);

G
Greg Rose 已提交
1886 1887 1888 1889 1890
/* Send to PF command (indirect 0x0801) id is only used by PF
 * Send to VF command (indirect 0x0802) id is only used by PF
 * Send to Peer PF command (indirect 0x0803)
 */
struct i40e_aqc_pf_vf_message {
1891 1892 1893 1894
	__le32	id;
	u8	reserved[4];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_pf_vf_message);

/* Alternate structure */

/* Direct write (direct 0x0900)
 * Direct read (direct 0x0902)
 */
struct i40e_aqc_alternate_write {
	__le32 address0;
	__le32 data0;
	__le32 address1;
	__le32 data1;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write);

/* Indirect write (indirect 0x0901)
 * Indirect read (indirect 0x0903)
 */

struct i40e_aqc_alternate_ind_write {
	__le32 address;
	__le32 length;
	__le32 addr_high;
	__le32 addr_low;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_ind_write);

/* Done alternate write (direct 0x0904)
 * uses i40e_aq_desc
 */
struct i40e_aqc_alternate_write_done {
1930
	__le16	cmd_flags;
G
Greg Rose 已提交
1931 1932 1933 1934
#define I40E_AQ_ALTERNATE_MODE_BIOS_MASK	1
#define I40E_AQ_ALTERNATE_MODE_BIOS_LEGACY	0
#define I40E_AQ_ALTERNATE_MODE_BIOS_UEFI	1
#define I40E_AQ_ALTERNATE_RESET_NEEDED		2
1935
	u8	reserved[14];
G
Greg Rose 已提交
1936 1937 1938 1939 1940 1941
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write_done);

/* Set OEM mode (direct 0x0905) */
struct i40e_aqc_alternate_set_mode {
1942
	__le32	mode;
G
Greg Rose 已提交
1943 1944
#define I40E_AQ_ALTERNATE_MODE_NONE	0
#define I40E_AQ_ALTERNATE_MODE_OEM	1
1945
	u8	reserved[12];
G
Greg Rose 已提交
1946 1947 1948 1949 1950 1951 1952 1953 1954 1955
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_set_mode);

/* Clear port Alternate RAM (direct 0x0906) uses i40e_aq_desc */

/* async events 0x10xx */

/* Lan Queue Overflow Event (direct, 0x1001) */
struct i40e_aqc_lan_overflow {
1956 1957 1958
	__le32	prtdcb_rupto;
	__le32	otx_ctl;
	u8	reserved[8];
G
Greg Rose 已提交
1959 1960 1961 1962 1963 1964
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_lan_overflow);

/* Get LLDP MIB (indirect 0x0A00) */
struct i40e_aqc_lldp_get_mib {
1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976
	u8	type;
	u8	reserved1;
#define I40E_AQ_LLDP_MIB_TYPE_MASK		0x3
#define I40E_AQ_LLDP_MIB_LOCAL			0x0
#define I40E_AQ_LLDP_MIB_REMOTE			0x1
#define I40E_AQ_LLDP_MIB_LOCAL_AND_REMOTE	0x2
#define I40E_AQ_LLDP_BRIDGE_TYPE_MASK		0xC
#define I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT		0x2
#define I40E_AQ_LLDP_BRIDGE_TYPE_NEAREST_BRIDGE	0x0
#define I40E_AQ_LLDP_BRIDGE_TYPE_NON_TPMR	0x1
#define I40E_AQ_LLDP_TX_SHIFT			0x4
#define I40E_AQ_LLDP_TX_MASK			(0x03 << I40E_AQ_LLDP_TX_SHIFT)
G
Greg Rose 已提交
1977
/* TX pause flags use I40E_AQ_LINK_TX_* above */
1978 1979 1980 1981 1982
	__le16	local_len;
	__le16	remote_len;
	u8	reserved2[2];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1983 1984 1985 1986 1987 1988 1989 1990
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_get_mib);

/* Configure LLDP MIB Change Event (direct 0x0A01)
 * also used for the event (with type in the command field)
 */
struct i40e_aqc_lldp_update_mib {
1991 1992 1993 1994 1995 1996
	u8	command;
#define I40E_AQ_LLDP_MIB_UPDATE_ENABLE	0x0
#define I40E_AQ_LLDP_MIB_UPDATE_DISABLE	0x1
	u8	reserved[7];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
1997 1998 1999 2000 2001 2002 2003 2004
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_mib);

/* Add LLDP TLV (indirect 0x0A02)
 * Delete LLDP TLV (indirect 0x0A04)
 */
struct i40e_aqc_lldp_add_tlv {
2005 2006 2007 2008 2009 2010
	u8	type; /* only nearest bridge and non-TPMR from 0x0A00 */
	u8	reserved1[1];
	__le16	len;
	u8	reserved2[4];
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
2011 2012 2013 2014 2015 2016
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_add_tlv);

/* Update LLDP TLV (indirect 0x0A03) */
struct i40e_aqc_lldp_update_tlv {
2017 2018 2019 2020 2021 2022 2023
	u8	type; /* only nearest bridge and non-TPMR from 0x0A00 */
	u8	reserved;
	__le16	old_len;
	__le16	new_offset;
	__le16	new_len;
	__le32	addr_high;
	__le32	addr_low;
G
Greg Rose 已提交
2024 2025 2026 2027 2028 2029
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);

/* Stop LLDP (direct 0x0A05) */
struct i40e_aqc_lldp_stop {
2030 2031 2032 2033
	u8	command;
#define I40E_AQ_LLDP_AGENT_STOP		0x0
#define I40E_AQ_LLDP_AGENT_SHUTDOWN	0x1
	u8	reserved[15];
G
Greg Rose 已提交
2034 2035 2036 2037 2038 2039 2040
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);

/* Start LLDP (direct 0x0A06) */

struct i40e_aqc_lldp_start {
2041 2042 2043
	u8	command;
#define I40E_AQ_LLDP_AGENT_START	0x1
	u8	reserved[15];
G
Greg Rose 已提交
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_start);

/* Apply MIB changes (0x0A07)
 * uses the generic struc as it contains no data
 */

/* Add Udp Tunnel command and completion (direct 0x0B00) */
struct i40e_aqc_add_udp_tunnel {
2054 2055 2056
	__le16	udp_port;
	u8	reserved0[3];
	u8	protocol_type;
S
Shannon Nelson 已提交
2057 2058 2059
#define I40E_AQC_TUNNEL_TYPE_VXLAN	0x00
#define I40E_AQC_TUNNEL_TYPE_NGE	0x01
#define I40E_AQC_TUNNEL_TYPE_TEREDO	0x10
2060
	u8	reserved1[10];
G
Greg Rose 已提交
2061 2062 2063 2064 2065 2066 2067 2068
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel);

struct i40e_aqc_add_udp_tunnel_completion {
	__le16 udp_port;
	u8	filter_entry_index;
	u8	multiple_pfs;
2069 2070
#define I40E_AQC_SINGLE_PF		0x0
#define I40E_AQC_MULTIPLE_PFS		0x1
G
Greg Rose 已提交
2071 2072 2073 2074 2075 2076 2077 2078
	u8	total_filters;
	u8	reserved[11];
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel_completion);

/* remove UDP Tunnel command (0x0B01) */
struct i40e_aqc_remove_udp_tunnel {
2079 2080 2081
	u8	reserved[2];
	u8	index; /* 0 to 15 */
	u8	reserved2[13];
G
Greg Rose 已提交
2082 2083 2084 2085 2086
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_udp_tunnel);

struct i40e_aqc_del_udp_tunnel_completion {
2087 2088 2089 2090 2091
	__le16	udp_port;
	u8	index; /* 0 to 15 */
	u8	multiple_pfs;
	u8	total_filters_used;
	u8	reserved1[11];
G
Greg Rose 已提交
2092 2093 2094 2095 2096 2097
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion);

/* tunnel key structure 0x0B10 */

G
Greg Rose 已提交
2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113
struct i40e_aqc_tunnel_key_structure_A0 {
	__le16     key1_off;
	__le16     key1_len;
	__le16     key2_off;
	__le16     key2_len;
	__le16     flags;
#define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE 0x01
/* response flags */
#define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS    0x01
#define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED   0x02
#define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN 0x03
	u8         resreved[6];
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure_A0);

G
Greg Rose 已提交
2114 2115 2116 2117 2118 2119
struct i40e_aqc_tunnel_key_structure {
	u8	key1_off;
	u8	key2_off;
	u8	key1_len;  /* 0 to 15 */
	u8	key2_len;  /* 0 to 15 */
	u8	flags;
2120
#define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE	0x01
G
Greg Rose 已提交
2121
/* response flags */
2122 2123 2124
#define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS	0x01
#define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED	0x02
#define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN	0x03
G
Greg Rose 已提交
2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136
	u8	network_key_index;
#define I40E_AQC_NETWORK_KEY_INDEX_VXLAN		0x0
#define I40E_AQC_NETWORK_KEY_INDEX_NGE			0x1
#define I40E_AQC_NETWORK_KEY_INDEX_FLEX_MAC_IN_UDP	0x2
#define I40E_AQC_NETWORK_KEY_INDEX_GRE			0x3
	u8	reserved[10];
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure);

/* OEM mode commands (direct 0xFE0x) */
struct i40e_aqc_oem_param_change {
2137 2138 2139 2140 2141
	__le32	param_type;
#define I40E_AQ_OEM_PARAM_TYPE_PF_CTL	0
#define I40E_AQ_OEM_PARAM_TYPE_BW_CTL	1
#define I40E_AQ_OEM_PARAM_MAC		2
	__le32	param_value1;
2142 2143
	__le16	param_value2;
	u8	reserved[6];
G
Greg Rose 已提交
2144 2145 2146 2147 2148
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change);

struct i40e_aqc_oem_state_change {
2149 2150 2151 2152
	__le32	state;
#define I40E_AQ_OEM_STATE_LINK_DOWN	0x0
#define I40E_AQ_OEM_STATE_LINK_UP	0x1
	u8	reserved[12];
G
Greg Rose 已提交
2153 2154 2155 2156
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_state_change);

2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178
/* Initialize OCSD (0xFE02, direct) */
struct i40e_aqc_opc_oem_ocsd_initialize {
	u8 type_status;
	u8 reserved1[3];
	__le32 ocsd_memory_block_addr_high;
	__le32 ocsd_memory_block_addr_low;
	__le32 requested_update_interval;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocsd_initialize);

/* Initialize OCBB  (0xFE03, direct) */
struct i40e_aqc_opc_oem_ocbb_initialize {
	u8 type_status;
	u8 reserved1[3];
	__le32 ocbb_memory_block_addr_high;
	__le32 ocbb_memory_block_addr_low;
	u8 reserved2[4];
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocbb_initialize);

G
Greg Rose 已提交
2179 2180 2181 2182 2183 2184 2185
/* debug commands */

/* get device id (0xFF00) uses the generic structure */

/* set test more (0xFF01, internal) */

struct i40e_acq_set_test_mode {
2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197
	u8	mode;
#define I40E_AQ_TEST_PARTIAL	0
#define I40E_AQ_TEST_FULL	1
#define I40E_AQ_TEST_NVM	2
	u8	reserved[3];
	u8	command;
#define I40E_AQ_TEST_OPEN	0
#define I40E_AQ_TEST_CLOSE	1
#define I40E_AQ_TEST_INC	2
	u8	reserved2[3];
	__le32	address_high;
	__le32	address_low;
G
Greg Rose 已提交
2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249
};

I40E_CHECK_CMD_LENGTH(i40e_acq_set_test_mode);

/* Debug Read Register command (0xFF03)
 * Debug Write Register command (0xFF04)
 */
struct i40e_aqc_debug_reg_read_write {
	__le32 reserved;
	__le32 address;
	__le32 value_high;
	__le32 value_low;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_reg_read_write);

/* Scatter/gather Reg Read  (indirect 0xFF05)
 * Scatter/gather Reg Write (indirect 0xFF06)
 */

/* i40e_aq_desc is used for the command */
struct i40e_aqc_debug_reg_sg_element_data {
	__le32 address;
	__le32 value;
};

/* Debug Modify register (direct 0xFF07) */
struct i40e_aqc_debug_modify_reg {
	__le32 address;
	__le32 value;
	__le32 clear_mask;
	__le32 set_mask;
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_reg);

/* dump internal data (0xFF08, indirect) */

#define I40E_AQ_CLUSTER_ID_AUX		0
#define I40E_AQ_CLUSTER_ID_SWITCH_FLU	1
#define I40E_AQ_CLUSTER_ID_TXSCHED	2
#define I40E_AQ_CLUSTER_ID_HMC		3
#define I40E_AQ_CLUSTER_ID_MAC0		4
#define I40E_AQ_CLUSTER_ID_MAC1		5
#define I40E_AQ_CLUSTER_ID_MAC2		6
#define I40E_AQ_CLUSTER_ID_MAC3		7
#define I40E_AQ_CLUSTER_ID_DCB		8
#define I40E_AQ_CLUSTER_ID_EMP_MEM	9
#define I40E_AQ_CLUSTER_ID_PKT_BUF	10
#define I40E_AQ_CLUSTER_ID_ALTRAM	11

struct i40e_aqc_debug_dump_internals {
2250 2251 2252 2253 2254 2255
	u8	cluster_id;
	u8	table_id;
	__le16	data_size;
	__le32	idx;
	__le32	address_high;
	__le32	address_low;
G
Greg Rose 已提交
2256 2257 2258 2259 2260
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_dump_internals);

struct i40e_aqc_debug_modify_internals {
2261 2262 2263 2264
	u8	cluster_id;
	u8	cluster_specific_params[7];
	__le32	address_high;
	__le32	address_low;
G
Greg Rose 已提交
2265 2266 2267 2268 2269
};

I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);

#endif