xref: /dflybsd-src/sys/dev/netif/ix/if_ix.h (revision 82db96e912bf0117f3be1e6c424df1f83bc0bac0)
179251f5eSSepherosa Ziehau /*
279251f5eSSepherosa Ziehau  * Copyright (c) 2001-2013, Intel Corporation
379251f5eSSepherosa Ziehau  * All rights reserved.
479251f5eSSepherosa Ziehau  *
579251f5eSSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
679251f5eSSepherosa Ziehau  * modification, are permitted provided that the following conditions are met:
779251f5eSSepherosa Ziehau  *
879251f5eSSepherosa Ziehau  *  1. Redistributions of source code must retain the above copyright notice,
979251f5eSSepherosa Ziehau  *     this list of conditions and the following disclaimer.
1079251f5eSSepherosa Ziehau  *
1179251f5eSSepherosa Ziehau  *  2. Redistributions in binary form must reproduce the above copyright
1279251f5eSSepherosa Ziehau  *     notice, this list of conditions and the following disclaimer in the
1379251f5eSSepherosa Ziehau  *     documentation and/or other materials provided with the distribution.
1479251f5eSSepherosa Ziehau  *
1579251f5eSSepherosa Ziehau  *  3. Neither the name of the Intel Corporation nor the names of its
1679251f5eSSepherosa Ziehau  *     contributors may be used to endorse or promote products derived from
1779251f5eSSepherosa Ziehau  *     this software without specific prior written permission.
1879251f5eSSepherosa Ziehau  *
1979251f5eSSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2079251f5eSSepherosa Ziehau  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2179251f5eSSepherosa Ziehau  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2279251f5eSSepherosa Ziehau  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2379251f5eSSepherosa Ziehau  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2479251f5eSSepherosa Ziehau  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2579251f5eSSepherosa Ziehau  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2679251f5eSSepherosa Ziehau  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2779251f5eSSepherosa Ziehau  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2879251f5eSSepherosa Ziehau  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2979251f5eSSepherosa Ziehau  * POSSIBILITY OF SUCH DAMAGE.
3079251f5eSSepherosa Ziehau  */
3179251f5eSSepherosa Ziehau 
3279251f5eSSepherosa Ziehau #ifndef _IF_IX_H_
3379251f5eSSepherosa Ziehau #define _IF_IX_H_
3479251f5eSSepherosa Ziehau 
3579251f5eSSepherosa Ziehau /* Tunables */
3679251f5eSSepherosa Ziehau 
3779251f5eSSepherosa Ziehau /*
38189a0ff3SSepherosa Ziehau  * MSI-X count
39189a0ff3SSepherosa Ziehau  */
40189a0ff3SSepherosa Ziehau #define IX_MAX_MSIX		64
41189a0ff3SSepherosa Ziehau #define IX_MAX_MSIX_82598	16
42189a0ff3SSepherosa Ziehau 
43189a0ff3SSepherosa Ziehau /*
4479251f5eSSepherosa Ziehau  * RX ring count
4579251f5eSSepherosa Ziehau  */
4679251f5eSSepherosa Ziehau #define IX_MAX_RXRING		16
47737c1c7cSSepherosa Ziehau #define IX_MAX_RXRING_X550	64
4879251f5eSSepherosa Ziehau #define IX_MIN_RXRING_RSS	2
4979251f5eSSepherosa Ziehau 
5079251f5eSSepherosa Ziehau /*
51189a0ff3SSepherosa Ziehau  * TX ring count
52189a0ff3SSepherosa Ziehau  */
53737c1c7cSSepherosa Ziehau #define IX_MAX_TXRING		16
54189a0ff3SSepherosa Ziehau #define IX_MAX_TXRING_82598	32
55189a0ff3SSepherosa Ziehau #define IX_MAX_TXRING_82599	64
56189a0ff3SSepherosa Ziehau #define IX_MAX_TXRING_X540	64
57737c1c7cSSepherosa Ziehau #define IX_MAX_TXRING_X550	64
58189a0ff3SSepherosa Ziehau 
59189a0ff3SSepherosa Ziehau /*
6079251f5eSSepherosa Ziehau  * Default number of segments received before writing to RX related registers
6179251f5eSSepherosa Ziehau  */
6279251f5eSSepherosa Ziehau #define IX_DEF_RXWREG_NSEGS	32
6379251f5eSSepherosa Ziehau 
6479251f5eSSepherosa Ziehau /*
6579251f5eSSepherosa Ziehau  * Default number of segments sent before writing to TX related registers
6679251f5eSSepherosa Ziehau  */
6779251f5eSSepherosa Ziehau #define IX_DEF_TXWREG_NSEGS	8
6879251f5eSSepherosa Ziehau 
6979251f5eSSepherosa Ziehau /*
7079251f5eSSepherosa Ziehau  * TxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
7179251f5eSSepherosa Ziehau  * number of transmit descriptors allocated by the driver. Increasing this
7279251f5eSSepherosa Ziehau  * value allows the driver to queue more transmits. Each descriptor is 16
7379251f5eSSepherosa Ziehau  * bytes. Performance tests have show the 2K value to be optimal for top
7479251f5eSSepherosa Ziehau  * performance.
7579251f5eSSepherosa Ziehau  */
7679251f5eSSepherosa Ziehau #define IX_DEF_TXD		1024
7779251f5eSSepherosa Ziehau #define IX_PERF_TXD		2048
7879251f5eSSepherosa Ziehau #define IX_MAX_TXD		4096
7979251f5eSSepherosa Ziehau #define IX_MIN_TXD		64
8079251f5eSSepherosa Ziehau 
8179251f5eSSepherosa Ziehau /*
8279251f5eSSepherosa Ziehau  * RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
8379251f5eSSepherosa Ziehau  * number of receive descriptors allocated for each RX queue. Increasing this
8479251f5eSSepherosa Ziehau  * value allows the driver to buffer more incoming packets. Each descriptor
8579251f5eSSepherosa Ziehau  * is 16 bytes.  A receive buffer is also allocated for each descriptor.
8679251f5eSSepherosa Ziehau  *
8779251f5eSSepherosa Ziehau  * Note: with 8 rings and a dual port card, it is possible to bump up
8879251f5eSSepherosa Ziehau  *	against the system mbuf pool limit, you can tune nmbclusters
8979251f5eSSepherosa Ziehau  *	to adjust for this.
9079251f5eSSepherosa Ziehau  */
9179251f5eSSepherosa Ziehau #define IX_DEF_RXD		1024
9279251f5eSSepherosa Ziehau #define IX_PERF_RXD		2048
9379251f5eSSepherosa Ziehau #define IX_MAX_RXD		4096
9479251f5eSSepherosa Ziehau #define IX_MIN_RXD		64
9579251f5eSSepherosa Ziehau 
9679251f5eSSepherosa Ziehau /* Alignment for rings */
9779251f5eSSepherosa Ziehau #define IX_DBA_ALIGN		128
9879251f5eSSepherosa Ziehau 
9963d483cdSSepherosa Ziehau #define IX_MAX_FRAME_SIZE	9728
10063d483cdSSepherosa Ziehau #define IX_MTU_HDR		(ETHER_HDR_LEN + ETHER_CRC_LEN + EVL_ENCAPLEN)
10163d483cdSSepherosa Ziehau #define IX_MAX_MTU		(IX_MAX_FRAME_SIZE - IX_MTU_HDR)
10263d483cdSSepherosa Ziehau 
10379251f5eSSepherosa Ziehau 
10479251f5eSSepherosa Ziehau /* Flow control constants */
10579251f5eSSepherosa Ziehau #define IX_FC_PAUSE		0xFFFF
10679251f5eSSepherosa Ziehau #define IX_FC_HI		0x20000
10779251f5eSSepherosa Ziehau #define IX_FC_LO		0x10000
10879251f5eSSepherosa Ziehau 
10979251f5eSSepherosa Ziehau /*
11079251f5eSSepherosa Ziehau  * RSS related registers
11179251f5eSSepherosa Ziehau  */
11279251f5eSSepherosa Ziehau #define IX_NRSSRK		10
11379251f5eSSepherosa Ziehau #define IX_RSSRK_SIZE		4
11479251f5eSSepherosa Ziehau #define IX_RSSRK_VAL(key, i)	(key[(i) * IX_RSSRK_SIZE] | \
11579251f5eSSepherosa Ziehau 				 key[(i) * IX_RSSRK_SIZE + 1] << 8 | \
11679251f5eSSepherosa Ziehau 				 key[(i) * IX_RSSRK_SIZE + 2] << 16 | \
11779251f5eSSepherosa Ziehau 				 key[(i) * IX_RSSRK_SIZE + 3] << 24)
11879251f5eSSepherosa Ziehau #define IX_NRETA		32
11963d483cdSSepherosa Ziehau #define IX_NRETA_X550		128
1203c37d13bSSepherosa Ziehau #define IX_NRETA_MAX		128
12179251f5eSSepherosa Ziehau #define IX_RETA_SIZE		4
12279251f5eSSepherosa Ziehau 
1233c37d13bSSepherosa Ziehau #define IX_RDRTABLE_SIZE	(IX_NRETA_MAX * IX_RETA_SIZE)
1243c37d13bSSepherosa Ziehau 
12579251f5eSSepherosa Ziehau /*
12679251f5eSSepherosa Ziehau  * EITR
12779251f5eSSepherosa Ziehau  */
12879251f5eSSepherosa Ziehau #define IX_EITR_INTVL_MASK_82598 0xffff
12979251f5eSSepherosa Ziehau #define IX_EITR_INTVL_MASK	0x0fff
13079251f5eSSepherosa Ziehau #define IX_EITR_INTVL_RSVD_MASK	0x0007
13179251f5eSSepherosa Ziehau #define IX_EITR_INTVL_MIN	IXGBE_MIN_EITR
13279251f5eSSepherosa Ziehau #define IX_EITR_INTVL_MAX	IXGBE_MAX_EITR
13379251f5eSSepherosa Ziehau 
13479251f5eSSepherosa Ziehau /*
13579251f5eSSepherosa Ziehau  * Used for optimizing small rx mbufs.  Effort is made to keep the copy
13679251f5eSSepherosa Ziehau  * small and aligned for the CPU L1 cache.
13779251f5eSSepherosa Ziehau  *
13879251f5eSSepherosa Ziehau  * MHLEN is typically 168 bytes, giving us 8-byte alignment.  Getting
13979251f5eSSepherosa Ziehau  * 32 byte alignment needed for the fast bcopy results in 8 bytes being
14079251f5eSSepherosa Ziehau  * wasted.  Getting 64 byte alignment, which _should_ be ideal for
14179251f5eSSepherosa Ziehau  * modern Intel CPUs, results in 40 bytes wasted and a significant drop
14279251f5eSSepherosa Ziehau  * in observed efficiency of the optimization, 97.9% -> 81.8%.
14379251f5eSSepherosa Ziehau  */
14479251f5eSSepherosa Ziehau #define IX_RX_COPY_LEN		160
14579251f5eSSepherosa Ziehau #define IX_RX_COPY_ALIGN	(MHLEN - IX_RX_COPY_LEN)
14679251f5eSSepherosa Ziehau 
14779251f5eSSepherosa Ziehau #define IX_MAX_MCASTADDR	128
14879251f5eSSepherosa Ziehau 
149189a0ff3SSepherosa Ziehau #define IX_MSIX_BAR_82598	3
150189a0ff3SSepherosa Ziehau #define IX_MSIX_BAR_82599	4
15179251f5eSSepherosa Ziehau 
15279251f5eSSepherosa Ziehau #define IX_TSO_SIZE		(IP_MAXPACKET + \
15379251f5eSSepherosa Ziehau 				 sizeof(struct ether_vlan_header))
15479251f5eSSepherosa Ziehau 
15579251f5eSSepherosa Ziehau /*
15679251f5eSSepherosa Ziehau  * MUST be less than 38.  Though 82598 does not have this limit,
15779251f5eSSepherosa Ziehau  * we don't want long TX chain.  33 should be large enough even
15879251f5eSSepherosa Ziehau  * for 64K TSO (32 x 2K mbuf cluster and 1 x mbuf header).
15979251f5eSSepherosa Ziehau  *
16079251f5eSSepherosa Ziehau  * Reference:
16179251f5eSSepherosa Ziehau  * - 82599 datasheet 7.2.1.1
16279251f5eSSepherosa Ziehau  * - X540 datasheet 7.2.1.1
16379251f5eSSepherosa Ziehau  */
16479251f5eSSepherosa Ziehau #define IX_MAX_SCATTER		33
16579251f5eSSepherosa Ziehau #define IX_TX_RESERVED		3	/* 1 for TX ctx, 2 reserved */
16679251f5eSSepherosa Ziehau 
16779251f5eSSepherosa Ziehau /* MSI and legacy interrupt */
16879251f5eSSepherosa Ziehau #define IX_TX_INTR_VEC		0
16979251f5eSSepherosa Ziehau #define IX_TX_INTR_MASK		(1 << IX_TX_INTR_VEC)
17079251f5eSSepherosa Ziehau #define IX_RX0_INTR_VEC		1
17179251f5eSSepherosa Ziehau #define IX_RX0_INTR_MASK	(1 << IX_RX0_INTR_VEC)
17279251f5eSSepherosa Ziehau #define IX_RX1_INTR_VEC		2
17379251f5eSSepherosa Ziehau #define IX_RX1_INTR_MASK	(1 << IX_RX1_INTR_VEC)
17479251f5eSSepherosa Ziehau 
17579251f5eSSepherosa Ziehau #define IX_INTR_RATE		8000
176189a0ff3SSepherosa Ziehau #define IX_MSIX_RX_RATE		8000
177189a0ff3SSepherosa Ziehau #define IX_MSIX_TX_RATE		6000
17879251f5eSSepherosa Ziehau 
17979251f5eSSepherosa Ziehau /* IOCTL define to gather SFP+ Diagnostic data */
18079251f5eSSepherosa Ziehau #define SIOCGI2C		SIOCGIFGENERIC
18179251f5eSSepherosa Ziehau 
18279251f5eSSepherosa Ziehau /* TX checksum offload */
18379251f5eSSepherosa Ziehau #define CSUM_OFFLOAD		(CSUM_IP|CSUM_TCP|CSUM_UDP)
18479251f5eSSepherosa Ziehau 
185189a0ff3SSepherosa Ziehau #define IX_EICR_STATUS		(IXGBE_EICR_LSC | IXGBE_EICR_ECC | \
186189a0ff3SSepherosa Ziehau 				 IXGBE_EICR_GPI_SDP1 | IXGBE_EICR_GPI_SDP2 | \
187189a0ff3SSepherosa Ziehau 				 IXGBE_EICR_TS)
188189a0ff3SSepherosa Ziehau 
18979251f5eSSepherosa Ziehau /* This is used to get SFP+ module data */
19079251f5eSSepherosa Ziehau struct ix_i2c_req {
19179251f5eSSepherosa Ziehau 	uint8_t		dev_addr;
19279251f5eSSepherosa Ziehau 	uint8_t		offset;
19379251f5eSSepherosa Ziehau 	uint8_t		len;
19479251f5eSSepherosa Ziehau 	uint8_t		data[8];
19579251f5eSSepherosa Ziehau };
19679251f5eSSepherosa Ziehau 
19779251f5eSSepherosa Ziehau struct ix_tx_buf {
19879251f5eSSepherosa Ziehau 	struct mbuf	*m_head;
19979251f5eSSepherosa Ziehau 	bus_dmamap_t	map;
20079251f5eSSepherosa Ziehau };
20179251f5eSSepherosa Ziehau 
20279251f5eSSepherosa Ziehau struct ix_rx_buf {
20379251f5eSSepherosa Ziehau 	struct mbuf	*m_head;
20479251f5eSSepherosa Ziehau 	struct mbuf	*fmp;
20579251f5eSSepherosa Ziehau 	struct mbuf	*lmp;
20679251f5eSSepherosa Ziehau 	bus_dmamap_t	map;
20779251f5eSSepherosa Ziehau 	bus_addr_t	paddr;
20879251f5eSSepherosa Ziehau 	u_int		flags;
20979251f5eSSepherosa Ziehau #define IX_RX_COPY	0x1
21079251f5eSSepherosa Ziehau };
21179251f5eSSepherosa Ziehau 
21279251f5eSSepherosa Ziehau struct ix_softc;
21379251f5eSSepherosa Ziehau 
21479251f5eSSepherosa Ziehau struct ix_tx_ring {
21579251f5eSSepherosa Ziehau 	struct lwkt_serialize	tx_serialize;
21679251f5eSSepherosa Ziehau 	struct ifaltq_subque	*tx_ifsq;
21779251f5eSSepherosa Ziehau 	struct ix_softc		*tx_sc;
21879251f5eSSepherosa Ziehau 	volatile uint32_t	*tx_hdr;
21979251f5eSSepherosa Ziehau 	union ixgbe_adv_tx_desc	*tx_base;
22079251f5eSSepherosa Ziehau 	struct ix_tx_buf	*tx_buf;
22179251f5eSSepherosa Ziehau 	bus_dma_tag_t		tx_tag;
222*82db96e9SSepherosa Ziehau 	int8_t			tx_running;
223*82db96e9SSepherosa Ziehau #define IX_TX_RUNNING		100
224*82db96e9SSepherosa Ziehau #define IX_TX_RUNNING_DEC	25
225*82db96e9SSepherosa Ziehau 	uint8_t			tx_flags;
2264a648aefSSepherosa Ziehau #define IX_TXFLAG_ENABLED	0x1
227*82db96e9SSepherosa Ziehau 	uint16_t		tx_nmbuf;
22879251f5eSSepherosa Ziehau 	uint32_t		tx_idx;
22979251f5eSSepherosa Ziehau 	uint16_t		tx_avail;
23079251f5eSSepherosa Ziehau 	uint16_t		tx_next_avail;
23179251f5eSSepherosa Ziehau 	uint16_t		tx_next_clean;
23279251f5eSSepherosa Ziehau 	uint16_t		tx_ndesc;
23379251f5eSSepherosa Ziehau 	uint16_t		tx_wreg_nsegs;
23479251f5eSSepherosa Ziehau 	uint16_t		tx_intr_nsegs;
23579251f5eSSepherosa Ziehau 	uint16_t		tx_nsegs;
23679251f5eSSepherosa Ziehau 	int16_t			tx_intr_vec;
23779251f5eSSepherosa Ziehau 	int			tx_intr_cpuid;
238189a0ff3SSepherosa Ziehau 	uint32_t		tx_eims;
239189a0ff3SSepherosa Ziehau 	uint32_t		tx_eims_val;
24079251f5eSSepherosa Ziehau 	struct ifsubq_watchdog	tx_watchdog;
241*82db96e9SSepherosa Ziehau 	struct callout		tx_gc_timer;
242*82db96e9SSepherosa Ziehau 
243*82db96e9SSepherosa Ziehau 	u_long			tx_gc;
24479251f5eSSepherosa Ziehau 
24579251f5eSSepherosa Ziehau 	bus_dma_tag_t		tx_base_dtag;
24679251f5eSSepherosa Ziehau 	bus_dmamap_t		tx_base_map;
24779251f5eSSepherosa Ziehau 	bus_addr_t		tx_base_paddr;
24879251f5eSSepherosa Ziehau 
24979251f5eSSepherosa Ziehau 	bus_dma_tag_t		tx_hdr_dtag;
25079251f5eSSepherosa Ziehau 	bus_dmamap_t		tx_hdr_map;
25179251f5eSSepherosa Ziehau 	bus_addr_t		tx_hdr_paddr;
25279251f5eSSepherosa Ziehau } __cachealign;
25379251f5eSSepherosa Ziehau 
25479251f5eSSepherosa Ziehau struct ix_rx_ring {
25579251f5eSSepherosa Ziehau 	struct lwkt_serialize	rx_serialize;
25679251f5eSSepherosa Ziehau 	struct ix_softc		*rx_sc;
25779251f5eSSepherosa Ziehau 	union ixgbe_adv_rx_desc	*rx_base;
25879251f5eSSepherosa Ziehau 	struct ix_rx_buf	*rx_buf;
25979251f5eSSepherosa Ziehau 	bus_dma_tag_t		rx_tag;
26079251f5eSSepherosa Ziehau 	bus_dmamap_t		rx_sparemap;
26179251f5eSSepherosa Ziehau 	uint32_t		rx_idx;
26279251f5eSSepherosa Ziehau 	uint16_t		rx_flags;
26379251f5eSSepherosa Ziehau #define IX_RXRING_FLAG_LRO	0x01
26479251f5eSSepherosa Ziehau #define IX_RXRING_FLAG_DISC	0x02
26579251f5eSSepherosa Ziehau 	uint16_t 		rx_next_check;
26679251f5eSSepherosa Ziehau 	uint16_t		rx_ndesc;
26779251f5eSSepherosa Ziehau 	uint16_t		rx_mbuf_sz;
26879251f5eSSepherosa Ziehau 	uint16_t		rx_wreg_nsegs;
26979251f5eSSepherosa Ziehau 	int16_t			rx_intr_vec;
270189a0ff3SSepherosa Ziehau 	uint32_t		rx_eims;
271189a0ff3SSepherosa Ziehau 	uint32_t		rx_eims_val;
272189a0ff3SSepherosa Ziehau 	struct ix_tx_ring	*rx_txr;	/* piggybacked TX ring */
27379251f5eSSepherosa Ziehau 
27479251f5eSSepherosa Ziehau #ifdef IX_RSS_DEBUG
27579251f5eSSepherosa Ziehau 	u_long			rx_pkts;
27679251f5eSSepherosa Ziehau #endif
27779251f5eSSepherosa Ziehau 
27879251f5eSSepherosa Ziehau 	bus_dma_tag_t		rx_base_dtag;
27979251f5eSSepherosa Ziehau 	bus_dmamap_t		rx_base_map;
28079251f5eSSepherosa Ziehau 	bus_addr_t		rx_base_paddr;
28179251f5eSSepherosa Ziehau } __cachealign;
28279251f5eSSepherosa Ziehau 
28379251f5eSSepherosa Ziehau struct ix_intr_data {
28479251f5eSSepherosa Ziehau 	struct lwkt_serialize	*intr_serialize;
28579251f5eSSepherosa Ziehau 	driver_intr_t		*intr_func;
28679251f5eSSepherosa Ziehau 	void			*intr_hand;
28779251f5eSSepherosa Ziehau 	struct resource		*intr_res;
28879251f5eSSepherosa Ziehau 	void			*intr_funcarg;
28979251f5eSSepherosa Ziehau 	int			intr_rid;
29079251f5eSSepherosa Ziehau 	int			intr_cpuid;
29179251f5eSSepherosa Ziehau 	int			intr_rate;
29279251f5eSSepherosa Ziehau 	int			intr_use;
29379251f5eSSepherosa Ziehau #define IX_INTR_USE_RXTX	0
29479251f5eSSepherosa Ziehau #define IX_INTR_USE_STATUS	1
29579251f5eSSepherosa Ziehau #define IX_INTR_USE_RX		2
29679251f5eSSepherosa Ziehau #define IX_INTR_USE_TX		3
29779251f5eSSepherosa Ziehau 	const char		*intr_desc;
29879251f5eSSepherosa Ziehau 	char			intr_desc0[64];
29979251f5eSSepherosa Ziehau };
30079251f5eSSepherosa Ziehau 
30179251f5eSSepherosa Ziehau struct ix_softc {
30279251f5eSSepherosa Ziehau 	struct arpcom		arpcom;
30379251f5eSSepherosa Ziehau 
30479251f5eSSepherosa Ziehau 	struct ixgbe_hw		hw;
30579251f5eSSepherosa Ziehau 	struct ixgbe_osdep	osdep;
30679251f5eSSepherosa Ziehau 
30779251f5eSSepherosa Ziehau 	struct lwkt_serialize	main_serialize;
30879251f5eSSepherosa Ziehau 	uint32_t		intr_mask;
30979251f5eSSepherosa Ziehau 
31079251f5eSSepherosa Ziehau 	boolean_t		link_active;
31179251f5eSSepherosa Ziehau 
31279251f5eSSepherosa Ziehau 	int			rx_ring_inuse;
313189a0ff3SSepherosa Ziehau 	int			tx_ring_inuse;
314189a0ff3SSepherosa Ziehau 
31579251f5eSSepherosa Ziehau 	struct ix_rx_ring	*rx_rings;
316189a0ff3SSepherosa Ziehau 	struct ix_tx_ring	*tx_rings;
31779251f5eSSepherosa Ziehau 
31879251f5eSSepherosa Ziehau 	struct callout		timer;
31979251f5eSSepherosa Ziehau 	int			timer_cpuid;
32079251f5eSSepherosa Ziehau 
32163d483cdSSepherosa Ziehau 	int			ifm_media;	/* IFM_ */
32279251f5eSSepherosa Ziehau 	uint32_t		link_speed;
32379251f5eSSepherosa Ziehau 	bool			link_up;
32479251f5eSSepherosa Ziehau 	boolean_t		sfp_probe;	/* plyggable optics */
32579251f5eSSepherosa Ziehau 
32679251f5eSSepherosa Ziehau 	struct ixgbe_hw_stats 	stats;
32779251f5eSSepherosa Ziehau 
328189a0ff3SSepherosa Ziehau 	int			rx_ring_cnt;
329189a0ff3SSepherosa Ziehau 	int			rx_ring_msix;
330189a0ff3SSepherosa Ziehau 
331189a0ff3SSepherosa Ziehau 	int			tx_ring_cnt;
332189a0ff3SSepherosa Ziehau 	int			tx_ring_msix;
333189a0ff3SSepherosa Ziehau 
33479251f5eSSepherosa Ziehau 	int			intr_type;
33579251f5eSSepherosa Ziehau 	int			intr_cnt;
33679251f5eSSepherosa Ziehau 	struct ix_intr_data	*intr_data;
33779251f5eSSepherosa Ziehau 
33879251f5eSSepherosa Ziehau 	device_t		dev;
33979251f5eSSepherosa Ziehau 	bus_dma_tag_t		parent_tag;
34079251f5eSSepherosa Ziehau 	struct ifmedia		media;
34179251f5eSSepherosa Ziehau 
34279251f5eSSepherosa Ziehau 	struct resource		*mem_res;
34379251f5eSSepherosa Ziehau 	int			mem_rid;
34479251f5eSSepherosa Ziehau 
345189a0ff3SSepherosa Ziehau 	struct resource 	*msix_mem_res;
346189a0ff3SSepherosa Ziehau 	int			msix_mem_rid;
347189a0ff3SSepherosa Ziehau 
34879251f5eSSepherosa Ziehau 	int			nserialize;
34979251f5eSSepherosa Ziehau 	struct lwkt_serialize	**serializes;
35079251f5eSSepherosa Ziehau 
35179251f5eSSepherosa Ziehau 	uint8_t			*mta;		/* Multicast array memory */
35279251f5eSSepherosa Ziehau 
35379251f5eSSepherosa Ziehau 	int			if_flags;
35479251f5eSSepherosa Ziehau 	int			advspeed;	/* advertised link speeds */
35563d483cdSSepherosa Ziehau 	uint32_t		wufc;		/* power management */
35663d483cdSSepherosa Ziehau 	uint16_t		dmac;		/* DMA coalescing */
35779251f5eSSepherosa Ziehau 	uint16_t		max_frame_size;
358189a0ff3SSepherosa Ziehau 	int16_t			sts_msix_vec;	/* status MSI-X vector */
35979251f5eSSepherosa Ziehau 
3603c37d13bSSepherosa Ziehau 	struct if_ringmap	*tx_rmap;
3613c37d13bSSepherosa Ziehau 	struct if_ringmap	*tx_rmap_intr;
3623c37d13bSSepherosa Ziehau 	struct if_ringmap	*rx_rmap;
3633c37d13bSSepherosa Ziehau 	struct if_ringmap	*rx_rmap_intr;
3643c37d13bSSepherosa Ziehau 
3653c37d13bSSepherosa Ziehau 	int			rdr_table[IX_RDRTABLE_SIZE];
3664a648aefSSepherosa Ziehau 
3678d0afa86SSepherosa Ziehau 	struct task		wdog_task;
3688d0afa86SSepherosa Ziehau 	int			direct_input;
36979251f5eSSepherosa Ziehau #ifdef IX_RSS_DEBUG
37079251f5eSSepherosa Ziehau 	int			rss_debug;
37179251f5eSSepherosa Ziehau #endif
37279251f5eSSepherosa Ziehau };
37379251f5eSSepherosa Ziehau 
37479251f5eSSepherosa Ziehau #define IX_ENABLE_HWRSS(sc)	((sc)->rx_ring_cnt > 1)
37579251f5eSSepherosa Ziehau #define IX_ENABLE_HWTSS(sc)	((sc)->tx_ring_cnt > 1)
37679251f5eSSepherosa Ziehau 
37779251f5eSSepherosa Ziehau #endif /* _IF_IX_H_ */
378