xref: /freebsd/sys/dev/ixl/ixl.h (revision cb6b8299fdda0ccd5c9c9b0d29cd9c005f6d780b)
161ae650dSJack F Vogel /******************************************************************************
261ae650dSJack F Vogel 
3b6c8f260SJack F Vogel   Copyright (c) 2013-2015, Intel Corporation
461ae650dSJack F Vogel   All rights reserved.
561ae650dSJack F Vogel 
661ae650dSJack F Vogel   Redistribution and use in source and binary forms, with or without
761ae650dSJack F Vogel   modification, are permitted provided that the following conditions are met:
861ae650dSJack F Vogel 
961ae650dSJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
1061ae650dSJack F Vogel       this list of conditions and the following disclaimer.
1161ae650dSJack F Vogel 
1261ae650dSJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
1361ae650dSJack F Vogel       notice, this list of conditions and the following disclaimer in the
1461ae650dSJack F Vogel       documentation and/or other materials provided with the distribution.
1561ae650dSJack F Vogel 
1661ae650dSJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
1761ae650dSJack F Vogel       contributors may be used to endorse or promote products derived from
1861ae650dSJack F Vogel       this software without specific prior written permission.
1961ae650dSJack F Vogel 
2061ae650dSJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2161ae650dSJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2261ae650dSJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2361ae650dSJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2461ae650dSJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2561ae650dSJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2661ae650dSJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2761ae650dSJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2861ae650dSJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2961ae650dSJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3061ae650dSJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
3161ae650dSJack F Vogel 
3261ae650dSJack F Vogel ******************************************************************************/
3361ae650dSJack F Vogel /*$FreeBSD$*/
3461ae650dSJack F Vogel 
3561ae650dSJack F Vogel 
3661ae650dSJack F Vogel #ifndef _IXL_H_
3761ae650dSJack F Vogel #define _IXL_H_
3861ae650dSJack F Vogel 
39f7c73984SSean Bruno #include "opt_inet.h"
40f7c73984SSean Bruno #include "opt_inet6.h"
41f7c73984SSean Bruno #include "opt_rss.h"
42*cb6b8299SEric Joyner #include "opt_ixl.h"
43f7c73984SSean Bruno 
4461ae650dSJack F Vogel #include <sys/param.h>
4561ae650dSJack F Vogel #include <sys/systm.h>
4661ae650dSJack F Vogel #include <sys/buf_ring.h>
4761ae650dSJack F Vogel #include <sys/mbuf.h>
4861ae650dSJack F Vogel #include <sys/protosw.h>
4961ae650dSJack F Vogel #include <sys/socket.h>
5061ae650dSJack F Vogel #include <sys/malloc.h>
5161ae650dSJack F Vogel #include <sys/kernel.h>
5261ae650dSJack F Vogel #include <sys/module.h>
5361ae650dSJack F Vogel #include <sys/sockio.h>
5413b40804SSteven Hartland #include <sys/eventhandler.h>
55*cb6b8299SEric Joyner #include <sys/syslog.h>
5661ae650dSJack F Vogel 
5761ae650dSJack F Vogel #include <net/if.h>
5813b40804SSteven Hartland #include <net/if_var.h>
5961ae650dSJack F Vogel #include <net/if_arp.h>
6061ae650dSJack F Vogel #include <net/bpf.h>
6161ae650dSJack F Vogel #include <net/ethernet.h>
6261ae650dSJack F Vogel #include <net/if_dl.h>
6361ae650dSJack F Vogel #include <net/if_media.h>
6461ae650dSJack F Vogel 
6561ae650dSJack F Vogel #include <net/bpf.h>
6661ae650dSJack F Vogel #include <net/if_types.h>
6761ae650dSJack F Vogel #include <net/if_vlan_var.h>
6861ae650dSJack F Vogel 
6961ae650dSJack F Vogel #include <netinet/in_systm.h>
7061ae650dSJack F Vogel #include <netinet/in.h>
7161ae650dSJack F Vogel #include <netinet/if_ether.h>
7261ae650dSJack F Vogel #include <netinet/ip.h>
7361ae650dSJack F Vogel #include <netinet/ip6.h>
7461ae650dSJack F Vogel #include <netinet/tcp.h>
7561ae650dSJack F Vogel #include <netinet/tcp_lro.h>
7661ae650dSJack F Vogel #include <netinet/udp.h>
7761ae650dSJack F Vogel #include <netinet/sctp.h>
7861ae650dSJack F Vogel 
7961ae650dSJack F Vogel #include <machine/in_cksum.h>
8061ae650dSJack F Vogel 
8161ae650dSJack F Vogel #include <sys/bus.h>
8261ae650dSJack F Vogel #include <machine/bus.h>
8361ae650dSJack F Vogel #include <sys/rman.h>
8461ae650dSJack F Vogel #include <machine/resource.h>
8561ae650dSJack F Vogel #include <vm/vm.h>
8661ae650dSJack F Vogel #include <vm/pmap.h>
8761ae650dSJack F Vogel #include <machine/clock.h>
8861ae650dSJack F Vogel #include <dev/pci/pcivar.h>
8961ae650dSJack F Vogel #include <dev/pci/pcireg.h>
9061ae650dSJack F Vogel #include <sys/proc.h>
9161ae650dSJack F Vogel #include <sys/sysctl.h>
9261ae650dSJack F Vogel #include <sys/endian.h>
9361ae650dSJack F Vogel #include <sys/taskqueue.h>
9461ae650dSJack F Vogel #include <sys/pcpu.h>
9561ae650dSJack F Vogel #include <sys/smp.h>
961d767a8eSEric Joyner #include <sys/sbuf.h>
9761ae650dSJack F Vogel #include <machine/smp.h>
984294f337SSean Bruno #include <machine/stdarg.h>
9961ae650dSJack F Vogel 
1004294f337SSean Bruno #ifdef RSS
1014294f337SSean Bruno #include <net/rss_config.h>
102f7c73984SSean Bruno #include <netinet/in_rss.h>
10356c2c47bSJack F Vogel #endif
10456c2c47bSJack F Vogel 
10561ae650dSJack F Vogel #include "i40e_type.h"
10661ae650dSJack F Vogel #include "i40e_prototype.h"
10761ae650dSJack F Vogel 
10861ae650dSJack F Vogel #define MAC_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x"
10961ae650dSJack F Vogel #define MAC_FORMAT_ARGS(mac_addr) \
11061ae650dSJack F Vogel 	(mac_addr)[0], (mac_addr)[1], (mac_addr)[2], (mac_addr)[3], \
11161ae650dSJack F Vogel 	(mac_addr)[4], (mac_addr)[5]
11261ae650dSJack F Vogel #define ON_OFF_STR(is_set) ((is_set) ? "On" : "Off")
11361ae650dSJack F Vogel 
114393c4bb1SJack F Vogel #ifdef IXL_DEBUG
11561ae650dSJack F Vogel 
11661ae650dSJack F Vogel #define _DBG_PRINTF(S, ...)		printf("%s: " S "\n", __func__, ##__VA_ARGS__)
11761ae650dSJack F Vogel #define _DEV_DBG_PRINTF(dev, S, ...)	device_printf(dev, "%s: " S "\n", __func__, ##__VA_ARGS__)
11861ae650dSJack F Vogel #define _IF_DBG_PRINTF(ifp, S, ...)	if_printf(ifp, "%s: " S "\n", __func__, ##__VA_ARGS__)
11961ae650dSJack F Vogel 
12061ae650dSJack F Vogel /* Defines for printing generic debug information */
12161ae650dSJack F Vogel #define DPRINTF(...)			_DBG_PRINTF(__VA_ARGS__)
12261ae650dSJack F Vogel #define DDPRINTF(...)			_DEV_DBG_PRINTF(__VA_ARGS__)
12361ae650dSJack F Vogel #define IDPRINTF(...)			_IF_DBG_PRINTF(__VA_ARGS__)
12461ae650dSJack F Vogel 
12561ae650dSJack F Vogel /* Defines for printing specific debug information */
12661ae650dSJack F Vogel #define DEBUG_INIT  1
12761ae650dSJack F Vogel #define DEBUG_IOCTL 1
12861ae650dSJack F Vogel #define DEBUG_HW    1
12961ae650dSJack F Vogel 
13061ae650dSJack F Vogel #define INIT_DEBUGOUT(...)		if (DEBUG_INIT) _DBG_PRINTF(__VA_ARGS__)
13161ae650dSJack F Vogel #define INIT_DBG_DEV(...)		if (DEBUG_INIT) _DEV_DBG_PRINTF(__VA_ARGS__)
13261ae650dSJack F Vogel #define INIT_DBG_IF(...)		if (DEBUG_INIT) _IF_DBG_PRINTF(__VA_ARGS__)
13361ae650dSJack F Vogel 
13461ae650dSJack F Vogel #define IOCTL_DEBUGOUT(...)		if (DEBUG_IOCTL) _DBG_PRINTF(__VA_ARGS__)
13561ae650dSJack F Vogel #define IOCTL_DBG_IF2(ifp, S, ...)	if (DEBUG_IOCTL) \
13661ae650dSJack F Vogel 					    if_printf(ifp, S "\n", ##__VA_ARGS__)
13761ae650dSJack F Vogel #define IOCTL_DBG_IF(...)		if (DEBUG_IOCTL) _IF_DBG_PRINTF(__VA_ARGS__)
13861ae650dSJack F Vogel 
13961ae650dSJack F Vogel #define HW_DEBUGOUT(...)		if (DEBUG_HW) _DBG_PRINTF(__VA_ARGS__)
14061ae650dSJack F Vogel 
141393c4bb1SJack F Vogel #else /* no IXL_DEBUG */
14261ae650dSJack F Vogel #define DEBUG_INIT  0
14361ae650dSJack F Vogel #define DEBUG_IOCTL 0
14461ae650dSJack F Vogel #define DEBUG_HW    0
14561ae650dSJack F Vogel 
14661ae650dSJack F Vogel #define DPRINTF(...)
14761ae650dSJack F Vogel #define DDPRINTF(...)
14861ae650dSJack F Vogel #define IDPRINTF(...)
14961ae650dSJack F Vogel 
15061ae650dSJack F Vogel #define INIT_DEBUGOUT(...)
15161ae650dSJack F Vogel #define INIT_DBG_DEV(...)
15261ae650dSJack F Vogel #define INIT_DBG_IF(...)
15361ae650dSJack F Vogel #define IOCTL_DEBUGOUT(...)
15461ae650dSJack F Vogel #define IOCTL_DBG_IF2(...)
15561ae650dSJack F Vogel #define IOCTL_DBG_IF(...)
15661ae650dSJack F Vogel #define HW_DEBUGOUT(...)
157393c4bb1SJack F Vogel #endif /* IXL_DEBUG */
15861ae650dSJack F Vogel 
1594294f337SSean Bruno enum ixl_dbg_mask {
1604294f337SSean Bruno 	IXL_DBG_INFO			= 0x00000001,
1614294f337SSean Bruno 	IXL_DBG_EN_DIS			= 0x00000002,
1624294f337SSean Bruno 	IXL_DBG_AQ			= 0x00000004,
1634294f337SSean Bruno 	IXL_DBG_NVMUPD			= 0x00000008,
1644294f337SSean Bruno 
1654294f337SSean Bruno 	IXL_DBG_IOCTL_KNOWN		= 0x00000010,
1664294f337SSean Bruno 	IXL_DBG_IOCTL_UNKNOWN		= 0x00000020,
1674294f337SSean Bruno 	IXL_DBG_IOCTL_ALL		= 0x00000030,
1684294f337SSean Bruno 
1694294f337SSean Bruno 	I40E_DEBUG_RSS			= 0x00000100,
1704294f337SSean Bruno 
1714294f337SSean Bruno 	IXL_DBG_IOV			= 0x00001000,
1724294f337SSean Bruno 	IXL_DBG_IOV_VC			= 0x00002000,
1734294f337SSean Bruno 
1744294f337SSean Bruno 	IXL_DBG_SWITCH_INFO		= 0x00010000,
175*cb6b8299SEric Joyner 	IXL_DBG_I2C			= 0x00020000,
1764294f337SSean Bruno 
1774294f337SSean Bruno 	IXL_DBG_ALL			= 0xFFFFFFFF
1784294f337SSean Bruno };
1794294f337SSean Bruno 
18061ae650dSJack F Vogel /* Tunables */
18161ae650dSJack F Vogel 
18261ae650dSJack F Vogel /*
18361ae650dSJack F Vogel  * Ring Descriptors Valid Range: 32-4096 Default Value: 1024 This value is the
18461ae650dSJack F Vogel  * number of tx/rx descriptors allocated by the driver. Increasing this
1856c426059SEric Joyner  * value allows the driver to queue more operations.
1866c426059SEric Joyner  *
1876c426059SEric Joyner  * Tx descriptors are always 16 bytes, but Rx descriptors can be 32 bytes.
1886c426059SEric Joyner  * The driver currently always uses 32 byte Rx descriptors.
18961ae650dSJack F Vogel  */
190*cb6b8299SEric Joyner #define IXL_DEFAULT_RING	1024
1914294f337SSean Bruno #define IXL_MAX_RING		8160
1924294f337SSean Bruno #define IXL_MIN_RING		32
1934294f337SSean Bruno #define IXL_RING_INCREMENT	32
1944294f337SSean Bruno 
1954294f337SSean Bruno #define IXL_AQ_LEN		256
1964294f337SSean Bruno #define IXL_AQ_LEN_MAX		1024
19761ae650dSJack F Vogel 
19861ae650dSJack F Vogel /*
19961ae650dSJack F Vogel ** Default number of entries in Tx queue buf_ring.
20061ae650dSJack F Vogel */
2014294f337SSean Bruno #define DEFAULT_TXBRSZ		4096
20261ae650dSJack F Vogel 
20361ae650dSJack F Vogel /* Alignment for rings */
20461ae650dSJack F Vogel #define DBA_ALIGN		128
20561ae650dSJack F Vogel 
20661ae650dSJack F Vogel /*
20761ae650dSJack F Vogel  * This is the max watchdog interval, ie. the time that can
20861ae650dSJack F Vogel  * pass between any two TX clean operations, such only happening
20961ae650dSJack F Vogel  * when the TX hardware is functioning.
21061ae650dSJack F Vogel  */
21161ae650dSJack F Vogel #define IXL_WATCHDOG		(10 * hz)
21261ae650dSJack F Vogel 
21361ae650dSJack F Vogel /*
21461ae650dSJack F Vogel  * This parameters control when the driver calls the routine to reclaim
21561ae650dSJack F Vogel  * transmit descriptors.
21661ae650dSJack F Vogel  */
21761ae650dSJack F Vogel #define IXL_TX_CLEANUP_THRESHOLD	(que->num_desc / 8)
21861ae650dSJack F Vogel #define IXL_TX_OP_THRESHOLD		(que->num_desc / 32)
21961ae650dSJack F Vogel 
22061ae650dSJack F Vogel #define MAX_MULTICAST_ADDR	128
22161ae650dSJack F Vogel 
222*cb6b8299SEric Joyner #define IXL_MSIX_BAR		3
22361ae650dSJack F Vogel #define IXL_ADM_LIMIT		2
22461ae650dSJack F Vogel #define IXL_TSO_SIZE		65535
22561ae650dSJack F Vogel #define IXL_AQ_BUF_SZ		((u32) 4096)
22661ae650dSJack F Vogel #define IXL_RX_HDR		128
22761ae650dSJack F Vogel #define IXL_RX_LIMIT		512
22861ae650dSJack F Vogel #define IXL_RX_ITR		0
22961ae650dSJack F Vogel #define IXL_TX_ITR		1
23061ae650dSJack F Vogel #define IXL_ITR_NONE		3
23161ae650dSJack F Vogel #define IXL_QUEUE_EOL		0x7FF
2326c426059SEric Joyner #define IXL_MAX_FRAME		9728
23361ae650dSJack F Vogel #define IXL_MAX_TX_SEGS		8
2344294f337SSean Bruno #define IXL_MAX_TSO_SEGS	128
23561ae650dSJack F Vogel #define IXL_SPARSE_CHAIN	6
23661ae650dSJack F Vogel #define IXL_QUEUE_HUNG		0x80000000
237*cb6b8299SEric Joyner #define IXL_MIN_TSO_MSS		64
2384294f337SSean Bruno 
2394294f337SSean Bruno #define IXL_RSS_KEY_SIZE_REG		13
2404294f337SSean Bruno #define IXL_RSS_KEY_SIZE		(IXL_RSS_KEY_SIZE_REG * 4)
2414294f337SSean Bruno #define IXL_RSS_VSI_LUT_SIZE		64	/* X722 -> VSI, X710 -> VF */
2424294f337SSean Bruno #define IXL_RSS_VSI_LUT_ENTRY_MASK	0x3F
2434294f337SSean Bruno #define IXL_RSS_VF_LUT_ENTRY_MASK	0xF
24461ae650dSJack F Vogel 
24556c2c47bSJack F Vogel #define IXL_VF_MAX_BUFFER	0x3F80
24656c2c47bSJack F Vogel #define IXL_VF_MAX_HDR_BUFFER	0x840
24756c2c47bSJack F Vogel #define IXL_VF_MAX_FRAME	0x3FFF
24856c2c47bSJack F Vogel 
2494294f337SSean Bruno /* ERJ: hardware can support ~2k (SW5+) filters between all functions */
25061ae650dSJack F Vogel #define IXL_MAX_FILTERS		256
25161ae650dSJack F Vogel #define IXL_MAX_TX_BUSY		10
25261ae650dSJack F Vogel 
25361ae650dSJack F Vogel #define IXL_NVM_VERSION_LO_SHIFT	0
25461ae650dSJack F Vogel #define IXL_NVM_VERSION_LO_MASK		(0xff << IXL_NVM_VERSION_LO_SHIFT)
25561ae650dSJack F Vogel #define IXL_NVM_VERSION_HI_SHIFT	12
25661ae650dSJack F Vogel #define IXL_NVM_VERSION_HI_MASK		(0xf << IXL_NVM_VERSION_HI_SHIFT)
25761ae650dSJack F Vogel 
25861ae650dSJack F Vogel /*
25961ae650dSJack F Vogel  * Interrupt Moderation parameters
260*cb6b8299SEric Joyner  * Multiply ITR values by 2 for real ITR value
26161ae650dSJack F Vogel  */
262*cb6b8299SEric Joyner #define IXL_MAX_ITR		0x0FF0
26361ae650dSJack F Vogel #define IXL_ITR_100K		0x0005
26461ae650dSJack F Vogel #define IXL_ITR_20K		0x0019
26561ae650dSJack F Vogel #define IXL_ITR_8K		0x003E
26661ae650dSJack F Vogel #define IXL_ITR_4K		0x007A
267*cb6b8299SEric Joyner #define IXL_ITR_1K		0x01F4
26861ae650dSJack F Vogel #define IXL_ITR_DYNAMIC		0x8000
26961ae650dSJack F Vogel #define IXL_LOW_LATENCY		0
27061ae650dSJack F Vogel #define IXL_AVE_LATENCY		1
27161ae650dSJack F Vogel #define IXL_BULK_LATENCY	2
27261ae650dSJack F Vogel 
27361ae650dSJack F Vogel /* MacVlan Flags */
27461ae650dSJack F Vogel #define IXL_FILTER_USED		(u16)(1 << 0)
27561ae650dSJack F Vogel #define IXL_FILTER_VLAN		(u16)(1 << 1)
27661ae650dSJack F Vogel #define IXL_FILTER_ADD		(u16)(1 << 2)
27761ae650dSJack F Vogel #define IXL_FILTER_DEL		(u16)(1 << 3)
27861ae650dSJack F Vogel #define IXL_FILTER_MC		(u16)(1 << 4)
27961ae650dSJack F Vogel 
28061ae650dSJack F Vogel /* used in the vlan field of the filter when not a vlan */
28161ae650dSJack F Vogel #define IXL_VLAN_ANY		-1
28261ae650dSJack F Vogel 
28361ae650dSJack F Vogel #define CSUM_OFFLOAD_IPV4	(CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
28461ae650dSJack F Vogel #define CSUM_OFFLOAD_IPV6	(CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6)
28561ae650dSJack F Vogel #define CSUM_OFFLOAD		(CSUM_OFFLOAD_IPV4|CSUM_OFFLOAD_IPV6|CSUM_TSO)
28661ae650dSJack F Vogel 
28761ae650dSJack F Vogel /* Misc flags for ixl_vsi.flags */
28861ae650dSJack F Vogel #define IXL_FLAGS_KEEP_TSO4	(1 << 0)
28961ae650dSJack F Vogel #define IXL_FLAGS_KEEP_TSO6	(1 << 1)
29061ae650dSJack F Vogel 
29156c2c47bSJack F Vogel #define IXL_VF_RESET_TIMEOUT	100
29256c2c47bSJack F Vogel 
29356c2c47bSJack F Vogel #define IXL_VSI_DATA_PORT	0x01
29456c2c47bSJack F Vogel 
29556c2c47bSJack F Vogel #define IXLV_MAX_QUEUES		16
29656c2c47bSJack F Vogel #define IXL_MAX_VSI_QUEUES	(2 * (I40E_VSILAN_QTABLE_MAX_INDEX + 1))
29756c2c47bSJack F Vogel 
29856c2c47bSJack F Vogel #define IXL_RX_CTX_BASE_UNITS	128
29956c2c47bSJack F Vogel #define IXL_TX_CTX_BASE_UNITS	128
30056c2c47bSJack F Vogel 
30156c2c47bSJack F Vogel #define IXL_VPINT_LNKLSTN_REG(hw, vector, vf_num) \
30256c2c47bSJack F Vogel 	I40E_VPINT_LNKLSTN(((vector) - 1) + \
30356c2c47bSJack F Vogel 	    (((hw)->func_caps.num_msix_vectors_vf - 1) * (vf_num)))
30456c2c47bSJack F Vogel 
30556c2c47bSJack F Vogel #define IXL_VFINT_DYN_CTLN_REG(hw, vector, vf_num) \
30656c2c47bSJack F Vogel 	I40E_VFINT_DYN_CTLN(((vector) - 1) + \
30756c2c47bSJack F Vogel 	    (((hw)->func_caps.num_msix_vectors_vf - 1) * (vf_num)))
30856c2c47bSJack F Vogel 
30956c2c47bSJack F Vogel #define IXL_PF_PCI_CIAA_VF_DEVICE_STATUS	0xAA
31056c2c47bSJack F Vogel 
31156c2c47bSJack F Vogel #define IXL_PF_PCI_CIAD_VF_TRANS_PENDING_MASK	0x20
31256c2c47bSJack F Vogel 
31356c2c47bSJack F Vogel #define IXL_GLGEN_VFLRSTAT_INDEX(glb_vf)	((glb_vf) / 32)
31456c2c47bSJack F Vogel #define IXL_GLGEN_VFLRSTAT_MASK(glb_vf)	(1 << ((glb_vf) % 32))
31556c2c47bSJack F Vogel 
31656c2c47bSJack F Vogel #define IXL_MAX_ITR_IDX		3
31756c2c47bSJack F Vogel 
31856c2c47bSJack F Vogel #define IXL_END_OF_INTR_LNKLST	0x7FF
31956c2c47bSJack F Vogel 
320*cb6b8299SEric Joyner #define IXL_DEFAULT_RSS_HENA_BASE (\
3214294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) |	\
3224294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) |	\
3234294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) |	\
3244294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) |	\
3254294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) |		\
3264294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) |	\
3274294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) |	\
3284294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) |	\
3294294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) |	\
3304294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) |		\
3314294f337SSean Bruno 	BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD))
3324294f337SSean Bruno 
333*cb6b8299SEric Joyner #define IXL_DEFAULT_RSS_HENA_XL710	IXL_DEFAULT_RSS_HENA_BASE
334*cb6b8299SEric Joyner 
335*cb6b8299SEric Joyner #define IXL_DEFAULT_RSS_HENA_X722 (\
336*cb6b8299SEric Joyner 	IXL_DEFAULT_RSS_HENA_BASE |			\
337*cb6b8299SEric Joyner 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
338*cb6b8299SEric Joyner 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
339*cb6b8299SEric Joyner 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
340*cb6b8299SEric Joyner 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP) | \
341*cb6b8299SEric Joyner 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
342*cb6b8299SEric Joyner 	BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK))
343*cb6b8299SEric Joyner 
34461ae650dSJack F Vogel #define IXL_TX_LOCK(_sc)                mtx_lock(&(_sc)->mtx)
34561ae650dSJack F Vogel #define IXL_TX_UNLOCK(_sc)              mtx_unlock(&(_sc)->mtx)
34661ae650dSJack F Vogel #define IXL_TX_LOCK_DESTROY(_sc)        mtx_destroy(&(_sc)->mtx)
34761ae650dSJack F Vogel #define IXL_TX_TRYLOCK(_sc)             mtx_trylock(&(_sc)->mtx)
34861ae650dSJack F Vogel #define IXL_TX_LOCK_ASSERT(_sc)         mtx_assert(&(_sc)->mtx, MA_OWNED)
34961ae650dSJack F Vogel 
35061ae650dSJack F Vogel #define IXL_RX_LOCK(_sc)                mtx_lock(&(_sc)->mtx)
35161ae650dSJack F Vogel #define IXL_RX_UNLOCK(_sc)              mtx_unlock(&(_sc)->mtx)
35261ae650dSJack F Vogel #define IXL_RX_LOCK_DESTROY(_sc)        mtx_destroy(&(_sc)->mtx)
35361ae650dSJack F Vogel 
354a48d00d2SEric Joyner /* Pre-11 counter(9) compatibility */
355b6c8f260SJack F Vogel #if __FreeBSD_version >= 1100036
3564b443922SGleb Smirnoff #define IXL_SET_IPACKETS(vsi, count)	(vsi)->ipackets = (count)
3574b443922SGleb Smirnoff #define IXL_SET_IERRORS(vsi, count)	(vsi)->ierrors = (count)
3584b443922SGleb Smirnoff #define IXL_SET_OPACKETS(vsi, count)	(vsi)->opackets = (count)
3594b443922SGleb Smirnoff #define IXL_SET_OERRORS(vsi, count)	(vsi)->oerrors = (count)
3604b443922SGleb Smirnoff #define IXL_SET_COLLISIONS(vsi, count)	/* Do nothing; collisions is always 0. */
3614b443922SGleb Smirnoff #define IXL_SET_IBYTES(vsi, count)	(vsi)->ibytes = (count)
3624b443922SGleb Smirnoff #define IXL_SET_OBYTES(vsi, count)	(vsi)->obytes = (count)
3634b443922SGleb Smirnoff #define IXL_SET_IMCASTS(vsi, count)	(vsi)->imcasts = (count)
3644b443922SGleb Smirnoff #define IXL_SET_OMCASTS(vsi, count)	(vsi)->omcasts = (count)
3654b443922SGleb Smirnoff #define IXL_SET_IQDROPS(vsi, count)	(vsi)->iqdrops = (count)
366625d12c6SJohn Baldwin #define IXL_SET_OQDROPS(vsi, count)	(vsi)->oqdrops = (count)
3674b443922SGleb Smirnoff #define IXL_SET_NOPROTO(vsi, count)	(vsi)->noproto = (count)
3684b443922SGleb Smirnoff #else
3694b443922SGleb Smirnoff #define IXL_SET_IPACKETS(vsi, count)	(vsi)->ifp->if_ipackets = (count)
3704b443922SGleb Smirnoff #define IXL_SET_IERRORS(vsi, count)	(vsi)->ifp->if_ierrors = (count)
3714b443922SGleb Smirnoff #define IXL_SET_OPACKETS(vsi, count)	(vsi)->ifp->if_opackets = (count)
3724b443922SGleb Smirnoff #define IXL_SET_OERRORS(vsi, count)	(vsi)->ifp->if_oerrors = (count)
3734b443922SGleb Smirnoff #define IXL_SET_COLLISIONS(vsi, count)	(vsi)->ifp->if_collisions = (count)
3744b443922SGleb Smirnoff #define IXL_SET_IBYTES(vsi, count)	(vsi)->ifp->if_ibytes = (count)
3754b443922SGleb Smirnoff #define IXL_SET_OBYTES(vsi, count)	(vsi)->ifp->if_obytes = (count)
3764b443922SGleb Smirnoff #define IXL_SET_IMCASTS(vsi, count)	(vsi)->ifp->if_imcasts = (count)
3774b443922SGleb Smirnoff #define IXL_SET_OMCASTS(vsi, count)	(vsi)->ifp->if_omcasts = (count)
3784b443922SGleb Smirnoff #define IXL_SET_IQDROPS(vsi, count)	(vsi)->ifp->if_iqdrops = (count)
3794b443922SGleb Smirnoff #define IXL_SET_OQDROPS(vsi, odrops)	(vsi)->ifp->if_snd.ifq_drops = (odrops)
3804b443922SGleb Smirnoff #define IXL_SET_NOPROTO(vsi, count)	(vsi)->noproto = (count)
3814b443922SGleb Smirnoff #endif
3824b443922SGleb Smirnoff 
38361ae650dSJack F Vogel /*
38461ae650dSJack F Vogel  *****************************************************************************
38561ae650dSJack F Vogel  * vendor_info_array
38661ae650dSJack F Vogel  *
38761ae650dSJack F Vogel  * This array contains the list of Subvendor/Subdevice IDs on which the driver
38861ae650dSJack F Vogel  * should load.
38961ae650dSJack F Vogel  *
39061ae650dSJack F Vogel  *****************************************************************************
39161ae650dSJack F Vogel  */
39261ae650dSJack F Vogel typedef struct _ixl_vendor_info_t {
39361ae650dSJack F Vogel 	unsigned int    vendor_id;
39461ae650dSJack F Vogel 	unsigned int    device_id;
39561ae650dSJack F Vogel 	unsigned int    subvendor_id;
39661ae650dSJack F Vogel 	unsigned int    subdevice_id;
39761ae650dSJack F Vogel 	unsigned int    index;
39861ae650dSJack F Vogel } ixl_vendor_info_t;
39961ae650dSJack F Vogel 
40061ae650dSJack F Vogel 
40161ae650dSJack F Vogel struct ixl_tx_buf {
40261ae650dSJack F Vogel 	u32		eop_index;
40361ae650dSJack F Vogel 	struct mbuf	*m_head;
40461ae650dSJack F Vogel 	bus_dmamap_t	map;
40561ae650dSJack F Vogel 	bus_dma_tag_t	tag;
40661ae650dSJack F Vogel };
40761ae650dSJack F Vogel 
40861ae650dSJack F Vogel struct ixl_rx_buf {
40961ae650dSJack F Vogel 	struct mbuf	*m_head;
41061ae650dSJack F Vogel 	struct mbuf	*m_pack;
41161ae650dSJack F Vogel 	struct mbuf	*fmp;
41261ae650dSJack F Vogel 	bus_dmamap_t	hmap;
41361ae650dSJack F Vogel 	bus_dmamap_t	pmap;
41461ae650dSJack F Vogel };
41561ae650dSJack F Vogel 
41661ae650dSJack F Vogel /*
41761ae650dSJack F Vogel ** This struct has multiple uses, multicast
41861ae650dSJack F Vogel ** addresses, vlans, and mac filters all use it.
41961ae650dSJack F Vogel */
42061ae650dSJack F Vogel struct ixl_mac_filter {
42161ae650dSJack F Vogel 	SLIST_ENTRY(ixl_mac_filter) next;
42261ae650dSJack F Vogel 	u8	macaddr[ETHER_ADDR_LEN];
42361ae650dSJack F Vogel 	s16	vlan;
42461ae650dSJack F Vogel 	u16	flags;
42561ae650dSJack F Vogel };
42661ae650dSJack F Vogel 
42761ae650dSJack F Vogel /*
42861ae650dSJack F Vogel  * The Transmit ring control struct
42961ae650dSJack F Vogel  */
43061ae650dSJack F Vogel struct tx_ring {
43161ae650dSJack F Vogel         struct ixl_queue	*que;
43261ae650dSJack F Vogel 	struct mtx		mtx;
43361ae650dSJack F Vogel 	u32			tail;
43461ae650dSJack F Vogel 	struct i40e_tx_desc	*base;
43561ae650dSJack F Vogel 	struct i40e_dma_mem	dma;
43661ae650dSJack F Vogel 	u16			next_avail;
43761ae650dSJack F Vogel 	u16			next_to_clean;
43861ae650dSJack F Vogel 	u16			atr_rate;
43961ae650dSJack F Vogel 	u16			atr_count;
4406d011ad5SEric Joyner 	u32			itr;
4416d011ad5SEric Joyner 	u32			latency;
44261ae650dSJack F Vogel 	struct ixl_tx_buf	*buffers;
44361ae650dSJack F Vogel 	volatile u16		avail;
44461ae650dSJack F Vogel 	u32			cmd;
44561ae650dSJack F Vogel 	bus_dma_tag_t		tx_tag;
44661ae650dSJack F Vogel 	bus_dma_tag_t		tso_tag;
44761ae650dSJack F Vogel 	char			mtx_name[16];
44861ae650dSJack F Vogel 	struct buf_ring		*br;
449*cb6b8299SEric Joyner 	s32			watchdog_timer;
45061ae650dSJack F Vogel 
45161ae650dSJack F Vogel 	/* Used for Dynamic ITR calculation */
45261ae650dSJack F Vogel 	u32			packets;
45361ae650dSJack F Vogel 	u32 			bytes;
45461ae650dSJack F Vogel 
45561ae650dSJack F Vogel 	/* Soft Stats */
45661ae650dSJack F Vogel 	u64			tx_bytes;
45761ae650dSJack F Vogel 	u64			no_desc;
45861ae650dSJack F Vogel 	u64			total_packets;
45961ae650dSJack F Vogel };
46061ae650dSJack F Vogel 
46161ae650dSJack F Vogel 
46261ae650dSJack F Vogel /*
46361ae650dSJack F Vogel  * The Receive ring control struct
46461ae650dSJack F Vogel  */
46561ae650dSJack F Vogel struct rx_ring {
46661ae650dSJack F Vogel         struct ixl_queue	*que;
46761ae650dSJack F Vogel 	struct mtx		mtx;
46861ae650dSJack F Vogel 	union i40e_rx_desc	*base;
46961ae650dSJack F Vogel 	struct i40e_dma_mem	dma;
47061ae650dSJack F Vogel 	struct lro_ctrl		lro;
47161ae650dSJack F Vogel 	bool			lro_enabled;
47261ae650dSJack F Vogel 	bool			hdr_split;
47361ae650dSJack F Vogel 	bool			discard;
4746d011ad5SEric Joyner         u32			next_refresh;
4756d011ad5SEric Joyner         u32 			next_check;
4766d011ad5SEric Joyner 	u32			itr;
4776d011ad5SEric Joyner 	u32			latency;
47861ae650dSJack F Vogel 	char			mtx_name[16];
47961ae650dSJack F Vogel 	struct ixl_rx_buf	*buffers;
48061ae650dSJack F Vogel 	u32			mbuf_sz;
48161ae650dSJack F Vogel 	u32			tail;
48261ae650dSJack F Vogel 	bus_dma_tag_t		htag;
48361ae650dSJack F Vogel 	bus_dma_tag_t		ptag;
48461ae650dSJack F Vogel 
48561ae650dSJack F Vogel 	/* Used for Dynamic ITR calculation */
48661ae650dSJack F Vogel 	u32			packets;
48761ae650dSJack F Vogel 	u32 			bytes;
48861ae650dSJack F Vogel 
48961ae650dSJack F Vogel 	/* Soft stats */
49061ae650dSJack F Vogel 	u64			split;
49161ae650dSJack F Vogel 	u64			rx_packets;
49261ae650dSJack F Vogel 	u64 			rx_bytes;
4936d011ad5SEric Joyner 	u64 			desc_errs;
49461ae650dSJack F Vogel 	u64 			not_done;
49561ae650dSJack F Vogel };
49661ae650dSJack F Vogel 
49761ae650dSJack F Vogel /*
49861ae650dSJack F Vogel ** Driver queue struct: this is the interrupt container
49961ae650dSJack F Vogel **  for the associated tx and rx ring pair.
50061ae650dSJack F Vogel */
50161ae650dSJack F Vogel struct ixl_queue {
50261ae650dSJack F Vogel 	struct ixl_vsi		*vsi;
50361ae650dSJack F Vogel 	u32			me;
50461ae650dSJack F Vogel 	u32			msix;           /* This queue's MSIX vector */
50561ae650dSJack F Vogel 	u32			eims;           /* This queue's EIMS bit */
50661ae650dSJack F Vogel 	struct resource		*res;
50761ae650dSJack F Vogel 	void			*tag;
50861ae650dSJack F Vogel 	int			num_desc;	/* both tx and rx */
50961ae650dSJack F Vogel 	struct tx_ring		txr;
51061ae650dSJack F Vogel 	struct rx_ring		rxr;
51161ae650dSJack F Vogel 	struct task		task;
51261ae650dSJack F Vogel 	struct task		tx_task;
51361ae650dSJack F Vogel 	struct taskqueue	*tq;
51461ae650dSJack F Vogel 
51561ae650dSJack F Vogel 	/* Queue stats */
51661ae650dSJack F Vogel 	u64			irqs;
51761ae650dSJack F Vogel 	u64			tso;
51861ae650dSJack F Vogel 	u64			mbuf_defrag_failed;
51961ae650dSJack F Vogel 	u64			mbuf_hdr_failed;
52061ae650dSJack F Vogel 	u64			mbuf_pkt_failed;
5214294f337SSean Bruno 	u64			tx_dmamap_failed;
52261ae650dSJack F Vogel 	u64			dropped_pkts;
523*cb6b8299SEric Joyner 	u64			mss_too_small;
52461ae650dSJack F Vogel };
52561ae650dSJack F Vogel 
52661ae650dSJack F Vogel /*
5274294f337SSean Bruno ** Virtual Station Interface
52861ae650dSJack F Vogel */
52961ae650dSJack F Vogel SLIST_HEAD(ixl_ftl_head, ixl_mac_filter);
53061ae650dSJack F Vogel struct ixl_vsi {
53161ae650dSJack F Vogel 	void 			*back;
53261ae650dSJack F Vogel 	struct ifnet		*ifp;
533bd937497SJean-Sébastien Pédron 	device_t		dev;
53461ae650dSJack F Vogel 	struct i40e_hw		*hw;
53561ae650dSJack F Vogel 	struct ifmedia		media;
536ac83ea83SEric Joyner 	enum i40e_vsi_type	type;
53761ae650dSJack F Vogel 	int			id;
53861ae650dSJack F Vogel 	u16			num_queues;
5396d011ad5SEric Joyner 	u32			rx_itr_setting;
5406d011ad5SEric Joyner 	u32			tx_itr_setting;
5414294f337SSean Bruno 	u16			max_frame_size;
5424294f337SSean Bruno 
54361ae650dSJack F Vogel 	struct ixl_queue	*queues;	/* head of queues */
5444294f337SSean Bruno 
5454294f337SSean Bruno 	u16			vsi_num;
54661ae650dSJack F Vogel 	bool			link_active;
54761ae650dSJack F Vogel 	u16			seid;
54856c2c47bSJack F Vogel 	u16			uplink_seid;
54956c2c47bSJack F Vogel 	u16			downlink_seid;
55061ae650dSJack F Vogel 
55161ae650dSJack F Vogel 	/* MAC/VLAN Filter list */
55261ae650dSJack F Vogel 	struct ixl_ftl_head	ftl;
55356c2c47bSJack F Vogel 	u16			num_macs;
55461ae650dSJack F Vogel 
5554294f337SSean Bruno 	/* Contains readylist & stat counter id */
55661ae650dSJack F Vogel 	struct i40e_aqc_vsi_properties_data info;
55761ae650dSJack F Vogel 
55861ae650dSJack F Vogel 	eventhandler_tag 	vlan_attach;
55961ae650dSJack F Vogel 	eventhandler_tag 	vlan_detach;
56061ae650dSJack F Vogel 	u16			num_vlans;
56161ae650dSJack F Vogel 
56261ae650dSJack F Vogel 	/* Per-VSI stats from hardware */
56361ae650dSJack F Vogel 	struct i40e_eth_stats	eth_stats;
56461ae650dSJack F Vogel 	struct i40e_eth_stats	eth_stats_offsets;
56561ae650dSJack F Vogel 	bool 			stat_offsets_loaded;
566e5100ee2SJack F Vogel 	/* VSI stat counters */
5674b443922SGleb Smirnoff 	u64			ipackets;
5684b443922SGleb Smirnoff 	u64			ierrors;
5694b443922SGleb Smirnoff 	u64			opackets;
5704b443922SGleb Smirnoff 	u64			oerrors;
5714b443922SGleb Smirnoff 	u64			ibytes;
5724b443922SGleb Smirnoff 	u64			obytes;
5734b443922SGleb Smirnoff 	u64			imcasts;
5744b443922SGleb Smirnoff 	u64			omcasts;
5754b443922SGleb Smirnoff 	u64			iqdrops;
5764b443922SGleb Smirnoff 	u64			oqdrops;
5774b443922SGleb Smirnoff 	u64			noproto;
57861ae650dSJack F Vogel 
57961ae650dSJack F Vogel 	/* Driver statistics */
58061ae650dSJack F Vogel 	u64			hw_filters_del;
58161ae650dSJack F Vogel 	u64			hw_filters_add;
58261ae650dSJack F Vogel 
58361ae650dSJack F Vogel 	/* Misc. */
58461ae650dSJack F Vogel 	u64 			flags;
58556c2c47bSJack F Vogel 	struct sysctl_oid	*vsi_node;
58661ae650dSJack F Vogel };
58761ae650dSJack F Vogel 
58861ae650dSJack F Vogel /*
58961ae650dSJack F Vogel ** Find the number of unrefreshed RX descriptors
59061ae650dSJack F Vogel */
59161ae650dSJack F Vogel static inline u16
59261ae650dSJack F Vogel ixl_rx_unrefreshed(struct ixl_queue *que)
59361ae650dSJack F Vogel {
59461ae650dSJack F Vogel         struct rx_ring	*rxr = &que->rxr;
59561ae650dSJack F Vogel 
59661ae650dSJack F Vogel 	if (rxr->next_check > rxr->next_refresh)
59761ae650dSJack F Vogel 		return (rxr->next_check - rxr->next_refresh - 1);
59861ae650dSJack F Vogel 	else
59961ae650dSJack F Vogel 		return ((que->num_desc + rxr->next_check) -
60061ae650dSJack F Vogel 		    rxr->next_refresh - 1);
60161ae650dSJack F Vogel }
60261ae650dSJack F Vogel 
60361ae650dSJack F Vogel /*
60461ae650dSJack F Vogel ** Find the next available unused filter
60561ae650dSJack F Vogel */
60661ae650dSJack F Vogel static inline struct ixl_mac_filter *
60761ae650dSJack F Vogel ixl_get_filter(struct ixl_vsi *vsi)
60861ae650dSJack F Vogel {
60961ae650dSJack F Vogel 	struct ixl_mac_filter  *f;
61061ae650dSJack F Vogel 
61161ae650dSJack F Vogel 	/* create a new empty filter */
61261ae650dSJack F Vogel 	f = malloc(sizeof(struct ixl_mac_filter),
61361ae650dSJack F Vogel 	    M_DEVBUF, M_NOWAIT | M_ZERO);
614e5100ee2SJack F Vogel 	if (f)
61561ae650dSJack F Vogel 		SLIST_INSERT_HEAD(&vsi->ftl, f, next);
61661ae650dSJack F Vogel 
61761ae650dSJack F Vogel 	return (f);
61861ae650dSJack F Vogel }
61961ae650dSJack F Vogel 
62061ae650dSJack F Vogel /*
62161ae650dSJack F Vogel ** Compare two ethernet addresses
62261ae650dSJack F Vogel */
62361ae650dSJack F Vogel static inline bool
62456c2c47bSJack F Vogel cmp_etheraddr(const u8 *ea1, const u8 *ea2)
62561ae650dSJack F Vogel {
62661ae650dSJack F Vogel 	bool cmp = FALSE;
62761ae650dSJack F Vogel 
62861ae650dSJack F Vogel 	if ((ea1[0] == ea2[0]) && (ea1[1] == ea2[1]) &&
62961ae650dSJack F Vogel 	    (ea1[2] == ea2[2]) && (ea1[3] == ea2[3]) &&
63061ae650dSJack F Vogel 	    (ea1[4] == ea2[4]) && (ea1[5] == ea2[5]))
63161ae650dSJack F Vogel 		cmp = TRUE;
63261ae650dSJack F Vogel 
63361ae650dSJack F Vogel 	return (cmp);
63461ae650dSJack F Vogel }
63561ae650dSJack F Vogel 
63661ae650dSJack F Vogel /*
6374294f337SSean Bruno  * Return next largest power of 2, unsigned
6384294f337SSean Bruno  *
6394294f337SSean Bruno  * Public domain, from Bit Twiddling Hacks
6404294f337SSean Bruno  */
6414294f337SSean Bruno static inline u32
6424294f337SSean Bruno next_power_of_two(u32 n)
6434294f337SSean Bruno {
6444294f337SSean Bruno 	n--;
6454294f337SSean Bruno 	n |= n >> 1;
6464294f337SSean Bruno 	n |= n >> 2;
6474294f337SSean Bruno 	n |= n >> 4;
6484294f337SSean Bruno 	n |= n >> 8;
6494294f337SSean Bruno 	n |= n >> 16;
6504294f337SSean Bruno 	n++;
6514294f337SSean Bruno 
6524294f337SSean Bruno 	/* Next power of two > 0 is 1 */
6534294f337SSean Bruno 	n += (n == 0);
6544294f337SSean Bruno 
6554294f337SSean Bruno 	return (n);
6564294f337SSean Bruno }
6574294f337SSean Bruno 
6584294f337SSean Bruno /*
65961ae650dSJack F Vogel  * Info for stats sysctls
66061ae650dSJack F Vogel  */
66161ae650dSJack F Vogel struct ixl_sysctl_info {
66261ae650dSJack F Vogel 	u64	*stat;
66361ae650dSJack F Vogel 	char	*name;
66461ae650dSJack F Vogel 	char	*description;
66561ae650dSJack F Vogel };
66661ae650dSJack F Vogel 
6674294f337SSean Bruno static uint8_t ixl_bcast_addr[ETHER_ADDR_LEN] =
6684294f337SSean Bruno     {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
66961ae650dSJack F Vogel 
67061ae650dSJack F Vogel /*********************************************************************
67161ae650dSJack F Vogel  *  TXRX Function prototypes
67261ae650dSJack F Vogel  *********************************************************************/
67361ae650dSJack F Vogel int	ixl_allocate_tx_data(struct ixl_queue *);
67461ae650dSJack F Vogel int	ixl_allocate_rx_data(struct ixl_queue *);
67561ae650dSJack F Vogel void	ixl_init_tx_ring(struct ixl_queue *);
67661ae650dSJack F Vogel int	ixl_init_rx_ring(struct ixl_queue *);
67761ae650dSJack F Vogel bool	ixl_rxeof(struct ixl_queue *, int);
67861ae650dSJack F Vogel bool	ixl_txeof(struct ixl_queue *);
6794294f337SSean Bruno void	ixl_free_que_tx(struct ixl_queue *);
6804294f337SSean Bruno void	ixl_free_que_rx(struct ixl_queue *);
6814294f337SSean Bruno 
68261ae650dSJack F Vogel int	ixl_mq_start(struct ifnet *, struct mbuf *);
68361ae650dSJack F Vogel int	ixl_mq_start_locked(struct ifnet *, struct tx_ring *);
68461ae650dSJack F Vogel void	ixl_deferred_mq_start(void *, int);
68561ae650dSJack F Vogel void	ixl_free_vsi(struct ixl_vsi *);
6864294f337SSean Bruno void	ixl_qflush(struct ifnet *);
6874294f337SSean Bruno 
6884294f337SSean Bruno /* Common function prototypes between PF/VF driver */
6894b443922SGleb Smirnoff #if __FreeBSD_version >= 1100000
6904b443922SGleb Smirnoff uint64_t ixl_get_counter(if_t ifp, ift_counter cnt);
6914b443922SGleb Smirnoff #endif
6924294f337SSean Bruno void	ixl_get_default_rss_key(u32 *);
69361ae650dSJack F Vogel #endif /* _IXL_H_ */
694