xref: /openbmc/linux/drivers/net/ethernet/intel/ixgbe/ixgbe.h (revision 8e2813f59e2036aac12fe7b23eda95406b14a83f)
1dee1ad47SJeff Kirsher /*******************************************************************************
2dee1ad47SJeff Kirsher 
3dee1ad47SJeff Kirsher   Intel 10 Gigabit PCI Express Linux driver
494971820SDon Skidmore   Copyright(c) 1999 - 2012 Intel Corporation.
5dee1ad47SJeff Kirsher 
6dee1ad47SJeff Kirsher   This program is free software; you can redistribute it and/or modify it
7dee1ad47SJeff Kirsher   under the terms and conditions of the GNU General Public License,
8dee1ad47SJeff Kirsher   version 2, as published by the Free Software Foundation.
9dee1ad47SJeff Kirsher 
10dee1ad47SJeff Kirsher   This program is distributed in the hope it will be useful, but WITHOUT
11dee1ad47SJeff Kirsher   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12dee1ad47SJeff Kirsher   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13dee1ad47SJeff Kirsher   more details.
14dee1ad47SJeff Kirsher 
15dee1ad47SJeff Kirsher   You should have received a copy of the GNU General Public License along with
16dee1ad47SJeff Kirsher   this program; if not, write to the Free Software Foundation, Inc.,
17dee1ad47SJeff Kirsher   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18dee1ad47SJeff Kirsher 
19dee1ad47SJeff Kirsher   The full GNU General Public License is included in this distribution in
20dee1ad47SJeff Kirsher   the file called "COPYING".
21dee1ad47SJeff Kirsher 
22dee1ad47SJeff Kirsher   Contact Information:
23dee1ad47SJeff Kirsher   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24dee1ad47SJeff Kirsher   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25dee1ad47SJeff Kirsher 
26dee1ad47SJeff Kirsher *******************************************************************************/
27dee1ad47SJeff Kirsher 
28dee1ad47SJeff Kirsher #ifndef _IXGBE_H_
29dee1ad47SJeff Kirsher #define _IXGBE_H_
30dee1ad47SJeff Kirsher 
31dee1ad47SJeff Kirsher #include <linux/bitops.h>
32dee1ad47SJeff Kirsher #include <linux/types.h>
33dee1ad47SJeff Kirsher #include <linux/pci.h>
34dee1ad47SJeff Kirsher #include <linux/netdevice.h>
35dee1ad47SJeff Kirsher #include <linux/cpumask.h>
36dee1ad47SJeff Kirsher #include <linux/aer.h>
37dee1ad47SJeff Kirsher #include <linux/if_vlan.h>
38dee1ad47SJeff Kirsher 
39dee1ad47SJeff Kirsher #include "ixgbe_type.h"
40dee1ad47SJeff Kirsher #include "ixgbe_common.h"
41dee1ad47SJeff Kirsher #include "ixgbe_dcb.h"
42dee1ad47SJeff Kirsher #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
43dee1ad47SJeff Kirsher #define IXGBE_FCOE
44dee1ad47SJeff Kirsher #include "ixgbe_fcoe.h"
45dee1ad47SJeff Kirsher #endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */
46dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCA
47dee1ad47SJeff Kirsher #include <linux/dca.h>
48dee1ad47SJeff Kirsher #endif
49dee1ad47SJeff Kirsher 
50dee1ad47SJeff Kirsher /* common prefix used by pr_<> macros */
51dee1ad47SJeff Kirsher #undef pr_fmt
52dee1ad47SJeff Kirsher #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
53dee1ad47SJeff Kirsher 
54dee1ad47SJeff Kirsher /* TX/RX descriptor defines */
55dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_TXD		    512
5659224555SAlexander Duyck #define IXGBE_DEFAULT_TX_WORK		    256
57dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD			   4096
58dee1ad47SJeff Kirsher #define IXGBE_MIN_TXD			     64
59dee1ad47SJeff Kirsher 
60dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_RXD		    512
61dee1ad47SJeff Kirsher #define IXGBE_MAX_RXD			   4096
62dee1ad47SJeff Kirsher #define IXGBE_MIN_RXD			     64
63dee1ad47SJeff Kirsher 
64dee1ad47SJeff Kirsher /* flow control */
65dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTL			   0x40
66dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTL			0x7FF80
67dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTH			  0x600
68dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTH			0x7FFF0
69dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_FCPAUSE		 0xFFFF
70dee1ad47SJeff Kirsher #define IXGBE_MIN_FCPAUSE		      0
71dee1ad47SJeff Kirsher #define IXGBE_MAX_FCPAUSE		 0xFFFF
72dee1ad47SJeff Kirsher 
73dee1ad47SJeff Kirsher /* Supported Rx Buffer Sizes */
74dee1ad47SJeff Kirsher #define IXGBE_RXBUFFER_512   512    /* Used for packet split */
75dee1ad47SJeff Kirsher #define IXGBE_MAX_RXBUFFER  16384  /* largest size for a single descriptor */
76dee1ad47SJeff Kirsher 
77dee1ad47SJeff Kirsher /*
78dee1ad47SJeff Kirsher  * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN mans we
79dee1ad47SJeff Kirsher  * reserve 2 more, and skb_shared_info adds an additional 384 bytes more,
80dee1ad47SJeff Kirsher  * this adds up to 512 bytes of extra data meaning the smallest allocation
81dee1ad47SJeff Kirsher  * we could have is 1K.
82dee1ad47SJeff Kirsher  * i.e. RXBUFFER_512 --> size-1024 slab
83dee1ad47SJeff Kirsher  */
84dee1ad47SJeff Kirsher #define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_512
85dee1ad47SJeff Kirsher 
86dee1ad47SJeff Kirsher #define MAXIMUM_ETHERNET_VLAN_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
87dee1ad47SJeff Kirsher 
88dee1ad47SJeff Kirsher /* How many Rx Buffers do we bundle into one write to the hardware ? */
89dee1ad47SJeff Kirsher #define IXGBE_RX_BUFFER_WRITE	16	/* Must be power of 2 */
90dee1ad47SJeff Kirsher 
91dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_CSUM		(u32)(1)
9266f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_HW_VLAN		(u32)(1 << 1)
9366f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_SW_VLAN		(u32)(1 << 2)
9466f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_TSO		(u32)(1 << 3)
9566f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_IPV4		(u32)(1 << 4)
9666f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_FCOE		(u32)(1 << 5)
9766f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_FSO		(u32)(1 << 6)
987f9643fdSAlexander Duyck #define IXGBE_TX_FLAGS_TXSW		(u32)(1 << 7)
99dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_MASK	0xffff0000
10066f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK	0xe0000000
10166f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT  29
102dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_SHIFT	16
103dee1ad47SJeff Kirsher 
104dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_MC_ENTRIES         30
105dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_FUNCTIONS          64
106dee1ad47SJeff Kirsher #define IXGBE_MAX_VFTA_ENTRIES          128
107dee1ad47SJeff Kirsher #define MAX_EMULATION_MAC_ADDRS         16
108dee1ad47SJeff Kirsher #define IXGBE_MAX_PF_MACVLANS           15
109dee1ad47SJeff Kirsher #define VMDQ_P(p)   ((p) + adapter->num_vfs)
11083c61fa9SGreg Rose #define IXGBE_82599_VF_DEVICE_ID        0x10ED
11183c61fa9SGreg Rose #define IXGBE_X540_VF_DEVICE_ID         0x1515
112dee1ad47SJeff Kirsher 
113dee1ad47SJeff Kirsher struct vf_data_storage {
114dee1ad47SJeff Kirsher 	unsigned char vf_mac_addresses[ETH_ALEN];
115dee1ad47SJeff Kirsher 	u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES];
116dee1ad47SJeff Kirsher 	u16 num_vf_mc_hashes;
117dee1ad47SJeff Kirsher 	u16 default_vf_vlan_id;
118dee1ad47SJeff Kirsher 	u16 vlans_enabled;
119dee1ad47SJeff Kirsher 	bool clear_to_send;
120dee1ad47SJeff Kirsher 	bool pf_set_mac;
121dee1ad47SJeff Kirsher 	u16 pf_vlan; /* When set, guest VLAN config not allowed. */
122dee1ad47SJeff Kirsher 	u16 pf_qos;
123dee1ad47SJeff Kirsher 	u16 tx_rate;
124de4c7f65SGreg Rose 	u16 vlan_count;
125de4c7f65SGreg Rose 	u8 spoofchk_enabled;
126c6bda30aSGreg Rose 	struct pci_dev *vfdev;
127dee1ad47SJeff Kirsher };
128dee1ad47SJeff Kirsher 
129dee1ad47SJeff Kirsher struct vf_macvlans {
130dee1ad47SJeff Kirsher 	struct list_head l;
131dee1ad47SJeff Kirsher 	int vf;
132dee1ad47SJeff Kirsher 	int rar_entry;
133dee1ad47SJeff Kirsher 	bool free;
134dee1ad47SJeff Kirsher 	bool is_macvlan;
135dee1ad47SJeff Kirsher 	u8 vf_macvlan[ETH_ALEN];
136dee1ad47SJeff Kirsher };
137dee1ad47SJeff Kirsher 
138dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD_PWR	14
139dee1ad47SJeff Kirsher #define IXGBE_MAX_DATA_PER_TXD	(1 << IXGBE_MAX_TXD_PWR)
140dee1ad47SJeff Kirsher 
141dee1ad47SJeff Kirsher /* Tx Descriptors needed, worst case */
142dee1ad47SJeff Kirsher #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD)
143dee1ad47SJeff Kirsher #define DESC_NEEDED ((MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE)) + 4)
144dee1ad47SJeff Kirsher 
145dee1ad47SJeff Kirsher /* wrapper around a pointer to a socket buffer,
146dee1ad47SJeff Kirsher  * so a DMA handle can be stored along with the buffer */
147dee1ad47SJeff Kirsher struct ixgbe_tx_buffer {
148d3d00239SAlexander Duyck 	union ixgbe_adv_tx_desc *next_to_watch;
149dee1ad47SJeff Kirsher 	unsigned long time_stamp;
150d3d00239SAlexander Duyck 	struct sk_buff *skb;
151fd0db0edSAlexander Duyck 	unsigned int bytecount;
152fd0db0edSAlexander Duyck 	unsigned short gso_segs;
153244e27adSAlexander Duyck 	__be16 protocol;
154729739b7SAlexander Duyck 	DEFINE_DMA_UNMAP_ADDR(dma);
155729739b7SAlexander Duyck 	DEFINE_DMA_UNMAP_LEN(len);
156fd0db0edSAlexander Duyck 	u32 tx_flags;
157dee1ad47SJeff Kirsher };
158dee1ad47SJeff Kirsher 
159dee1ad47SJeff Kirsher struct ixgbe_rx_buffer {
160dee1ad47SJeff Kirsher 	struct sk_buff *skb;
161dee1ad47SJeff Kirsher 	dma_addr_t dma;
162dee1ad47SJeff Kirsher 	struct page *page;
163dee1ad47SJeff Kirsher 	unsigned int page_offset;
164dee1ad47SJeff Kirsher };
165dee1ad47SJeff Kirsher 
166dee1ad47SJeff Kirsher struct ixgbe_queue_stats {
167dee1ad47SJeff Kirsher 	u64 packets;
168dee1ad47SJeff Kirsher 	u64 bytes;
169dee1ad47SJeff Kirsher };
170dee1ad47SJeff Kirsher 
171dee1ad47SJeff Kirsher struct ixgbe_tx_queue_stats {
172dee1ad47SJeff Kirsher 	u64 restart_queue;
173dee1ad47SJeff Kirsher 	u64 tx_busy;
174dee1ad47SJeff Kirsher 	u64 tx_done_old;
175dee1ad47SJeff Kirsher };
176dee1ad47SJeff Kirsher 
177dee1ad47SJeff Kirsher struct ixgbe_rx_queue_stats {
178dee1ad47SJeff Kirsher 	u64 rsc_count;
179dee1ad47SJeff Kirsher 	u64 rsc_flush;
180dee1ad47SJeff Kirsher 	u64 non_eop_descs;
181dee1ad47SJeff Kirsher 	u64 alloc_rx_page_failed;
182dee1ad47SJeff Kirsher 	u64 alloc_rx_buff_failed;
1838a0da21bSAlexander Duyck 	u64 csum_err;
184dee1ad47SJeff Kirsher };
185dee1ad47SJeff Kirsher 
186f800326dSAlexander Duyck enum ixgbe_ring_state_t {
187dee1ad47SJeff Kirsher 	__IXGBE_TX_FDIR_INIT_DONE,
188dee1ad47SJeff Kirsher 	__IXGBE_TX_DETECT_HANG,
189dee1ad47SJeff Kirsher 	__IXGBE_HANG_CHECK_ARMED,
190dee1ad47SJeff Kirsher 	__IXGBE_RX_RSC_ENABLED,
1918a0da21bSAlexander Duyck 	__IXGBE_RX_CSUM_UDP_ZERO_ERR,
192f800326dSAlexander Duyck 	__IXGBE_RX_FCOE_BUFSZ,
193dee1ad47SJeff Kirsher };
194dee1ad47SJeff Kirsher 
195dee1ad47SJeff Kirsher #define check_for_tx_hang(ring) \
196dee1ad47SJeff Kirsher 	test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
197dee1ad47SJeff Kirsher #define set_check_for_tx_hang(ring) \
198dee1ad47SJeff Kirsher 	set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
199dee1ad47SJeff Kirsher #define clear_check_for_tx_hang(ring) \
200dee1ad47SJeff Kirsher 	clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
201dee1ad47SJeff Kirsher #define ring_is_rsc_enabled(ring) \
202dee1ad47SJeff Kirsher 	test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
203dee1ad47SJeff Kirsher #define set_ring_rsc_enabled(ring) \
204dee1ad47SJeff Kirsher 	set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
205dee1ad47SJeff Kirsher #define clear_ring_rsc_enabled(ring) \
206dee1ad47SJeff Kirsher 	clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
207dee1ad47SJeff Kirsher struct ixgbe_ring {
208efe3d3c8SAlexander Duyck 	struct ixgbe_ring *next;	/* pointer to next ring in q_vector */
209d3ee4294SAlexander Duyck 	struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */
210dee1ad47SJeff Kirsher 	struct net_device *netdev;	/* netdev ring belongs to */
211d3ee4294SAlexander Duyck 	struct device *dev;		/* device for DMA mapping */
212d3ee4294SAlexander Duyck 	void *desc;			/* descriptor ring memory */
213dee1ad47SJeff Kirsher 	union {
214dee1ad47SJeff Kirsher 		struct ixgbe_tx_buffer *tx_buffer_info;
215dee1ad47SJeff Kirsher 		struct ixgbe_rx_buffer *rx_buffer_info;
216dee1ad47SJeff Kirsher 	};
217dee1ad47SJeff Kirsher 	unsigned long state;
218dee1ad47SJeff Kirsher 	u8 __iomem *tail;
219d3ee4294SAlexander Duyck 	dma_addr_t dma;			/* phys. address of descriptor ring */
220d3ee4294SAlexander Duyck 	unsigned int size;		/* length in bytes */
221dee1ad47SJeff Kirsher 
222dee1ad47SJeff Kirsher 	u16 count;			/* amount of descriptors */
223dee1ad47SJeff Kirsher 
224dee1ad47SJeff Kirsher 	u8 queue_index; /* needed for multiqueue queue management */
225dee1ad47SJeff Kirsher 	u8 reg_idx;			/* holds the special value that gets
226dee1ad47SJeff Kirsher 					 * the hardware register offset
227dee1ad47SJeff Kirsher 					 * associated with this ring, which is
228dee1ad47SJeff Kirsher 					 * different for DCB and RSS modes
229dee1ad47SJeff Kirsher 					 */
230d3ee4294SAlexander Duyck 	u16 next_to_use;
231d3ee4294SAlexander Duyck 	u16 next_to_clean;
232d3ee4294SAlexander Duyck 
233f800326dSAlexander Duyck 	union {
234d3ee4294SAlexander Duyck 		u16 next_to_alloc;
235f800326dSAlexander Duyck 		struct {
236dee1ad47SJeff Kirsher 			u8 atr_sample_rate;
237dee1ad47SJeff Kirsher 			u8 atr_count;
238f800326dSAlexander Duyck 		};
239f800326dSAlexander Duyck 	};
240dee1ad47SJeff Kirsher 
241dee1ad47SJeff Kirsher 	u8 dcb_tc;
242dee1ad47SJeff Kirsher 	struct ixgbe_queue_stats stats;
243dee1ad47SJeff Kirsher 	struct u64_stats_sync syncp;
244dee1ad47SJeff Kirsher 	union {
245dee1ad47SJeff Kirsher 		struct ixgbe_tx_queue_stats tx_stats;
246dee1ad47SJeff Kirsher 		struct ixgbe_rx_queue_stats rx_stats;
247dee1ad47SJeff Kirsher 	};
248dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp;
249dee1ad47SJeff Kirsher 
250dee1ad47SJeff Kirsher enum ixgbe_ring_f_enum {
251dee1ad47SJeff Kirsher 	RING_F_NONE = 0,
252dee1ad47SJeff Kirsher 	RING_F_VMDQ,  /* SR-IOV uses the same ring feature */
253dee1ad47SJeff Kirsher 	RING_F_RSS,
254dee1ad47SJeff Kirsher 	RING_F_FDIR,
255dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
256dee1ad47SJeff Kirsher 	RING_F_FCOE,
257dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
258dee1ad47SJeff Kirsher 
259dee1ad47SJeff Kirsher 	RING_F_ARRAY_SIZE      /* must be last in enum set */
260dee1ad47SJeff Kirsher };
261dee1ad47SJeff Kirsher 
262dee1ad47SJeff Kirsher #define IXGBE_MAX_RSS_INDICES  16
263dee1ad47SJeff Kirsher #define IXGBE_MAX_VMDQ_INDICES 64
264dee1ad47SJeff Kirsher #define IXGBE_MAX_FDIR_INDICES 64
265dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
266dee1ad47SJeff Kirsher #define IXGBE_MAX_FCOE_INDICES  8
267dee1ad47SJeff Kirsher #define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES)
268dee1ad47SJeff Kirsher #define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES)
269dee1ad47SJeff Kirsher #else
270dee1ad47SJeff Kirsher #define MAX_RX_QUEUES IXGBE_MAX_FDIR_INDICES
271dee1ad47SJeff Kirsher #define MAX_TX_QUEUES IXGBE_MAX_FDIR_INDICES
272dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
273dee1ad47SJeff Kirsher struct ixgbe_ring_feature {
274dee1ad47SJeff Kirsher 	int indices;
275dee1ad47SJeff Kirsher 	int mask;
276dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp;
277dee1ad47SJeff Kirsher 
278f800326dSAlexander Duyck /*
279f800326dSAlexander Duyck  * FCoE requires that all Rx buffers be over 2200 bytes in length.  Since
280f800326dSAlexander Duyck  * this is twice the size of a half page we need to double the page order
281f800326dSAlexander Duyck  * for FCoE enabled Rx queues.
282f800326dSAlexander Duyck  */
283f800326dSAlexander Duyck #if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192)
284f800326dSAlexander Duyck static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
285f800326dSAlexander Duyck {
286f800326dSAlexander Duyck 	return test_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state) ? 1 : 0;
287f800326dSAlexander Duyck }
288f800326dSAlexander Duyck #else
289f800326dSAlexander Duyck #define ixgbe_rx_pg_order(_ring) 0
290f800326dSAlexander Duyck #endif
291f800326dSAlexander Duyck #define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring))
292f800326dSAlexander Duyck #define ixgbe_rx_bufsz(_ring) ((PAGE_SIZE / 2) << ixgbe_rx_pg_order(_ring))
293f800326dSAlexander Duyck 
294dee1ad47SJeff Kirsher struct ixgbe_ring_container {
295efe3d3c8SAlexander Duyck 	struct ixgbe_ring *ring;	/* pointer to linked list of rings */
296dee1ad47SJeff Kirsher 	unsigned int total_bytes;	/* total bytes processed this int */
297dee1ad47SJeff Kirsher 	unsigned int total_packets;	/* total packets processed this int */
298dee1ad47SJeff Kirsher 	u16 work_limit;			/* total work allowed per interrupt */
299dee1ad47SJeff Kirsher 	u8 count;			/* total number of rings in vector */
300dee1ad47SJeff Kirsher 	u8 itr;				/* current ITR setting for ring */
301dee1ad47SJeff Kirsher };
302dee1ad47SJeff Kirsher 
303a557928eSAlexander Duyck /* iterator for handling rings in ring container */
304a557928eSAlexander Duyck #define ixgbe_for_each_ring(pos, head) \
305a557928eSAlexander Duyck 	for (pos = (head).ring; pos != NULL; pos = pos->next)
306a557928eSAlexander Duyck 
307dee1ad47SJeff Kirsher #define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \
308dee1ad47SJeff Kirsher                               ? 8 : 1)
309dee1ad47SJeff Kirsher #define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS
310dee1ad47SJeff Kirsher 
311dee1ad47SJeff Kirsher /* MAX_MSIX_Q_VECTORS of these are allocated,
312dee1ad47SJeff Kirsher  * but we only use one per queue-specific vector.
313dee1ad47SJeff Kirsher  */
314dee1ad47SJeff Kirsher struct ixgbe_q_vector {
315dee1ad47SJeff Kirsher 	struct ixgbe_adapter *adapter;
316dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCA
317dee1ad47SJeff Kirsher 	int cpu;	    /* CPU for DCA */
318dee1ad47SJeff Kirsher #endif
319d5bf4f67SEmil Tantilov 	u16 v_idx;		/* index of q_vector within array, also used for
320d5bf4f67SEmil Tantilov 				 * finding the bit in EICR and friends that
321d5bf4f67SEmil Tantilov 				 * represents the vector for this ring */
322d5bf4f67SEmil Tantilov 	u16 itr;		/* Interrupt throttle rate written to EITR */
323dee1ad47SJeff Kirsher 	struct ixgbe_ring_container rx, tx;
324d5bf4f67SEmil Tantilov 
325d5bf4f67SEmil Tantilov 	struct napi_struct napi;
326de88eeebSAlexander Duyck 	cpumask_t affinity_mask;
327de88eeebSAlexander Duyck 	int numa_node;
328de88eeebSAlexander Duyck 	struct rcu_head rcu;	/* to avoid race with update stats on free */
329dee1ad47SJeff Kirsher 	char name[IFNAMSIZ + 9];
330de88eeebSAlexander Duyck 
331de88eeebSAlexander Duyck 	/* for dynamic allocation of rings associated with this q_vector */
332de88eeebSAlexander Duyck 	struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp;
333dee1ad47SJeff Kirsher };
334dee1ad47SJeff Kirsher 
335d5bf4f67SEmil Tantilov /*
336d5bf4f67SEmil Tantilov  * microsecond values for various ITR rates shifted by 2 to fit itr register
337d5bf4f67SEmil Tantilov  * with the first 3 bits reserved 0
338dee1ad47SJeff Kirsher  */
339d5bf4f67SEmil Tantilov #define IXGBE_MIN_RSC_ITR	24
340d5bf4f67SEmil Tantilov #define IXGBE_100K_ITR		40
341d5bf4f67SEmil Tantilov #define IXGBE_20K_ITR		200
342d5bf4f67SEmil Tantilov #define IXGBE_10K_ITR		400
343d5bf4f67SEmil Tantilov #define IXGBE_8K_ITR		500
344dee1ad47SJeff Kirsher 
345f56e0cb1SAlexander Duyck /* ixgbe_test_staterr - tests bits in Rx descriptor status and error fields */
346f56e0cb1SAlexander Duyck static inline __le32 ixgbe_test_staterr(union ixgbe_adv_rx_desc *rx_desc,
347f56e0cb1SAlexander Duyck 					const u32 stat_err_bits)
348f56e0cb1SAlexander Duyck {
349f56e0cb1SAlexander Duyck 	return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
350f56e0cb1SAlexander Duyck }
351f56e0cb1SAlexander Duyck 
352dee1ad47SJeff Kirsher static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring)
353dee1ad47SJeff Kirsher {
354dee1ad47SJeff Kirsher 	u16 ntc = ring->next_to_clean;
355dee1ad47SJeff Kirsher 	u16 ntu = ring->next_to_use;
356dee1ad47SJeff Kirsher 
357dee1ad47SJeff Kirsher 	return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
358dee1ad47SJeff Kirsher }
359dee1ad47SJeff Kirsher 
360e4f74028SAlexander Duyck #define IXGBE_RX_DESC(R, i)	    \
361dee1ad47SJeff Kirsher 	(&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
362e4f74028SAlexander Duyck #define IXGBE_TX_DESC(R, i)	    \
363dee1ad47SJeff Kirsher 	(&(((union ixgbe_adv_tx_desc *)((R)->desc))[i]))
364e4f74028SAlexander Duyck #define IXGBE_TX_CTXTDESC(R, i)	    \
365dee1ad47SJeff Kirsher 	(&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
366dee1ad47SJeff Kirsher 
367dee1ad47SJeff Kirsher #define IXGBE_MAX_JUMBO_FRAME_SIZE        16128
368dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
369dee1ad47SJeff Kirsher /* Use 3K as the baby jumbo frame size for FCoE */
370dee1ad47SJeff Kirsher #define IXGBE_FCOE_JUMBO_FRAME_SIZE       3072
371dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
372dee1ad47SJeff Kirsher 
373dee1ad47SJeff Kirsher #define OTHER_VECTOR 1
374dee1ad47SJeff Kirsher #define NON_Q_VECTORS (OTHER_VECTOR)
375dee1ad47SJeff Kirsher 
376dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82599 64
377dee1ad47SJeff Kirsher #define MAX_MSIX_Q_VECTORS_82599 64
378dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82598 18
379dee1ad47SJeff Kirsher #define MAX_MSIX_Q_VECTORS_82598 16
380dee1ad47SJeff Kirsher 
381dee1ad47SJeff Kirsher #define MAX_MSIX_Q_VECTORS MAX_MSIX_Q_VECTORS_82599
382dee1ad47SJeff Kirsher #define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82599
383dee1ad47SJeff Kirsher 
3848f15486dSAlexander Duyck #define MIN_MSIX_Q_VECTORS 1
385dee1ad47SJeff Kirsher #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS)
386dee1ad47SJeff Kirsher 
38746646e61SAlexander Duyck /* default to trying for four seconds */
38846646e61SAlexander Duyck #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ)
38946646e61SAlexander Duyck 
390dee1ad47SJeff Kirsher /* board specific private data structure */
391dee1ad47SJeff Kirsher struct ixgbe_adapter {
39246646e61SAlexander Duyck 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
39346646e61SAlexander Duyck 	/* OS defined structs */
39446646e61SAlexander Duyck 	struct net_device *netdev;
39546646e61SAlexander Duyck 	struct pci_dev *pdev;
39646646e61SAlexander Duyck 
397dee1ad47SJeff Kirsher 	unsigned long state;
398dee1ad47SJeff Kirsher 
399dee1ad47SJeff Kirsher 	/* Some features need tri-state capability,
400dee1ad47SJeff Kirsher 	 * thus the additional *_CAPABLE flags.
401dee1ad47SJeff Kirsher 	 */
402dee1ad47SJeff Kirsher 	u32 flags;
403dee1ad47SJeff Kirsher #define IXGBE_FLAG_MSI_CAPABLE                  (u32)(1 << 1)
404dee1ad47SJeff Kirsher #define IXGBE_FLAG_MSI_ENABLED                  (u32)(1 << 2)
405dee1ad47SJeff Kirsher #define IXGBE_FLAG_MSIX_CAPABLE                 (u32)(1 << 3)
406dee1ad47SJeff Kirsher #define IXGBE_FLAG_MSIX_ENABLED                 (u32)(1 << 4)
407dee1ad47SJeff Kirsher #define IXGBE_FLAG_RX_1BUF_CAPABLE              (u32)(1 << 6)
408dee1ad47SJeff Kirsher #define IXGBE_FLAG_RX_PS_CAPABLE                (u32)(1 << 7)
409dee1ad47SJeff Kirsher #define IXGBE_FLAG_RX_PS_ENABLED                (u32)(1 << 8)
410dee1ad47SJeff Kirsher #define IXGBE_FLAG_IN_NETPOLL                   (u32)(1 << 9)
411dee1ad47SJeff Kirsher #define IXGBE_FLAG_DCA_ENABLED                  (u32)(1 << 10)
412dee1ad47SJeff Kirsher #define IXGBE_FLAG_DCA_CAPABLE                  (u32)(1 << 11)
413dee1ad47SJeff Kirsher #define IXGBE_FLAG_IMIR_ENABLED                 (u32)(1 << 12)
414dee1ad47SJeff Kirsher #define IXGBE_FLAG_MQ_CAPABLE                   (u32)(1 << 13)
415dee1ad47SJeff Kirsher #define IXGBE_FLAG_DCB_ENABLED                  (u32)(1 << 14)
416dee1ad47SJeff Kirsher #define IXGBE_FLAG_RSS_ENABLED                  (u32)(1 << 16)
417dee1ad47SJeff Kirsher #define IXGBE_FLAG_RSS_CAPABLE                  (u32)(1 << 17)
418dee1ad47SJeff Kirsher #define IXGBE_FLAG_VMDQ_CAPABLE                 (u32)(1 << 18)
419dee1ad47SJeff Kirsher #define IXGBE_FLAG_VMDQ_ENABLED                 (u32)(1 << 19)
420dee1ad47SJeff Kirsher #define IXGBE_FLAG_FAN_FAIL_CAPABLE             (u32)(1 << 20)
421dee1ad47SJeff Kirsher #define IXGBE_FLAG_NEED_LINK_UPDATE             (u32)(1 << 22)
422dee1ad47SJeff Kirsher #define IXGBE_FLAG_NEED_LINK_CONFIG             (u32)(1 << 23)
423dee1ad47SJeff Kirsher #define IXGBE_FLAG_FDIR_HASH_CAPABLE            (u32)(1 << 24)
424dee1ad47SJeff Kirsher #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE         (u32)(1 << 25)
425dee1ad47SJeff Kirsher #define IXGBE_FLAG_FCOE_CAPABLE                 (u32)(1 << 26)
426dee1ad47SJeff Kirsher #define IXGBE_FLAG_FCOE_ENABLED                 (u32)(1 << 27)
427dee1ad47SJeff Kirsher #define IXGBE_FLAG_SRIOV_CAPABLE                (u32)(1 << 28)
428dee1ad47SJeff Kirsher #define IXGBE_FLAG_SRIOV_ENABLED                (u32)(1 << 29)
429dee1ad47SJeff Kirsher 
430dee1ad47SJeff Kirsher 	u32 flags2;
431dee1ad47SJeff Kirsher #define IXGBE_FLAG2_RSC_CAPABLE                 (u32)(1)
432dee1ad47SJeff Kirsher #define IXGBE_FLAG2_RSC_ENABLED                 (u32)(1 << 1)
433dee1ad47SJeff Kirsher #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE         (u32)(1 << 2)
434dee1ad47SJeff Kirsher #define IXGBE_FLAG2_TEMP_SENSOR_EVENT           (u32)(1 << 3)
435dee1ad47SJeff Kirsher #define IXGBE_FLAG2_SEARCH_FOR_SFP              (u32)(1 << 4)
436dee1ad47SJeff Kirsher #define IXGBE_FLAG2_SFP_NEEDS_RESET             (u32)(1 << 5)
437dee1ad47SJeff Kirsher #define IXGBE_FLAG2_RESET_REQUESTED             (u32)(1 << 6)
438dee1ad47SJeff Kirsher #define IXGBE_FLAG2_FDIR_REQUIRES_REINIT        (u32)(1 << 7)
439ef6afc0cSAlexander Duyck #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP		(u32)(1 << 8)
440ef6afc0cSAlexander Duyck #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP		(u32)(1 << 9)
44146646e61SAlexander Duyck 
44246646e61SAlexander Duyck 	/* Tx fast path data */
44346646e61SAlexander Duyck 	int num_tx_queues;
44446646e61SAlexander Duyck 	u16 tx_itr_setting;
44546646e61SAlexander Duyck 	u16 tx_work_limit;
44646646e61SAlexander Duyck 
44746646e61SAlexander Duyck 	/* Rx fast path data */
44846646e61SAlexander Duyck 	int num_rx_queues;
44946646e61SAlexander Duyck 	u16 rx_itr_setting;
45046646e61SAlexander Duyck 
45146646e61SAlexander Duyck 	/* TX */
45246646e61SAlexander Duyck 	struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp;
45346646e61SAlexander Duyck 
45446646e61SAlexander Duyck 	u64 restart_queue;
45546646e61SAlexander Duyck 	u64 lsc_int;
45646646e61SAlexander Duyck 	u32 tx_timeout_count;
45746646e61SAlexander Duyck 
45846646e61SAlexander Duyck 	/* RX */
45946646e61SAlexander Duyck 	struct ixgbe_ring *rx_ring[MAX_RX_QUEUES];
46046646e61SAlexander Duyck 	int num_rx_pools;		/* == num_rx_queues in 82598 */
46146646e61SAlexander Duyck 	int num_rx_queues_per_pool;	/* 1 if 82598, can be many if 82599 */
46246646e61SAlexander Duyck 	u64 hw_csum_rx_error;
46346646e61SAlexander Duyck 	u64 hw_rx_no_dma_resources;
46446646e61SAlexander Duyck 	u64 rsc_total_count;
46546646e61SAlexander Duyck 	u64 rsc_total_flush;
46646646e61SAlexander Duyck 	u64 non_eop_descs;
46746646e61SAlexander Duyck 	u32 alloc_rx_page_failed;
46846646e61SAlexander Duyck 	u32 alloc_rx_buff_failed;
46946646e61SAlexander Duyck 
470dee1ad47SJeff Kirsher 	struct ixgbe_q_vector *q_vector[MAX_MSIX_Q_VECTORS];
471dee1ad47SJeff Kirsher 
472dee1ad47SJeff Kirsher 	/* DCB parameters */
473dee1ad47SJeff Kirsher 	struct ieee_pfc *ixgbe_ieee_pfc;
474dee1ad47SJeff Kirsher 	struct ieee_ets *ixgbe_ieee_ets;
475dee1ad47SJeff Kirsher 	struct ixgbe_dcb_config dcb_cfg;
476dee1ad47SJeff Kirsher 	struct ixgbe_dcb_config temp_dcb_cfg;
477dee1ad47SJeff Kirsher 	u8 dcb_set_bitmap;
478dee1ad47SJeff Kirsher 	u8 dcbx_cap;
479dee1ad47SJeff Kirsher 	enum ixgbe_fc_mode last_lfc_mode;
480dee1ad47SJeff Kirsher 
481dee1ad47SJeff Kirsher 	int num_msix_vectors;
482dee1ad47SJeff Kirsher 	int max_msix_q_vectors;         /* true count of q_vectors for device */
483dee1ad47SJeff Kirsher 	struct ixgbe_ring_feature ring_feature[RING_F_ARRAY_SIZE];
484dee1ad47SJeff Kirsher 	struct msix_entry *msix_entries;
485dee1ad47SJeff Kirsher 
486dee1ad47SJeff Kirsher 	u32 test_icr;
487dee1ad47SJeff Kirsher 	struct ixgbe_ring test_tx_ring;
488dee1ad47SJeff Kirsher 	struct ixgbe_ring test_rx_ring;
489dee1ad47SJeff Kirsher 
490dee1ad47SJeff Kirsher 	/* structs defined in ixgbe_hw.h */
491dee1ad47SJeff Kirsher 	struct ixgbe_hw hw;
492dee1ad47SJeff Kirsher 	u16 msg_enable;
493dee1ad47SJeff Kirsher 	struct ixgbe_hw_stats stats;
494dee1ad47SJeff Kirsher 
495dee1ad47SJeff Kirsher 	u64 tx_busy;
496dee1ad47SJeff Kirsher 	unsigned int tx_ring_count;
497dee1ad47SJeff Kirsher 	unsigned int rx_ring_count;
498dee1ad47SJeff Kirsher 
499dee1ad47SJeff Kirsher 	u32 link_speed;
500dee1ad47SJeff Kirsher 	bool link_up;
501dee1ad47SJeff Kirsher 	unsigned long link_check_timeout;
502dee1ad47SJeff Kirsher 
503dee1ad47SJeff Kirsher 	struct timer_list service_timer;
50446646e61SAlexander Duyck 	struct work_struct service_task;
50546646e61SAlexander Duyck 
50646646e61SAlexander Duyck 	struct hlist_head fdir_filter_list;
50746646e61SAlexander Duyck 	unsigned long fdir_overflow; /* number of times ATR was backed off */
50846646e61SAlexander Duyck 	union ixgbe_atr_input fdir_mask;
50946646e61SAlexander Duyck 	int fdir_filter_count;
510dee1ad47SJeff Kirsher 	u32 fdir_pballoc;
511dee1ad47SJeff Kirsher 	u32 atr_sample_rate;
512dee1ad47SJeff Kirsher 	spinlock_t fdir_perfect_lock;
51346646e61SAlexander Duyck 
514dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
515dee1ad47SJeff Kirsher 	struct ixgbe_fcoe fcoe;
516dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
517dee1ad47SJeff Kirsher 	u32 wol;
51846646e61SAlexander Duyck 
51946646e61SAlexander Duyck 	u16 bd_number;
52046646e61SAlexander Duyck 
52115e5209fSEmil Tantilov 	u16 eeprom_verh;
52215e5209fSEmil Tantilov 	u16 eeprom_verl;
523c23f5b6bSEmil Tantilov 	u16 eeprom_cap;
524dee1ad47SJeff Kirsher 
525dee1ad47SJeff Kirsher 	u32 interrupt_event;
52646646e61SAlexander Duyck 	u32 led_reg;
527dee1ad47SJeff Kirsher 
528dee1ad47SJeff Kirsher 	/* SR-IOV */
529dee1ad47SJeff Kirsher 	DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS);
530dee1ad47SJeff Kirsher 	unsigned int num_vfs;
531dee1ad47SJeff Kirsher 	struct vf_data_storage *vfinfo;
532dee1ad47SJeff Kirsher 	int vf_rate_link_speed;
533dee1ad47SJeff Kirsher 	struct vf_macvlans vf_mvs;
534dee1ad47SJeff Kirsher 	struct vf_macvlans *mv_list;
535dee1ad47SJeff Kirsher 
53683c61fa9SGreg Rose 	u32 timer_event_accumulator;
53783c61fa9SGreg Rose 	u32 vferr_refcount;
538dee1ad47SJeff Kirsher };
539dee1ad47SJeff Kirsher 
540dee1ad47SJeff Kirsher struct ixgbe_fdir_filter {
541dee1ad47SJeff Kirsher 	struct hlist_node fdir_node;
542dee1ad47SJeff Kirsher 	union ixgbe_atr_input filter;
543dee1ad47SJeff Kirsher 	u16 sw_idx;
544dee1ad47SJeff Kirsher 	u16 action;
545dee1ad47SJeff Kirsher };
546dee1ad47SJeff Kirsher 
54770e5576cSDon Skidmore enum ixgbe_state_t {
548dee1ad47SJeff Kirsher 	__IXGBE_TESTING,
549dee1ad47SJeff Kirsher 	__IXGBE_RESETTING,
550dee1ad47SJeff Kirsher 	__IXGBE_DOWN,
551dee1ad47SJeff Kirsher 	__IXGBE_SERVICE_SCHED,
552dee1ad47SJeff Kirsher 	__IXGBE_IN_SFP_INIT,
553dee1ad47SJeff Kirsher };
554dee1ad47SJeff Kirsher 
5554c1975d7SAlexander Duyck struct ixgbe_cb {
5564c1975d7SAlexander Duyck 	union {				/* Union defining head/tail partner */
5574c1975d7SAlexander Duyck 		struct sk_buff *head;
5584c1975d7SAlexander Duyck 		struct sk_buff *tail;
5594c1975d7SAlexander Duyck 	};
560dee1ad47SJeff Kirsher 	dma_addr_t dma;
5614c1975d7SAlexander Duyck 	u16 append_cnt;
562f800326dSAlexander Duyck 	bool page_released;
563dee1ad47SJeff Kirsher };
5644c1975d7SAlexander Duyck #define IXGBE_CB(skb) ((struct ixgbe_cb *)(skb)->cb)
565dee1ad47SJeff Kirsher 
566dee1ad47SJeff Kirsher enum ixgbe_boards {
567dee1ad47SJeff Kirsher 	board_82598,
568dee1ad47SJeff Kirsher 	board_82599,
569dee1ad47SJeff Kirsher 	board_X540,
570dee1ad47SJeff Kirsher };
571dee1ad47SJeff Kirsher 
572dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_82598_info;
573dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_82599_info;
574dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_X540_info;
575dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB
576dee1ad47SJeff Kirsher extern const struct dcbnl_rtnl_ops dcbnl_ops;
577dee1ad47SJeff Kirsher extern int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg,
578dee1ad47SJeff Kirsher                               struct ixgbe_dcb_config *dst_dcb_cfg,
579dee1ad47SJeff Kirsher                               int tc_max);
580dee1ad47SJeff Kirsher #endif
581dee1ad47SJeff Kirsher 
582dee1ad47SJeff Kirsher extern char ixgbe_driver_name[];
583dee1ad47SJeff Kirsher extern const char ixgbe_driver_version[];
5848af3c33fSJeff Kirsher #ifdef IXGBE_FCOE
585ea81875aSNeerav Parikh extern char ixgbe_default_device_descr[];
5868af3c33fSJeff Kirsher #endif /* IXGBE_FCOE */
587dee1ad47SJeff Kirsher 
588c7ccde0fSAlexander Duyck extern void ixgbe_up(struct ixgbe_adapter *adapter);
589dee1ad47SJeff Kirsher extern void ixgbe_down(struct ixgbe_adapter *adapter);
590dee1ad47SJeff Kirsher extern void ixgbe_reinit_locked(struct ixgbe_adapter *adapter);
591dee1ad47SJeff Kirsher extern void ixgbe_reset(struct ixgbe_adapter *adapter);
592dee1ad47SJeff Kirsher extern void ixgbe_set_ethtool_ops(struct net_device *netdev);
593dee1ad47SJeff Kirsher extern int ixgbe_setup_rx_resources(struct ixgbe_ring *);
594dee1ad47SJeff Kirsher extern int ixgbe_setup_tx_resources(struct ixgbe_ring *);
595dee1ad47SJeff Kirsher extern void ixgbe_free_rx_resources(struct ixgbe_ring *);
596dee1ad47SJeff Kirsher extern void ixgbe_free_tx_resources(struct ixgbe_ring *);
597dee1ad47SJeff Kirsher extern void ixgbe_configure_rx_ring(struct ixgbe_adapter *,struct ixgbe_ring *);
598dee1ad47SJeff Kirsher extern void ixgbe_configure_tx_ring(struct ixgbe_adapter *,struct ixgbe_ring *);
599dee1ad47SJeff Kirsher extern void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter,
600dee1ad47SJeff Kirsher 				   struct ixgbe_ring *);
601dee1ad47SJeff Kirsher extern void ixgbe_update_stats(struct ixgbe_adapter *adapter);
602dee1ad47SJeff Kirsher extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
603*8e2813f5SJacob Keller extern int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
604*8e2813f5SJacob Keller 			       u16 subdevice_id);
605dee1ad47SJeff Kirsher extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter);
606dee1ad47SJeff Kirsher extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *,
607dee1ad47SJeff Kirsher 					 struct ixgbe_adapter *,
608dee1ad47SJeff Kirsher 					 struct ixgbe_ring *);
609dee1ad47SJeff Kirsher extern void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *,
610dee1ad47SJeff Kirsher                                              struct ixgbe_tx_buffer *);
611dee1ad47SJeff Kirsher extern void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16);
612dee1ad47SJeff Kirsher extern void ixgbe_write_eitr(struct ixgbe_q_vector *);
6138af3c33fSJeff Kirsher extern int ixgbe_poll(struct napi_struct *napi, int budget);
614dee1ad47SJeff Kirsher extern int ethtool_ioctl(struct ifreq *ifr);
615dee1ad47SJeff Kirsher extern s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);
616dee1ad47SJeff Kirsher extern s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl);
617dee1ad47SJeff Kirsher extern s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl);
618dee1ad47SJeff Kirsher extern s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
619dee1ad47SJeff Kirsher 						 union ixgbe_atr_hash_dword input,
620dee1ad47SJeff Kirsher 						 union ixgbe_atr_hash_dword common,
621dee1ad47SJeff Kirsher                                                  u8 queue);
622dee1ad47SJeff Kirsher extern s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,
623dee1ad47SJeff Kirsher 					   union ixgbe_atr_input *input_mask);
624dee1ad47SJeff Kirsher extern s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
625dee1ad47SJeff Kirsher 						 union ixgbe_atr_input *input,
626dee1ad47SJeff Kirsher 						 u16 soft_id, u8 queue);
627dee1ad47SJeff Kirsher extern s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw,
628dee1ad47SJeff Kirsher 						 union ixgbe_atr_input *input,
629dee1ad47SJeff Kirsher 						 u16 soft_id);
630dee1ad47SJeff Kirsher extern void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
631dee1ad47SJeff Kirsher 						 union ixgbe_atr_input *mask);
632dee1ad47SJeff Kirsher extern void ixgbe_set_rx_mode(struct net_device *netdev);
6338af3c33fSJeff Kirsher #ifdef CONFIG_IXGBE_DCB
634dee1ad47SJeff Kirsher extern int ixgbe_setup_tc(struct net_device *dev, u8 tc);
6358af3c33fSJeff Kirsher #endif
636dee1ad47SJeff Kirsher extern void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32);
637dee1ad47SJeff Kirsher extern void ixgbe_do_reset(struct net_device *netdev);
638dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
639dee1ad47SJeff Kirsher extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter);
640fd0db0edSAlexander Duyck extern int ixgbe_fso(struct ixgbe_ring *tx_ring,
641fd0db0edSAlexander Duyck 		     struct ixgbe_tx_buffer *first,
642244e27adSAlexander Duyck 		     u8 *hdr_len);
643dee1ad47SJeff Kirsher extern void ixgbe_cleanup_fcoe(struct ixgbe_adapter *adapter);
644dee1ad47SJeff Kirsher extern int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
645dee1ad47SJeff Kirsher 			  union ixgbe_adv_rx_desc *rx_desc,
646f56e0cb1SAlexander Duyck 			  struct sk_buff *skb);
647dee1ad47SJeff Kirsher extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
648dee1ad47SJeff Kirsher                               struct scatterlist *sgl, unsigned int sgc);
649dee1ad47SJeff Kirsher extern int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid,
650dee1ad47SJeff Kirsher 				 struct scatterlist *sgl, unsigned int sgc);
651dee1ad47SJeff Kirsher extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
652dee1ad47SJeff Kirsher extern int ixgbe_fcoe_enable(struct net_device *netdev);
653dee1ad47SJeff Kirsher extern int ixgbe_fcoe_disable(struct net_device *netdev);
654dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB
655dee1ad47SJeff Kirsher extern u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter);
656dee1ad47SJeff Kirsher extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up);
657dee1ad47SJeff Kirsher #endif /* CONFIG_IXGBE_DCB */
658dee1ad47SJeff Kirsher extern int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
659ea81875aSNeerav Parikh extern int ixgbe_fcoe_get_hbainfo(struct net_device *netdev,
660ea81875aSNeerav Parikh 				  struct netdev_fcoe_hbainfo *info);
661dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
662dee1ad47SJeff Kirsher 
663b2d96e0aSAlexander Duyck static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
664b2d96e0aSAlexander Duyck {
665b2d96e0aSAlexander Duyck 	return netdev_get_tx_queue(ring->netdev, ring->queue_index);
666b2d96e0aSAlexander Duyck }
667b2d96e0aSAlexander Duyck 
668dee1ad47SJeff Kirsher #endif /* _IXGBE_H_ */
669