xref: /dflybsd-src/sys/dev/netif/ix/if_ix.h (revision dd5ce676d9b4496101d795200cb99fd0ddf5b254)
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 
1976150453fSSepherosa Ziehau struct ix_mc_addr {
1986150453fSSepherosa Ziehau 	uint8_t		addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
1996150453fSSepherosa Ziehau 	uint32_t	vmdq;
2006150453fSSepherosa Ziehau };
2016150453fSSepherosa Ziehau 
20279251f5eSSepherosa Ziehau struct ix_tx_buf {
20379251f5eSSepherosa Ziehau 	struct mbuf	*m_head;
20479251f5eSSepherosa Ziehau 	bus_dmamap_t	map;
20579251f5eSSepherosa Ziehau };
20679251f5eSSepherosa Ziehau 
20779251f5eSSepherosa Ziehau struct ix_rx_buf {
20879251f5eSSepherosa Ziehau 	struct mbuf	*m_head;
20979251f5eSSepherosa Ziehau 	struct mbuf	*fmp;
21079251f5eSSepherosa Ziehau 	struct mbuf	*lmp;
21179251f5eSSepherosa Ziehau 	bus_dmamap_t	map;
21279251f5eSSepherosa Ziehau 	bus_addr_t	paddr;
21379251f5eSSepherosa Ziehau 	u_int		flags;
21479251f5eSSepherosa Ziehau #define IX_RX_COPY	0x1
21579251f5eSSepherosa Ziehau };
21679251f5eSSepherosa Ziehau 
21779251f5eSSepherosa Ziehau struct ix_softc;
21879251f5eSSepherosa Ziehau 
21979251f5eSSepherosa Ziehau struct ix_tx_ring {
22079251f5eSSepherosa Ziehau 	struct lwkt_serialize	tx_serialize;
22179251f5eSSepherosa Ziehau 	struct ifaltq_subque	*tx_ifsq;
22279251f5eSSepherosa Ziehau 	struct ix_softc		*tx_sc;
22379251f5eSSepherosa Ziehau 	volatile uint32_t	*tx_hdr;
22479251f5eSSepherosa Ziehau 	union ixgbe_adv_tx_desc	*tx_base;
22579251f5eSSepherosa Ziehau 	struct ix_tx_buf	*tx_buf;
22679251f5eSSepherosa Ziehau 	bus_dma_tag_t		tx_tag;
22782db96e9SSepherosa Ziehau 	int8_t			tx_running;
22882db96e9SSepherosa Ziehau #define IX_TX_RUNNING		100
22982db96e9SSepherosa Ziehau #define IX_TX_RUNNING_DEC	25
23082db96e9SSepherosa Ziehau 	uint8_t			tx_flags;
2314a648aefSSepherosa Ziehau #define IX_TXFLAG_ENABLED	0x1
23282db96e9SSepherosa Ziehau 	uint16_t		tx_nmbuf;
23379251f5eSSepherosa Ziehau 	uint32_t		tx_idx;
23479251f5eSSepherosa Ziehau 	uint16_t		tx_avail;
23579251f5eSSepherosa Ziehau 	uint16_t		tx_next_avail;
23679251f5eSSepherosa Ziehau 	uint16_t		tx_next_clean;
23779251f5eSSepherosa Ziehau 	uint16_t		tx_ndesc;
23879251f5eSSepherosa Ziehau 	uint16_t		tx_wreg_nsegs;
23979251f5eSSepherosa Ziehau 	uint16_t		tx_intr_nsegs;
24079251f5eSSepherosa Ziehau 	uint16_t		tx_nsegs;
24179251f5eSSepherosa Ziehau 	int16_t			tx_intr_vec;
24279251f5eSSepherosa Ziehau 	int			tx_intr_cpuid;
243189a0ff3SSepherosa Ziehau 	uint32_t		tx_eims;
244189a0ff3SSepherosa Ziehau 	uint32_t		tx_eims_val;
24579251f5eSSepherosa Ziehau 	struct ifsubq_watchdog	tx_watchdog;
24682db96e9SSepherosa Ziehau 	struct callout		tx_gc_timer;
24782db96e9SSepherosa Ziehau 
24882db96e9SSepherosa Ziehau 	u_long			tx_gc;
24979251f5eSSepherosa Ziehau 
25079251f5eSSepherosa Ziehau 	bus_dma_tag_t		tx_base_dtag;
25179251f5eSSepherosa Ziehau 	bus_dmamap_t		tx_base_map;
25279251f5eSSepherosa Ziehau 	bus_addr_t		tx_base_paddr;
25379251f5eSSepherosa Ziehau 
25479251f5eSSepherosa Ziehau 	bus_dma_tag_t		tx_hdr_dtag;
25579251f5eSSepherosa Ziehau 	bus_dmamap_t		tx_hdr_map;
25679251f5eSSepherosa Ziehau 	bus_addr_t		tx_hdr_paddr;
25779251f5eSSepherosa Ziehau } __cachealign;
25879251f5eSSepherosa Ziehau 
25979251f5eSSepherosa Ziehau struct ix_rx_ring {
26079251f5eSSepherosa Ziehau 	struct lwkt_serialize	rx_serialize;
26179251f5eSSepherosa Ziehau 	struct ix_softc		*rx_sc;
26279251f5eSSepherosa Ziehau 	union ixgbe_adv_rx_desc	*rx_base;
26379251f5eSSepherosa Ziehau 	struct ix_rx_buf	*rx_buf;
26479251f5eSSepherosa Ziehau 	bus_dma_tag_t		rx_tag;
26579251f5eSSepherosa Ziehau 	bus_dmamap_t		rx_sparemap;
26679251f5eSSepherosa Ziehau 	uint32_t		rx_idx;
26779251f5eSSepherosa Ziehau 	uint16_t		rx_flags;
26879251f5eSSepherosa Ziehau #define IX_RXRING_FLAG_LRO	0x01
26979251f5eSSepherosa Ziehau #define IX_RXRING_FLAG_DISC	0x02
27079251f5eSSepherosa Ziehau 	uint16_t 		rx_next_check;
27179251f5eSSepherosa Ziehau 	uint16_t		rx_ndesc;
27279251f5eSSepherosa Ziehau 	uint16_t		rx_mbuf_sz;
27379251f5eSSepherosa Ziehau 	uint16_t		rx_wreg_nsegs;
27479251f5eSSepherosa Ziehau 	int16_t			rx_intr_vec;
275189a0ff3SSepherosa Ziehau 	uint32_t		rx_eims;
276189a0ff3SSepherosa Ziehau 	uint32_t		rx_eims_val;
277189a0ff3SSepherosa Ziehau 	struct ix_tx_ring	*rx_txr;	/* piggybacked TX ring */
27879251f5eSSepherosa Ziehau 
27979251f5eSSepherosa Ziehau #ifdef IX_RSS_DEBUG
28079251f5eSSepherosa Ziehau 	u_long			rx_pkts;
28179251f5eSSepherosa Ziehau #endif
28279251f5eSSepherosa Ziehau 
28379251f5eSSepherosa Ziehau 	bus_dma_tag_t		rx_base_dtag;
28479251f5eSSepherosa Ziehau 	bus_dmamap_t		rx_base_map;
28579251f5eSSepherosa Ziehau 	bus_addr_t		rx_base_paddr;
28679251f5eSSepherosa Ziehau } __cachealign;
28779251f5eSSepherosa Ziehau 
28879251f5eSSepherosa Ziehau struct ix_intr_data {
28979251f5eSSepherosa Ziehau 	struct lwkt_serialize	*intr_serialize;
29079251f5eSSepherosa Ziehau 	driver_intr_t		*intr_func;
29179251f5eSSepherosa Ziehau 	void			*intr_hand;
29279251f5eSSepherosa Ziehau 	struct resource		*intr_res;
29379251f5eSSepherosa Ziehau 	void			*intr_funcarg;
29479251f5eSSepherosa Ziehau 	int			intr_rid;
29579251f5eSSepherosa Ziehau 	int			intr_cpuid;
29679251f5eSSepherosa Ziehau 	int			intr_rate;
29779251f5eSSepherosa Ziehau 	int			intr_use;
29879251f5eSSepherosa Ziehau #define IX_INTR_USE_RXTX	0
29979251f5eSSepherosa Ziehau #define IX_INTR_USE_STATUS	1
30079251f5eSSepherosa Ziehau #define IX_INTR_USE_RX		2
30179251f5eSSepherosa Ziehau #define IX_INTR_USE_TX		3
30279251f5eSSepherosa Ziehau 	const char		*intr_desc;
30379251f5eSSepherosa Ziehau 	char			intr_desc0[64];
30479251f5eSSepherosa Ziehau };
30579251f5eSSepherosa Ziehau 
30679251f5eSSepherosa Ziehau struct ix_softc {
30779251f5eSSepherosa Ziehau 	struct arpcom		arpcom;
30879251f5eSSepherosa Ziehau 
30979251f5eSSepherosa Ziehau 	struct ixgbe_hw		hw;
31079251f5eSSepherosa Ziehau 	struct ixgbe_osdep	osdep;
31179251f5eSSepherosa Ziehau 
31279251f5eSSepherosa Ziehau 	struct lwkt_serialize	main_serialize;
31379251f5eSSepherosa Ziehau 	uint32_t		intr_mask;
31479251f5eSSepherosa Ziehau 
31579251f5eSSepherosa Ziehau 	boolean_t		link_active;
31679251f5eSSepherosa Ziehau 
31779251f5eSSepherosa Ziehau 	int			rx_ring_inuse;
318189a0ff3SSepherosa Ziehau 	int			tx_ring_inuse;
319189a0ff3SSepherosa Ziehau 
32079251f5eSSepherosa Ziehau 	struct ix_rx_ring	*rx_rings;
321189a0ff3SSepherosa Ziehau 	struct ix_tx_ring	*tx_rings;
32279251f5eSSepherosa Ziehau 
32379251f5eSSepherosa Ziehau 	struct callout		timer;
32479251f5eSSepherosa Ziehau 	int			timer_cpuid;
32579251f5eSSepherosa Ziehau 
32663d483cdSSepherosa Ziehau 	int			ifm_media;	/* IFM_ */
32779251f5eSSepherosa Ziehau 	uint32_t		link_speed;
32879251f5eSSepherosa Ziehau 	bool			link_up;
329*dd5ce676SSepherosa Ziehau 	boolean_t		sfp_probe;	/* pluggable optics */
3306150453fSSepherosa Ziehau 	uint32_t		phy_layer;
3316150453fSSepherosa Ziehau 
332*dd5ce676SSepherosa Ziehau 	uint16_t		caps;		/* IX_CAP_ */
3336150453fSSepherosa Ziehau #define IX_CAP_DETECT_FANFAIL	0x0001
3346150453fSSepherosa Ziehau #define IX_CAP_TEMP_SENSOR	0x0002
3356150453fSSepherosa Ziehau #define IX_CAP_EEE		0x0004
3366150453fSSepherosa Ziehau #define IX_CAP_LEGACY_INTR	0x0008
337*dd5ce676SSepherosa Ziehau #define IX_CAP_FW_RECOVERY	0x0010
338*dd5ce676SSepherosa Ziehau 
339*dd5ce676SSepherosa Ziehau 	uint16_t		flags;		/* IX_FLAG_ */
340*dd5ce676SSepherosa Ziehau #define IX_FLAG_FW_RECOVERY	0x0001
341*dd5ce676SSepherosa Ziehau 
342*dd5ce676SSepherosa Ziehau 	struct callout		fw_timer;
34379251f5eSSepherosa Ziehau 
34479251f5eSSepherosa Ziehau 	struct ixgbe_hw_stats 	stats;
34579251f5eSSepherosa Ziehau 
346189a0ff3SSepherosa Ziehau 	int			rx_ring_cnt;
347189a0ff3SSepherosa Ziehau 	int			rx_ring_msix;
348189a0ff3SSepherosa Ziehau 
349189a0ff3SSepherosa Ziehau 	int			tx_ring_cnt;
350189a0ff3SSepherosa Ziehau 	int			tx_ring_msix;
351189a0ff3SSepherosa Ziehau 
35279251f5eSSepherosa Ziehau 	int			intr_type;
35379251f5eSSepherosa Ziehau 	int			intr_cnt;
35479251f5eSSepherosa Ziehau 	struct ix_intr_data	*intr_data;
35579251f5eSSepherosa Ziehau 
35679251f5eSSepherosa Ziehau 	device_t		dev;
35779251f5eSSepherosa Ziehau 	bus_dma_tag_t		parent_tag;
35879251f5eSSepherosa Ziehau 	struct ifmedia		media;
35979251f5eSSepherosa Ziehau 
36079251f5eSSepherosa Ziehau 	struct resource		*mem_res;
36179251f5eSSepherosa Ziehau 	int			mem_rid;
36279251f5eSSepherosa Ziehau 
363189a0ff3SSepherosa Ziehau 	struct resource 	*msix_mem_res;
364189a0ff3SSepherosa Ziehau 	int			msix_mem_rid;
365189a0ff3SSepherosa Ziehau 
36679251f5eSSepherosa Ziehau 	int			nserialize;
36779251f5eSSepherosa Ziehau 	struct lwkt_serialize	**serializes;
36879251f5eSSepherosa Ziehau 
3696150453fSSepherosa Ziehau 	struct ix_mc_addr	*mta;		/* Multicast array memory */
37079251f5eSSepherosa Ziehau 
37179251f5eSSepherosa Ziehau 	int			if_flags;
37279251f5eSSepherosa Ziehau 	int			advspeed;	/* advertised link speeds */
37363d483cdSSepherosa Ziehau 	uint32_t		wufc;		/* power management */
37463d483cdSSepherosa Ziehau 	uint16_t		dmac;		/* DMA coalescing */
37579251f5eSSepherosa Ziehau 	uint16_t		max_frame_size;
376189a0ff3SSepherosa Ziehau 	int16_t			sts_msix_vec;	/* status MSI-X vector */
37779251f5eSSepherosa Ziehau 
3783c37d13bSSepherosa Ziehau 	struct if_ringmap	*tx_rmap;
3793c37d13bSSepherosa Ziehau 	struct if_ringmap	*tx_rmap_intr;
3803c37d13bSSepherosa Ziehau 	struct if_ringmap	*rx_rmap;
3813c37d13bSSepherosa Ziehau 	struct if_ringmap	*rx_rmap_intr;
3823c37d13bSSepherosa Ziehau 
3833c37d13bSSepherosa Ziehau 	int			rdr_table[IX_RDRTABLE_SIZE];
3844a648aefSSepherosa Ziehau 
3858d0afa86SSepherosa Ziehau 	struct task		wdog_task;
3868d0afa86SSepherosa Ziehau 	int			direct_input;
38779251f5eSSepherosa Ziehau #ifdef IX_RSS_DEBUG
38879251f5eSSepherosa Ziehau 	int			rss_debug;
38979251f5eSSepherosa Ziehau #endif
39079251f5eSSepherosa Ziehau };
39179251f5eSSepherosa Ziehau 
39279251f5eSSepherosa Ziehau #define IX_ENABLE_HWRSS(sc)	((sc)->rx_ring_cnt > 1)
39379251f5eSSepherosa Ziehau #define IX_ENABLE_HWTSS(sc)	((sc)->tx_ring_cnt > 1)
39479251f5eSSepherosa Ziehau 
39579251f5eSSepherosa Ziehau #endif /* _IF_IX_H_ */
396