1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*******************************************************************************
3 
4   Intel 10 Gigabit PCI Express Linux driver
5   Copyright(c) 1999 - 2016 Intel Corporation.
6 
7   This program is free software; you can redistribute it and/or modify it
8   under the terms and conditions of the GNU General Public License,
9   version 2, as published by the Free Software Foundation.
10 
11   This program is distributed in the hope it will be useful, but WITHOUT
12   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14   more details.
15 
16   You should have received a copy of the GNU General Public License along with
17   this program; if not, write to the Free Software Foundation, Inc.,
18   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 
20   The full GNU General Public License is included in this distribution in
21   the file called "COPYING".
22 
23   Contact Information:
24   Linux NICS <linux.nics@intel.com>
25   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
26   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 
28 *******************************************************************************/
29 
30 #ifndef _IXGBE_H_
31 #define _IXGBE_H_
32 
33 #include <linux/bitops.h>
34 #include <linux/types.h>
35 #include <linux/pci.h>
36 #include <linux/netdevice.h>
37 #include <linux/cpumask.h>
38 #include <linux/aer.h>
39 #include <linux/if_vlan.h>
40 #include <linux/jiffies.h>
41 
42 #include <linux/timecounter.h>
43 #include <linux/net_tstamp.h>
44 #include <linux/ptp_clock_kernel.h>
45 
46 #include "ixgbe_type.h"
47 #include "ixgbe_common.h"
48 #include "ixgbe_dcb.h"
49 #if IS_ENABLED(CONFIG_FCOE)
50 #define IXGBE_FCOE
51 #include "ixgbe_fcoe.h"
52 #endif /* IS_ENABLED(CONFIG_FCOE) */
53 #ifdef CONFIG_IXGBE_DCA
54 #include <linux/dca.h>
55 #endif
56 #include "ixgbe_ipsec.h"
57 
58 #include <net/xdp.h>
59 #include <net/busy_poll.h>
60 
61 /* common prefix used by pr_<> macros */
62 #undef pr_fmt
63 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
64 
65 /* TX/RX descriptor defines */
66 #define IXGBE_DEFAULT_TXD		    512
67 #define IXGBE_DEFAULT_TX_WORK		    256
68 #define IXGBE_MAX_TXD			   4096
69 #define IXGBE_MIN_TXD			     64
70 
71 #if (PAGE_SIZE < 8192)
72 #define IXGBE_DEFAULT_RXD		    512
73 #else
74 #define IXGBE_DEFAULT_RXD		    128
75 #endif
76 #define IXGBE_MAX_RXD			   4096
77 #define IXGBE_MIN_RXD			     64
78 
79 #define IXGBE_ETH_P_LLDP		 0x88CC
80 
81 /* flow control */
82 #define IXGBE_MIN_FCRTL			   0x40
83 #define IXGBE_MAX_FCRTL			0x7FF80
84 #define IXGBE_MIN_FCRTH			  0x600
85 #define IXGBE_MAX_FCRTH			0x7FFF0
86 #define IXGBE_DEFAULT_FCPAUSE		 0xFFFF
87 #define IXGBE_MIN_FCPAUSE		      0
88 #define IXGBE_MAX_FCPAUSE		 0xFFFF
89 
90 /* Supported Rx Buffer Sizes */
91 #define IXGBE_RXBUFFER_256    256  /* Used for skb receive header */
92 #define IXGBE_RXBUFFER_1536  1536
93 #define IXGBE_RXBUFFER_2K    2048
94 #define IXGBE_RXBUFFER_3K    3072
95 #define IXGBE_RXBUFFER_4K    4096
96 #define IXGBE_MAX_RXBUFFER  16384  /* largest size for a single descriptor */
97 
98 /* Attempt to maximize the headroom available for incoming frames.  We
99  * use a 2K buffer for receives and need 1536/1534 to store the data for
100  * the frame.  This leaves us with 512 bytes of room.  From that we need
101  * to deduct the space needed for the shared info and the padding needed
102  * to IP align the frame.
103  *
104  * Note: For cache line sizes 256 or larger this value is going to end
105  *	 up negative.  In these cases we should fall back to the 3K
106  *	 buffers.
107  */
108 #if (PAGE_SIZE < 8192)
109 #define IXGBE_MAX_2K_FRAME_BUILD_SKB (IXGBE_RXBUFFER_1536 - NET_IP_ALIGN)
110 #define IXGBE_2K_TOO_SMALL_WITH_PADDING \
111 ((NET_SKB_PAD + IXGBE_RXBUFFER_1536) > SKB_WITH_OVERHEAD(IXGBE_RXBUFFER_2K))
112 
113 static inline int ixgbe_compute_pad(int rx_buf_len)
114 {
115 	int page_size, pad_size;
116 
117 	page_size = ALIGN(rx_buf_len, PAGE_SIZE / 2);
118 	pad_size = SKB_WITH_OVERHEAD(page_size) - rx_buf_len;
119 
120 	return pad_size;
121 }
122 
123 static inline int ixgbe_skb_pad(void)
124 {
125 	int rx_buf_len;
126 
127 	/* If a 2K buffer cannot handle a standard Ethernet frame then
128 	 * optimize padding for a 3K buffer instead of a 1.5K buffer.
129 	 *
130 	 * For a 3K buffer we need to add enough padding to allow for
131 	 * tailroom due to NET_IP_ALIGN possibly shifting us out of
132 	 * cache-line alignment.
133 	 */
134 	if (IXGBE_2K_TOO_SMALL_WITH_PADDING)
135 		rx_buf_len = IXGBE_RXBUFFER_3K + SKB_DATA_ALIGN(NET_IP_ALIGN);
136 	else
137 		rx_buf_len = IXGBE_RXBUFFER_1536;
138 
139 	/* if needed make room for NET_IP_ALIGN */
140 	rx_buf_len -= NET_IP_ALIGN;
141 
142 	return ixgbe_compute_pad(rx_buf_len);
143 }
144 
145 #define IXGBE_SKB_PAD	ixgbe_skb_pad()
146 #else
147 #define IXGBE_SKB_PAD	(NET_SKB_PAD + NET_IP_ALIGN)
148 #endif
149 
150 /*
151  * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN means we
152  * reserve 64 more, and skb_shared_info adds an additional 320 bytes more,
153  * this adds up to 448 bytes of extra data.
154  *
155  * Since netdev_alloc_skb now allocates a page fragment we can use a value
156  * of 256 and the resultant skb will have a truesize of 960 or less.
157  */
158 #define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_256
159 
160 /* How many Rx Buffers do we bundle into one write to the hardware ? */
161 #define IXGBE_RX_BUFFER_WRITE	16	/* Must be power of 2 */
162 
163 #define IXGBE_RX_DMA_ATTR \
164 	(DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING)
165 
166 enum ixgbe_tx_flags {
167 	/* cmd_type flags */
168 	IXGBE_TX_FLAGS_HW_VLAN	= 0x01,
169 	IXGBE_TX_FLAGS_TSO	= 0x02,
170 	IXGBE_TX_FLAGS_TSTAMP	= 0x04,
171 
172 	/* olinfo flags */
173 	IXGBE_TX_FLAGS_CC	= 0x08,
174 	IXGBE_TX_FLAGS_IPV4	= 0x10,
175 	IXGBE_TX_FLAGS_CSUM	= 0x20,
176 	IXGBE_TX_FLAGS_IPSEC	= 0x40,
177 
178 	/* software defined flags */
179 	IXGBE_TX_FLAGS_SW_VLAN	= 0x80,
180 	IXGBE_TX_FLAGS_FCOE	= 0x100,
181 };
182 
183 /* VLAN info */
184 #define IXGBE_TX_FLAGS_VLAN_MASK	0xffff0000
185 #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK	0xe0000000
186 #define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT  29
187 #define IXGBE_TX_FLAGS_VLAN_SHIFT	16
188 
189 #define IXGBE_MAX_VF_MC_ENTRIES         30
190 #define IXGBE_MAX_VF_FUNCTIONS          64
191 #define IXGBE_MAX_VFTA_ENTRIES          128
192 #define MAX_EMULATION_MAC_ADDRS         16
193 #define IXGBE_MAX_PF_MACVLANS           15
194 #define VMDQ_P(p)   ((p) + adapter->ring_feature[RING_F_VMDQ].offset)
195 #define IXGBE_82599_VF_DEVICE_ID        0x10ED
196 #define IXGBE_X540_VF_DEVICE_ID         0x1515
197 
198 struct vf_data_storage {
199 	struct pci_dev *vfdev;
200 	unsigned char vf_mac_addresses[ETH_ALEN];
201 	u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES];
202 	u16 num_vf_mc_hashes;
203 	bool clear_to_send;
204 	bool pf_set_mac;
205 	u16 pf_vlan; /* When set, guest VLAN config not allowed. */
206 	u16 pf_qos;
207 	u16 tx_rate;
208 	u8 spoofchk_enabled;
209 	bool rss_query_enabled;
210 	u8 trusted;
211 	int xcast_mode;
212 	unsigned int vf_api;
213 };
214 
215 enum ixgbevf_xcast_modes {
216 	IXGBEVF_XCAST_MODE_NONE = 0,
217 	IXGBEVF_XCAST_MODE_MULTI,
218 	IXGBEVF_XCAST_MODE_ALLMULTI,
219 	IXGBEVF_XCAST_MODE_PROMISC,
220 };
221 
222 struct vf_macvlans {
223 	struct list_head l;
224 	int vf;
225 	bool free;
226 	bool is_macvlan;
227 	u8 vf_macvlan[ETH_ALEN];
228 };
229 
230 #define IXGBE_MAX_TXD_PWR	14
231 #define IXGBE_MAX_DATA_PER_TXD	(1u << IXGBE_MAX_TXD_PWR)
232 
233 /* Tx Descriptors needed, worst case */
234 #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD)
235 #define DESC_NEEDED (MAX_SKB_FRAGS + 4)
236 
237 /* wrapper around a pointer to a socket buffer,
238  * so a DMA handle can be stored along with the buffer */
239 struct ixgbe_tx_buffer {
240 	union ixgbe_adv_tx_desc *next_to_watch;
241 	unsigned long time_stamp;
242 	union {
243 		struct sk_buff *skb;
244 		/* XDP uses address ptr on irq_clean */
245 		void *data;
246 	};
247 	unsigned int bytecount;
248 	unsigned short gso_segs;
249 	__be16 protocol;
250 	DEFINE_DMA_UNMAP_ADDR(dma);
251 	DEFINE_DMA_UNMAP_LEN(len);
252 	u32 tx_flags;
253 };
254 
255 struct ixgbe_rx_buffer {
256 	struct sk_buff *skb;
257 	dma_addr_t dma;
258 	struct page *page;
259 #if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
260 	__u32 page_offset;
261 #else
262 	__u16 page_offset;
263 #endif
264 	__u16 pagecnt_bias;
265 };
266 
267 struct ixgbe_queue_stats {
268 	u64 packets;
269 	u64 bytes;
270 };
271 
272 struct ixgbe_tx_queue_stats {
273 	u64 restart_queue;
274 	u64 tx_busy;
275 	u64 tx_done_old;
276 };
277 
278 struct ixgbe_rx_queue_stats {
279 	u64 rsc_count;
280 	u64 rsc_flush;
281 	u64 non_eop_descs;
282 	u64 alloc_rx_page;
283 	u64 alloc_rx_page_failed;
284 	u64 alloc_rx_buff_failed;
285 	u64 csum_err;
286 };
287 
288 #define IXGBE_TS_HDR_LEN 8
289 
290 enum ixgbe_ring_state_t {
291 	__IXGBE_RX_3K_BUFFER,
292 	__IXGBE_RX_BUILD_SKB_ENABLED,
293 	__IXGBE_RX_RSC_ENABLED,
294 	__IXGBE_RX_CSUM_UDP_ZERO_ERR,
295 	__IXGBE_RX_FCOE,
296 	__IXGBE_TX_FDIR_INIT_DONE,
297 	__IXGBE_TX_XPS_INIT_DONE,
298 	__IXGBE_TX_DETECT_HANG,
299 	__IXGBE_HANG_CHECK_ARMED,
300 	__IXGBE_TX_XDP_RING,
301 };
302 
303 #define ring_uses_build_skb(ring) \
304 	test_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state)
305 
306 struct ixgbe_fwd_adapter {
307 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
308 	struct net_device *netdev;
309 	struct ixgbe_adapter *real_adapter;
310 	unsigned int tx_base_queue;
311 	unsigned int rx_base_queue;
312 	int pool;
313 };
314 
315 #define check_for_tx_hang(ring) \
316 	test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
317 #define set_check_for_tx_hang(ring) \
318 	set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
319 #define clear_check_for_tx_hang(ring) \
320 	clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
321 #define ring_is_rsc_enabled(ring) \
322 	test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
323 #define set_ring_rsc_enabled(ring) \
324 	set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
325 #define clear_ring_rsc_enabled(ring) \
326 	clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
327 #define ring_is_xdp(ring) \
328 	test_bit(__IXGBE_TX_XDP_RING, &(ring)->state)
329 #define set_ring_xdp(ring) \
330 	set_bit(__IXGBE_TX_XDP_RING, &(ring)->state)
331 #define clear_ring_xdp(ring) \
332 	clear_bit(__IXGBE_TX_XDP_RING, &(ring)->state)
333 struct ixgbe_ring {
334 	struct ixgbe_ring *next;	/* pointer to next ring in q_vector */
335 	struct ixgbe_q_vector *q_vector; /* backpointer to host q_vector */
336 	struct net_device *netdev;	/* netdev ring belongs to */
337 	struct bpf_prog *xdp_prog;
338 	struct device *dev;		/* device for DMA mapping */
339 	void *desc;			/* descriptor ring memory */
340 	union {
341 		struct ixgbe_tx_buffer *tx_buffer_info;
342 		struct ixgbe_rx_buffer *rx_buffer_info;
343 	};
344 	unsigned long state;
345 	u8 __iomem *tail;
346 	dma_addr_t dma;			/* phys. address of descriptor ring */
347 	unsigned int size;		/* length in bytes */
348 
349 	u16 count;			/* amount of descriptors */
350 
351 	u8 queue_index; /* needed for multiqueue queue management */
352 	u8 reg_idx;			/* holds the special value that gets
353 					 * the hardware register offset
354 					 * associated with this ring, which is
355 					 * different for DCB and RSS modes
356 					 */
357 	u16 next_to_use;
358 	u16 next_to_clean;
359 
360 	unsigned long last_rx_timestamp;
361 
362 	union {
363 		u16 next_to_alloc;
364 		struct {
365 			u8 atr_sample_rate;
366 			u8 atr_count;
367 		};
368 	};
369 
370 	u8 dcb_tc;
371 	struct ixgbe_queue_stats stats;
372 	struct u64_stats_sync syncp;
373 	union {
374 		struct ixgbe_tx_queue_stats tx_stats;
375 		struct ixgbe_rx_queue_stats rx_stats;
376 	};
377 	struct xdp_rxq_info xdp_rxq;
378 } ____cacheline_internodealigned_in_smp;
379 
380 enum ixgbe_ring_f_enum {
381 	RING_F_NONE = 0,
382 	RING_F_VMDQ,  /* SR-IOV uses the same ring feature */
383 	RING_F_RSS,
384 	RING_F_FDIR,
385 #ifdef IXGBE_FCOE
386 	RING_F_FCOE,
387 #endif /* IXGBE_FCOE */
388 
389 	RING_F_ARRAY_SIZE      /* must be last in enum set */
390 };
391 
392 #define IXGBE_MAX_RSS_INDICES		16
393 #define IXGBE_MAX_RSS_INDICES_X550	63
394 #define IXGBE_MAX_VMDQ_INDICES		64
395 #define IXGBE_MAX_FDIR_INDICES		63	/* based on q_vector limit */
396 #define IXGBE_MAX_FCOE_INDICES		8
397 #define MAX_RX_QUEUES			(IXGBE_MAX_FDIR_INDICES + 1)
398 #define MAX_TX_QUEUES			(IXGBE_MAX_FDIR_INDICES + 1)
399 #define MAX_XDP_QUEUES			(IXGBE_MAX_FDIR_INDICES + 1)
400 #define IXGBE_MAX_L2A_QUEUES		4
401 #define IXGBE_BAD_L2A_QUEUE		3
402 #define IXGBE_MAX_MACVLANS		63
403 
404 struct ixgbe_ring_feature {
405 	u16 limit;	/* upper limit on feature indices */
406 	u16 indices;	/* current value of indices */
407 	u16 mask;	/* Mask used for feature to ring mapping */
408 	u16 offset;	/* offset to start of feature */
409 } ____cacheline_internodealigned_in_smp;
410 
411 #define IXGBE_82599_VMDQ_8Q_MASK 0x78
412 #define IXGBE_82599_VMDQ_4Q_MASK 0x7C
413 #define IXGBE_82599_VMDQ_2Q_MASK 0x7E
414 
415 /*
416  * FCoE requires that all Rx buffers be over 2200 bytes in length.  Since
417  * this is twice the size of a half page we need to double the page order
418  * for FCoE enabled Rx queues.
419  */
420 static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring)
421 {
422 	if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state))
423 		return IXGBE_RXBUFFER_3K;
424 #if (PAGE_SIZE < 8192)
425 	if (ring_uses_build_skb(ring))
426 		return IXGBE_MAX_2K_FRAME_BUILD_SKB;
427 #endif
428 	return IXGBE_RXBUFFER_2K;
429 }
430 
431 static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
432 {
433 #if (PAGE_SIZE < 8192)
434 	if (test_bit(__IXGBE_RX_3K_BUFFER, &ring->state))
435 		return 1;
436 #endif
437 	return 0;
438 }
439 #define ixgbe_rx_pg_size(_ring) (PAGE_SIZE << ixgbe_rx_pg_order(_ring))
440 
441 #define IXGBE_ITR_ADAPTIVE_MIN_INC	2
442 #define IXGBE_ITR_ADAPTIVE_MIN_USECS	10
443 #define IXGBE_ITR_ADAPTIVE_MAX_USECS	126
444 #define IXGBE_ITR_ADAPTIVE_LATENCY	0x80
445 #define IXGBE_ITR_ADAPTIVE_BULK		0x00
446 
447 struct ixgbe_ring_container {
448 	struct ixgbe_ring *ring;	/* pointer to linked list of rings */
449 	unsigned long next_update;	/* jiffies value of last update */
450 	unsigned int total_bytes;	/* total bytes processed this int */
451 	unsigned int total_packets;	/* total packets processed this int */
452 	u16 work_limit;			/* total work allowed per interrupt */
453 	u8 count;			/* total number of rings in vector */
454 	u8 itr;				/* current ITR setting for ring */
455 };
456 
457 /* iterator for handling rings in ring container */
458 #define ixgbe_for_each_ring(pos, head) \
459 	for (pos = (head).ring; pos != NULL; pos = pos->next)
460 
461 #define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \
462 			      ? 8 : 1)
463 #define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS
464 
465 /* MAX_Q_VECTORS of these are allocated,
466  * but we only use one per queue-specific vector.
467  */
468 struct ixgbe_q_vector {
469 	struct ixgbe_adapter *adapter;
470 #ifdef CONFIG_IXGBE_DCA
471 	int cpu;	    /* CPU for DCA */
472 #endif
473 	u16 v_idx;		/* index of q_vector within array, also used for
474 				 * finding the bit in EICR and friends that
475 				 * represents the vector for this ring */
476 	u16 itr;		/* Interrupt throttle rate written to EITR */
477 	struct ixgbe_ring_container rx, tx;
478 
479 	struct napi_struct napi;
480 	cpumask_t affinity_mask;
481 	int numa_node;
482 	struct rcu_head rcu;	/* to avoid race with update stats on free */
483 	char name[IFNAMSIZ + 9];
484 
485 	/* for dynamic allocation of rings associated with this q_vector */
486 	struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp;
487 };
488 
489 #ifdef CONFIG_IXGBE_HWMON
490 
491 #define IXGBE_HWMON_TYPE_LOC		0
492 #define IXGBE_HWMON_TYPE_TEMP		1
493 #define IXGBE_HWMON_TYPE_CAUTION	2
494 #define IXGBE_HWMON_TYPE_MAX		3
495 
496 struct hwmon_attr {
497 	struct device_attribute dev_attr;
498 	struct ixgbe_hw *hw;
499 	struct ixgbe_thermal_diode_data *sensor;
500 	char name[12];
501 };
502 
503 struct hwmon_buff {
504 	struct attribute_group group;
505 	const struct attribute_group *groups[2];
506 	struct attribute *attrs[IXGBE_MAX_SENSORS * 4 + 1];
507 	struct hwmon_attr hwmon_list[IXGBE_MAX_SENSORS * 4];
508 	unsigned int n_hwmon;
509 };
510 #endif /* CONFIG_IXGBE_HWMON */
511 
512 /*
513  * microsecond values for various ITR rates shifted by 2 to fit itr register
514  * with the first 3 bits reserved 0
515  */
516 #define IXGBE_MIN_RSC_ITR	24
517 #define IXGBE_100K_ITR		40
518 #define IXGBE_20K_ITR		200
519 #define IXGBE_12K_ITR		336
520 
521 /* ixgbe_test_staterr - tests bits in Rx descriptor status and error fields */
522 static inline __le32 ixgbe_test_staterr(union ixgbe_adv_rx_desc *rx_desc,
523 					const u32 stat_err_bits)
524 {
525 	return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
526 }
527 
528 static inline u16 ixgbe_desc_unused(struct ixgbe_ring *ring)
529 {
530 	u16 ntc = ring->next_to_clean;
531 	u16 ntu = ring->next_to_use;
532 
533 	return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
534 }
535 
536 #define IXGBE_RX_DESC(R, i)	    \
537 	(&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
538 #define IXGBE_TX_DESC(R, i)	    \
539 	(&(((union ixgbe_adv_tx_desc *)((R)->desc))[i]))
540 #define IXGBE_TX_CTXTDESC(R, i)	    \
541 	(&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
542 
543 #define IXGBE_MAX_JUMBO_FRAME_SIZE	9728 /* Maximum Supported Size 9.5KB */
544 #ifdef IXGBE_FCOE
545 /* Use 3K as the baby jumbo frame size for FCoE */
546 #define IXGBE_FCOE_JUMBO_FRAME_SIZE       3072
547 #endif /* IXGBE_FCOE */
548 
549 #define OTHER_VECTOR 1
550 #define NON_Q_VECTORS (OTHER_VECTOR)
551 
552 #define MAX_MSIX_VECTORS_82599 64
553 #define MAX_Q_VECTORS_82599 64
554 #define MAX_MSIX_VECTORS_82598 18
555 #define MAX_Q_VECTORS_82598 16
556 
557 struct ixgbe_mac_addr {
558 	u8 addr[ETH_ALEN];
559 	u16 pool;
560 	u16 state; /* bitmask */
561 };
562 
563 #define IXGBE_MAC_STATE_DEFAULT		0x1
564 #define IXGBE_MAC_STATE_MODIFIED	0x2
565 #define IXGBE_MAC_STATE_IN_USE		0x4
566 
567 #define MAX_Q_VECTORS MAX_Q_VECTORS_82599
568 #define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82599
569 
570 #define MIN_MSIX_Q_VECTORS 1
571 #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS)
572 
573 /* default to trying for four seconds */
574 #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ)
575 #define IXGBE_SFP_POLL_JIFFIES (2 * HZ)	/* SFP poll every 2 seconds */
576 
577 /* board specific private data structure */
578 struct ixgbe_adapter {
579 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
580 	/* OS defined structs */
581 	struct net_device *netdev;
582 	struct bpf_prog *xdp_prog;
583 	struct pci_dev *pdev;
584 
585 	unsigned long state;
586 
587 	/* Some features need tri-state capability,
588 	 * thus the additional *_CAPABLE flags.
589 	 */
590 	u32 flags;
591 #define IXGBE_FLAG_MSI_ENABLED			BIT(1)
592 #define IXGBE_FLAG_MSIX_ENABLED			BIT(3)
593 #define IXGBE_FLAG_RX_1BUF_CAPABLE		BIT(4)
594 #define IXGBE_FLAG_RX_PS_CAPABLE		BIT(5)
595 #define IXGBE_FLAG_RX_PS_ENABLED		BIT(6)
596 #define IXGBE_FLAG_DCA_ENABLED			BIT(8)
597 #define IXGBE_FLAG_DCA_CAPABLE			BIT(9)
598 #define IXGBE_FLAG_IMIR_ENABLED			BIT(10)
599 #define IXGBE_FLAG_MQ_CAPABLE			BIT(11)
600 #define IXGBE_FLAG_DCB_ENABLED			BIT(12)
601 #define IXGBE_FLAG_VMDQ_CAPABLE			BIT(13)
602 #define IXGBE_FLAG_VMDQ_ENABLED			BIT(14)
603 #define IXGBE_FLAG_FAN_FAIL_CAPABLE		BIT(15)
604 #define IXGBE_FLAG_NEED_LINK_UPDATE		BIT(16)
605 #define IXGBE_FLAG_NEED_LINK_CONFIG		BIT(17)
606 #define IXGBE_FLAG_FDIR_HASH_CAPABLE		BIT(18)
607 #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE		BIT(19)
608 #define IXGBE_FLAG_FCOE_CAPABLE			BIT(20)
609 #define IXGBE_FLAG_FCOE_ENABLED			BIT(21)
610 #define IXGBE_FLAG_SRIOV_CAPABLE		BIT(22)
611 #define IXGBE_FLAG_SRIOV_ENABLED		BIT(23)
612 #define IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE	BIT(24)
613 #define IXGBE_FLAG_RX_HWTSTAMP_ENABLED		BIT(25)
614 #define IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER	BIT(26)
615 #define IXGBE_FLAG_DCB_CAPABLE			BIT(27)
616 #define IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE	BIT(28)
617 
618 	u32 flags2;
619 #define IXGBE_FLAG2_RSC_CAPABLE			BIT(0)
620 #define IXGBE_FLAG2_RSC_ENABLED			BIT(1)
621 #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE		BIT(2)
622 #define IXGBE_FLAG2_TEMP_SENSOR_EVENT		BIT(3)
623 #define IXGBE_FLAG2_SEARCH_FOR_SFP		BIT(4)
624 #define IXGBE_FLAG2_SFP_NEEDS_RESET		BIT(5)
625 #define IXGBE_FLAG2_FDIR_REQUIRES_REINIT	BIT(7)
626 #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP		BIT(8)
627 #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP		BIT(9)
628 #define IXGBE_FLAG2_PTP_PPS_ENABLED		BIT(10)
629 #define IXGBE_FLAG2_PHY_INTERRUPT		BIT(11)
630 #define IXGBE_FLAG2_UDP_TUN_REREG_NEEDED	BIT(12)
631 #define IXGBE_FLAG2_VLAN_PROMISC		BIT(13)
632 #define IXGBE_FLAG2_EEE_CAPABLE			BIT(14)
633 #define IXGBE_FLAG2_EEE_ENABLED			BIT(15)
634 #define IXGBE_FLAG2_RX_LEGACY			BIT(16)
635 #define IXGBE_FLAG2_IPSEC_ENABLED		BIT(17)
636 
637 	/* Tx fast path data */
638 	int num_tx_queues;
639 	u16 tx_itr_setting;
640 	u16 tx_work_limit;
641 	u64 tx_ipsec;
642 
643 	/* Rx fast path data */
644 	int num_rx_queues;
645 	u16 rx_itr_setting;
646 	u64 rx_ipsec;
647 
648 	/* Port number used to identify VXLAN traffic */
649 	__be16 vxlan_port;
650 	__be16 geneve_port;
651 
652 	/* XDP */
653 	int num_xdp_queues;
654 	struct ixgbe_ring *xdp_ring[MAX_XDP_QUEUES];
655 
656 	/* TX */
657 	struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp;
658 
659 	u64 restart_queue;
660 	u64 lsc_int;
661 	u32 tx_timeout_count;
662 
663 	/* RX */
664 	struct ixgbe_ring *rx_ring[MAX_RX_QUEUES];
665 	int num_rx_pools;		/* == num_rx_queues in 82598 */
666 	int num_rx_queues_per_pool;	/* 1 if 82598, can be many if 82599 */
667 	u64 hw_csum_rx_error;
668 	u64 hw_rx_no_dma_resources;
669 	u64 rsc_total_count;
670 	u64 rsc_total_flush;
671 	u64 non_eop_descs;
672 	u32 alloc_rx_page;
673 	u32 alloc_rx_page_failed;
674 	u32 alloc_rx_buff_failed;
675 
676 	struct ixgbe_q_vector *q_vector[MAX_Q_VECTORS];
677 
678 	/* DCB parameters */
679 	struct ieee_pfc *ixgbe_ieee_pfc;
680 	struct ieee_ets *ixgbe_ieee_ets;
681 	struct ixgbe_dcb_config dcb_cfg;
682 	struct ixgbe_dcb_config temp_dcb_cfg;
683 	u8 hw_tcs;
684 	u8 dcb_set_bitmap;
685 	u8 dcbx_cap;
686 	enum ixgbe_fc_mode last_lfc_mode;
687 
688 	int num_q_vectors;	/* current number of q_vectors for device */
689 	int max_q_vectors;	/* true count of q_vectors for device */
690 	struct ixgbe_ring_feature ring_feature[RING_F_ARRAY_SIZE];
691 	struct msix_entry *msix_entries;
692 
693 	u32 test_icr;
694 	struct ixgbe_ring test_tx_ring;
695 	struct ixgbe_ring test_rx_ring;
696 
697 	/* structs defined in ixgbe_hw.h */
698 	struct ixgbe_hw hw;
699 	u16 msg_enable;
700 	struct ixgbe_hw_stats stats;
701 
702 	u64 tx_busy;
703 	unsigned int tx_ring_count;
704 	unsigned int xdp_ring_count;
705 	unsigned int rx_ring_count;
706 
707 	u32 link_speed;
708 	bool link_up;
709 	unsigned long sfp_poll_time;
710 	unsigned long link_check_timeout;
711 
712 	struct timer_list service_timer;
713 	struct work_struct service_task;
714 
715 	struct hlist_head fdir_filter_list;
716 	unsigned long fdir_overflow; /* number of times ATR was backed off */
717 	union ixgbe_atr_input fdir_mask;
718 	int fdir_filter_count;
719 	u32 fdir_pballoc;
720 	u32 atr_sample_rate;
721 	spinlock_t fdir_perfect_lock;
722 
723 #ifdef IXGBE_FCOE
724 	struct ixgbe_fcoe fcoe;
725 #endif /* IXGBE_FCOE */
726 	u8 __iomem *io_addr; /* Mainly for iounmap use */
727 	u32 wol;
728 
729 	u16 bridge_mode;
730 
731 	char eeprom_id[NVM_VER_SIZE];
732 	u16 eeprom_cap;
733 
734 	u32 interrupt_event;
735 	u32 led_reg;
736 
737 	struct ptp_clock *ptp_clock;
738 	struct ptp_clock_info ptp_caps;
739 	struct work_struct ptp_tx_work;
740 	struct sk_buff *ptp_tx_skb;
741 	struct hwtstamp_config tstamp_config;
742 	unsigned long ptp_tx_start;
743 	unsigned long last_overflow_check;
744 	unsigned long last_rx_ptp_check;
745 	unsigned long last_rx_timestamp;
746 	spinlock_t tmreg_lock;
747 	struct cyclecounter hw_cc;
748 	struct timecounter hw_tc;
749 	u32 base_incval;
750 	u32 tx_hwtstamp_timeouts;
751 	u32 tx_hwtstamp_skipped;
752 	u32 rx_hwtstamp_cleared;
753 	void (*ptp_setup_sdp)(struct ixgbe_adapter *);
754 
755 	/* SR-IOV */
756 	DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS);
757 	unsigned int num_vfs;
758 	struct vf_data_storage *vfinfo;
759 	int vf_rate_link_speed;
760 	struct vf_macvlans vf_mvs;
761 	struct vf_macvlans *mv_list;
762 
763 	u32 timer_event_accumulator;
764 	u32 vferr_refcount;
765 	struct ixgbe_mac_addr *mac_table;
766 	struct kobject *info_kobj;
767 #ifdef CONFIG_IXGBE_HWMON
768 	struct hwmon_buff *ixgbe_hwmon_buff;
769 #endif /* CONFIG_IXGBE_HWMON */
770 #ifdef CONFIG_DEBUG_FS
771 	struct dentry *ixgbe_dbg_adapter;
772 #endif /*CONFIG_DEBUG_FS*/
773 
774 	u8 default_up;
775 	/* Bitmask indicating in use pools */
776 	DECLARE_BITMAP(fwd_bitmask, IXGBE_MAX_MACVLANS + 1);
777 
778 #define IXGBE_MAX_LINK_HANDLE 10
779 	struct ixgbe_jump_table *jump_tables[IXGBE_MAX_LINK_HANDLE];
780 	unsigned long tables;
781 
782 /* maximum number of RETA entries among all devices supported by ixgbe
783  * driver: currently it's x550 device in non-SRIOV mode
784  */
785 #define IXGBE_MAX_RETA_ENTRIES 512
786 	u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES];
787 
788 #define IXGBE_RSS_KEY_SIZE     40  /* size of RSS Hash Key in bytes */
789 	u32 *rss_key;
790 
791 #ifdef CONFIG_XFRM
792 	struct ixgbe_ipsec *ipsec;
793 #endif /* CONFIG_XFRM */
794 };
795 
796 static inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter)
797 {
798 	switch (adapter->hw.mac.type) {
799 	case ixgbe_mac_82598EB:
800 	case ixgbe_mac_82599EB:
801 	case ixgbe_mac_X540:
802 		return IXGBE_MAX_RSS_INDICES;
803 	case ixgbe_mac_X550:
804 	case ixgbe_mac_X550EM_x:
805 	case ixgbe_mac_x550em_a:
806 		return IXGBE_MAX_RSS_INDICES_X550;
807 	default:
808 		return 0;
809 	}
810 }
811 
812 struct ixgbe_fdir_filter {
813 	struct hlist_node fdir_node;
814 	union ixgbe_atr_input filter;
815 	u16 sw_idx;
816 	u64 action;
817 };
818 
819 enum ixgbe_state_t {
820 	__IXGBE_TESTING,
821 	__IXGBE_RESETTING,
822 	__IXGBE_DOWN,
823 	__IXGBE_DISABLED,
824 	__IXGBE_REMOVING,
825 	__IXGBE_SERVICE_SCHED,
826 	__IXGBE_SERVICE_INITED,
827 	__IXGBE_IN_SFP_INIT,
828 	__IXGBE_PTP_RUNNING,
829 	__IXGBE_PTP_TX_IN_PROGRESS,
830 	__IXGBE_RESET_REQUESTED,
831 };
832 
833 struct ixgbe_cb {
834 	union {				/* Union defining head/tail partner */
835 		struct sk_buff *head;
836 		struct sk_buff *tail;
837 	};
838 	dma_addr_t dma;
839 	u16 append_cnt;
840 	bool page_released;
841 };
842 #define IXGBE_CB(skb) ((struct ixgbe_cb *)(skb)->cb)
843 
844 enum ixgbe_boards {
845 	board_82598,
846 	board_82599,
847 	board_X540,
848 	board_X550,
849 	board_X550EM_x,
850 	board_x550em_x_fw,
851 	board_x550em_a,
852 	board_x550em_a_fw,
853 };
854 
855 extern const struct ixgbe_info ixgbe_82598_info;
856 extern const struct ixgbe_info ixgbe_82599_info;
857 extern const struct ixgbe_info ixgbe_X540_info;
858 extern const struct ixgbe_info ixgbe_X550_info;
859 extern const struct ixgbe_info ixgbe_X550EM_x_info;
860 extern const struct ixgbe_info ixgbe_x550em_x_fw_info;
861 extern const struct ixgbe_info ixgbe_x550em_a_info;
862 extern const struct ixgbe_info ixgbe_x550em_a_fw_info;
863 #ifdef CONFIG_IXGBE_DCB
864 extern const struct dcbnl_rtnl_ops ixgbe_dcbnl_ops;
865 #endif
866 
867 extern char ixgbe_driver_name[];
868 extern const char ixgbe_driver_version[];
869 #ifdef IXGBE_FCOE
870 extern char ixgbe_default_device_descr[];
871 #endif /* IXGBE_FCOE */
872 
873 int ixgbe_open(struct net_device *netdev);
874 int ixgbe_close(struct net_device *netdev);
875 void ixgbe_up(struct ixgbe_adapter *adapter);
876 void ixgbe_down(struct ixgbe_adapter *adapter);
877 void ixgbe_reinit_locked(struct ixgbe_adapter *adapter);
878 void ixgbe_reset(struct ixgbe_adapter *adapter);
879 void ixgbe_set_ethtool_ops(struct net_device *netdev);
880 int ixgbe_setup_rx_resources(struct ixgbe_adapter *, struct ixgbe_ring *);
881 int ixgbe_setup_tx_resources(struct ixgbe_ring *);
882 void ixgbe_free_rx_resources(struct ixgbe_ring *);
883 void ixgbe_free_tx_resources(struct ixgbe_ring *);
884 void ixgbe_configure_rx_ring(struct ixgbe_adapter *, struct ixgbe_ring *);
885 void ixgbe_configure_tx_ring(struct ixgbe_adapter *, struct ixgbe_ring *);
886 void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_ring *);
887 void ixgbe_update_stats(struct ixgbe_adapter *adapter);
888 int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
889 bool ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
890 			 u16 subdevice_id);
891 #ifdef CONFIG_PCI_IOV
892 void ixgbe_full_sync_mac_table(struct ixgbe_adapter *adapter);
893 #endif
894 int ixgbe_add_mac_filter(struct ixgbe_adapter *adapter,
895 			 const u8 *addr, u16 queue);
896 int ixgbe_del_mac_filter(struct ixgbe_adapter *adapter,
897 			 const u8 *addr, u16 queue);
898 void ixgbe_update_pf_promisc_vlvf(struct ixgbe_adapter *adapter, u32 vid);
899 void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter);
900 netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, struct ixgbe_adapter *,
901 				  struct ixgbe_ring *);
902 void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *,
903 				      struct ixgbe_tx_buffer *);
904 void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16);
905 void ixgbe_write_eitr(struct ixgbe_q_vector *);
906 int ixgbe_poll(struct napi_struct *napi, int budget);
907 int ethtool_ioctl(struct ifreq *ifr);
908 s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);
909 s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl);
910 s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl);
911 s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
912 					  union ixgbe_atr_hash_dword input,
913 					  union ixgbe_atr_hash_dword common,
914 					  u8 queue);
915 s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,
916 				    union ixgbe_atr_input *input_mask);
917 s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
918 					  union ixgbe_atr_input *input,
919 					  u16 soft_id, u8 queue);
920 s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw,
921 					  union ixgbe_atr_input *input,
922 					  u16 soft_id);
923 void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
924 					  union ixgbe_atr_input *mask);
925 int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
926 				    struct ixgbe_fdir_filter *input,
927 				    u16 sw_idx);
928 void ixgbe_set_rx_mode(struct net_device *netdev);
929 #ifdef CONFIG_IXGBE_DCB
930 void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter);
931 #endif
932 int ixgbe_setup_tc(struct net_device *dev, u8 tc);
933 void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32);
934 void ixgbe_do_reset(struct net_device *netdev);
935 #ifdef CONFIG_IXGBE_HWMON
936 void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter);
937 int ixgbe_sysfs_init(struct ixgbe_adapter *adapter);
938 #endif /* CONFIG_IXGBE_HWMON */
939 #ifdef IXGBE_FCOE
940 void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter);
941 int ixgbe_fso(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first,
942 	      u8 *hdr_len);
943 int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
944 		   union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb);
945 int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
946 		       struct scatterlist *sgl, unsigned int sgc);
947 int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid,
948 			  struct scatterlist *sgl, unsigned int sgc);
949 int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
950 int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter);
951 void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter);
952 int ixgbe_fcoe_enable(struct net_device *netdev);
953 int ixgbe_fcoe_disable(struct net_device *netdev);
954 #ifdef CONFIG_IXGBE_DCB
955 u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter);
956 u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up);
957 #endif /* CONFIG_IXGBE_DCB */
958 int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
959 int ixgbe_fcoe_get_hbainfo(struct net_device *netdev,
960 			   struct netdev_fcoe_hbainfo *info);
961 u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter);
962 #endif /* IXGBE_FCOE */
963 #ifdef CONFIG_DEBUG_FS
964 void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter);
965 void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter);
966 void ixgbe_dbg_init(void);
967 void ixgbe_dbg_exit(void);
968 #else
969 static inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {}
970 static inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {}
971 static inline void ixgbe_dbg_init(void) {}
972 static inline void ixgbe_dbg_exit(void) {}
973 #endif /* CONFIG_DEBUG_FS */
974 static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
975 {
976 	return netdev_get_tx_queue(ring->netdev, ring->queue_index);
977 }
978 
979 void ixgbe_ptp_init(struct ixgbe_adapter *adapter);
980 void ixgbe_ptp_suspend(struct ixgbe_adapter *adapter);
981 void ixgbe_ptp_stop(struct ixgbe_adapter *adapter);
982 void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter);
983 void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter);
984 void ixgbe_ptp_tx_hang(struct ixgbe_adapter *adapter);
985 void ixgbe_ptp_rx_pktstamp(struct ixgbe_q_vector *, struct sk_buff *);
986 void ixgbe_ptp_rx_rgtstamp(struct ixgbe_q_vector *, struct sk_buff *skb);
987 static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring,
988 					 union ixgbe_adv_rx_desc *rx_desc,
989 					 struct sk_buff *skb)
990 {
991 	if (unlikely(ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_TSIP))) {
992 		ixgbe_ptp_rx_pktstamp(rx_ring->q_vector, skb);
993 		return;
994 	}
995 
996 	if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS)))
997 		return;
998 
999 	ixgbe_ptp_rx_rgtstamp(rx_ring->q_vector, skb);
1000 
1001 	/* Update the last_rx_timestamp timer in order to enable watchdog check
1002 	 * for error case of latched timestamp on a dropped packet.
1003 	 */
1004 	rx_ring->last_rx_timestamp = jiffies;
1005 }
1006 
1007 int ixgbe_ptp_set_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr);
1008 int ixgbe_ptp_get_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr);
1009 void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter);
1010 void ixgbe_ptp_reset(struct ixgbe_adapter *adapter);
1011 void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter);
1012 #ifdef CONFIG_PCI_IOV
1013 void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter);
1014 #endif
1015 
1016 netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
1017 				  struct ixgbe_adapter *adapter,
1018 				  struct ixgbe_ring *tx_ring);
1019 u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter);
1020 void ixgbe_store_key(struct ixgbe_adapter *adapter);
1021 void ixgbe_store_reta(struct ixgbe_adapter *adapter);
1022 s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
1023 		       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);
1024 #ifdef CONFIG_XFRM_OFFLOAD
1025 void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter);
1026 void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter);
1027 void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter);
1028 void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
1029 		    union ixgbe_adv_rx_desc *rx_desc,
1030 		    struct sk_buff *skb);
1031 int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first,
1032 		   struct ixgbe_ipsec_tx_data *itd);
1033 #else
1034 static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { };
1035 static inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { };
1036 static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { };
1037 static inline void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
1038 				  union ixgbe_adv_rx_desc *rx_desc,
1039 				  struct sk_buff *skb) { };
1040 static inline int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring,
1041 				 struct ixgbe_tx_buffer *first,
1042 				 struct ixgbe_ipsec_tx_data *itd) { return 0; };
1043 #endif /* CONFIG_XFRM_OFFLOAD */
1044 #endif /* _IXGBE_H_ */
1045