Home | History | Annotate | Line # | Download | only in pci
      1  1.8  yamaguch /*	$NetBSD: if_ixlvar.h,v 1.8 2022/03/16 05:26:37 yamaguchi Exp $	*/
      2  1.1  yamaguch 
      3  1.1  yamaguch /*
      4  1.1  yamaguch  * Copyright (c) 2019 Internet Initiative Japan, Inc.
      5  1.1  yamaguch  * All rights reserved.
      6  1.1  yamaguch  *
      7  1.1  yamaguch  * Redistribution and use in source and binary forms, with or without
      8  1.1  yamaguch  * modification, are permitted provided that the following conditions
      9  1.1  yamaguch  * are met:
     10  1.1  yamaguch  * 1. Redistributions of source code must retain the above copyright
     11  1.1  yamaguch  *    notice, this list of conditions and the following disclaimer.
     12  1.1  yamaguch  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  yamaguch  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  yamaguch  *    documentation and/or other materials provided with the distribution.
     15  1.1  yamaguch  *
     16  1.1  yamaguch  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17  1.1  yamaguch  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  1.1  yamaguch  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  1.1  yamaguch  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20  1.1  yamaguch  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  1.1  yamaguch  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  1.1  yamaguch  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  1.1  yamaguch  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  1.1  yamaguch  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  1.1  yamaguch  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  yamaguch  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  yamaguch  */
     28  1.1  yamaguch 
     29  1.1  yamaguch #ifndef _DEV_PCI_IF_IXLVAR_H_
     30  1.1  yamaguch #define _DEV_PCI_IF_IXLVAR_H_
     31  1.1  yamaguch 
     32  1.1  yamaguch enum i40e_filter_pctype {
     33  1.1  yamaguch 	/* Note: Values 0-28 are reserved for future use.
     34  1.1  yamaguch 	 * Value 29, 30, 32 are not supported on XL710 and X710.
     35  1.1  yamaguch 	 */
     36  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP        = 29,
     37  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP      = 30,
     38  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV4_UDP                = 31,
     39  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK     = 32,
     40  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV4_TCP                = 33,
     41  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV4_SCTP               = 34,
     42  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV4_OTHER              = 35,
     43  1.1  yamaguch 	I40E_FILTER_PCTYPE_FRAG_IPV4                    = 36,
     44  1.1  yamaguch 	/* Note: Values 37-38 are reserved for future use.
     45  1.1  yamaguch 	 * Value 39, 40, 42 are not supported on XL710 and X710.
     46  1.1  yamaguch 	 */
     47  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP        = 39,
     48  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP      = 40,
     49  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV6_UDP                = 41,
     50  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK     = 42,
     51  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV6_TCP                = 43,
     52  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV6_SCTP               = 44,
     53  1.1  yamaguch 	I40E_FILTER_PCTYPE_NONF_IPV6_OTHER              = 45,
     54  1.1  yamaguch 	I40E_FILTER_PCTYPE_FRAG_IPV6                    = 46,
     55  1.1  yamaguch 	/* Note: Value 47 is reserved for future use */
     56  1.1  yamaguch 	I40E_FILTER_PCTYPE_FCOE_OX                      = 48,
     57  1.1  yamaguch 	I40E_FILTER_PCTYPE_FCOE_RX                      = 49,
     58  1.1  yamaguch 	I40E_FILTER_PCTYPE_FCOE_OTHER                   = 50,
     59  1.1  yamaguch 	/* Note: Values 51-62 are reserved for future use */
     60  1.1  yamaguch 	I40E_FILTER_PCTYPE_L2_PAYLOAD                   = 63,
     61  1.1  yamaguch };
     62  1.1  yamaguch 
     63  1.7  yamaguch #define IXL_BIT_ULL(a)	(1ULL << (a))
     64  1.7  yamaguch #define IXL_RSS_HENA_DEFAULT_BASE			\
     65  1.7  yamaguch 	(IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) |	\
     66  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) |	\
     67  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) |	\
     68  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) |	\
     69  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) |	\
     70  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) |	\
     71  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) |	\
     72  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) |	\
     73  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) |	\
     74  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) |	\
     75  1.7  yamaguch 	 IXL_BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD))
     76  1.7  yamaguch #define IXL_RSS_HENA_DEFAULT_XL710	IXL_RSS_HENA_DEFAULT_BASE
     77  1.7  yamaguch #define IXL_RSS_HENA_DEFAULT_X722	(IXL_RSS_HENA_DEFAULT_XL710 |	\
     78  1.7  yamaguch 	IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) |		\
     79  1.7  yamaguch 	IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) |	\
     80  1.7  yamaguch 	IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) |		\
     81  1.7  yamaguch 	IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP) |	\
     82  1.7  yamaguch 	IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) |	\
     83  1.7  yamaguch 	IXL_BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK))
     84  1.7  yamaguch 
     85  1.7  yamaguch #define IXL_RSS_VSI_LUT_SIZE	64
     86  1.7  yamaguch #define IXL_RSS_KEY_SIZE_REG	13
     87  1.7  yamaguch #define IXL_RSS_KEY_SIZE	(IXL_RSS_KEY_SIZE_REG * sizeof(uint32_t))
     88  1.7  yamaguch 
     89  1.1  yamaguch enum i40e_reset_type {
     90  1.1  yamaguch 	I40E_RESET_POR          = 0,
     91  1.1  yamaguch 	I40E_RESET_CORER        = 1,
     92  1.1  yamaguch 	I40E_RESET_GLOBR        = 2,
     93  1.1  yamaguch 	I40E_RESET_EMPR         = 3,
     94  1.1  yamaguch };
     95  1.1  yamaguch 
     96  1.1  yamaguch struct ixl_aq_desc {
     97  1.1  yamaguch 	uint16_t	iaq_flags;
     98  1.1  yamaguch #define	IXL_AQ_DD		(1U << 0)
     99  1.1  yamaguch #define	IXL_AQ_CMP		(1U << 1)
    100  1.1  yamaguch #define IXL_AQ_ERR		(1U << 2)
    101  1.1  yamaguch #define IXL_AQ_VFE		(1U << 3)
    102  1.1  yamaguch #define IXL_AQ_LB		(1U << 9)
    103  1.1  yamaguch #define IXL_AQ_RD		(1U << 10)
    104  1.1  yamaguch #define IXL_AQ_VFC		(1U << 11)
    105  1.1  yamaguch #define IXL_AQ_BUF		(1U << 12)
    106  1.1  yamaguch #define IXL_AQ_SI		(1U << 13)
    107  1.1  yamaguch #define IXL_AQ_EI		(1U << 14)
    108  1.1  yamaguch #define IXL_AQ_FE		(1U << 15)
    109  1.1  yamaguch 
    110  1.1  yamaguch #define IXL_AQ_FLAGS_FMT	"\020" "\020FE" "\017EI" "\016SI" "\015BUF" \
    111  1.1  yamaguch 				    "\014VFC" "\013DB" "\012LB" "\004VFE" \
    112  1.1  yamaguch 				    "\003ERR" "\002CMP" "\001DD"
    113  1.1  yamaguch 
    114  1.1  yamaguch 	uint16_t	iaq_opcode;
    115  1.1  yamaguch 
    116  1.1  yamaguch 	uint16_t	iaq_datalen;
    117  1.1  yamaguch 	uint16_t	iaq_retval;
    118  1.1  yamaguch 
    119  1.1  yamaguch 	uint64_t	iaq_cookie;
    120  1.1  yamaguch 
    121  1.1  yamaguch 	uint32_t	iaq_param[4];
    122  1.1  yamaguch /*	iaq_data_hi	iaq_param[2] */
    123  1.1  yamaguch /*	iaq_data_lo	iaq_param[3] */
    124  1.1  yamaguch } __packed __aligned(16);
    125  1.1  yamaguch 
    126  1.1  yamaguch /* aq commands */
    127  1.1  yamaguch #define IXL_AQ_OP_GET_VERSION		0x0001
    128  1.1  yamaguch #define IXL_AQ_OP_DRIVER_VERSION	0x0002
    129  1.1  yamaguch #define IXL_AQ_OP_QUEUE_SHUTDOWN	0x0003
    130  1.1  yamaguch #define IXL_AQ_OP_SET_PF_CONTEXT	0x0004
    131  1.1  yamaguch #define IXL_AQ_OP_GET_AQ_ERR_REASON	0x0005
    132  1.1  yamaguch #define IXL_AQ_OP_REQUEST_RESOURCE	0x0008
    133  1.1  yamaguch #define IXL_AQ_OP_RELEASE_RESOURCE	0x0009
    134  1.1  yamaguch #define IXL_AQ_OP_LIST_FUNC_CAP		0x000a
    135  1.1  yamaguch #define IXL_AQ_OP_LIST_DEV_CAP		0x000b
    136  1.1  yamaguch #define IXL_AQ_OP_MAC_ADDRESS_READ	0x0107
    137  1.1  yamaguch #define IXL_AQ_OP_CLEAR_PXE_MODE	0x0110
    138  1.1  yamaguch #define IXL_AQ_OP_SWITCH_GET_CONFIG	0x0200
    139  1.1  yamaguch #define IXL_AQ_OP_RX_CTL_REG_READ	0x0206
    140  1.1  yamaguch #define IXL_AQ_OP_RX_CTL_REG_WRITE	0x0207
    141  1.1  yamaguch #define IXL_AQ_OP_ADD_VSI		0x0210
    142  1.1  yamaguch #define IXL_AQ_OP_UPD_VSI_PARAMS	0x0211
    143  1.1  yamaguch #define IXL_AQ_OP_GET_VSI_PARAMS	0x0212
    144  1.1  yamaguch #define IXL_AQ_OP_ADD_VEB		0x0230
    145  1.1  yamaguch #define IXL_AQ_OP_UPD_VEB_PARAMS	0x0231
    146  1.1  yamaguch #define IXL_AQ_OP_GET_VEB_PARAMS	0x0232
    147  1.1  yamaguch #define IXL_AQ_OP_ADD_MACVLAN		0x0250
    148  1.1  yamaguch #define IXL_AQ_OP_REMOVE_MACVLAN	0x0251
    149  1.1  yamaguch #define IXL_AQ_OP_SET_VSI_PROMISC	0x0254
    150  1.1  yamaguch #define IXL_AQ_OP_PHY_GET_ABILITIES	0x0600
    151  1.1  yamaguch #define IXL_AQ_OP_PHY_SET_CONFIG	0x0601
    152  1.1  yamaguch #define IXL_AQ_OP_PHY_SET_MAC_CONFIG	0x0603
    153  1.1  yamaguch #define IXL_AQ_OP_PHY_RESTART_AN	0x0605
    154  1.1  yamaguch #define IXL_AQ_OP_PHY_LINK_STATUS	0x0607
    155  1.1  yamaguch #define IXL_AQ_OP_PHY_SET_EVENT_MASK	0x0613
    156  1.1  yamaguch #define IXL_AQ_OP_PHY_SET_REGISTER	0x0628
    157  1.1  yamaguch #define IXL_AQ_OP_PHY_GET_REGISTER	0x0629
    158  1.4  yamaguch #define IXL_AQ_OP_NVM_READ		0x0701
    159  1.1  yamaguch #define IXL_AQ_OP_LLDP_GET_MIB		0x0a00
    160  1.1  yamaguch #define IXL_AQ_OP_LLDP_MIB_CHG_EV	0x0a01
    161  1.1  yamaguch #define IXL_AQ_OP_LLDP_ADD_TLV		0x0a02
    162  1.1  yamaguch #define IXL_AQ_OP_LLDP_UPD_TLV		0x0a03
    163  1.1  yamaguch #define IXL_AQ_OP_LLDP_DEL_TLV		0x0a04
    164  1.1  yamaguch #define IXL_AQ_OP_LLDP_STOP_AGENT	0x0a05
    165  1.1  yamaguch #define IXL_AQ_OP_LLDP_START_AGENT	0x0a06
    166  1.1  yamaguch #define IXL_AQ_OP_LLDP_GET_CEE_DCBX	0x0a07
    167  1.1  yamaguch #define IXL_AQ_OP_LLDP_SPECIFIC_AGENT	0x0a09
    168  1.6  yamaguch #define IXL_AQ_OP_RSS_SET_KEY		0x0b02
    169  1.6  yamaguch #define IXL_AQ_OP_RSS_SET_LUT		0x0b03
    170  1.6  yamaguch #define IXL_AQ_OP_RSS_GET_KEY		0x0b04
    171  1.6  yamaguch #define IXL_AQ_OP_RSS_GET_LUT		0x0b05
    172  1.1  yamaguch 
    173  1.7  yamaguch static inline void
    174  1.7  yamaguch ixl_aq_dva(struct ixl_aq_desc *iaq, bus_addr_t addr)
    175  1.7  yamaguch {
    176  1.7  yamaguch 	uint64_t val;
    177  1.7  yamaguch 
    178  1.7  yamaguch 	if (sizeof(addr) > 4) {
    179  1.7  yamaguch 		val = (intptr_t)addr;
    180  1.7  yamaguch 		iaq->iaq_param[2] = htole32(val >> 32);
    181  1.7  yamaguch 	} else {
    182  1.7  yamaguch 		iaq->iaq_param[2] = htole32(0);
    183  1.7  yamaguch 	}
    184  1.7  yamaguch 
    185  1.7  yamaguch 	iaq->iaq_param[3] = htole32(addr);
    186  1.7  yamaguch }
    187  1.7  yamaguch 
    188  1.7  yamaguch static inline bool
    189  1.7  yamaguch ixl_aq_has_dva(struct ixl_aq_desc *iaq)
    190  1.7  yamaguch {
    191  1.7  yamaguch 	uint64_t val;
    192  1.7  yamaguch 
    193  1.7  yamaguch 	if (sizeof(bus_addr_t) > 4) {
    194  1.7  yamaguch 		val = le32toh(iaq->iaq_param[2]);
    195  1.7  yamaguch 		val = val << 32;
    196  1.7  yamaguch 	} else {
    197  1.7  yamaguch 		val = 0;
    198  1.7  yamaguch 	}
    199  1.7  yamaguch 	val |= htole32(iaq->iaq_param[3]);
    200  1.7  yamaguch 
    201  1.7  yamaguch 	return !(val == 0);
    202  1.7  yamaguch }
    203  1.7  yamaguch 
    204  1.1  yamaguch struct ixl_aq_mac_addresses {
    205  1.1  yamaguch 	uint8_t		pf_lan[ETHER_ADDR_LEN];
    206  1.1  yamaguch 	uint8_t		pf_san[ETHER_ADDR_LEN];
    207  1.1  yamaguch 	uint8_t		port[ETHER_ADDR_LEN];
    208  1.1  yamaguch 	uint8_t		pf_wol[ETHER_ADDR_LEN];
    209  1.1  yamaguch } __packed;
    210  1.1  yamaguch 
    211  1.1  yamaguch #define IXL_AQ_MAC_PF_LAN_VALID		(1U << 4)
    212  1.1  yamaguch #define IXL_AQ_MAC_PF_SAN_VALID		(1U << 5)
    213  1.1  yamaguch #define IXL_AQ_MAC_PORT_VALID		(1U << 6)
    214  1.1  yamaguch #define IXL_AQ_MAC_PF_WOL_VALID		(1U << 7)
    215  1.1  yamaguch 
    216  1.1  yamaguch struct ixl_aq_capability {
    217  1.1  yamaguch 	uint16_t	cap_id;
    218  1.1  yamaguch #define IXL_AQ_CAP_SWITCH_MODE		0x0001
    219  1.1  yamaguch #define IXL_AQ_CAP_MNG_MODE		0x0002
    220  1.1  yamaguch #define IXL_AQ_CAP_NPAR_ACTIVE		0x0003
    221  1.1  yamaguch #define IXL_AQ_CAP_OS2BMC_CAP		0x0004
    222  1.1  yamaguch #define IXL_AQ_CAP_FUNCTIONS_VALID	0x0005
    223  1.1  yamaguch #define IXL_AQ_CAP_ALTERNATE_RAM	0x0006
    224  1.1  yamaguch #define IXL_AQ_CAP_WOL_AND_PROXY	0x0008
    225  1.1  yamaguch #define IXL_AQ_CAP_SRIOV		0x0012
    226  1.1  yamaguch #define IXL_AQ_CAP_VF			0x0013
    227  1.1  yamaguch #define IXL_AQ_CAP_VMDQ			0x0014
    228  1.1  yamaguch #define IXL_AQ_CAP_8021QBG		0x0015
    229  1.1  yamaguch #define IXL_AQ_CAP_8021QBR		0x0016
    230  1.1  yamaguch #define IXL_AQ_CAP_VSI			0x0017
    231  1.1  yamaguch #define IXL_AQ_CAP_DCB			0x0018
    232  1.1  yamaguch #define IXL_AQ_CAP_FCOE			0x0021
    233  1.1  yamaguch #define IXL_AQ_CAP_ISCSI		0x0022
    234  1.1  yamaguch #define IXL_AQ_CAP_RSS			0x0040
    235  1.1  yamaguch #define IXL_AQ_CAP_RXQ			0x0041
    236  1.1  yamaguch #define IXL_AQ_CAP_TXQ			0x0042
    237  1.1  yamaguch #define IXL_AQ_CAP_MSIX			0x0043
    238  1.1  yamaguch #define IXL_AQ_CAP_VF_MSIX		0x0044
    239  1.1  yamaguch #define IXL_AQ_CAP_FLOW_DIRECTOR	0x0045
    240  1.1  yamaguch #define IXL_AQ_CAP_1588			0x0046
    241  1.1  yamaguch #define IXL_AQ_CAP_IWARP		0x0051
    242  1.1  yamaguch #define IXL_AQ_CAP_LED			0x0061
    243  1.1  yamaguch #define IXL_AQ_CAP_SDP			0x0062
    244  1.1  yamaguch #define IXL_AQ_CAP_MDIO			0x0063
    245  1.1  yamaguch #define IXL_AQ_CAP_WSR_PROT		0x0064
    246  1.1  yamaguch #define IXL_AQ_CAP_NVM_MGMT		0x0080
    247  1.1  yamaguch #define IXL_AQ_CAP_FLEX10		0x00F1
    248  1.1  yamaguch #define IXL_AQ_CAP_CEM			0x00F2
    249  1.1  yamaguch 	uint8_t		major_rev;
    250  1.1  yamaguch 	uint8_t		minor_rev;
    251  1.1  yamaguch 	uint32_t	number;
    252  1.1  yamaguch 	uint32_t	logical_id;
    253  1.1  yamaguch 	uint32_t	phys_id;
    254  1.1  yamaguch 	uint8_t		_reserved[16];
    255  1.1  yamaguch } __packed __aligned(4);
    256  1.1  yamaguch 
    257  1.1  yamaguch #define IXL_LLDP_SHUTDOWN		0x1
    258  1.1  yamaguch 
    259  1.1  yamaguch struct ixl_aq_switch_config {
    260  1.1  yamaguch 	uint16_t	num_reported;
    261  1.1  yamaguch 	uint16_t	num_total;
    262  1.1  yamaguch 	uint8_t		_reserved[12];
    263  1.1  yamaguch } __packed __aligned(4);
    264  1.1  yamaguch 
    265  1.1  yamaguch struct ixl_aq_switch_config_element {
    266  1.1  yamaguch 	uint8_t		type;
    267  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_MAC		1
    268  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_PF		2
    269  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_VF		3
    270  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_EMP		4
    271  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_BMC		5
    272  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_PV		16
    273  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_VEB		17
    274  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_PA		18
    275  1.1  yamaguch #define IXL_AQ_SW_ELEM_TYPE_VSI		19
    276  1.1  yamaguch 	uint8_t		revision;
    277  1.1  yamaguch #define IXL_AQ_SW_ELEM_REV_1		1
    278  1.1  yamaguch 	uint16_t	seid;
    279  1.1  yamaguch 
    280  1.1  yamaguch 	uint16_t	uplink_seid;
    281  1.1  yamaguch 	uint16_t	downlink_seid;
    282  1.1  yamaguch 
    283  1.1  yamaguch 	uint8_t		_reserved[3];
    284  1.1  yamaguch 	uint8_t		connection_type;
    285  1.1  yamaguch #define IXL_AQ_CONN_TYPE_REGULAR	0x1
    286  1.1  yamaguch #define IXL_AQ_CONN_TYPE_DEFAULT	0x2
    287  1.1  yamaguch #define IXL_AQ_CONN_TYPE_CASCADED	0x3
    288  1.1  yamaguch 
    289  1.1  yamaguch 	uint16_t	scheduler_id;
    290  1.1  yamaguch 	uint16_t	element_info;
    291  1.1  yamaguch } __packed __aligned(4);
    292  1.1  yamaguch 
    293  1.1  yamaguch #define IXL_PHY_TYPE_SGMII		0x00
    294  1.1  yamaguch #define IXL_PHY_TYPE_1000BASE_KX	0x01
    295  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_KX4	0x02
    296  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_KR		0x03
    297  1.1  yamaguch #define IXL_PHY_TYPE_40GBASE_KR4	0x04
    298  1.1  yamaguch #define IXL_PHY_TYPE_XAUI		0x05
    299  1.1  yamaguch #define IXL_PHY_TYPE_XFI		0x06
    300  1.1  yamaguch #define IXL_PHY_TYPE_SFI		0x07
    301  1.1  yamaguch #define IXL_PHY_TYPE_XLAUI		0x08
    302  1.1  yamaguch #define IXL_PHY_TYPE_XLPPI		0x09
    303  1.1  yamaguch #define IXL_PHY_TYPE_40GBASE_CR4_CU	0x0a
    304  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_CR1_CU	0x0b
    305  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_AOC	0x0c
    306  1.1  yamaguch #define IXL_PHY_TYPE_40GBASE_AOC	0x0d
    307  1.1  yamaguch #define IXL_PHY_TYPE_100BASE_TX		0x11
    308  1.1  yamaguch #define IXL_PHY_TYPE_1000BASE_T		0x12
    309  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_T		0x13
    310  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_SR		0x14
    311  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_LR		0x15
    312  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_SFPP_CU	0x16
    313  1.1  yamaguch #define IXL_PHY_TYPE_10GBASE_CR1	0x17
    314  1.1  yamaguch #define IXL_PHY_TYPE_40GBASE_CR4	0x18
    315  1.1  yamaguch #define IXL_PHY_TYPE_40GBASE_SR4	0x19
    316  1.1  yamaguch #define IXL_PHY_TYPE_40GBASE_LR4	0x1a
    317  1.1  yamaguch #define IXL_PHY_TYPE_1000BASE_SX	0x1b
    318  1.1  yamaguch #define IXL_PHY_TYPE_1000BASE_LX	0x1c
    319  1.1  yamaguch #define IXL_PHY_TYPE_1000BASE_T_OPTICAL	0x1d
    320  1.1  yamaguch #define IXL_PHY_TYPE_20GBASE_KR2	0x1e
    321  1.1  yamaguch 
    322  1.1  yamaguch #define IXL_PHY_TYPE_25GBASE_KR		0x1f
    323  1.1  yamaguch #define IXL_PHY_TYPE_25GBASE_CR		0x20
    324  1.1  yamaguch #define IXL_PHY_TYPE_25GBASE_SR		0x21
    325  1.1  yamaguch #define IXL_PHY_TYPE_25GBASE_LR		0x22
    326  1.1  yamaguch #define IXL_PHY_TYPE_25GBASE_AOC	0x23
    327  1.1  yamaguch #define IXL_PHY_TYPE_25GBASE_ACC	0x24
    328  1.1  yamaguch 
    329  1.8  yamaguch #define IXL_PHY_TYPE_2500BASE_T_1	0x26
    330  1.8  yamaguch #define IXL_PHY_TYPE_5000BASE_T_1	0x27
    331  1.8  yamaguch 
    332  1.8  yamaguch #define IXL_PHY_TYPE_2500BASE_T_2	0x30
    333  1.8  yamaguch #define IXL_PHY_TYPE_5000BASE_T_2	0x31
    334  1.8  yamaguch 
    335  1.8  yamaguch #define IXL_PHY_LINK_SPEED_2500MB	(1 << 0)
    336  1.5  yamaguch #define IXL_PHY_LINK_SPEED_100MB	(1 << 1)
    337  1.5  yamaguch #define IXL_PHY_LINK_SPEED_1000MB	(1 << 2)
    338  1.5  yamaguch #define IXL_PHY_LINK_SPEED_10GB		(1 << 3)
    339  1.5  yamaguch #define IXL_PHY_LINK_SPEED_40GB		(1 << 4)
    340  1.5  yamaguch #define IXL_PHY_LINK_SPEED_20GB		(1 << 5)
    341  1.5  yamaguch #define IXL_PHY_LINK_SPEED_25GB		(1 << 6)
    342  1.8  yamaguch #define IXL_PHY_LINK_SPEED_5000MB	(1 << 7)
    343  1.5  yamaguch 
    344  1.5  yamaguch #define IXL_PHY_ABILITY_PAUSE_TX	(1 << 0)
    345  1.5  yamaguch #define IXL_PHY_ABILITY_PAUSE_RX	(1 << 1)
    346  1.5  yamaguch #define IXL_PHY_ABILITY_LOWPOW		(1 << 2)
    347  1.5  yamaguch #define IXL_PHY_ABILITY_LINKUP		(1 << 3)
    348  1.5  yamaguch #define IXL_PHY_ABILITY_AUTONEGO	(1 << 4)
    349  1.5  yamaguch #define IXL_PHY_ABILITY_MODQUAL		(1 << 5)
    350  1.5  yamaguch 
    351  1.1  yamaguch struct ixl_aq_module_desc {
    352  1.1  yamaguch 	uint8_t		oui[3];
    353  1.1  yamaguch 	uint8_t		_reserved1;
    354  1.1  yamaguch 	uint8_t		part_number[16];
    355  1.1  yamaguch 	uint8_t		revision[4];
    356  1.1  yamaguch 	uint8_t		_reserved2[8];
    357  1.1  yamaguch } __packed __aligned(4);
    358  1.1  yamaguch 
    359  1.1  yamaguch struct ixl_aq_phy_abilities {
    360  1.1  yamaguch 	uint32_t	phy_type;
    361  1.1  yamaguch 
    362  1.1  yamaguch 	uint8_t		link_speed;
    363  1.1  yamaguch 	uint8_t		abilities;
    364  1.1  yamaguch 	uint16_t	eee_capability;
    365  1.1  yamaguch 
    366  1.1  yamaguch 	uint32_t	eeer_val;
    367  1.1  yamaguch 
    368  1.1  yamaguch 	uint8_t		d3_lpan;
    369  1.1  yamaguch 	uint8_t		phy_type_ext;
    370  1.1  yamaguch #define IXL_AQ_PHY_TYPE_EXT_25G_KR	0x01
    371  1.1  yamaguch #define IXL_AQ_PHY_TYPE_EXT_25G_CR	0x02
    372  1.1  yamaguch #define IXL_AQ_PHY_TYPE_EXT_25G_SR	0x04
    373  1.1  yamaguch #define IXL_AQ_PHY_TYPE_EXT_25G_LR	0x08
    374  1.8  yamaguch #define IXL_AQ_PHY_TYPE_EXT_25G_AOC	0x10
    375  1.8  yamaguch #define IXL_AQ_PHY_TYPE_EXT_25G_ACC	0x20
    376  1.8  yamaguch #define IXL_AQ_PHY_TYPE_EXT_2500_T	0x40
    377  1.8  yamaguch #define IXL_AQ_PHY_TYPE_EXT_5000_T	0x80
    378  1.1  yamaguch 	uint8_t		fec_cfg_curr_mod_ext_info;
    379  1.1  yamaguch #define IXL_AQ_ENABLE_FEC_KR		0x01
    380  1.1  yamaguch #define IXL_AQ_ENABLE_FEC_RS		0x02
    381  1.1  yamaguch #define IXL_AQ_REQUEST_FEC_KR		0x04
    382  1.1  yamaguch #define IXL_AQ_REQUEST_FEC_RS		0x08
    383  1.1  yamaguch #define IXL_AQ_ENABLE_FEC_AUTO		0x10
    384  1.1  yamaguch #define IXL_AQ_MODULE_TYPE_EXT_MASK	0xe0
    385  1.1  yamaguch #define IXL_AQ_MODULE_TYPE_EXT_SHIFT	5
    386  1.1  yamaguch 	uint8_t		ext_comp_code;
    387  1.1  yamaguch 
    388  1.1  yamaguch 	uint8_t		phy_id[4];
    389  1.1  yamaguch 
    390  1.1  yamaguch 	uint8_t		module_type[3];
    391  1.1  yamaguch #define IXL_SFF8024_ID_SFP		0x03
    392  1.1  yamaguch #define IXL_SFF8024_ID_QSFP		0x0c
    393  1.1  yamaguch #define IXL_SFF8024_ID_QSFP_PLUS	0x0d
    394  1.1  yamaguch #define IXL_SFF8024_ID_QSFP28		0x11
    395  1.1  yamaguch 	uint8_t		qualified_module_count;
    396  1.1  yamaguch #define IXL_AQ_PHY_MAX_QMS		16
    397  1.1  yamaguch 	struct ixl_aq_module_desc
    398  1.1  yamaguch 			qualified_module[IXL_AQ_PHY_MAX_QMS];
    399  1.1  yamaguch } __packed __aligned(4);
    400  1.1  yamaguch 
    401  1.5  yamaguch struct ixl_aq_phy_param {
    402  1.5  yamaguch 	uint32_t	 phy_types;
    403  1.5  yamaguch 	uint8_t		 link_speed;
    404  1.5  yamaguch 	uint8_t		 abilities;
    405  1.5  yamaguch #define IXL_AQ_PHY_ABILITY_AUTO_LINK	(1 << 5)
    406  1.5  yamaguch 	uint16_t	 eee_capability;
    407  1.5  yamaguch 	uint32_t	 eeer_val;
    408  1.5  yamaguch 	uint8_t		 d3_lpan;
    409  1.5  yamaguch 	uint8_t		 phy_type_ext;
    410  1.5  yamaguch 	uint8_t		 fec_cfg;
    411  1.5  yamaguch 	uint8_t		 config;
    412  1.5  yamaguch } __packed __aligned(4);
    413  1.5  yamaguch 
    414  1.1  yamaguch struct ixl_aq_link_param {
    415  1.1  yamaguch 	uint8_t		notify;
    416  1.1  yamaguch #define IXL_AQ_LINK_NOTIFY	0x03
    417  1.1  yamaguch 	uint8_t		_reserved1;
    418  1.1  yamaguch 	uint8_t		phy;
    419  1.1  yamaguch 	uint8_t		speed;
    420  1.1  yamaguch 	uint8_t		status;
    421  1.1  yamaguch 	uint8_t		_reserved2[11];
    422  1.1  yamaguch } __packed __aligned(4);
    423  1.1  yamaguch 
    424  1.1  yamaguch struct ixl_aq_vsi_param {
    425  1.1  yamaguch 	uint16_t	uplink_seid;
    426  1.1  yamaguch 	uint8_t		connect_type;
    427  1.1  yamaguch #define IXL_AQ_VSI_CONN_TYPE_NORMAL	(0x1)
    428  1.1  yamaguch #define IXL_AQ_VSI_CONN_TYPE_DEFAULT	(0x2)
    429  1.1  yamaguch #define IXL_AQ_VSI_CONN_TYPE_CASCADED	(0x3)
    430  1.1  yamaguch 	uint8_t		_reserved1;
    431  1.1  yamaguch 
    432  1.1  yamaguch 	uint8_t		vf_id;
    433  1.1  yamaguch 	uint8_t		_reserved2;
    434  1.1  yamaguch 	uint16_t	vsi_flags;
    435  1.1  yamaguch #define IXL_AQ_VSI_TYPE_SHIFT		0x0
    436  1.1  yamaguch #define IXL_AQ_VSI_TYPE_MASK		(0x3 << IXL_AQ_VSI_TYPE_SHIFT)
    437  1.1  yamaguch #define IXL_AQ_VSI_TYPE_VF		0x0
    438  1.1  yamaguch #define IXL_AQ_VSI_TYPE_VMDQ2		0x1
    439  1.1  yamaguch #define IXL_AQ_VSI_TYPE_PF		0x2
    440  1.1  yamaguch #define IXL_AQ_VSI_TYPE_EMP_MNG		0x3
    441  1.1  yamaguch #define IXL_AQ_VSI_FLAG_CASCADED_PV	0x4
    442  1.1  yamaguch 
    443  1.1  yamaguch 	uint32_t	addr_hi;
    444  1.1  yamaguch 	uint32_t	addr_lo;
    445  1.1  yamaguch } __packed __aligned(16);
    446  1.1  yamaguch 
    447  1.1  yamaguch struct ixl_aq_add_macvlan {
    448  1.1  yamaguch 	uint16_t	num_addrs;
    449  1.1  yamaguch 	uint16_t	seid0;
    450  1.1  yamaguch 	uint16_t	seid1;
    451  1.1  yamaguch 	uint16_t	seid2;
    452  1.1  yamaguch 	uint32_t	addr_hi;
    453  1.1  yamaguch 	uint32_t	addr_lo;
    454  1.1  yamaguch } __packed __aligned(16);
    455  1.1  yamaguch 
    456  1.1  yamaguch struct ixl_aq_add_macvlan_elem {
    457  1.1  yamaguch 	uint8_t		macaddr[6];
    458  1.1  yamaguch 	uint16_t	vlan;
    459  1.1  yamaguch 	uint16_t	flags;
    460  1.1  yamaguch #define IXL_AQ_OP_ADD_MACVLAN_PERFECT_MATCH	0x0001
    461  1.1  yamaguch #define IXL_AQ_OP_ADD_MACVLAN_IGNORE_VLAN	0x0004
    462  1.1  yamaguch 	uint16_t	queue;
    463  1.1  yamaguch 	uint32_t	_reserved;
    464  1.1  yamaguch } __packed __aligned(16);
    465  1.1  yamaguch 
    466  1.1  yamaguch struct ixl_aq_remove_macvlan {
    467  1.1  yamaguch 	uint16_t	num_addrs;
    468  1.1  yamaguch 	uint16_t	seid0;
    469  1.1  yamaguch 	uint16_t	seid1;
    470  1.1  yamaguch 	uint16_t	seid2;
    471  1.1  yamaguch 	uint32_t	addr_hi;
    472  1.1  yamaguch 	uint32_t	addr_lo;
    473  1.1  yamaguch } __packed __aligned(16);
    474  1.1  yamaguch 
    475  1.1  yamaguch struct ixl_aq_remove_macvlan_elem {
    476  1.1  yamaguch 	uint8_t		macaddr[6];
    477  1.1  yamaguch 	uint16_t	vlan;
    478  1.1  yamaguch 	uint8_t		flags;
    479  1.1  yamaguch #define IXL_AQ_OP_REMOVE_MACVLAN_PERFECT_MATCH	0x0001
    480  1.1  yamaguch #define IXL_AQ_OP_REMOVE_MACVLAN_IGNORE_VLAN	0x0008
    481  1.1  yamaguch 	uint8_t		_reserved[7];
    482  1.1  yamaguch } __packed __aligned(16);
    483  1.1  yamaguch 
    484  1.1  yamaguch struct ixl_aq_vsi_reply {
    485  1.1  yamaguch 	uint16_t	seid;
    486  1.1  yamaguch 	uint16_t	vsi_number;
    487  1.1  yamaguch 
    488  1.1  yamaguch 	uint16_t	vsis_used;
    489  1.1  yamaguch 	uint16_t	vsis_free;
    490  1.1  yamaguch 
    491  1.1  yamaguch 	uint32_t	addr_hi;
    492  1.1  yamaguch 	uint32_t	addr_lo;
    493  1.1  yamaguch } __packed __aligned(16);
    494  1.1  yamaguch 
    495  1.1  yamaguch struct ixl_aq_vsi_data {
    496  1.1  yamaguch 	/* first 96 byte are written by SW */
    497  1.1  yamaguch 	uint16_t	valid_sections;
    498  1.1  yamaguch #define IXL_AQ_VSI_VALID_SWITCH		(1 << 0)
    499  1.1  yamaguch #define IXL_AQ_VSI_VALID_SECURITY	(1 << 1)
    500  1.1  yamaguch #define IXL_AQ_VSI_VALID_VLAN		(1 << 2)
    501  1.1  yamaguch #define IXL_AQ_VSI_VALID_CAS_PV		(1 << 3)
    502  1.1  yamaguch #define IXL_AQ_VSI_VALID_INGRESS_UP	(1 << 4)
    503  1.1  yamaguch #define IXL_AQ_VSI_VALID_EGRESS_UP	(1 << 5)
    504  1.1  yamaguch #define IXL_AQ_VSI_VALID_QUEUE_MAP	(1 << 6)
    505  1.1  yamaguch #define IXL_AQ_VSI_VALID_QUEUE_OPT	(1 << 7)
    506  1.1  yamaguch #define IXL_AQ_VSI_VALID_OUTER_UP	(1 << 8)
    507  1.1  yamaguch #define IXL_AQ_VSI_VALID_SCHED		(1 << 9)
    508  1.1  yamaguch 	/* switch section */
    509  1.1  yamaguch 	uint16_t	switch_id;
    510  1.1  yamaguch #define IXL_AQ_VSI_SWITCH_ID_SHIFT	0
    511  1.1  yamaguch #define IXL_AQ_VSI_SWITCH_ID_MASK	(0xfff << IXL_AQ_VSI_SWITCH_ID_SHIFT)
    512  1.1  yamaguch #define IXL_AQ_VSI_SWITCH_NOT_STAG	(1 << 12)
    513  1.1  yamaguch #define IXL_AQ_VSI_SWITCH_LOCAL_LB	(1 << 14)
    514  1.1  yamaguch 
    515  1.1  yamaguch 	uint8_t		_reserved1[2];
    516  1.1  yamaguch 	/* security section */
    517  1.1  yamaguch 	uint8_t		sec_flags;
    518  1.1  yamaguch #define IXL_AQ_VSI_SEC_ALLOW_DEST_OVRD	(1 << 0)
    519  1.1  yamaguch #define IXL_AQ_VSI_SEC_ENABLE_VLAN_CHK	(1 << 1)
    520  1.1  yamaguch #define IXL_AQ_VSI_SEC_ENABLE_MAC_CHK	(1 << 2)
    521  1.1  yamaguch 	uint8_t		_reserved2;
    522  1.1  yamaguch 
    523  1.1  yamaguch 	/* vlan section */
    524  1.1  yamaguch 	uint16_t	pvid;
    525  1.1  yamaguch 	uint16_t	fcoe_pvid;
    526  1.1  yamaguch 
    527  1.1  yamaguch 	uint8_t		port_vlan_flags;
    528  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_MODE_SHIFT	0
    529  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_MODE_MASK	(0x3 << IXL_AQ_VSI_PVLAN_MODE_SHIFT)
    530  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_MODE_TAGGED	(0x1 << IXL_AQ_VSI_PVLAN_MODE_SHIFT)
    531  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_MODE_UNTAGGED	(0x2 << IXL_AQ_VSI_PVLAN_MODE_SHIFT)
    532  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_MODE_ALL	(0x3 << IXL_AQ_VSI_PVLAN_MODE_SHIFT)
    533  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_INSERT_PVID	(0x4 << IXL_AQ_VSI_PVLAN_MODE_SHIFT)
    534  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_EMOD_SHIFT	0x3
    535  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_EMOD_MASK	(0x3 << IXL_AQ_VSI_PVLAN_EMOD_SHIFT)
    536  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_EMOD_STR_BOTH	(0x0 << IXL_AQ_VSI_PVLAN_EMOD_SHIFT)
    537  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_EMOD_STR_UP	(0x1 << IXL_AQ_VSI_PVLAN_EMOD_SHIFT)
    538  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_EMOD_STR	(0x2 << IXL_AQ_VSI_PVLAN_EMOD_SHIFT)
    539  1.1  yamaguch #define IXL_AQ_VSI_PVLAN_EMOD_NOTHING	(0x3 << IXL_AQ_VSI_PVLAN_EMOD_SHIFT)
    540  1.1  yamaguch 	uint8_t		_reserved3[3];
    541  1.1  yamaguch 
    542  1.1  yamaguch 	/* ingress egress up section */
    543  1.1  yamaguch 	uint32_t	ingress_table;
    544  1.1  yamaguch #define IXL_AQ_VSI_UP_SHIFT(_up)	((_up) * 3)
    545  1.1  yamaguch #define IXL_AQ_VSI_UP_MASK(_up)		(0x7 << (IXL_AQ_VSI_UP_SHIFT(_up))
    546  1.1  yamaguch 	uint32_t	egress_table;
    547  1.1  yamaguch 
    548  1.1  yamaguch 	/* cascaded pv section */
    549  1.1  yamaguch 	uint16_t	cas_pv_tag;
    550  1.1  yamaguch 	uint8_t		cas_pv_flags;
    551  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_TAGX_SHIFT	0
    552  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_TAGX_MASK	(0x3 << IXL_AQ_VSI_CAS_PV_TAGX_SHIFT)
    553  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_TAGX_LEAVE	(0x0 << IXL_AQ_VSI_CAS_PV_TAGX_SHIFT)
    554  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_TAGX_REMOVE	(0x1 << IXL_AQ_VSI_CAS_PV_TAGX_SHIFT)
    555  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_TAGX_COPY	(0x2 << IXL_AQ_VSI_CAS_PV_TAGX_SHIFT)
    556  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_INSERT_TAG	(1 << 4)
    557  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_ETAG_PRUNE	(1 << 5)
    558  1.1  yamaguch #define IXL_AQ_VSI_CAS_PV_ACCEPT_HOST_TAG \
    559  1.1  yamaguch 					(1 << 6)
    560  1.1  yamaguch 	uint8_t		_reserved4;
    561  1.1  yamaguch 
    562  1.1  yamaguch 	/* queue mapping section */
    563  1.1  yamaguch 	uint16_t	mapping_flags;
    564  1.1  yamaguch #define IXL_AQ_VSI_QUE_MAP_MASK		0x1
    565  1.1  yamaguch #define IXL_AQ_VSI_QUE_MAP_CONTIG	0x0
    566  1.1  yamaguch #define IXL_AQ_VSI_QUE_MAP_NONCONTIG	0x1
    567  1.1  yamaguch 	uint16_t	queue_mapping[16];
    568  1.1  yamaguch #define IXL_AQ_VSI_QUEUE_SHIFT		0x0
    569  1.1  yamaguch #define IXL_AQ_VSI_QUEUE_MASK		(0x7ff << IXL_AQ_VSI_QUEUE_SHIFT)
    570  1.1  yamaguch 	uint16_t	tc_mapping[8];
    571  1.1  yamaguch #define IXL_AQ_VSI_TC_Q_OFFSET_SHIFT	0
    572  1.1  yamaguch #define IXL_AQ_VSI_TC_Q_OFFSET_MASK	(0x1ff << IXL_AQ_VSI_TC_Q_OFFSET_SHIFT)
    573  1.1  yamaguch #define IXL_AQ_VSI_TC_Q_NUMBER_SHIFT	9
    574  1.1  yamaguch #define IXL_AQ_VSI_TC_Q_NUMBER_MASK	(0x7 << IXL_AQ_VSI_TC_Q_NUMBER_SHIFT)
    575  1.1  yamaguch 
    576  1.1  yamaguch 	/* queueing option section */
    577  1.1  yamaguch 	uint8_t		queueing_opt_flags;
    578  1.1  yamaguch #define IXL_AQ_VSI_QUE_OPT_MCAST_UDP_EN	(1 << 2)
    579  1.1  yamaguch #define IXL_AQ_VSI_QUE_OPT_UCAST_UDP_EN	(1 << 3)
    580  1.1  yamaguch #define IXL_AQ_VSI_QUE_OPT_TCP_EN	(1 << 4)
    581  1.1  yamaguch #define IXL_AQ_VSI_QUE_OPT_FCOE_EN	(1 << 5)
    582  1.1  yamaguch #define IXL_AQ_VSI_QUE_OPT_RSS_LUT_PF	0
    583  1.1  yamaguch #define IXL_AQ_VSI_QUE_OPT_RSS_LUT_VSI	(1 << 6)
    584  1.1  yamaguch 	uint8_t		_reserved5[3];
    585  1.1  yamaguch 
    586  1.1  yamaguch 	/* scheduler section */
    587  1.1  yamaguch 	uint8_t		up_enable_bits;
    588  1.1  yamaguch 	uint8_t		_reserved6;
    589  1.1  yamaguch 
    590  1.1  yamaguch 	/* outer up section */
    591  1.1  yamaguch 	uint32_t	outer_up_table; /* same as ingress/egress tables */
    592  1.1  yamaguch 	uint8_t		_reserved7[8];
    593  1.1  yamaguch 
    594  1.1  yamaguch 	/* last 32 bytes are written by FW */
    595  1.1  yamaguch 	uint16_t	qs_handle[8];
    596  1.1  yamaguch #define IXL_AQ_VSI_QS_HANDLE_INVALID	0xffff
    597  1.1  yamaguch 	uint16_t	stat_counter_idx;
    598  1.1  yamaguch 	uint16_t	sched_id;
    599  1.1  yamaguch 
    600  1.1  yamaguch 	uint8_t		_reserved8[12];
    601  1.1  yamaguch } __packed __aligned(8);
    602  1.1  yamaguch 
    603  1.1  yamaguch CTASSERT(sizeof(struct ixl_aq_vsi_data) == 128);
    604  1.1  yamaguch 
    605  1.1  yamaguch struct ixl_aq_vsi_promisc_param {
    606  1.1  yamaguch 	uint16_t	flags;
    607  1.1  yamaguch 	uint16_t	valid_flags;
    608  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_FLAG_UCAST	(1 << 0)
    609  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_FLAG_MCAST	(1 << 1)
    610  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_FLAG_BCAST	(1 << 2)
    611  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_FLAG_DFLT	(1 << 3)
    612  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_FLAG_VLAN	(1 << 4)
    613  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_FLAG_RXONLY	(1 << 15)
    614  1.1  yamaguch 
    615  1.1  yamaguch 	uint16_t	seid;
    616  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_SEID_VALID	(1 << 15)
    617  1.1  yamaguch 	uint16_t	vlan;
    618  1.1  yamaguch #define IXL_AQ_VSI_PROMISC_VLAN_VALID	(1 << 15)
    619  1.1  yamaguch 	uint32_t	reserved[2];
    620  1.1  yamaguch } __packed __aligned(8);
    621  1.1  yamaguch 
    622  1.1  yamaguch struct ixl_aq_veb_param {
    623  1.1  yamaguch 	uint16_t	uplink_seid;
    624  1.1  yamaguch 	uint16_t	downlink_seid;
    625  1.1  yamaguch 	uint16_t	veb_flags;
    626  1.1  yamaguch #define IXL_AQ_ADD_VEB_FLOATING		(1 << 0)
    627  1.1  yamaguch #define IXL_AQ_ADD_VEB_PORT_TYPE_SHIFT	1
    628  1.1  yamaguch #define IXL_AQ_ADD_VEB_PORT_TYPE_MASK	(0x3 << IXL_AQ_ADD_VEB_PORT_TYPE_SHIFT)
    629  1.1  yamaguch #define IXL_AQ_ADD_VEB_PORT_TYPE_DEFAULT \
    630  1.1  yamaguch 					(0x2 << IXL_AQ_ADD_VEB_PORT_TYPE_SHIFT)
    631  1.1  yamaguch #define IXL_AQ_ADD_VEB_PORT_TYPE_DATA	(0x4 << IXL_AQ_ADD_VEB_PORT_TYPE_SHIFT)
    632  1.1  yamaguch #define IXL_AQ_ADD_VEB_ENABLE_L2_FILTER	(1 << 3) /* deprecated */
    633  1.1  yamaguch #define IXL_AQ_ADD_VEB_DISABLE_STATS	(1 << 4)
    634  1.1  yamaguch 	uint8_t		enable_tcs;
    635  1.1  yamaguch 	uint8_t		_reserved[9];
    636  1.1  yamaguch } __packed __aligned(16);
    637  1.1  yamaguch 
    638  1.1  yamaguch struct ixl_aq_veb_reply {
    639  1.1  yamaguch 	uint16_t	_reserved1;
    640  1.1  yamaguch 	uint16_t	_reserved2;
    641  1.1  yamaguch 	uint16_t	_reserved3;
    642  1.1  yamaguch 	uint16_t	switch_seid;
    643  1.1  yamaguch 	uint16_t	veb_seid;
    644  1.1  yamaguch #define IXL_AQ_VEB_ERR_FLAG_NO_VEB	(1 << 0)
    645  1.1  yamaguch #define IXL_AQ_VEB_ERR_FLAG_NO_SCHED	(1 << 1)
    646  1.1  yamaguch #define IXL_AQ_VEB_ERR_FLAG_NO_COUNTER	(1 << 2)
    647  1.1  yamaguch #define IXL_AQ_VEB_ERR_FLAG_NO_ENTRY	(1 << 3);
    648  1.1  yamaguch 	uint16_t	statistic_index;
    649  1.1  yamaguch 	uint16_t	vebs_used;
    650  1.1  yamaguch 	uint16_t	vebs_free;
    651  1.1  yamaguch } __packed __aligned(16);
    652  1.1  yamaguch 
    653  1.1  yamaguch /* GET PHY ABILITIES param[0] */
    654  1.1  yamaguch #define IXL_AQ_PHY_REPORT_QUAL		(1 << 0)
    655  1.1  yamaguch #define IXL_AQ_PHY_REPORT_INIT		(1 << 1)
    656  1.1  yamaguch 
    657  1.1  yamaguch struct ixl_aq_phy_reg_access {
    658  1.1  yamaguch 	uint8_t		phy_iface;
    659  1.1  yamaguch #define IXL_AQ_PHY_IF_INTERNAL		0
    660  1.1  yamaguch #define IXL_AQ_PHY_IF_EXTERNAL		1
    661  1.1  yamaguch #define IXL_AQ_PHY_IF_MODULE		2
    662  1.1  yamaguch 	uint8_t		dev_addr;
    663  1.1  yamaguch 	uint16_t	recall;
    664  1.1  yamaguch #define IXL_AQ_PHY_QSFP_DEV_ADDR	0
    665  1.1  yamaguch #define IXL_AQ_PHY_QSFP_LAST		1
    666  1.1  yamaguch 	uint32_t	reg;
    667  1.1  yamaguch 	uint32_t	val;
    668  1.1  yamaguch 	uint32_t	_reserved2;
    669  1.1  yamaguch } __packed __aligned(16);
    670  1.1  yamaguch 
    671  1.1  yamaguch /* RESTART_AN param[0] */
    672  1.1  yamaguch #define IXL_AQ_PHY_RESTART_AN		(1 << 1)
    673  1.1  yamaguch #define IXL_AQ_PHY_LINK_ENABLE		(1 << 2)
    674  1.1  yamaguch 
    675  1.1  yamaguch struct ixl_aq_link_status { /* this occupies the iaq_param space */
    676  1.1  yamaguch 	uint16_t	command_flags; /* only field set on command */
    677  1.1  yamaguch #define IXL_AQ_LSE_MASK			0x3
    678  1.1  yamaguch #define IXL_AQ_LSE_NOP			0x0
    679  1.1  yamaguch #define IXL_AQ_LSE_DISABLE		0x2
    680  1.1  yamaguch #define IXL_AQ_LSE_ENABLE		0x3
    681  1.1  yamaguch #define IXL_AQ_LSE_IS_ENABLED		0x1 /* only set in response */
    682  1.1  yamaguch 	uint8_t		phy_type;
    683  1.1  yamaguch 	uint8_t		link_speed;
    684  1.8  yamaguch #define IXL_AQ_LINK_SPEED_2500MB	(1 << 0)
    685  1.1  yamaguch #define IXL_AQ_LINK_SPEED_100MB		(1 << 1)
    686  1.1  yamaguch #define IXL_AQ_LINK_SPEED_1000MB	(1 << 2)
    687  1.1  yamaguch #define IXL_AQ_LINK_SPEED_10GB		(1 << 3)
    688  1.1  yamaguch #define IXL_AQ_LINK_SPEED_40GB		(1 << 4)
    689  1.1  yamaguch #define IXL_AQ_LINK_SPEED_25GB		(1 << 6)
    690  1.8  yamaguch #define IXL_AQ_LINK_SPEED_5000MB	(1 << 7)
    691  1.1  yamaguch 	uint8_t		link_info;
    692  1.1  yamaguch #define IXL_AQ_LINK_UP_FUNCTION		0x01
    693  1.1  yamaguch #define IXL_AQ_LINK_FAULT		0x02
    694  1.1  yamaguch #define IXL_AQ_LINK_FAULT_TX		0x04
    695  1.1  yamaguch #define IXL_AQ_LINK_FAULT_RX		0x08
    696  1.1  yamaguch #define IXL_AQ_LINK_FAULT_REMOTE	0x10
    697  1.1  yamaguch #define IXL_AQ_LINK_UP_PORT		0x20
    698  1.1  yamaguch #define IXL_AQ_MEDIA_AVAILABLE		0x40
    699  1.1  yamaguch #define IXL_AQ_SIGNAL_DETECT		0x80
    700  1.1  yamaguch 	uint8_t		an_info;
    701  1.1  yamaguch #define IXL_AQ_AN_COMPLETED		0x01
    702  1.1  yamaguch #define IXL_AQ_LP_AN_ABILITY		0x02
    703  1.1  yamaguch #define IXL_AQ_PD_FAULT			0x04
    704  1.1  yamaguch #define IXL_AQ_FEC_EN			0x08
    705  1.1  yamaguch #define IXL_AQ_PHY_LOW_POWER		0x10
    706  1.1  yamaguch #define IXL_AQ_LINK_PAUSE_TX		0x20
    707  1.1  yamaguch #define IXL_AQ_LINK_PAUSE_RX		0x40
    708  1.1  yamaguch #define IXL_AQ_QUALIFIED_MODULE		0x80
    709  1.1  yamaguch 
    710  1.1  yamaguch 	uint8_t		ext_info;
    711  1.1  yamaguch #define IXL_AQ_LINK_PHY_TEMP_ALARM	0x01
    712  1.1  yamaguch #define IXL_AQ_LINK_XCESSIVE_ERRORS	0x02
    713  1.1  yamaguch #define IXL_AQ_LINK_TX_SHIFT		0x02
    714  1.1  yamaguch #define IXL_AQ_LINK_TX_MASK		(0x03 << IXL_AQ_LINK_TX_SHIFT)
    715  1.1  yamaguch #define IXL_AQ_LINK_TX_ACTIVE		0x00
    716  1.1  yamaguch #define IXL_AQ_LINK_TX_DRAINED		0x01
    717  1.1  yamaguch #define IXL_AQ_LINK_TX_FLUSHED		0x03
    718  1.1  yamaguch #define IXL_AQ_LINK_FORCED_40G		0x10
    719  1.1  yamaguch /* 25G Error Codes */
    720  1.1  yamaguch #define IXL_AQ_25G_NO_ERR		0X00
    721  1.1  yamaguch #define IXL_AQ_25G_NOT_PRESENT		0X01
    722  1.1  yamaguch #define IXL_AQ_25G_NVM_CRC_ERR		0X02
    723  1.1  yamaguch #define IXL_AQ_25G_SBUS_UCODE_ERR	0X03
    724  1.1  yamaguch #define IXL_AQ_25G_SERDES_UCODE_ERR	0X04
    725  1.1  yamaguch #define IXL_AQ_25G_NIMB_UCODE_ERR	0X05
    726  1.1  yamaguch 	uint8_t		loopback;
    727  1.1  yamaguch 	uint16_t	max_frame_size;
    728  1.1  yamaguch 
    729  1.1  yamaguch 	uint8_t		config;
    730  1.1  yamaguch #define IXL_AQ_CONFIG_FEC_KR_ENA	0x01
    731  1.1  yamaguch #define IXL_AQ_CONFIG_FEC_RS_ENA	0x02
    732  1.1  yamaguch #define IXL_AQ_CONFIG_CRC_ENA	0x04
    733  1.1  yamaguch #define IXL_AQ_CONFIG_PACING_MASK	0x78
    734  1.1  yamaguch 	uint8_t		power_desc;
    735  1.1  yamaguch #define IXL_AQ_LINK_POWER_CLASS_1	0x00
    736  1.1  yamaguch #define IXL_AQ_LINK_POWER_CLASS_2	0x01
    737  1.1  yamaguch #define IXL_AQ_LINK_POWER_CLASS_3	0x02
    738  1.1  yamaguch #define IXL_AQ_LINK_POWER_CLASS_4	0x03
    739  1.1  yamaguch #define IXL_AQ_PWR_CLASS_MASK		0x03
    740  1.1  yamaguch 
    741  1.1  yamaguch 	uint8_t		reserved[4];
    742  1.1  yamaguch } __packed __aligned(4);
    743  1.1  yamaguch 
    744  1.1  yamaguch /* event mask command flags for param[2] */
    745  1.1  yamaguch #define IXL_AQ_PHY_EV_MASK		0x3ff
    746  1.1  yamaguch #define IXL_AQ_PHY_EV_LINK_UPDOWN	(1 << 1)
    747  1.1  yamaguch #define IXL_AQ_PHY_EV_MEDIA_NA		(1 << 2)
    748  1.1  yamaguch #define IXL_AQ_PHY_EV_LINK_FAULT	(1 << 3)
    749  1.1  yamaguch #define IXL_AQ_PHY_EV_PHY_TEMP_ALARM	(1 << 4)
    750  1.1  yamaguch #define IXL_AQ_PHY_EV_EXCESS_ERRORS	(1 << 5)
    751  1.1  yamaguch #define IXL_AQ_PHY_EV_SIGNAL_DETECT	(1 << 6)
    752  1.1  yamaguch #define IXL_AQ_PHY_EV_AN_COMPLETED	(1 << 7)
    753  1.1  yamaguch #define IXL_AQ_PHY_EV_MODULE_QUAL_FAIL	(1 << 8)
    754  1.1  yamaguch #define IXL_AQ_PHY_EV_PORT_TX_SUSPENDED	(1 << 9)
    755  1.1  yamaguch 
    756  1.4  yamaguch struct ixl_aq_req_resource_param {
    757  1.4  yamaguch 	uint16_t	 resource_id;
    758  1.4  yamaguch #define IXL_AQ_RESOURCE_ID_NVM		0x0001
    759  1.4  yamaguch #define IXL_AQ_RESOURCE_ID_SDP		0x0002
    760  1.4  yamaguch 
    761  1.4  yamaguch 	uint16_t	 access_type;
    762  1.4  yamaguch #define IXL_AQ_RESOURCE_ACCES_READ	0x01
    763  1.4  yamaguch #define IXL_AQ_RESOURCE_ACCES_WRITE	0x02
    764  1.4  yamaguch 
    765  1.4  yamaguch 	uint16_t	 timeout;
    766  1.4  yamaguch 	uint32_t	 resource_num;
    767  1.4  yamaguch 	uint32_t	 reserved;
    768  1.4  yamaguch } __packed __aligned(8);
    769  1.4  yamaguch 
    770  1.4  yamaguch struct ixl_aq_rel_resource_param {
    771  1.4  yamaguch 	uint16_t	 resource_id;
    772  1.4  yamaguch /* defined in ixl_aq_req_resource_param */
    773  1.4  yamaguch 	uint16_t	 _reserved1[3];
    774  1.4  yamaguch 	uint32_t	 resource_num;
    775  1.4  yamaguch 	uint32_t	 _reserved2;
    776  1.4  yamaguch } __packed __aligned(8);
    777  1.4  yamaguch 
    778  1.4  yamaguch struct ixl_aq_nvm_param {
    779  1.4  yamaguch 	uint8_t		 command_flags;
    780  1.4  yamaguch #define IXL_AQ_NVM_LAST_CMD	(1 << 0)
    781  1.4  yamaguch #define IXL_AQ_NVM_FLASH_ONLY	(1 << 7)
    782  1.4  yamaguch 	uint8_t		 module_pointer;
    783  1.4  yamaguch 	uint16_t	 length;
    784  1.4  yamaguch 	uint32_t	 offset;
    785  1.4  yamaguch 	uint32_t	 addr_hi;
    786  1.4  yamaguch 	uint32_t	 addr_lo;
    787  1.4  yamaguch } __packed __aligned(4);
    788  1.4  yamaguch 
    789  1.6  yamaguch struct ixl_aq_rss_key_param {
    790  1.6  yamaguch 	uint16_t	 vsi_id;
    791  1.6  yamaguch #define IXL_AQ_RSSKEY_VSI_VALID		(0x01 << 15)
    792  1.6  yamaguch #define IXL_AQ_RSSKEY_VSI_ID_SHIFT	0
    793  1.6  yamaguch #define IXL_AQ_RSSKEY_VSI_ID_MASK	(0x3FF << IXL_RSSKEY_VSI_ID_SHIFT)
    794  1.6  yamaguch 
    795  1.6  yamaguch 	uint8_t		 reserved[6];
    796  1.6  yamaguch 	uint32_t	 addr_hi;
    797  1.6  yamaguch 	uint32_t	 addr_lo;
    798  1.6  yamaguch } __packed __aligned(8);
    799  1.6  yamaguch 
    800  1.6  yamaguch struct ixl_aq_rss_key_data {
    801  1.6  yamaguch 	uint8_t	 standard_rss_key[0x28];
    802  1.6  yamaguch 	uint8_t	 extended_hash_key[0xc];
    803  1.6  yamaguch } __packed __aligned(8);
    804  1.6  yamaguch 
    805  1.6  yamaguch struct ixl_aq_rss_lut_param {
    806  1.6  yamaguch 	uint16_t	 vsi_id;
    807  1.6  yamaguch #define IXL_AQ_RSSLUT_VSI_VALID		(0x01 << 15)
    808  1.6  yamaguch #define IXL_AQ_RSSLUT_VSI_ID_SHIFT	0
    809  1.6  yamaguch #define IXL_AQ_RSSLUT_VSI_ID_MASK	(0x03FF << IXL_AQ_RSSLUT_VSI_ID_SHIFT)
    810  1.6  yamaguch 
    811  1.6  yamaguch 	uint16_t flags;
    812  1.6  yamaguch #define IXL_AQ_RSSLUT_TABLE_TYPE_SHIFT	0
    813  1.6  yamaguch #define IXL_AQ_RSSLUT_TABLE_TYPE_MASK	(0x01 << IXL_AQ_RSSLUT_TABLE_TYPE_SHIFT)
    814  1.6  yamaguch #define IXL_AQ_RSSLUT_TABLE_TYPE_VSI	0
    815  1.6  yamaguch #define IXL_AQ_RSSLUT_TABLE_TYPE_PF	1
    816  1.6  yamaguch 	uint8_t		 reserved[4];
    817  1.6  yamaguch 	uint32_t	 addr_hi;
    818  1.6  yamaguch 	uint32_t	 addr_lo;
    819  1.6  yamaguch } __packed __aligned(8);
    820  1.6  yamaguch 
    821  1.1  yamaguch /* aq response codes */
    822  1.1  yamaguch #define IXL_AQ_RC_OK			0  /* success */
    823  1.1  yamaguch #define IXL_AQ_RC_EPERM			1  /* Operation not permitted */
    824  1.1  yamaguch #define IXL_AQ_RC_ENOENT		2  /* No such element */
    825  1.1  yamaguch #define IXL_AQ_RC_ESRCH			3  /* Bad opcode */
    826  1.1  yamaguch #define IXL_AQ_RC_EINTR			4  /* operation interrupted */
    827  1.1  yamaguch #define IXL_AQ_RC_EIO			5  /* I/O error */
    828  1.1  yamaguch #define IXL_AQ_RC_ENXIO			6  /* No such resource */
    829  1.1  yamaguch #define IXL_AQ_RC_E2BIG			7  /* Arg too long */
    830  1.1  yamaguch #define IXL_AQ_RC_EAGAIN		8  /* Try again */
    831  1.1  yamaguch #define IXL_AQ_RC_ENOMEM		9  /* Out of memory */
    832  1.1  yamaguch #define IXL_AQ_RC_EACCES		10 /* Permission denied */
    833  1.1  yamaguch #define IXL_AQ_RC_EFAULT		11 /* Bad address */
    834  1.1  yamaguch #define IXL_AQ_RC_EBUSY			12 /* Device or resource busy */
    835  1.1  yamaguch #define IXL_AQ_RC_EEXIST		13 /* object already exists */
    836  1.1  yamaguch #define IXL_AQ_RC_EINVAL		14 /* invalid argument */
    837  1.1  yamaguch #define IXL_AQ_RC_ENOTTY		15 /* not a typewriter */
    838  1.1  yamaguch #define IXL_AQ_RC_ENOSPC		16 /* No space or alloc failure */
    839  1.1  yamaguch #define IXL_AQ_RC_ENOSYS		17 /* function not implemented */
    840  1.1  yamaguch #define IXL_AQ_RC_ERANGE		18 /* parameter out of range */
    841  1.1  yamaguch #define IXL_AQ_RC_EFLUSHED		19 /* cmd flushed due to prev error */
    842  1.1  yamaguch #define IXL_AQ_RC_BAD_ADDR		20 /* contains a bad pointer */
    843  1.1  yamaguch #define IXL_AQ_RC_EMODE			21 /* not allowed in current mode */
    844  1.1  yamaguch #define IXL_AQ_RC_EFBIG			22 /* file too large */
    845  1.1  yamaguch 
    846  1.1  yamaguch struct ixl_tx_desc {
    847  1.1  yamaguch 	uint64_t		addr;
    848  1.1  yamaguch 	uint64_t		cmd;
    849  1.1  yamaguch #define IXL_TX_DESC_DTYPE_SHIFT		0
    850  1.1  yamaguch #define IXL_TX_DESC_DTYPE_MASK		(0xfULL << IXL_TX_DESC_DTYPE_SHIFT)
    851  1.1  yamaguch #define IXL_TX_DESC_DTYPE_DATA		(0x0ULL << IXL_TX_DESC_DTYPE_SHIFT)
    852  1.1  yamaguch #define IXL_TX_DESC_DTYPE_NOP		(0x1ULL << IXL_TX_DESC_DTYPE_SHIFT)
    853  1.1  yamaguch #define IXL_TX_DESC_DTYPE_CONTEXT	(0x1ULL << IXL_TX_DESC_DTYPE_SHIFT)
    854  1.1  yamaguch #define IXL_TX_DESC_DTYPE_FCOE_CTX	(0x2ULL << IXL_TX_DESC_DTYPE_SHIFT)
    855  1.1  yamaguch #define IXL_TX_DESC_DTYPE_FD		(0x8ULL << IXL_TX_DESC_DTYPE_SHIFT)
    856  1.1  yamaguch #define IXL_TX_DESC_DTYPE_DDP_CTX	(0x9ULL << IXL_TX_DESC_DTYPE_SHIFT)
    857  1.1  yamaguch #define IXL_TX_DESC_DTYPE_FLEX_DATA	(0xbULL << IXL_TX_DESC_DTYPE_SHIFT)
    858  1.1  yamaguch #define IXL_TX_DESC_DTYPE_FLEX_CTX_1	(0xcULL << IXL_TX_DESC_DTYPE_SHIFT)
    859  1.1  yamaguch #define IXL_TX_DESC_DTYPE_FLEX_CTX_2	(0xdULL << IXL_TX_DESC_DTYPE_SHIFT)
    860  1.1  yamaguch #define IXL_TX_DESC_DTYPE_DONE		(0xfULL << IXL_TX_DESC_DTYPE_SHIFT)
    861  1.1  yamaguch 
    862  1.1  yamaguch #define IXL_TX_DESC_CMD_SHIFT		4
    863  1.1  yamaguch #define IXL_TX_DESC_CMD_MASK		(0x3ffULL << IXL_TX_DESC_CMD_SHIFT)
    864  1.1  yamaguch #define IXL_TX_DESC_CMD_EOP		(0x001 << IXL_TX_DESC_CMD_SHIFT)
    865  1.1  yamaguch #define IXL_TX_DESC_CMD_RS		(0x002 << IXL_TX_DESC_CMD_SHIFT)
    866  1.1  yamaguch #define IXL_TX_DESC_CMD_ICRC		(0x004 << IXL_TX_DESC_CMD_SHIFT)
    867  1.1  yamaguch #define IXL_TX_DESC_CMD_IL2TAG1		(0x008 << IXL_TX_DESC_CMD_SHIFT)
    868  1.1  yamaguch #define IXL_TX_DESC_CMD_DUMMY		(0x010 << IXL_TX_DESC_CMD_SHIFT)
    869  1.1  yamaguch #define IXL_TX_DESC_CMD_IIPT_MASK	(0x060 << IXL_TX_DESC_CMD_SHIFT)
    870  1.1  yamaguch #define IXL_TX_DESC_CMD_IIPT_NONIP	(0x000 << IXL_TX_DESC_CMD_SHIFT)
    871  1.1  yamaguch #define IXL_TX_DESC_CMD_IIPT_IPV6	(0x020 << IXL_TX_DESC_CMD_SHIFT)
    872  1.1  yamaguch #define IXL_TX_DESC_CMD_IIPT_IPV4	(0x040 << IXL_TX_DESC_CMD_SHIFT)
    873  1.1  yamaguch #define IXL_TX_DESC_CMD_IIPT_IPV4_CSUM	(0x060 << IXL_TX_DESC_CMD_SHIFT)
    874  1.1  yamaguch #define IXL_TX_DESC_CMD_FCOET		(0x080 << IXL_TX_DESC_CMD_SHIFT)
    875  1.1  yamaguch #define IXL_TX_DESC_CMD_L4T_EOFT_MASK	(0x300 << IXL_TX_DESC_CMD_SHIFT)
    876  1.1  yamaguch #define IXL_TX_DESC_CMD_L4T_EOFT_UNK	(0x000 << IXL_TX_DESC_CMD_SHIFT)
    877  1.1  yamaguch #define IXL_TX_DESC_CMD_L4T_EOFT_TCP	(0x100 << IXL_TX_DESC_CMD_SHIFT)
    878  1.1  yamaguch #define IXL_TX_DESC_CMD_L4T_EOFT_SCTP	(0x200 << IXL_TX_DESC_CMD_SHIFT)
    879  1.1  yamaguch #define IXL_TX_DESC_CMD_L4T_EOFT_UDP	(0x300 << IXL_TX_DESC_CMD_SHIFT)
    880  1.1  yamaguch 
    881  1.1  yamaguch #define IXL_TX_DESC_MACLEN_SHIFT	16
    882  1.1  yamaguch #define IXL_TX_DESC_MACLEN_MASK		(0x7fULL << IXL_TX_DESC_MACLEN_SHIFT)
    883  1.1  yamaguch #define IXL_TX_DESC_IPLEN_SHIFT		23
    884  1.1  yamaguch #define IXL_TX_DESC_IPLEN_MASK		(0x7fULL << IXL_TX_DESC_IPLEN_SHIFT)
    885  1.1  yamaguch #define IXL_TX_DESC_L4LEN_SHIFT		30
    886  1.1  yamaguch #define IXL_TX_DESC_L4LEN_MASK		(0xfULL << IXL_TX_DESC_L4LEN_SHIFT)
    887  1.1  yamaguch #define IXL_TX_DESC_FCLEN_SHIFT		30
    888  1.1  yamaguch #define IXL_TX_DESC_FCLEN_MASK		(0xfULL << IXL_TX_DESC_FCLEN_SHIFT)
    889  1.1  yamaguch 
    890  1.1  yamaguch #define IXL_TX_DESC_BSIZE_SHIFT		34
    891  1.1  yamaguch #define IXL_TX_DESC_BSIZE_MAX		0x3fffULL
    892  1.1  yamaguch #define IXL_TX_DESC_BSIZE_MASK		\
    893  1.1  yamaguch 	(IXL_TX_DESC_BSIZE_MAX << IXL_TX_DESC_BSIZE_SHIFT)
    894  1.2  yamaguch #define IXL_TX_DESC_L2TAG1_SHIFT	48
    895  1.1  yamaguch } __packed __aligned(16);
    896  1.1  yamaguch 
    897  1.1  yamaguch struct ixl_rx_rd_desc_16 {
    898  1.1  yamaguch 	uint64_t		paddr; /* packet addr */
    899  1.1  yamaguch 	uint64_t		haddr; /* header addr */
    900  1.1  yamaguch } __packed __aligned(16);
    901  1.1  yamaguch 
    902  1.1  yamaguch struct ixl_rx_rd_desc_32 {
    903  1.1  yamaguch 	uint64_t		paddr; /* packet addr */
    904  1.1  yamaguch 	uint64_t		haddr; /* header addr */
    905  1.1  yamaguch 	uint64_t		_reserved1;
    906  1.1  yamaguch 	uint64_t		_reserved2;
    907  1.1  yamaguch } __packed __aligned(16);
    908  1.1  yamaguch 
    909  1.1  yamaguch struct ixl_rx_wb_desc_16 {
    910  1.1  yamaguch 	uint64_t		qword0;
    911  1.2  yamaguch #define IXL_RX_DESC_L2TAG1_SHIFT	16
    912  1.2  yamaguch #define IXL_RX_DESC_L2TAG1_MASK		(0xffffULL << IXL_RX_DESC_L2TAG1_SHIFT)
    913  1.1  yamaguch 	uint64_t		qword1;
    914  1.1  yamaguch #define IXL_RX_DESC_DD			(1 << 0)
    915  1.1  yamaguch #define IXL_RX_DESC_EOP			(1 << 1)
    916  1.1  yamaguch #define IXL_RX_DESC_L2TAG1P		(1 << 2)
    917  1.1  yamaguch #define IXL_RX_DESC_L3L4P		(1 << 3)
    918  1.1  yamaguch #define IXL_RX_DESC_CRCP		(1 << 4)
    919  1.1  yamaguch #define IXL_RX_DESC_TSYNINDX_SHIFT	5	/* TSYNINDX */
    920  1.1  yamaguch #define IXL_RX_DESC_TSYNINDX_MASK	(7 << IXL_RX_DESC_TSYNINDX_SHIFT)
    921  1.1  yamaguch #define IXL_RX_DESC_UMB_SHIFT		9
    922  1.1  yamaguch #define IXL_RX_DESC_UMB_MASK		(0x3 << IXL_RX_DESC_UMB_SHIFT)
    923  1.1  yamaguch #define IXL_RX_DESC_UMB_UCAST		(0x0 << IXL_RX_DESC_UMB_SHIFT)
    924  1.1  yamaguch #define IXL_RX_DESC_UMB_MCAST		(0x1 << IXL_RX_DESC_UMB_SHIFT)
    925  1.1  yamaguch #define IXL_RX_DESC_UMB_BCAST		(0x2 << IXL_RX_DESC_UMB_SHIFT)
    926  1.1  yamaguch #define IXL_RX_DESC_UMB_MIRROR		(0x3 << IXL_RX_DESC_UMB_SHIFT)
    927  1.1  yamaguch #define IXL_RX_DESC_FLM			(1 << 11)
    928  1.1  yamaguch #define IXL_RX_DESC_FLTSTAT_SHIFT	12
    929  1.1  yamaguch #define IXL_RX_DESC_FLTSTAT_MASK	(0x3 << IXL_RX_DESC_FLTSTAT_SHIFT)
    930  1.1  yamaguch #define IXL_RX_DESC_FLTSTAT_NODATA	(0x0 << IXL_RX_DESC_FLTSTAT_SHIFT)
    931  1.1  yamaguch #define IXL_RX_DESC_FLTSTAT_FDFILTID	(0x1 << IXL_RX_DESC_FLTSTAT_SHIFT)
    932  1.1  yamaguch #define IXL_RX_DESC_FLTSTAT_RSS		(0x3 << IXL_RX_DESC_FLTSTAT_SHIFT)
    933  1.1  yamaguch #define IXL_RX_DESC_LPBK		(1 << 14)
    934  1.1  yamaguch #define IXL_RX_DESC_IPV6EXTADD		(1 << 15)
    935  1.1  yamaguch #define IXL_RX_DESC_INT_UDP_0		(1 << 18)
    936  1.1  yamaguch 
    937  1.1  yamaguch #define IXL_RX_DESC_RXE			(1 << 19)
    938  1.1  yamaguch #define IXL_RX_DESC_HBO			(1 << 21)
    939  1.1  yamaguch #define IXL_RX_DESC_IPE			(1 << 22)
    940  1.1  yamaguch #define IXL_RX_DESC_L4E			(1 << 23)
    941  1.1  yamaguch #define IXL_RX_DESC_EIPE		(1 << 24)
    942  1.1  yamaguch #define IXL_RX_DESC_OVERSIZE		(1 << 25)
    943  1.1  yamaguch 
    944  1.1  yamaguch #define IXL_RX_DESC_PTYPE_SHIFT		30
    945  1.1  yamaguch #define IXL_RX_DESC_PTYPE_MASK		(0xffULL << IXL_RX_DESC_PTYPE_SHIFT)
    946  1.1  yamaguch 
    947  1.1  yamaguch #define IXL_RX_DESC_PLEN_SHIFT		38
    948  1.1  yamaguch #define IXL_RX_DESC_PLEN_MASK		(0x3fffULL << IXL_RX_DESC_PLEN_SHIFT)
    949  1.1  yamaguch #define IXL_RX_DESC_HLEN_SHIFT		42
    950  1.1  yamaguch #define IXL_RX_DESC_HLEN_MASK		(0x7ffULL << IXL_RX_DESC_HLEN_SHIFT)
    951  1.1  yamaguch } __packed __aligned(16);
    952  1.1  yamaguch 
    953  1.3  yamaguch enum ixl_rx_desc_ptype {
    954  1.3  yamaguch 	IXL_RX_DESC_PTYPE_IPV4FRAG	= 22,
    955  1.3  yamaguch 	IXL_RX_DESC_PTYPE_IPV4		= 23,
    956  1.3  yamaguch 	IXL_RX_DESC_PTYPE_UDPV4		= 24,
    957  1.3  yamaguch 	IXL_RX_DESC_PTYPE_TCPV4		= 26,
    958  1.3  yamaguch 	IXL_RX_DESC_PTYPE_SCTPV4	= 27,
    959  1.3  yamaguch 	IXL_RX_DESC_PTYPE_ICMPV4	= 28,
    960  1.3  yamaguch 
    961  1.3  yamaguch 	IXL_RX_DESC_PTYPE_IPV6FRAG	= 88,
    962  1.3  yamaguch 	IXL_RX_DESC_PTYPE_IPV6		= 89,
    963  1.3  yamaguch 	IXL_RX_DESC_PTYPE_UDPV6		= 90,
    964  1.3  yamaguch 	IXL_RX_DESC_PTYPE_TCPV6		= 92,
    965  1.3  yamaguch 	IXL_RX_DESC_PTYPE_SCTPV6	= 93,
    966  1.3  yamaguch 	IXL_RX_DESC_PTYPE_ICMPV6	= 94,
    967  1.3  yamaguch };
    968  1.3  yamaguch 
    969  1.1  yamaguch struct ixl_rx_wb_desc_32 {
    970  1.1  yamaguch 	uint64_t		qword0;
    971  1.1  yamaguch 	uint64_t		qword1;
    972  1.1  yamaguch 	uint64_t		qword2;
    973  1.1  yamaguch 	uint64_t		qword3;
    974  1.1  yamaguch } __packed __aligned(16);
    975  1.1  yamaguch 
    976  1.1  yamaguch enum i40e_mac_type {
    977  1.1  yamaguch 	I40E_MAC_XL710,
    978  1.1  yamaguch 	I40E_MAC_X722,
    979  1.1  yamaguch 	I40E_MAC_X722_VF,
    980  1.1  yamaguch 	I40E_MAC_VF,
    981  1.1  yamaguch 	I40E_MAC_GENERIC
    982  1.1  yamaguch };
    983  1.1  yamaguch 
    984  1.4  yamaguch #define I40E_SR_NVM_DEV_STARTER_VERSION	0x18
    985  1.4  yamaguch #define I40E_SR_BOOT_CONFIG_PTR		0x17
    986  1.4  yamaguch #define I40E_NVM_OEM_VER_OFF		0x83
    987  1.4  yamaguch #define I40E_SR_NVM_EETRACK_LO		0x2D
    988  1.4  yamaguch #define I40E_SR_NVM_EETRACK_HI		0x2E
    989  1.4  yamaguch 
    990  1.4  yamaguch #define IXL_NVM_VERSION_LO_SHIFT	0
    991  1.4  yamaguch #define IXL_NVM_VERSION_LO_MASK		(0xffUL << IXL_NVM_VERSION_LO_SHIFT)
    992  1.4  yamaguch #define IXL_NVM_VERSION_HI_SHIFT	12
    993  1.4  yamaguch #define IXL_NVM_VERSION_HI_MASK		(0xfUL << IXL_NVM_VERSION_HI_SHIFT)
    994  1.4  yamaguch #define IXL_NVM_OEMVERSION_SHIFT	24
    995  1.4  yamaguch #define IXL_NVM_OEMVERSION_MASK		(0xffUL << IXL_NVM_OEMVERSION_SHIFT)
    996  1.4  yamaguch #define IXL_NVM_OEMBUILD_SHIFT		8
    997  1.4  yamaguch #define IXL_NVM_OEMBUILD_MASK		(0xffffUL << IXL_NVM_OEMBUILD_SHIFT)
    998  1.4  yamaguch #define IXL_NVM_OEMPATCH_SHIFT		0
    999  1.4  yamaguch #define IXL_NVM_OEMPATCH_MASK		(0xff << IXL_NVM_OEMPATCH_SHIFT)
   1000  1.7  yamaguch 
   1001  1.7  yamaguch struct ixl_aq_buf {
   1002  1.7  yamaguch 	SIMPLEQ_ENTRY(ixl_aq_buf)
   1003  1.7  yamaguch 				 aqb_entry;
   1004  1.7  yamaguch 	void			*aqb_data;
   1005  1.7  yamaguch 	bus_dmamap_t		 aqb_map;
   1006  1.7  yamaguch 	bus_dma_segment_t	 aqb_seg;
   1007  1.7  yamaguch 	size_t			 aqb_size;
   1008  1.7  yamaguch 	int			 aqb_nsegs;
   1009  1.7  yamaguch };
   1010  1.7  yamaguch SIMPLEQ_HEAD(ixl_aq_bufs, ixl_aq_buf);
   1011  1.7  yamaguch 
   1012  1.7  yamaguch #define IXL_AQB_MAP(_aqb)	((_aqb)->aqb_map)
   1013  1.7  yamaguch #define IXL_AQB_DVA(_aqb)	((_aqb)->aqb_map->dm_segs[0].ds_addr)
   1014  1.7  yamaguch #define IXL_AQB_KVA(_aqb)	((void *)(_aqb)->aqb_data)
   1015  1.7  yamaguch #define IXL_AQB_LEN(_aqb)	((_aqb)->aqb_size)
   1016  1.7  yamaguch 
   1017  1.7  yamaguch static inline unsigned int
   1018  1.7  yamaguch ixl_rxr_unrefreshed(unsigned int prod, unsigned int cons, unsigned int ndescs)
   1019  1.7  yamaguch {
   1020  1.7  yamaguch 	unsigned int num;
   1021  1.7  yamaguch 
   1022  1.7  yamaguch 	if (prod  < cons)
   1023  1.7  yamaguch 		num = cons - prod;
   1024  1.7  yamaguch 	else
   1025  1.7  yamaguch 		num  = (ndescs - prod) + cons;
   1026  1.7  yamaguch 
   1027  1.7  yamaguch 	if (__predict_true(num > 0)) {
   1028  1.7  yamaguch 		/* device cannot receive packets if all descripter is filled */
   1029  1.7  yamaguch 		num -= 1;
   1030  1.7  yamaguch 	}
   1031  1.7  yamaguch 
   1032  1.7  yamaguch 	return num;
   1033  1.7  yamaguch }
   1034  1.7  yamaguch 
   1035  1.7  yamaguch struct ixl_dmamem {
   1036  1.7  yamaguch 	bus_dmamap_t		 ixm_map;
   1037  1.7  yamaguch 	bus_dma_segment_t	 ixm_seg;
   1038  1.7  yamaguch 	int			 ixm_nsegs;
   1039  1.7  yamaguch 	size_t			 ixm_size;
   1040  1.7  yamaguch 	void			*ixm_kva;
   1041  1.7  yamaguch };
   1042  1.7  yamaguch 
   1043  1.7  yamaguch #define IXL_DMA_MAP(_ixm)	((_ixm)->ixm_map)
   1044  1.7  yamaguch #define IXL_DMA_DVA(_ixm)	((_ixm)->ixm_map->dm_segs[0].ds_addr)
   1045  1.7  yamaguch #define IXL_DMA_KVA(_ixm)	((void *)(_ixm)->ixm_kva)
   1046  1.7  yamaguch #define IXL_DMA_LEN(_ixm)	((_ixm)->ixm_size)
   1047  1.7  yamaguch 
   1048  1.7  yamaguch static inline uint32_t
   1049  1.7  yamaguch ixl_dmamem_hi(struct ixl_dmamem *ixm)
   1050  1.7  yamaguch {
   1051  1.7  yamaguch 	uint32_t retval;
   1052  1.7  yamaguch 	uint64_t val;
   1053  1.7  yamaguch 
   1054  1.7  yamaguch 	if (sizeof(IXL_DMA_DVA(ixm)) > 4) {
   1055  1.7  yamaguch 		val = (intptr_t)IXL_DMA_DVA(ixm);
   1056  1.7  yamaguch 		retval = val >> 32;
   1057  1.7  yamaguch 	} else {
   1058  1.7  yamaguch 		retval = 0;
   1059  1.7  yamaguch 	}
   1060  1.7  yamaguch 
   1061  1.7  yamaguch 	return retval;
   1062  1.7  yamaguch }
   1063  1.7  yamaguch 
   1064  1.7  yamaguch static inline uint32_t
   1065  1.7  yamaguch ixl_dmamem_lo(struct ixl_dmamem *ixm)
   1066  1.7  yamaguch {
   1067  1.7  yamaguch 
   1068  1.7  yamaguch 	return (uint32_t)IXL_DMA_DVA(ixm);
   1069  1.7  yamaguch }
   1070  1.7  yamaguch 
   1071  1.7  yamaguch struct i40e_eth_stats {
   1072  1.7  yamaguch 	uint64_t	 rx_bytes;
   1073  1.7  yamaguch 	uint64_t	 rx_unicast;
   1074  1.7  yamaguch 	uint64_t	 rx_multicast;
   1075  1.7  yamaguch 	uint64_t	 rx_broadcast;
   1076  1.7  yamaguch 	uint64_t	 rx_discards;
   1077  1.7  yamaguch 	uint64_t	 rx_unknown_protocol;
   1078  1.7  yamaguch 
   1079  1.7  yamaguch 	uint64_t	 tx_bytes;
   1080  1.7  yamaguch 	uint64_t	 tx_unicast;
   1081  1.7  yamaguch 	uint64_t	 tx_multicast;
   1082  1.7  yamaguch 	uint64_t	 tx_broadcast;
   1083  1.7  yamaguch 	uint64_t	 tx_discards;
   1084  1.7  yamaguch 	uint64_t	 tx_errors;
   1085  1.7  yamaguch } __packed;
   1086  1.1  yamaguch #endif
   1087