hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.h
....@@ -12,6 +12,7 @@
1212 #include <linux/aer.h>
1313 #include <linux/if_vlan.h>
1414 #include <linux/jiffies.h>
15
+#include <linux/phy.h>
1516
1617 #include <linux/timecounter.h>
1718 #include <linux/net_tstamp.h>
....@@ -30,7 +31,6 @@
3031 #include "ixgbe_ipsec.h"
3132
3233 #include <net/xdp.h>
33
-#include <net/busy_poll.h>
3434
3535 /* common prefix used by pr_<> macros */
3636 #undef pr_fmt
....@@ -50,8 +50,6 @@
5050 #define IXGBE_MAX_RXD 4096
5151 #define IXGBE_MIN_RXD 64
5252
53
-#define IXGBE_ETH_P_LLDP 0x88CC
54
-
5553 /* flow control */
5654 #define IXGBE_MIN_FCRTL 0x40
5755 #define IXGBE_MAX_FCRTL 0x7FF80
....@@ -68,6 +66,8 @@
6866 #define IXGBE_RXBUFFER_3K 3072
6967 #define IXGBE_RXBUFFER_4K 4096
7068 #define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */
69
+
70
+#define IXGBE_PKT_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))
7171
7272 /* Attempt to maximize the headroom available for incoming frames. We
7373 * use a 2K buffer for receives and need 1536/1534 to store the data for
....@@ -226,15 +226,19 @@
226226 };
227227
228228 struct ixgbe_rx_buffer {
229
- struct sk_buff *skb;
230
- dma_addr_t dma;
231
- struct page *page;
232
-#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
233
- __u32 page_offset;
234
-#else
235
- __u16 page_offset;
236
-#endif
237
- __u16 pagecnt_bias;
229
+ union {
230
+ struct {
231
+ struct sk_buff *skb;
232
+ dma_addr_t dma;
233
+ struct page *page;
234
+ __u32 page_offset;
235
+ __u16 pagecnt_bias;
236
+ };
237
+ struct {
238
+ bool discard;
239
+ struct xdp_buff *xdp;
240
+ };
241
+ };
238242 };
239243
240244 struct ixgbe_queue_stats {
....@@ -271,6 +275,7 @@
271275 __IXGBE_TX_DETECT_HANG,
272276 __IXGBE_HANG_CHECK_ARMED,
273277 __IXGBE_TX_XDP_RING,
278
+ __IXGBE_TX_DISABLED,
274279 };
275280
276281 #define ring_uses_build_skb(ring) \
....@@ -347,6 +352,9 @@
347352 struct ixgbe_rx_queue_stats rx_stats;
348353 };
349354 struct xdp_rxq_info xdp_rxq;
355
+ struct xsk_buff_pool *xsk_pool;
356
+ u16 ring_idx; /* {rx,tx,xdp}_ring back reference idx */
357
+ u16 rx_buf_len;
350358 } ____cacheline_internodealigned_in_smp;
351359
352360 enum ixgbe_ring_f_enum {
....@@ -455,7 +463,7 @@
455463 char name[IFNAMSIZ + 9];
456464
457465 /* for dynamic allocation of rings associated with this q_vector */
458
- struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp;
466
+ struct ixgbe_ring ring[] ____cacheline_internodealigned_in_smp;
459467 };
460468
461469 #ifdef CONFIG_IXGBE_HWMON
....@@ -553,6 +561,7 @@
553561 struct net_device *netdev;
554562 struct bpf_prog *xdp_prog;
555563 struct pci_dev *pdev;
564
+ struct mii_bus *mii_bus;
556565
557566 unsigned long state;
558567
....@@ -581,11 +590,9 @@
581590 #define IXGBE_FLAG_FCOE_ENABLED BIT(21)
582591 #define IXGBE_FLAG_SRIOV_CAPABLE BIT(22)
583592 #define IXGBE_FLAG_SRIOV_ENABLED BIT(23)
584
-#define IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE BIT(24)
585593 #define IXGBE_FLAG_RX_HWTSTAMP_ENABLED BIT(25)
586594 #define IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER BIT(26)
587595 #define IXGBE_FLAG_DCB_CAPABLE BIT(27)
588
-#define IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE BIT(28)
589596
590597 u32 flags2;
591598 #define IXGBE_FLAG2_RSC_CAPABLE BIT(0)
....@@ -599,12 +606,12 @@
599606 #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP BIT(9)
600607 #define IXGBE_FLAG2_PTP_PPS_ENABLED BIT(10)
601608 #define IXGBE_FLAG2_PHY_INTERRUPT BIT(11)
602
-#define IXGBE_FLAG2_UDP_TUN_REREG_NEEDED BIT(12)
603609 #define IXGBE_FLAG2_VLAN_PROMISC BIT(13)
604610 #define IXGBE_FLAG2_EEE_CAPABLE BIT(14)
605611 #define IXGBE_FLAG2_EEE_ENABLED BIT(15)
606612 #define IXGBE_FLAG2_RX_LEGACY BIT(16)
607613 #define IXGBE_FLAG2_IPSEC_ENABLED BIT(17)
614
+#define IXGBE_FLAG2_VF_IPSEC_ENABLED BIT(18)
608615
609616 /* Tx fast path data */
610617 int num_tx_queues;
....@@ -624,6 +631,7 @@
624631 /* XDP */
625632 int num_xdp_queues;
626633 struct ixgbe_ring *xdp_ring[MAX_XDP_QUEUES];
634
+ unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled rings */
627635
628636 /* TX */
629637 struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp;
....@@ -760,9 +768,10 @@
760768 #define IXGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
761769 u32 *rss_key;
762770
763
-#ifdef CONFIG_XFRM_OFFLOAD
771
+#ifdef CONFIG_IXGBE_IPSEC
764772 struct ixgbe_ipsec *ipsec;
765
-#endif /* CONFIG_XFRM_OFFLOAD */
773
+#endif /* CONFIG_IXGBE_IPSEC */
774
+ spinlock_t vfs_lock;
766775 };
767776
768777 static inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter)
....@@ -837,7 +846,6 @@
837846 #endif
838847
839848 extern char ixgbe_driver_name[];
840
-extern const char ixgbe_driver_version[];
841849 #ifdef IXGBE_FCOE
842850 extern char ixgbe_default_device_descr[];
843851 #endif /* IXGBE_FCOE */
....@@ -994,7 +1002,7 @@
9941002 void ixgbe_store_reta(struct ixgbe_adapter *adapter);
9951003 s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
9961004 u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);
997
-#ifdef CONFIG_XFRM_OFFLOAD
1005
+#ifdef CONFIG_IXGBE_IPSEC
9981006 void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter);
9991007 void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter);
10001008 void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter);
....@@ -1003,15 +1011,30 @@
10031011 struct sk_buff *skb);
10041012 int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first,
10051013 struct ixgbe_ipsec_tx_data *itd);
1014
+void ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter, u32 vf);
1015
+int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf);
1016
+int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf);
10061017 #else
1007
-static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { };
1008
-static inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { };
1009
-static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { };
1018
+static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { }
1019
+static inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { }
1020
+static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { }
10101021 static inline void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
10111022 union ixgbe_adv_rx_desc *rx_desc,
1012
- struct sk_buff *skb) { };
1023
+ struct sk_buff *skb) { }
10131024 static inline int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring,
10141025 struct ixgbe_tx_buffer *first,
1015
- struct ixgbe_ipsec_tx_data *itd) { return 0; };
1016
-#endif /* CONFIG_XFRM_OFFLOAD */
1026
+ struct ixgbe_ipsec_tx_data *itd) { return 0; }
1027
+static inline void ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter,
1028
+ u32 vf) { }
1029
+static inline int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter,
1030
+ u32 *mbuf, u32 vf) { return -EACCES; }
1031
+static inline int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter,
1032
+ u32 *mbuf, u32 vf) { return -EACCES; }
1033
+#endif /* CONFIG_IXGBE_IPSEC */
1034
+
1035
+static inline bool ixgbe_enabled_xdp_adapter(struct ixgbe_adapter *adapter)
1036
+{
1037
+ return !!adapter->xdp_prog;
1038
+}
1039
+
10171040 #endif /* _IXGBE_H_ */