xref: /openbmc/linux/drivers/net/ethernet/intel/ixgbe/ixgbe.h (revision b4640030ec987ec29f5f74792c8f5cc8068d1829)
1dee1ad47SJeff Kirsher /*******************************************************************************
2dee1ad47SJeff Kirsher 
3dee1ad47SJeff Kirsher   Intel 10 Gigabit PCI Express Linux driver
4434c5e39SDon Skidmore   Copyright(c) 1999 - 2013 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>
386cb562d6SJacob Keller #include <linux/jiffies.h>
39dee1ad47SJeff Kirsher 
403a6a4edaSJacob Keller #include <linux/clocksource.h>
413a6a4edaSJacob Keller #include <linux/net_tstamp.h>
423a6a4edaSJacob Keller #include <linux/ptp_clock_kernel.h>
433a6a4edaSJacob Keller 
44dee1ad47SJeff Kirsher #include "ixgbe_type.h"
45dee1ad47SJeff Kirsher #include "ixgbe_common.h"
46dee1ad47SJeff Kirsher #include "ixgbe_dcb.h"
47dee1ad47SJeff Kirsher #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
48dee1ad47SJeff Kirsher #define IXGBE_FCOE
49dee1ad47SJeff Kirsher #include "ixgbe_fcoe.h"
50dee1ad47SJeff Kirsher #endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */
51dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCA
52dee1ad47SJeff Kirsher #include <linux/dca.h>
53dee1ad47SJeff Kirsher #endif
54dee1ad47SJeff Kirsher 
55076bb0c8SEliezer Tamir #include <net/busy_poll.h>
565a85e737SEliezer Tamir 
57e0d1095aSCong Wang #ifdef CONFIG_NET_RX_BUSY_POLL
58*b4640030SJacob Keller #define BP_EXTENDED_STATS
597e15b90fSEliezer Tamir #endif
60dee1ad47SJeff Kirsher /* common prefix used by pr_<> macros */
61dee1ad47SJeff Kirsher #undef pr_fmt
62dee1ad47SJeff Kirsher #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
63dee1ad47SJeff Kirsher 
64dee1ad47SJeff Kirsher /* TX/RX descriptor defines */
65dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_TXD		    512
6659224555SAlexander Duyck #define IXGBE_DEFAULT_TX_WORK		    256
67dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD			   4096
68dee1ad47SJeff Kirsher #define IXGBE_MIN_TXD			     64
69dee1ad47SJeff Kirsher 
70dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_RXD		    512
71dee1ad47SJeff Kirsher #define IXGBE_MAX_RXD			   4096
72dee1ad47SJeff Kirsher #define IXGBE_MIN_RXD			     64
73dee1ad47SJeff Kirsher 
74dee1ad47SJeff Kirsher /* flow control */
75dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTL			   0x40
76dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTL			0x7FF80
77dee1ad47SJeff Kirsher #define IXGBE_MIN_FCRTH			  0x600
78dee1ad47SJeff Kirsher #define IXGBE_MAX_FCRTH			0x7FFF0
79dee1ad47SJeff Kirsher #define IXGBE_DEFAULT_FCPAUSE		 0xFFFF
80dee1ad47SJeff Kirsher #define IXGBE_MIN_FCPAUSE		      0
81dee1ad47SJeff Kirsher #define IXGBE_MAX_FCPAUSE		 0xFFFF
82dee1ad47SJeff Kirsher 
83dee1ad47SJeff Kirsher /* Supported Rx Buffer Sizes */
84252562c2SAlexander Duyck #define IXGBE_RXBUFFER_256    256  /* Used for skb receive header */
8509816fbeSAlexander Duyck #define IXGBE_RXBUFFER_2K    2048
8609816fbeSAlexander Duyck #define IXGBE_RXBUFFER_3K    3072
8709816fbeSAlexander Duyck #define IXGBE_RXBUFFER_4K    4096
88dee1ad47SJeff Kirsher #define IXGBE_MAX_RXBUFFER  16384  /* largest size for a single descriptor */
89dee1ad47SJeff Kirsher 
90dee1ad47SJeff Kirsher /*
91252562c2SAlexander Duyck  * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN means we
92252562c2SAlexander Duyck  * reserve 64 more, and skb_shared_info adds an additional 320 bytes more,
93252562c2SAlexander Duyck  * this adds up to 448 bytes of extra data.
94252562c2SAlexander Duyck  *
95252562c2SAlexander Duyck  * Since netdev_alloc_skb now allocates a page fragment we can use a value
96252562c2SAlexander Duyck  * of 256 and the resultant skb will have a truesize of 960 or less.
97dee1ad47SJeff Kirsher  */
98252562c2SAlexander Duyck #define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_256
99dee1ad47SJeff Kirsher 
100dee1ad47SJeff Kirsher /* How many Rx Buffers do we bundle into one write to the hardware ? */
101dee1ad47SJeff Kirsher #define IXGBE_RX_BUFFER_WRITE	16	/* Must be power of 2 */
102dee1ad47SJeff Kirsher 
103472148c3SAlexander Duyck enum ixgbe_tx_flags {
104472148c3SAlexander Duyck 	/* cmd_type flags */
105472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_HW_VLAN	= 0x01,
106472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_TSO	= 0x02,
107472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_TSTAMP	= 0x04,
108472148c3SAlexander Duyck 
109472148c3SAlexander Duyck 	/* olinfo flags */
110472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_CC	= 0x08,
111472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_IPV4	= 0x10,
112472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_CSUM	= 0x20,
113472148c3SAlexander Duyck 
114472148c3SAlexander Duyck 	/* software defined flags */
115472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_SW_VLAN	= 0x40,
116472148c3SAlexander Duyck 	IXGBE_TX_FLAGS_FCOE	= 0x80,
117472148c3SAlexander Duyck };
118472148c3SAlexander Duyck 
119472148c3SAlexander Duyck /* VLAN info */
120dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_MASK	0xffff0000
12166f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK	0xe0000000
12266f32a8bSAlexander Duyck #define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT  29
123dee1ad47SJeff Kirsher #define IXGBE_TX_FLAGS_VLAN_SHIFT	16
124dee1ad47SJeff Kirsher 
125dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_MC_ENTRIES         30
126dee1ad47SJeff Kirsher #define IXGBE_MAX_VF_FUNCTIONS          64
127dee1ad47SJeff Kirsher #define IXGBE_MAX_VFTA_ENTRIES          128
128dee1ad47SJeff Kirsher #define MAX_EMULATION_MAC_ADDRS         16
129dee1ad47SJeff Kirsher #define IXGBE_MAX_PF_MACVLANS           15
1301d9c0bfdSAlexander Duyck #define VMDQ_P(p)   ((p) + adapter->ring_feature[RING_F_VMDQ].offset)
13183c61fa9SGreg Rose #define IXGBE_82599_VF_DEVICE_ID        0x10ED
13283c61fa9SGreg Rose #define IXGBE_X540_VF_DEVICE_ID         0x1515
133dee1ad47SJeff Kirsher 
134dee1ad47SJeff Kirsher struct vf_data_storage {
135dee1ad47SJeff Kirsher 	unsigned char vf_mac_addresses[ETH_ALEN];
136dee1ad47SJeff Kirsher 	u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES];
137dee1ad47SJeff Kirsher 	u16 num_vf_mc_hashes;
138dee1ad47SJeff Kirsher 	u16 default_vf_vlan_id;
139dee1ad47SJeff Kirsher 	u16 vlans_enabled;
140dee1ad47SJeff Kirsher 	bool clear_to_send;
141dee1ad47SJeff Kirsher 	bool pf_set_mac;
142dee1ad47SJeff Kirsher 	u16 pf_vlan; /* When set, guest VLAN config not allowed. */
143dee1ad47SJeff Kirsher 	u16 pf_qos;
144dee1ad47SJeff Kirsher 	u16 tx_rate;
145de4c7f65SGreg Rose 	u16 vlan_count;
146de4c7f65SGreg Rose 	u8 spoofchk_enabled;
147374c65d6SAlexander Duyck 	unsigned int vf_api;
148dee1ad47SJeff Kirsher };
149dee1ad47SJeff Kirsher 
150dee1ad47SJeff Kirsher struct vf_macvlans {
151dee1ad47SJeff Kirsher 	struct list_head l;
152dee1ad47SJeff Kirsher 	int vf;
153dee1ad47SJeff Kirsher 	int rar_entry;
154dee1ad47SJeff Kirsher 	bool free;
155dee1ad47SJeff Kirsher 	bool is_macvlan;
156dee1ad47SJeff Kirsher 	u8 vf_macvlan[ETH_ALEN];
157dee1ad47SJeff Kirsher };
158dee1ad47SJeff Kirsher 
159dee1ad47SJeff Kirsher #define IXGBE_MAX_TXD_PWR	14
160dee1ad47SJeff Kirsher #define IXGBE_MAX_DATA_PER_TXD	(1 << IXGBE_MAX_TXD_PWR)
161dee1ad47SJeff Kirsher 
162dee1ad47SJeff Kirsher /* Tx Descriptors needed, worst case */
163dee1ad47SJeff Kirsher #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD)
164990a3158SAlexander Duyck #define DESC_NEEDED (MAX_SKB_FRAGS + 4)
165dee1ad47SJeff Kirsher 
166dee1ad47SJeff Kirsher /* wrapper around a pointer to a socket buffer,
167dee1ad47SJeff Kirsher  * so a DMA handle can be stored along with the buffer */
168dee1ad47SJeff Kirsher struct ixgbe_tx_buffer {
169d3d00239SAlexander Duyck 	union ixgbe_adv_tx_desc *next_to_watch;
170dee1ad47SJeff Kirsher 	unsigned long time_stamp;
171d3d00239SAlexander Duyck 	struct sk_buff *skb;
172fd0db0edSAlexander Duyck 	unsigned int bytecount;
173fd0db0edSAlexander Duyck 	unsigned short gso_segs;
174244e27adSAlexander Duyck 	__be16 protocol;
175729739b7SAlexander Duyck 	DEFINE_DMA_UNMAP_ADDR(dma);
176729739b7SAlexander Duyck 	DEFINE_DMA_UNMAP_LEN(len);
177fd0db0edSAlexander Duyck 	u32 tx_flags;
178dee1ad47SJeff Kirsher };
179dee1ad47SJeff Kirsher 
180dee1ad47SJeff Kirsher struct ixgbe_rx_buffer {
181dee1ad47SJeff Kirsher 	struct sk_buff *skb;
182dee1ad47SJeff Kirsher 	dma_addr_t dma;
183dee1ad47SJeff Kirsher 	struct page *page;
184dee1ad47SJeff Kirsher 	unsigned int page_offset;
185dee1ad47SJeff Kirsher };
186dee1ad47SJeff Kirsher 
187dee1ad47SJeff Kirsher struct ixgbe_queue_stats {
188dee1ad47SJeff Kirsher 	u64 packets;
189dee1ad47SJeff Kirsher 	u64 bytes;
190*b4640030SJacob Keller #ifdef BP_EXTENDED_STATS
1917e15b90fSEliezer Tamir 	u64 yields;
1927e15b90fSEliezer Tamir 	u64 misses;
1937e15b90fSEliezer Tamir 	u64 cleaned;
194*b4640030SJacob Keller #endif  /* BP_EXTENDED_STATS */
195dee1ad47SJeff Kirsher };
196dee1ad47SJeff Kirsher 
197dee1ad47SJeff Kirsher struct ixgbe_tx_queue_stats {
198dee1ad47SJeff Kirsher 	u64 restart_queue;
199dee1ad47SJeff Kirsher 	u64 tx_busy;
200dee1ad47SJeff Kirsher 	u64 tx_done_old;
201dee1ad47SJeff Kirsher };
202dee1ad47SJeff Kirsher 
203dee1ad47SJeff Kirsher struct ixgbe_rx_queue_stats {
204dee1ad47SJeff Kirsher 	u64 rsc_count;
205dee1ad47SJeff Kirsher 	u64 rsc_flush;
206dee1ad47SJeff Kirsher 	u64 non_eop_descs;
207dee1ad47SJeff Kirsher 	u64 alloc_rx_page_failed;
208dee1ad47SJeff Kirsher 	u64 alloc_rx_buff_failed;
2098a0da21bSAlexander Duyck 	u64 csum_err;
210dee1ad47SJeff Kirsher };
211dee1ad47SJeff Kirsher 
212f800326dSAlexander Duyck enum ixgbe_ring_state_t {
213dee1ad47SJeff Kirsher 	__IXGBE_TX_FDIR_INIT_DONE,
214fd786b7bSAlexander Duyck 	__IXGBE_TX_XPS_INIT_DONE,
215dee1ad47SJeff Kirsher 	__IXGBE_TX_DETECT_HANG,
216dee1ad47SJeff Kirsher 	__IXGBE_HANG_CHECK_ARMED,
217dee1ad47SJeff Kirsher 	__IXGBE_RX_RSC_ENABLED,
2188a0da21bSAlexander Duyck 	__IXGBE_RX_CSUM_UDP_ZERO_ERR,
21957efd44cSAlexander Duyck 	__IXGBE_RX_FCOE,
220dee1ad47SJeff Kirsher };
221dee1ad47SJeff Kirsher 
222dee1ad47SJeff Kirsher #define check_for_tx_hang(ring) \
223dee1ad47SJeff Kirsher 	test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
224dee1ad47SJeff Kirsher #define set_check_for_tx_hang(ring) \
225dee1ad47SJeff Kirsher 	set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
226dee1ad47SJeff Kirsher #define clear_check_for_tx_hang(ring) \
227dee1ad47SJeff Kirsher 	clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
228dee1ad47SJeff Kirsher #define ring_is_rsc_enabled(ring) \
229dee1ad47SJeff Kirsher 	test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
230dee1ad47SJeff Kirsher #define set_ring_rsc_enabled(ring) \
231dee1ad47SJeff Kirsher 	set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
232dee1ad47SJeff Kirsher #define clear_ring_rsc_enabled(ring) \
233dee1ad47SJeff Kirsher 	clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
234dee1ad47SJeff Kirsher struct ixgbe_ring {
235efe3d3c8SAlexander Duyck 	struct ixgbe_ring *next;	/* pointer to next ring in q_vector */
236d3ee4294SAlexander Duyck 	struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */
237dee1ad47SJeff Kirsher 	struct net_device *netdev;	/* netdev ring belongs to */
238d3ee4294SAlexander Duyck 	struct device *dev;		/* device for DMA mapping */
239d3ee4294SAlexander Duyck 	void *desc;			/* descriptor ring memory */
240dee1ad47SJeff Kirsher 	union {
241dee1ad47SJeff Kirsher 		struct ixgbe_tx_buffer *tx_buffer_info;
242dee1ad47SJeff Kirsher 		struct ixgbe_rx_buffer *rx_buffer_info;
243dee1ad47SJeff Kirsher 	};
2446cb562d6SJacob Keller 	unsigned long last_rx_timestamp;
245dee1ad47SJeff Kirsher 	unsigned long state;
246dee1ad47SJeff Kirsher 	u8 __iomem *tail;
247d3ee4294SAlexander Duyck 	dma_addr_t dma;			/* phys. address of descriptor ring */
248d3ee4294SAlexander Duyck 	unsigned int size;		/* length in bytes */
249dee1ad47SJeff Kirsher 
250dee1ad47SJeff Kirsher 	u16 count;			/* amount of descriptors */
251dee1ad47SJeff Kirsher 
252dee1ad47SJeff Kirsher 	u8 queue_index; /* needed for multiqueue queue management */
253dee1ad47SJeff Kirsher 	u8 reg_idx;			/* holds the special value that gets
254dee1ad47SJeff Kirsher 					 * the hardware register offset
255dee1ad47SJeff Kirsher 					 * associated with this ring, which is
256dee1ad47SJeff Kirsher 					 * different for DCB and RSS modes
257dee1ad47SJeff Kirsher 					 */
258d3ee4294SAlexander Duyck 	u16 next_to_use;
259d3ee4294SAlexander Duyck 	u16 next_to_clean;
260d3ee4294SAlexander Duyck 
261f800326dSAlexander Duyck 	union {
262d3ee4294SAlexander Duyck 		u16 next_to_alloc;
263f800326dSAlexander Duyck 		struct {
264dee1ad47SJeff Kirsher 			u8 atr_sample_rate;
265dee1ad47SJeff Kirsher 			u8 atr_count;
266f800326dSAlexander Duyck 		};
267f800326dSAlexander Duyck 	};
268dee1ad47SJeff Kirsher 
269dee1ad47SJeff Kirsher 	u8 dcb_tc;
270dee1ad47SJeff Kirsher 	struct ixgbe_queue_stats stats;
271dee1ad47SJeff Kirsher 	struct u64_stats_sync syncp;
272dee1ad47SJeff Kirsher 	union {
273dee1ad47SJeff Kirsher 		struct ixgbe_tx_queue_stats tx_stats;
274dee1ad47SJeff Kirsher 		struct ixgbe_rx_queue_stats rx_stats;
275dee1ad47SJeff Kirsher 	};
276dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp;
277dee1ad47SJeff Kirsher 
278dee1ad47SJeff Kirsher enum ixgbe_ring_f_enum {
279dee1ad47SJeff Kirsher 	RING_F_NONE = 0,
280dee1ad47SJeff Kirsher 	RING_F_VMDQ,  /* SR-IOV uses the same ring feature */
281dee1ad47SJeff Kirsher 	RING_F_RSS,
282dee1ad47SJeff Kirsher 	RING_F_FDIR,
283dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
284dee1ad47SJeff Kirsher 	RING_F_FCOE,
285dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
286dee1ad47SJeff Kirsher 
287dee1ad47SJeff Kirsher 	RING_F_ARRAY_SIZE      /* must be last in enum set */
288dee1ad47SJeff Kirsher };
289dee1ad47SJeff Kirsher 
290dee1ad47SJeff Kirsher #define IXGBE_MAX_RSS_INDICES  16
291dee1ad47SJeff Kirsher #define IXGBE_MAX_VMDQ_INDICES 64
292d3cb9869SAlexander Duyck #define IXGBE_MAX_FDIR_INDICES 63	/* based on q_vector limit */
293dee1ad47SJeff Kirsher #define IXGBE_MAX_FCOE_INDICES  8
294d3cb9869SAlexander Duyck #define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1)
295d3cb9869SAlexander Duyck #define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1)
296dee1ad47SJeff Kirsher struct ixgbe_ring_feature {
297c087663eSAlexander Duyck 	u16 limit;	/* upper limit on feature indices */
298c087663eSAlexander Duyck 	u16 indices;	/* current value of indices */
299e4b317e9SAlexander Duyck 	u16 mask;	/* Mask used for feature to ring mapping */
300e4b317e9SAlexander Duyck 	u16 offset;	/* offset to start of feature */
301dee1ad47SJeff Kirsher } ____cacheline_internodealigned_in_smp;
302dee1ad47SJeff Kirsher 
30373079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_8Q_MASK 0x78
30473079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_4Q_MASK 0x7C
30573079ea0SAlexander Duyck #define IXGBE_82599_VMDQ_2Q_MASK 0x7E
30673079ea0SAlexander Duyck 
307f800326dSAlexander Duyck /*
308f800326dSAlexander Duyck  * FCoE requires that all Rx buffers be over 2200 bytes in length.  Since
309f800326dSAlexander Duyck  * this is twice the size of a half page we need to double the page order
310f800326dSAlexander Duyck  * for FCoE enabled Rx queues.
311f800326dSAlexander Duyck  */
31209816fbeSAlexander Duyck static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring)
31309816fbeSAlexander Duyck {
31409816fbeSAlexander Duyck #ifdef IXGBE_FCOE
31509816fbeSAlexander Duyck 	if (test_bit(__IXGBE_RX_FCOE, &ring->state))
31609816fbeSAlexander Duyck 		return (PAGE_SIZE < 8192) ? IXGBE_RXBUFFER_4K :
31709816fbeSAlexander Duyck 					    IXGBE_RXBUFFER_3K;
31809816fbeSAlexander Duyck #endif
31909816fbeSAlexander Duyck 	return IXGBE_RXBUFFER_2K;
32009816fbeSAlexander Duyck }
32109816fbeSAlexander Duyck 
322f800326dSAlexander Duyck static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
323f800326dSAlexander Duyck {
32409816fbeSAlexander Duyck #ifdef IXGBE_FCOE
32509816fbeSAlexander Duyck 	if (test_bit(__IXGBE_RX_FCOE, &ring->state))
32609816fbeSAlexander Duyck 		return (PAGE_SIZE < 8192) ? 1 : 0;
327f800326dSAlexander Duyck #endif
32809816fbeSAlexander Duyck 	return 0;
32909816fbeSAlexander Duyck }
330f800326dSAlexander Duyck #define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring))
331f800326dSAlexander Duyck 
332dee1ad47SJeff Kirsher struct ixgbe_ring_container {
333efe3d3c8SAlexander Duyck 	struct ixgbe_ring *ring;	/* pointer to linked list of rings */
334dee1ad47SJeff Kirsher 	unsigned int total_bytes;	/* total bytes processed this int */
335dee1ad47SJeff Kirsher 	unsigned int total_packets;	/* total packets processed this int */
336dee1ad47SJeff Kirsher 	u16 work_limit;			/* total work allowed per interrupt */
337dee1ad47SJeff Kirsher 	u8 count;			/* total number of rings in vector */
338dee1ad47SJeff Kirsher 	u8 itr;				/* current ITR setting for ring */
339dee1ad47SJeff Kirsher };
340dee1ad47SJeff Kirsher 
341a557928eSAlexander Duyck /* iterator for handling rings in ring container */
342a557928eSAlexander Duyck #define ixgbe_for_each_ring(pos, head) \
343a557928eSAlexander Duyck 	for (pos = (head).ring; pos != NULL; pos = pos->next)
344a557928eSAlexander Duyck 
345dee1ad47SJeff Kirsher #define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \
346dee1ad47SJeff Kirsher                               ? 8 : 1)
347dee1ad47SJeff Kirsher #define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS
348dee1ad47SJeff Kirsher 
34949c7ffbeSAlexander Duyck /* MAX_Q_VECTORS of these are allocated,
350dee1ad47SJeff Kirsher  * but we only use one per queue-specific vector.
351dee1ad47SJeff Kirsher  */
352dee1ad47SJeff Kirsher struct ixgbe_q_vector {
353dee1ad47SJeff Kirsher 	struct ixgbe_adapter *adapter;
354dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCA
355dee1ad47SJeff Kirsher 	int cpu;	    /* CPU for DCA */
356dee1ad47SJeff Kirsher #endif
357d5bf4f67SEmil Tantilov 	u16 v_idx;		/* index of q_vector within array, also used for
358d5bf4f67SEmil Tantilov 				 * finding the bit in EICR and friends that
359d5bf4f67SEmil Tantilov 				 * represents the vector for this ring */
360d5bf4f67SEmil Tantilov 	u16 itr;		/* Interrupt throttle rate written to EITR */
361dee1ad47SJeff Kirsher 	struct ixgbe_ring_container rx, tx;
362d5bf4f67SEmil Tantilov 
363d5bf4f67SEmil Tantilov 	struct napi_struct napi;
364de88eeebSAlexander Duyck 	cpumask_t affinity_mask;
365de88eeebSAlexander Duyck 	int numa_node;
366de88eeebSAlexander Duyck 	struct rcu_head rcu;	/* to avoid race with update stats on free */
367dee1ad47SJeff Kirsher 	char name[IFNAMSIZ + 9];
368de88eeebSAlexander Duyck 
369e0d1095aSCong Wang #ifdef CONFIG_NET_RX_BUSY_POLL
3705a85e737SEliezer Tamir 	unsigned int state;
3715a85e737SEliezer Tamir #define IXGBE_QV_STATE_IDLE        0
3725a85e737SEliezer Tamir #define IXGBE_QV_STATE_NAPI	   1    /* NAPI owns this QV */
3735a85e737SEliezer Tamir #define IXGBE_QV_STATE_POLL	   2    /* poll owns this QV */
3745a85e737SEliezer Tamir #define IXGBE_QV_LOCKED (IXGBE_QV_STATE_NAPI | IXGBE_QV_STATE_POLL)
3755a85e737SEliezer Tamir #define IXGBE_QV_STATE_NAPI_YIELD  4    /* NAPI yielded this QV */
3765a85e737SEliezer Tamir #define IXGBE_QV_STATE_POLL_YIELD  8    /* poll yielded this QV */
3775a85e737SEliezer Tamir #define IXGBE_QV_YIELD (IXGBE_QV_STATE_NAPI_YIELD | IXGBE_QV_STATE_POLL_YIELD)
3785a85e737SEliezer Tamir #define IXGBE_QV_USER_PEND (IXGBE_QV_STATE_POLL | IXGBE_QV_STATE_POLL_YIELD)
3795a85e737SEliezer Tamir 	spinlock_t lock;
380e0d1095aSCong Wang #endif  /* CONFIG_NET_RX_BUSY_POLL */
3815a85e737SEliezer Tamir 
382de88eeebSAlexander Duyck 	/* for dynamic allocation of rings associated with this q_vector */
383de88eeebSAlexander Duyck 	struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp;
384dee1ad47SJeff Kirsher };
385e0d1095aSCong Wang #ifdef CONFIG_NET_RX_BUSY_POLL
3865a85e737SEliezer Tamir static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector)
3875a85e737SEliezer Tamir {
3885a85e737SEliezer Tamir 
3895a85e737SEliezer Tamir 	spin_lock_init(&q_vector->lock);
3905a85e737SEliezer Tamir 	q_vector->state = IXGBE_QV_STATE_IDLE;
3915a85e737SEliezer Tamir }
3925a85e737SEliezer Tamir 
3935a85e737SEliezer Tamir /* called from the device poll routine to get ownership of a q_vector */
3945a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_napi(struct ixgbe_q_vector *q_vector)
3955a85e737SEliezer Tamir {
3965a85e737SEliezer Tamir 	int rc = true;
3975a85e737SEliezer Tamir 	spin_lock(&q_vector->lock);
3985a85e737SEliezer Tamir 	if (q_vector->state & IXGBE_QV_LOCKED) {
3995a85e737SEliezer Tamir 		WARN_ON(q_vector->state & IXGBE_QV_STATE_NAPI);
4005a85e737SEliezer Tamir 		q_vector->state |= IXGBE_QV_STATE_NAPI_YIELD;
4015a85e737SEliezer Tamir 		rc = false;
402*b4640030SJacob Keller #ifdef BP_EXTENDED_STATS
4037e15b90fSEliezer Tamir 		q_vector->tx.ring->stats.yields++;
4047e15b90fSEliezer Tamir #endif
4055a85e737SEliezer Tamir 	} else
4065a85e737SEliezer Tamir 		/* we don't care if someone yielded */
4075a85e737SEliezer Tamir 		q_vector->state = IXGBE_QV_STATE_NAPI;
4085a85e737SEliezer Tamir 	spin_unlock(&q_vector->lock);
4095a85e737SEliezer Tamir 	return rc;
4105a85e737SEliezer Tamir }
4115a85e737SEliezer Tamir 
4125a85e737SEliezer Tamir /* returns true is someone tried to get the qv while napi had it */
4135a85e737SEliezer Tamir static inline bool ixgbe_qv_unlock_napi(struct ixgbe_q_vector *q_vector)
4145a85e737SEliezer Tamir {
4155a85e737SEliezer Tamir 	int rc = false;
4165a85e737SEliezer Tamir 	spin_lock(&q_vector->lock);
4175a85e737SEliezer Tamir 	WARN_ON(q_vector->state & (IXGBE_QV_STATE_POLL |
4185a85e737SEliezer Tamir 			       IXGBE_QV_STATE_NAPI_YIELD));
4195a85e737SEliezer Tamir 
4205a85e737SEliezer Tamir 	if (q_vector->state & IXGBE_QV_STATE_POLL_YIELD)
4215a85e737SEliezer Tamir 		rc = true;
4225a85e737SEliezer Tamir 	q_vector->state = IXGBE_QV_STATE_IDLE;
4235a85e737SEliezer Tamir 	spin_unlock(&q_vector->lock);
4245a85e737SEliezer Tamir 	return rc;
4255a85e737SEliezer Tamir }
4265a85e737SEliezer Tamir 
4275a85e737SEliezer Tamir /* called from ixgbe_low_latency_poll() */
4285a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_poll(struct ixgbe_q_vector *q_vector)
4295a85e737SEliezer Tamir {
4305a85e737SEliezer Tamir 	int rc = true;
4315a85e737SEliezer Tamir 	spin_lock_bh(&q_vector->lock);
4325a85e737SEliezer Tamir 	if ((q_vector->state & IXGBE_QV_LOCKED)) {
4335a85e737SEliezer Tamir 		q_vector->state |= IXGBE_QV_STATE_POLL_YIELD;
4345a85e737SEliezer Tamir 		rc = false;
435*b4640030SJacob Keller #ifdef BP_EXTENDED_STATS
4367e15b90fSEliezer Tamir 		q_vector->rx.ring->stats.yields++;
4377e15b90fSEliezer Tamir #endif
4385a85e737SEliezer Tamir 	} else
4395a85e737SEliezer Tamir 		/* preserve yield marks */
4405a85e737SEliezer Tamir 		q_vector->state |= IXGBE_QV_STATE_POLL;
4415a85e737SEliezer Tamir 	spin_unlock_bh(&q_vector->lock);
4425a85e737SEliezer Tamir 	return rc;
4435a85e737SEliezer Tamir }
4445a85e737SEliezer Tamir 
4455a85e737SEliezer Tamir /* returns true if someone tried to get the qv while it was locked */
4465a85e737SEliezer Tamir static inline bool ixgbe_qv_unlock_poll(struct ixgbe_q_vector *q_vector)
4475a85e737SEliezer Tamir {
4485a85e737SEliezer Tamir 	int rc = false;
4495a85e737SEliezer Tamir 	spin_lock_bh(&q_vector->lock);
4505a85e737SEliezer Tamir 	WARN_ON(q_vector->state & (IXGBE_QV_STATE_NAPI));
4515a85e737SEliezer Tamir 
4525a85e737SEliezer Tamir 	if (q_vector->state & IXGBE_QV_STATE_POLL_YIELD)
4535a85e737SEliezer Tamir 		rc = true;
4545a85e737SEliezer Tamir 	q_vector->state = IXGBE_QV_STATE_IDLE;
4555a85e737SEliezer Tamir 	spin_unlock_bh(&q_vector->lock);
4565a85e737SEliezer Tamir 	return rc;
4575a85e737SEliezer Tamir }
4585a85e737SEliezer Tamir 
4595a85e737SEliezer Tamir /* true if a socket is polling, even if it did not get the lock */
460*b4640030SJacob Keller static inline bool ixgbe_qv_busy_polling(struct ixgbe_q_vector *q_vector)
4615a85e737SEliezer Tamir {
4625a85e737SEliezer Tamir 	WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED));
4635a85e737SEliezer Tamir 	return q_vector->state & IXGBE_QV_USER_PEND;
4645a85e737SEliezer Tamir }
465e0d1095aSCong Wang #else /* CONFIG_NET_RX_BUSY_POLL */
4665a85e737SEliezer Tamir static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector)
4675a85e737SEliezer Tamir {
4685a85e737SEliezer Tamir }
4695a85e737SEliezer Tamir 
4705a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_napi(struct ixgbe_q_vector *q_vector)
4715a85e737SEliezer Tamir {
4725a85e737SEliezer Tamir 	return true;
4735a85e737SEliezer Tamir }
4745a85e737SEliezer Tamir 
4755a85e737SEliezer Tamir static inline bool ixgbe_qv_unlock_napi(struct ixgbe_q_vector *q_vector)
4765a85e737SEliezer Tamir {
4775a85e737SEliezer Tamir 	return false;
4785a85e737SEliezer Tamir }
4795a85e737SEliezer Tamir 
4805a85e737SEliezer Tamir static inline bool ixgbe_qv_lock_poll(struct ixgbe_q_vector *q_vector)
4815a85e737SEliezer Tamir {
4825a85e737SEliezer Tamir 	return false;
4835a85e737SEliezer Tamir }
4845a85e737SEliezer Tamir 
4855a85e737SEliezer Tamir static inline bool ixgbe_qv_unlock_poll(struct ixgbe_q_vector *q_vector)
4865a85e737SEliezer Tamir {
4875a85e737SEliezer Tamir 	return false;
4885a85e737SEliezer Tamir }
4895a85e737SEliezer Tamir 
490*b4640030SJacob Keller static inline bool ixgbe_qv_busy_polling(struct ixgbe_q_vector *q_vector)
4915a85e737SEliezer Tamir {
4925a85e737SEliezer Tamir 	return false;
4935a85e737SEliezer Tamir }
494e0d1095aSCong Wang #endif /* CONFIG_NET_RX_BUSY_POLL */
4955a85e737SEliezer Tamir 
4963ca8bc6dSDon Skidmore #ifdef CONFIG_IXGBE_HWMON
4973ca8bc6dSDon Skidmore 
4983ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_LOC		0
4993ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_TEMP		1
5003ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_CAUTION	2
5013ca8bc6dSDon Skidmore #define IXGBE_HWMON_TYPE_MAX		3
5023ca8bc6dSDon Skidmore 
5033ca8bc6dSDon Skidmore struct hwmon_attr {
5043ca8bc6dSDon Skidmore 	struct device_attribute dev_attr;
5053ca8bc6dSDon Skidmore 	struct ixgbe_hw *hw;
5063ca8bc6dSDon Skidmore 	struct ixgbe_thermal_diode_data *sensor;
5073ca8bc6dSDon Skidmore 	char name[12];
5083ca8bc6dSDon Skidmore };
5093ca8bc6dSDon Skidmore 
5103ca8bc6dSDon Skidmore struct hwmon_buff {
5113ca8bc6dSDon Skidmore 	struct device *device;
5123ca8bc6dSDon Skidmore 	struct hwmon_attr *hwmon_list;
5133ca8bc6dSDon Skidmore 	unsigned int n_hwmon;
5143ca8bc6dSDon Skidmore };
5153ca8bc6dSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */
516dee1ad47SJeff Kirsher 
517d5bf4f67SEmil Tantilov /*
518d5bf4f67SEmil Tantilov  * microsecond values for various ITR rates shifted by 2 to fit itr register
519d5bf4f67SEmil Tantilov  * with the first 3 bits reserved 0
520dee1ad47SJeff Kirsher  */
521d5bf4f67SEmil Tantilov #define IXGBE_MIN_RSC_ITR	24
522d5bf4f67SEmil Tantilov #define IXGBE_100K_ITR		40
523d5bf4f67SEmil Tantilov #define IXGBE_20K_ITR		200
524d5bf4f67SEmil Tantilov #define IXGBE_10K_ITR		400
525d5bf4f67SEmil Tantilov #define IXGBE_8K_ITR		500
526dee1ad47SJeff Kirsher 
527f56e0cb1SAlexander Duyck /* ixgbe_test_staterr - tests bits in Rx descriptor status and error fields */
528f56e0cb1SAlexander Duyck static inline __le32 ixgbe_test_staterr(union ixgbe_adv_rx_desc *rx_desc,
529f56e0cb1SAlexander Duyck 					const u32 stat_err_bits)
530f56e0cb1SAlexander Duyck {
531f56e0cb1SAlexander Duyck 	return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
532f56e0cb1SAlexander Duyck }
533f56e0cb1SAlexander Duyck 
534dee1ad47SJeff Kirsher static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring)
535dee1ad47SJeff Kirsher {
536dee1ad47SJeff Kirsher 	u16 ntc = ring->next_to_clean;
537dee1ad47SJeff Kirsher 	u16 ntu = ring->next_to_use;
538dee1ad47SJeff Kirsher 
539dee1ad47SJeff Kirsher 	return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
540dee1ad47SJeff Kirsher }
541dee1ad47SJeff Kirsher 
542e4f74028SAlexander Duyck #define IXGBE_RX_DESC(R, i)	    \
543dee1ad47SJeff Kirsher 	(&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
544e4f74028SAlexander Duyck #define IXGBE_TX_DESC(R, i)	    \
545dee1ad47SJeff Kirsher 	(&(((union ixgbe_adv_tx_desc *)((R)->desc))[i]))
546e4f74028SAlexander Duyck #define IXGBE_TX_CTXTDESC(R, i)	    \
547dee1ad47SJeff Kirsher 	(&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
548dee1ad47SJeff Kirsher 
549c88887e0SAlexander Duyck #define IXGBE_MAX_JUMBO_FRAME_SIZE	9728 /* Maximum Supported Size 9.5KB */
550dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
551dee1ad47SJeff Kirsher /* Use 3K as the baby jumbo frame size for FCoE */
552dee1ad47SJeff Kirsher #define IXGBE_FCOE_JUMBO_FRAME_SIZE       3072
553dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
554dee1ad47SJeff Kirsher 
555dee1ad47SJeff Kirsher #define OTHER_VECTOR 1
556dee1ad47SJeff Kirsher #define NON_Q_VECTORS (OTHER_VECTOR)
557dee1ad47SJeff Kirsher 
558dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82599 64
55949c7ffbeSAlexander Duyck #define MAX_Q_VECTORS_82599 64
560dee1ad47SJeff Kirsher #define MAX_MSIX_VECTORS_82598 18
56149c7ffbeSAlexander Duyck #define MAX_Q_VECTORS_82598 16
562dee1ad47SJeff Kirsher 
56349c7ffbeSAlexander Duyck #define MAX_Q_VECTORS MAX_Q_VECTORS_82599
564dee1ad47SJeff Kirsher #define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82599
565dee1ad47SJeff Kirsher 
5668f15486dSAlexander Duyck #define MIN_MSIX_Q_VECTORS 1
567dee1ad47SJeff Kirsher #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS)
568dee1ad47SJeff Kirsher 
56946646e61SAlexander Duyck /* default to trying for four seconds */
57046646e61SAlexander Duyck #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ)
57146646e61SAlexander Duyck 
572dee1ad47SJeff Kirsher /* board specific private data structure */
573dee1ad47SJeff Kirsher struct ixgbe_adapter {
57446646e61SAlexander Duyck 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
57546646e61SAlexander Duyck 	/* OS defined structs */
57646646e61SAlexander Duyck 	struct net_device *netdev;
57746646e61SAlexander Duyck 	struct pci_dev *pdev;
57846646e61SAlexander Duyck 
579dee1ad47SJeff Kirsher 	unsigned long state;
580dee1ad47SJeff Kirsher 
581dee1ad47SJeff Kirsher 	/* Some features need tri-state capability,
582dee1ad47SJeff Kirsher 	 * thus the additional *_CAPABLE flags.
583dee1ad47SJeff Kirsher 	 */
584dee1ad47SJeff Kirsher 	u32 flags;
585a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MSI_CAPABLE                  (u32)(1 << 0)
586a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MSI_ENABLED                  (u32)(1 << 1)
587a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MSIX_CAPABLE                 (u32)(1 << 2)
588a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MSIX_ENABLED                 (u32)(1 << 3)
589a16a0d2fSAlexander Duyck #define IXGBE_FLAG_RX_1BUF_CAPABLE              (u32)(1 << 4)
590a16a0d2fSAlexander Duyck #define IXGBE_FLAG_RX_PS_CAPABLE                (u32)(1 << 5)
591a16a0d2fSAlexander Duyck #define IXGBE_FLAG_RX_PS_ENABLED                (u32)(1 << 6)
592a16a0d2fSAlexander Duyck #define IXGBE_FLAG_IN_NETPOLL                   (u32)(1 << 7)
593a16a0d2fSAlexander Duyck #define IXGBE_FLAG_DCA_ENABLED                  (u32)(1 << 8)
594a16a0d2fSAlexander Duyck #define IXGBE_FLAG_DCA_CAPABLE                  (u32)(1 << 9)
595a16a0d2fSAlexander Duyck #define IXGBE_FLAG_IMIR_ENABLED                 (u32)(1 << 10)
596a16a0d2fSAlexander Duyck #define IXGBE_FLAG_MQ_CAPABLE                   (u32)(1 << 11)
597a16a0d2fSAlexander Duyck #define IXGBE_FLAG_DCB_ENABLED                  (u32)(1 << 12)
598a16a0d2fSAlexander Duyck #define IXGBE_FLAG_VMDQ_CAPABLE                 (u32)(1 << 13)
599a16a0d2fSAlexander Duyck #define IXGBE_FLAG_VMDQ_ENABLED                 (u32)(1 << 14)
600a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FAN_FAIL_CAPABLE             (u32)(1 << 15)
601a16a0d2fSAlexander Duyck #define IXGBE_FLAG_NEED_LINK_UPDATE             (u32)(1 << 16)
602a16a0d2fSAlexander Duyck #define IXGBE_FLAG_NEED_LINK_CONFIG             (u32)(1 << 17)
603a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FDIR_HASH_CAPABLE            (u32)(1 << 18)
604a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE         (u32)(1 << 19)
605a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FCOE_CAPABLE                 (u32)(1 << 20)
606a16a0d2fSAlexander Duyck #define IXGBE_FLAG_FCOE_ENABLED                 (u32)(1 << 21)
607a16a0d2fSAlexander Duyck #define IXGBE_FLAG_SRIOV_CAPABLE                (u32)(1 << 22)
608a16a0d2fSAlexander Duyck #define IXGBE_FLAG_SRIOV_ENABLED                (u32)(1 << 23)
609dee1ad47SJeff Kirsher 
610dee1ad47SJeff Kirsher 	u32 flags2;
611a16a0d2fSAlexander Duyck #define IXGBE_FLAG2_RSC_CAPABLE                 (u32)(1 << 0)
612dee1ad47SJeff Kirsher #define IXGBE_FLAG2_RSC_ENABLED                 (u32)(1 << 1)
613dee1ad47SJeff Kirsher #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE         (u32)(1 << 2)
614dee1ad47SJeff Kirsher #define IXGBE_FLAG2_TEMP_SENSOR_EVENT           (u32)(1 << 3)
615dee1ad47SJeff Kirsher #define IXGBE_FLAG2_SEARCH_FOR_SFP              (u32)(1 << 4)
616dee1ad47SJeff Kirsher #define IXGBE_FLAG2_SFP_NEEDS_RESET             (u32)(1 << 5)
617dee1ad47SJeff Kirsher #define IXGBE_FLAG2_RESET_REQUESTED             (u32)(1 << 6)
618dee1ad47SJeff Kirsher #define IXGBE_FLAG2_FDIR_REQUIRES_REINIT        (u32)(1 << 7)
619ef6afc0cSAlexander Duyck #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP		(u32)(1 << 8)
620ef6afc0cSAlexander Duyck #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP		(u32)(1 << 9)
6218fecf67cSJacob Keller #define IXGBE_FLAG2_PTP_PPS_ENABLED		(u32)(1 << 10)
6228fecf67cSJacob Keller #define IXGBE_FLAG2_BRIDGE_MODE_VEB		(u32)(1 << 11)
62346646e61SAlexander Duyck 
62446646e61SAlexander Duyck 	/* Tx fast path data */
62546646e61SAlexander Duyck 	int num_tx_queues;
62646646e61SAlexander Duyck 	u16 tx_itr_setting;
62746646e61SAlexander Duyck 	u16 tx_work_limit;
62846646e61SAlexander Duyck 
62946646e61SAlexander Duyck 	/* Rx fast path data */
63046646e61SAlexander Duyck 	int num_rx_queues;
63146646e61SAlexander Duyck 	u16 rx_itr_setting;
63246646e61SAlexander Duyck 
63346646e61SAlexander Duyck 	/* TX */
63446646e61SAlexander Duyck 	struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp;
63546646e61SAlexander Duyck 
63646646e61SAlexander Duyck 	u64 restart_queue;
63746646e61SAlexander Duyck 	u64 lsc_int;
63846646e61SAlexander Duyck 	u32 tx_timeout_count;
63946646e61SAlexander Duyck 
64046646e61SAlexander Duyck 	/* RX */
64146646e61SAlexander Duyck 	struct ixgbe_ring *rx_ring[MAX_RX_QUEUES];
64246646e61SAlexander Duyck 	int num_rx_pools;		/* == num_rx_queues in 82598 */
64346646e61SAlexander Duyck 	int num_rx_queues_per_pool;	/* 1 if 82598, can be many if 82599 */
64446646e61SAlexander Duyck 	u64 hw_csum_rx_error;
64546646e61SAlexander Duyck 	u64 hw_rx_no_dma_resources;
64646646e61SAlexander Duyck 	u64 rsc_total_count;
64746646e61SAlexander Duyck 	u64 rsc_total_flush;
64846646e61SAlexander Duyck 	u64 non_eop_descs;
64946646e61SAlexander Duyck 	u32 alloc_rx_page_failed;
65046646e61SAlexander Duyck 	u32 alloc_rx_buff_failed;
65146646e61SAlexander Duyck 
65249c7ffbeSAlexander Duyck 	struct ixgbe_q_vector *q_vector[MAX_Q_VECTORS];
653dee1ad47SJeff Kirsher 
654dee1ad47SJeff Kirsher 	/* DCB parameters */
655dee1ad47SJeff Kirsher 	struct ieee_pfc *ixgbe_ieee_pfc;
656dee1ad47SJeff Kirsher 	struct ieee_ets *ixgbe_ieee_ets;
657dee1ad47SJeff Kirsher 	struct ixgbe_dcb_config dcb_cfg;
658dee1ad47SJeff Kirsher 	struct ixgbe_dcb_config temp_dcb_cfg;
659dee1ad47SJeff Kirsher 	u8 dcb_set_bitmap;
660dee1ad47SJeff Kirsher 	u8 dcbx_cap;
661dee1ad47SJeff Kirsher 	enum ixgbe_fc_mode last_lfc_mode;
662dee1ad47SJeff Kirsher 
66349c7ffbeSAlexander Duyck 	int num_q_vectors;	/* current number of q_vectors for device */
66449c7ffbeSAlexander Duyck 	int max_q_vectors;	/* true count of q_vectors for device */
665dee1ad47SJeff Kirsher 	struct ixgbe_ring_feature ring_feature[RING_F_ARRAY_SIZE];
666dee1ad47SJeff Kirsher 	struct msix_entry *msix_entries;
667dee1ad47SJeff Kirsher 
668dee1ad47SJeff Kirsher 	u32 test_icr;
669dee1ad47SJeff Kirsher 	struct ixgbe_ring test_tx_ring;
670dee1ad47SJeff Kirsher 	struct ixgbe_ring test_rx_ring;
671dee1ad47SJeff Kirsher 
672dee1ad47SJeff Kirsher 	/* structs defined in ixgbe_hw.h */
673dee1ad47SJeff Kirsher 	struct ixgbe_hw hw;
674dee1ad47SJeff Kirsher 	u16 msg_enable;
675dee1ad47SJeff Kirsher 	struct ixgbe_hw_stats stats;
676dee1ad47SJeff Kirsher 
677dee1ad47SJeff Kirsher 	u64 tx_busy;
678dee1ad47SJeff Kirsher 	unsigned int tx_ring_count;
679dee1ad47SJeff Kirsher 	unsigned int rx_ring_count;
680dee1ad47SJeff Kirsher 
681dee1ad47SJeff Kirsher 	u32 link_speed;
682dee1ad47SJeff Kirsher 	bool link_up;
683dee1ad47SJeff Kirsher 	unsigned long link_check_timeout;
684dee1ad47SJeff Kirsher 
685dee1ad47SJeff Kirsher 	struct timer_list service_timer;
68646646e61SAlexander Duyck 	struct work_struct service_task;
68746646e61SAlexander Duyck 
68846646e61SAlexander Duyck 	struct hlist_head fdir_filter_list;
68946646e61SAlexander Duyck 	unsigned long fdir_overflow; /* number of times ATR was backed off */
69046646e61SAlexander Duyck 	union ixgbe_atr_input fdir_mask;
69146646e61SAlexander Duyck 	int fdir_filter_count;
692dee1ad47SJeff Kirsher 	u32 fdir_pballoc;
693dee1ad47SJeff Kirsher 	u32 atr_sample_rate;
694dee1ad47SJeff Kirsher 	spinlock_t fdir_perfect_lock;
69546646e61SAlexander Duyck 
696dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
697dee1ad47SJeff Kirsher 	struct ixgbe_fcoe fcoe;
698dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
699dee1ad47SJeff Kirsher 	u32 wol;
70046646e61SAlexander Duyck 
70146646e61SAlexander Duyck 	u16 bd_number;
70246646e61SAlexander Duyck 
70315e5209fSEmil Tantilov 	u16 eeprom_verh;
70415e5209fSEmil Tantilov 	u16 eeprom_verl;
705c23f5b6bSEmil Tantilov 	u16 eeprom_cap;
706dee1ad47SJeff Kirsher 
707dee1ad47SJeff Kirsher 	u32 interrupt_event;
70846646e61SAlexander Duyck 	u32 led_reg;
709dee1ad47SJeff Kirsher 
7103a6a4edaSJacob Keller 	struct ptp_clock *ptp_clock;
7113a6a4edaSJacob Keller 	struct ptp_clock_info ptp_caps;
712891dc082SJacob Keller 	struct work_struct ptp_tx_work;
713891dc082SJacob Keller 	struct sk_buff *ptp_tx_skb;
714891dc082SJacob Keller 	unsigned long ptp_tx_start;
7153a6a4edaSJacob Keller 	unsigned long last_overflow_check;
7166cb562d6SJacob Keller 	unsigned long last_rx_ptp_check;
7173a6a4edaSJacob Keller 	spinlock_t tmreg_lock;
7183a6a4edaSJacob Keller 	struct cyclecounter cc;
7193a6a4edaSJacob Keller 	struct timecounter tc;
7203a6a4edaSJacob Keller 	u32 base_incval;
7213a6a4edaSJacob Keller 
722dee1ad47SJeff Kirsher 	/* SR-IOV */
723dee1ad47SJeff Kirsher 	DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS);
724dee1ad47SJeff Kirsher 	unsigned int num_vfs;
725dee1ad47SJeff Kirsher 	struct vf_data_storage *vfinfo;
726dee1ad47SJeff Kirsher 	int vf_rate_link_speed;
727dee1ad47SJeff Kirsher 	struct vf_macvlans vf_mvs;
728dee1ad47SJeff Kirsher 	struct vf_macvlans *mv_list;
729dee1ad47SJeff Kirsher 
73083c61fa9SGreg Rose 	u32 timer_event_accumulator;
73183c61fa9SGreg Rose 	u32 vferr_refcount;
7323ca8bc6dSDon Skidmore 	struct kobject *info_kobj;
7333ca8bc6dSDon Skidmore #ifdef CONFIG_IXGBE_HWMON
7343ca8bc6dSDon Skidmore 	struct hwmon_buff ixgbe_hwmon_buff;
7353ca8bc6dSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */
73600949167SCatherine Sullivan #ifdef CONFIG_DEBUG_FS
73700949167SCatherine Sullivan 	struct dentry *ixgbe_dbg_adapter;
73800949167SCatherine Sullivan #endif /*CONFIG_DEBUG_FS*/
739107d3018SAlexander Duyck 
740107d3018SAlexander Duyck 	u8 default_up;
741dee1ad47SJeff Kirsher };
742dee1ad47SJeff Kirsher 
743dee1ad47SJeff Kirsher struct ixgbe_fdir_filter {
744dee1ad47SJeff Kirsher 	struct hlist_node fdir_node;
745dee1ad47SJeff Kirsher 	union ixgbe_atr_input filter;
746dee1ad47SJeff Kirsher 	u16 sw_idx;
747dee1ad47SJeff Kirsher 	u16 action;
748dee1ad47SJeff Kirsher };
749dee1ad47SJeff Kirsher 
75070e5576cSDon Skidmore enum ixgbe_state_t {
751dee1ad47SJeff Kirsher 	__IXGBE_TESTING,
752dee1ad47SJeff Kirsher 	__IXGBE_RESETTING,
753dee1ad47SJeff Kirsher 	__IXGBE_DOWN,
754dee1ad47SJeff Kirsher 	__IXGBE_SERVICE_SCHED,
755dee1ad47SJeff Kirsher 	__IXGBE_IN_SFP_INIT,
7568fecf67cSJacob Keller 	__IXGBE_PTP_RUNNING,
757dee1ad47SJeff Kirsher };
758dee1ad47SJeff Kirsher 
7594c1975d7SAlexander Duyck struct ixgbe_cb {
7604c1975d7SAlexander Duyck 	union {				/* Union defining head/tail partner */
7614c1975d7SAlexander Duyck 		struct sk_buff *head;
7624c1975d7SAlexander Duyck 		struct sk_buff *tail;
7634c1975d7SAlexander Duyck 	};
764dee1ad47SJeff Kirsher 	dma_addr_t dma;
7654c1975d7SAlexander Duyck 	u16 append_cnt;
766f800326dSAlexander Duyck 	bool page_released;
767dee1ad47SJeff Kirsher };
7684c1975d7SAlexander Duyck #define IXGBE_CB(skb) ((struct ixgbe_cb *)(skb)->cb)
769dee1ad47SJeff Kirsher 
770dee1ad47SJeff Kirsher enum ixgbe_boards {
771dee1ad47SJeff Kirsher 	board_82598,
772dee1ad47SJeff Kirsher 	board_82599,
773dee1ad47SJeff Kirsher 	board_X540,
774dee1ad47SJeff Kirsher };
775dee1ad47SJeff Kirsher 
776dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_82598_info;
777dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_82599_info;
778dee1ad47SJeff Kirsher extern struct ixgbe_info ixgbe_X540_info;
779dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB
780dee1ad47SJeff Kirsher extern const struct dcbnl_rtnl_ops dcbnl_ops;
781dee1ad47SJeff Kirsher #endif
782dee1ad47SJeff Kirsher 
783dee1ad47SJeff Kirsher extern char ixgbe_driver_name[];
784dee1ad47SJeff Kirsher extern const char ixgbe_driver_version[];
7858af3c33fSJeff Kirsher #ifdef IXGBE_FCOE
786ea81875aSNeerav Parikh extern char ixgbe_default_device_descr[];
7878af3c33fSJeff Kirsher #endif /* IXGBE_FCOE */
788dee1ad47SJeff Kirsher 
7895ccc921aSJoe Perches void ixgbe_up(struct ixgbe_adapter *adapter);
7905ccc921aSJoe Perches void ixgbe_down(struct ixgbe_adapter *adapter);
7915ccc921aSJoe Perches void ixgbe_reinit_locked(struct ixgbe_adapter *adapter);
7925ccc921aSJoe Perches void ixgbe_reset(struct ixgbe_adapter *adapter);
7935ccc921aSJoe Perches void ixgbe_set_ethtool_ops(struct net_device *netdev);
7945ccc921aSJoe Perches int ixgbe_setup_rx_resources(struct ixgbe_ring *);
7955ccc921aSJoe Perches int ixgbe_setup_tx_resources(struct ixgbe_ring *);
7965ccc921aSJoe Perches void ixgbe_free_rx_resources(struct ixgbe_ring *);
7975ccc921aSJoe Perches void ixgbe_free_tx_resources(struct ixgbe_ring *);
7985ccc921aSJoe Perches void ixgbe_configure_rx_ring(struct ixgbe_adapter *, struct ixgbe_ring *);
7995ccc921aSJoe Perches void ixgbe_configure_tx_ring(struct ixgbe_adapter *, struct ixgbe_ring *);
8005ccc921aSJoe Perches void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_ring *);
8015ccc921aSJoe Perches void ixgbe_update_stats(struct ixgbe_adapter *adapter);
8025ccc921aSJoe Perches int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
8035ccc921aSJoe Perches int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
8048e2813f5SJacob Keller 			       u16 subdevice_id);
8055ccc921aSJoe Perches void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter);
8065ccc921aSJoe Perches netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, struct ixgbe_adapter *,
807dee1ad47SJeff Kirsher 				  struct ixgbe_ring *);
8085ccc921aSJoe Perches void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *,
809dee1ad47SJeff Kirsher 				      struct ixgbe_tx_buffer *);
8105ccc921aSJoe Perches void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16);
8115ccc921aSJoe Perches void ixgbe_write_eitr(struct ixgbe_q_vector *);
8125ccc921aSJoe Perches int ixgbe_poll(struct napi_struct *napi, int budget);
8135ccc921aSJoe Perches int ethtool_ioctl(struct ifreq *ifr);
8145ccc921aSJoe Perches s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);
8155ccc921aSJoe Perches s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl);
8165ccc921aSJoe Perches s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl);
8175ccc921aSJoe Perches s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
818dee1ad47SJeff Kirsher 					  union ixgbe_atr_hash_dword input,
819dee1ad47SJeff Kirsher 					  union ixgbe_atr_hash_dword common,
820dee1ad47SJeff Kirsher 					  u8 queue);
8215ccc921aSJoe Perches s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,
822dee1ad47SJeff Kirsher 				    union ixgbe_atr_input *input_mask);
8235ccc921aSJoe Perches s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
824dee1ad47SJeff Kirsher 					  union ixgbe_atr_input *input,
825dee1ad47SJeff Kirsher 					  u16 soft_id, u8 queue);
8265ccc921aSJoe Perches s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw,
827dee1ad47SJeff Kirsher 					  union ixgbe_atr_input *input,
828dee1ad47SJeff Kirsher 					  u16 soft_id);
8295ccc921aSJoe Perches void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
830dee1ad47SJeff Kirsher 					  union ixgbe_atr_input *mask);
8315ccc921aSJoe Perches bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
8325ccc921aSJoe Perches void ixgbe_set_rx_mode(struct net_device *netdev);
8338af3c33fSJeff Kirsher #ifdef CONFIG_IXGBE_DCB
8345ccc921aSJoe Perches void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter);
8358af3c33fSJeff Kirsher #endif
8365ccc921aSJoe Perches int ixgbe_setup_tc(struct net_device *dev, u8 tc);
8375ccc921aSJoe Perches void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32);
8385ccc921aSJoe Perches void ixgbe_do_reset(struct net_device *netdev);
8391210982bSDon Skidmore #ifdef CONFIG_IXGBE_HWMON
8405ccc921aSJoe Perches void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter);
8415ccc921aSJoe Perches int ixgbe_sysfs_init(struct ixgbe_adapter *adapter);
8421210982bSDon Skidmore #endif /* CONFIG_IXGBE_HWMON */
843dee1ad47SJeff Kirsher #ifdef IXGBE_FCOE
8445ccc921aSJoe Perches void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter);
8455ccc921aSJoe Perches int ixgbe_fso(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first,
846244e27adSAlexander Duyck 	      u8 *hdr_len);
8475ccc921aSJoe Perches int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
8485ccc921aSJoe Perches 		   union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb);
8495ccc921aSJoe Perches int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
850dee1ad47SJeff Kirsher 		       struct scatterlist *sgl, unsigned int sgc);
8515ccc921aSJoe Perches int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid,
852dee1ad47SJeff Kirsher 			  struct scatterlist *sgl, unsigned int sgc);
8535ccc921aSJoe Perches int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
8545ccc921aSJoe Perches int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter);
8555ccc921aSJoe Perches void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter);
8565ccc921aSJoe Perches int ixgbe_fcoe_enable(struct net_device *netdev);
8575ccc921aSJoe Perches int ixgbe_fcoe_disable(struct net_device *netdev);
858dee1ad47SJeff Kirsher #ifdef CONFIG_IXGBE_DCB
8595ccc921aSJoe Perches u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter);
8605ccc921aSJoe Perches u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up);
861dee1ad47SJeff Kirsher #endif /* CONFIG_IXGBE_DCB */
8625ccc921aSJoe Perches int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
8635ccc921aSJoe Perches int ixgbe_fcoe_get_hbainfo(struct net_device *netdev,
864ea81875aSNeerav Parikh 			   struct netdev_fcoe_hbainfo *info);
8655ccc921aSJoe Perches u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter);
866dee1ad47SJeff Kirsher #endif /* IXGBE_FCOE */
86700949167SCatherine Sullivan #ifdef CONFIG_DEBUG_FS
8685ccc921aSJoe Perches void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter);
8695ccc921aSJoe Perches void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter);
8705ccc921aSJoe Perches void ixgbe_dbg_init(void);
8715ccc921aSJoe Perches void ixgbe_dbg_exit(void);
87233243fb0SJoe Perches #else
87333243fb0SJoe Perches static inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {}
87433243fb0SJoe Perches static inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {}
87533243fb0SJoe Perches static inline void ixgbe_dbg_init(void) {}
87633243fb0SJoe Perches static inline void ixgbe_dbg_exit(void) {}
87700949167SCatherine Sullivan #endif /* CONFIG_DEBUG_FS */
878b2d96e0aSAlexander Duyck static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
879b2d96e0aSAlexander Duyck {
880b2d96e0aSAlexander Duyck 	return netdev_get_tx_queue(ring->netdev, ring->queue_index);
881b2d96e0aSAlexander Duyck }
882b2d96e0aSAlexander Duyck 
8835ccc921aSJoe Perches void ixgbe_ptp_init(struct ixgbe_adapter *adapter);
8845ccc921aSJoe Perches void ixgbe_ptp_stop(struct ixgbe_adapter *adapter);
8855ccc921aSJoe Perches void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter);
8865ccc921aSJoe Perches void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter);
8875ccc921aSJoe Perches void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,
8883a6a4edaSJacob Keller 			     struct sk_buff *skb);
88939dfb71bSAlexander Duyck static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring,
89039dfb71bSAlexander Duyck 					 union ixgbe_adv_rx_desc *rx_desc,
89139dfb71bSAlexander Duyck 					 struct sk_buff *skb)
89239dfb71bSAlexander Duyck {
89339dfb71bSAlexander Duyck 	if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS)))
89439dfb71bSAlexander Duyck 		return;
89539dfb71bSAlexander Duyck 
89639dfb71bSAlexander Duyck 	__ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, skb);
89739dfb71bSAlexander Duyck 
89839dfb71bSAlexander Duyck 	/*
89939dfb71bSAlexander Duyck 	 * Update the last_rx_timestamp timer in order to enable watchdog check
90039dfb71bSAlexander Duyck 	 * for error case of latched timestamp on a dropped packet.
90139dfb71bSAlexander Duyck 	 */
90239dfb71bSAlexander Duyck 	rx_ring->last_rx_timestamp = jiffies;
90339dfb71bSAlexander Duyck }
90439dfb71bSAlexander Duyck 
9055ccc921aSJoe Perches int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, struct ifreq *ifr,
9065ccc921aSJoe Perches 			     int cmd);
9075ccc921aSJoe Perches void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter);
9085ccc921aSJoe Perches void ixgbe_ptp_reset(struct ixgbe_adapter *adapter);
9095ccc921aSJoe Perches void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr);
910da36b647SGreg Rose #ifdef CONFIG_PCI_IOV
911da36b647SGreg Rose void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter);
912da36b647SGreg Rose #endif
9133a6a4edaSJacob Keller 
914dee1ad47SJeff Kirsher #endif /* _IXGBE_H_ */
915