@@ -85,6 +85,8 @@ enum {
NETIF_F_HW_MACSEC_BIT, /* Offload MACsec operations */
+ NETIF_F_XDP_BIT, /* XDP support */
+ NETIF_F_AF_XDP_ZC_BIT, /* AF_XDP zero-copy support */
/*
* Add your fresh new feature above and remember to update
* netdev_features_strings[] in net/core/ethtool.c and maybe
@@ -157,6 +159,9 @@ enum {
#define NETIF_F_GRO_FRAGLIST __NETIF_F(GRO_FRAGLIST)
#define NETIF_F_GSO_FRAGLIST __NETIF_F(GSO_FRAGLIST)
#define NETIF_F_HW_MACSEC __NETIF_F(HW_MACSEC)
+#define NETIF_F_XDP __NETIF_F(XDP)
+#define NETIF_F_AF_XDP_ZC __NETIF_F(AF_XDP_ZC)
+
/* Finds the next feature with the highest number of the range of start till 0.
*/
@@ -182,6 +187,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
/* Features valid for ethtool to change */
/* = all defined minus driver/device-class-related */
#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
+ NETIF_F_XDP | NETIF_F_AF_XDP_ZC | \
NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
/* remember that ((t)1 << t_BITS) is undefined in C99 */
@@ -254,6 +254,19 @@ struct xdp_attachment_info {
u32 flags;
};
+#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
+static __always_inline void
+xdp_set_feature_flag(netdev_features_t *features)
+{
+ *features |= NETIF_F_XDP;
+}
+#else
+static __always_inline void
+xdp_set_feature_flag(netdev_features_t *features)
+{
+}
+#endif
+
struct netdev_bpf;
bool xdp_attachment_flags_ok(struct xdp_attachment_info *info,
struct netdev_bpf *bpf);
@@ -22,6 +22,12 @@ void xsk_clear_rx_need_wakeup(struct xsk_buff_pool *pool);
void xsk_clear_tx_need_wakeup(struct xsk_buff_pool *pool);
bool xsk_uses_need_wakeup(struct xsk_buff_pool *pool);
+static __always_inline void
+xsk_set_feature_flag(netdev_features_t *features)
+{
+ *features |= NETIF_F_AF_XDP_ZC;
+}
+
static inline u32 xsk_pool_get_headroom(struct xsk_buff_pool *pool)
{
return XDP_PACKET_HEADROOM + pool->headroom;
@@ -235,6 +241,11 @@ static inline void xsk_buff_raw_dma_sync_for_device(struct xsk_buff_pool *pool,
{
}
+static __always_inline void
+xsk_set_feature_flag(netdev_features_t *features)
+{
+}
+
#endif /* CONFIG_XDP_SOCKETS */
#endif /* _LINUX_XDP_SOCK_DRV_H */
@@ -68,6 +68,8 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
[NETIF_F_HW_TLS_RX_BIT] = "tls-hw-rx-offload",
[NETIF_F_GRO_FRAGLIST_BIT] = "rx-gro-list",
[NETIF_F_HW_MACSEC_BIT] = "macsec-hw-offload",
+ [NETIF_F_XDP_BIT] = "xdp",
+ [NETIF_F_AF_XDP_ZC_BIT] = "af-xdp-zc",
};
const char