forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
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
....@@ -49,8 +49,6 @@
4949 #endif
5050 #define IXGBE_MAX_RXD 4096
5151 #define IXGBE_MIN_RXD 64
52
-
53
-#define IXGBE_ETH_P_LLDP 0x88CC
5452
5553 /* flow control */
5654 #define IXGBE_MIN_FCRTL 0x40
....@@ -226,15 +224,19 @@
226224 };
227225
228226 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;
227
+ union {
228
+ struct {
229
+ struct sk_buff *skb;
230
+ dma_addr_t dma;
231
+ struct page *page;
232
+ __u32 page_offset;
233
+ __u16 pagecnt_bias;
234
+ };
235
+ struct {
236
+ bool discard;
237
+ struct xdp_buff *xdp;
238
+ };
239
+ };
238240 };
239241
240242 struct ixgbe_queue_stats {
....@@ -271,6 +273,7 @@
271273 __IXGBE_TX_DETECT_HANG,
272274 __IXGBE_HANG_CHECK_ARMED,
273275 __IXGBE_TX_XDP_RING,
276
+ __IXGBE_TX_DISABLED,
274277 };
275278
276279 #define ring_uses_build_skb(ring) \
....@@ -347,6 +350,9 @@
347350 struct ixgbe_rx_queue_stats rx_stats;
348351 };
349352 struct xdp_rxq_info xdp_rxq;
353
+ struct xsk_buff_pool *xsk_pool;
354
+ u16 ring_idx; /* {rx,tx,xdp}_ring back reference idx */
355
+ u16 rx_buf_len;
350356 } ____cacheline_internodealigned_in_smp;
351357
352358 enum ixgbe_ring_f_enum {
....@@ -455,7 +461,7 @@
455461 char name[IFNAMSIZ + 9];
456462
457463 /* for dynamic allocation of rings associated with this q_vector */
458
- struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp;
464
+ struct ixgbe_ring ring[] ____cacheline_internodealigned_in_smp;
459465 };
460466
461467 #ifdef CONFIG_IXGBE_HWMON
....@@ -553,6 +559,7 @@
553559 struct net_device *netdev;
554560 struct bpf_prog *xdp_prog;
555561 struct pci_dev *pdev;
562
+ struct mii_bus *mii_bus;
556563
557564 unsigned long state;
558565
....@@ -581,11 +588,9 @@
581588 #define IXGBE_FLAG_FCOE_ENABLED BIT(21)
582589 #define IXGBE_FLAG_SRIOV_CAPABLE BIT(22)
583590 #define IXGBE_FLAG_SRIOV_ENABLED BIT(23)
584
-#define IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE BIT(24)
585591 #define IXGBE_FLAG_RX_HWTSTAMP_ENABLED BIT(25)
586592 #define IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER BIT(26)
587593 #define IXGBE_FLAG_DCB_CAPABLE BIT(27)
588
-#define IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE BIT(28)
589594
590595 u32 flags2;
591596 #define IXGBE_FLAG2_RSC_CAPABLE BIT(0)
....@@ -599,12 +604,12 @@
599604 #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP BIT(9)
600605 #define IXGBE_FLAG2_PTP_PPS_ENABLED BIT(10)
601606 #define IXGBE_FLAG2_PHY_INTERRUPT BIT(11)
602
-#define IXGBE_FLAG2_UDP_TUN_REREG_NEEDED BIT(12)
603607 #define IXGBE_FLAG2_VLAN_PROMISC BIT(13)
604608 #define IXGBE_FLAG2_EEE_CAPABLE BIT(14)
605609 #define IXGBE_FLAG2_EEE_ENABLED BIT(15)
606610 #define IXGBE_FLAG2_RX_LEGACY BIT(16)
607611 #define IXGBE_FLAG2_IPSEC_ENABLED BIT(17)
612
+#define IXGBE_FLAG2_VF_IPSEC_ENABLED BIT(18)
608613
609614 /* Tx fast path data */
610615 int num_tx_queues;
....@@ -624,6 +629,7 @@
624629 /* XDP */
625630 int num_xdp_queues;
626631 struct ixgbe_ring *xdp_ring[MAX_XDP_QUEUES];
632
+ unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled rings */
627633
628634 /* TX */
629635 struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp;
....@@ -760,9 +766,10 @@
760766 #define IXGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
761767 u32 *rss_key;
762768
763
-#ifdef CONFIG_XFRM_OFFLOAD
769
+#ifdef CONFIG_IXGBE_IPSEC
764770 struct ixgbe_ipsec *ipsec;
765
-#endif /* CONFIG_XFRM_OFFLOAD */
771
+#endif /* CONFIG_IXGBE_IPSEC */
772
+ spinlock_t vfs_lock;
766773 };
767774
768775 static inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter)
....@@ -837,7 +844,6 @@
837844 #endif
838845
839846 extern char ixgbe_driver_name[];
840
-extern const char ixgbe_driver_version[];
841847 #ifdef IXGBE_FCOE
842848 extern char ixgbe_default_device_descr[];
843849 #endif /* IXGBE_FCOE */
....@@ -994,7 +1000,7 @@
9941000 void ixgbe_store_reta(struct ixgbe_adapter *adapter);
9951001 s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
9961002 u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);
997
-#ifdef CONFIG_XFRM_OFFLOAD
1003
+#ifdef CONFIG_IXGBE_IPSEC
9981004 void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter);
9991005 void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter);
10001006 void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter);
....@@ -1003,15 +1009,30 @@
10031009 struct sk_buff *skb);
10041010 int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first,
10051011 struct ixgbe_ipsec_tx_data *itd);
1012
+void ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter, u32 vf);
1013
+int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf);
1014
+int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *mbuf, u32 vf);
10061015 #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) { };
1016
+static inline void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) { }
1017
+static inline void ixgbe_stop_ipsec_offload(struct ixgbe_adapter *adapter) { }
1018
+static inline void ixgbe_ipsec_restore(struct ixgbe_adapter *adapter) { }
10101019 static inline void ixgbe_ipsec_rx(struct ixgbe_ring *rx_ring,
10111020 union ixgbe_adv_rx_desc *rx_desc,
1012
- struct sk_buff *skb) { };
1021
+ struct sk_buff *skb) { }
10131022 static inline int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring,
10141023 struct ixgbe_tx_buffer *first,
1015
- struct ixgbe_ipsec_tx_data *itd) { return 0; };
1016
-#endif /* CONFIG_XFRM_OFFLOAD */
1024
+ struct ixgbe_ipsec_tx_data *itd) { return 0; }
1025
+static inline void ixgbe_ipsec_vf_clear(struct ixgbe_adapter *adapter,
1026
+ u32 vf) { }
1027
+static inline int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter,
1028
+ u32 *mbuf, u32 vf) { return -EACCES; }
1029
+static inline int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter,
1030
+ u32 *mbuf, u32 vf) { return -EACCES; }
1031
+#endif /* CONFIG_IXGBE_IPSEC */
1032
+
1033
+static inline bool ixgbe_enabled_xdp_adapter(struct ixgbe_adapter *adapter)
1034
+{
1035
+ return !!adapter->xdp_prog;
1036
+}
1037
+
10171038 #endif /* _IXGBE_H_ */