Skip to contentSkip to conversation

eth: gve: use appropriate helper to set xdp_features

PATCH Applied Jakub Kicinski 4 participants 4 messages Jan 6, 2025 – Jan 8, 2025

Subsystems (4)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 eth: gve: use appropriate helper to set xdp_features

Commit f85949f98206 ("xdp: add xdp_set_features_flag utility routine") added routines to inform the core about XDP flag changes. GVE support was added around the same time and missed using them.

GVE only changes the flags on error recover or resume. Presumably the flags may change during resume if VM migrated. User would not get the notification and upper devices would not get a chance to recalculate their flags.

Fixes 75eaae158b1b ("gve: Add XDP DROP and TX support for GQI-QPL format")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 drivers/net/ethernet/google/gve/gve_main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +9 -5
index 8a8f6ab12a98..533e659b15b3 100644
@@ -2241,14 +2241,18 @@ static void gve_service_task(struct work_struct *work)
 
 static void gve_set_netdev_xdp_features(struct gve_priv *priv)
 {
+	xdp_features_t xdp_features;
+
 	if (priv->queue_format == GVE_GQI_QPL_FORMAT) {
-		priv->dev->xdp_features = NETDEV_XDP_ACT_BASIC;
-		priv->dev->xdp_features |= NETDEV_XDP_ACT_REDIRECT;
-		priv->dev->xdp_features |= NETDEV_XDP_ACT_NDO_XMIT;
-		priv->dev->xdp_features |= NETDEV_XDP_ACT_XSK_ZEROCOPY;
+		xdp_features = NETDEV_XDP_ACT_BASIC;
+		xdp_features |= NETDEV_XDP_ACT_REDIRECT;
+		xdp_features |= NETDEV_XDP_ACT_NDO_XMIT;
+		xdp_features |= NETDEV_XDP_ACT_XSK_ZEROCOPY;
 	} else {
-		priv->dev->xdp_features = 0;
+		xdp_features = 0;
 	}
+
+	xdp_set_features_flag(priv->dev, xdp_features);
 }
 
 static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 55 lines · Jakub Kicinski

Commit f85949f98206 ("xdp: add xdp_set_features_flag utility routine") added routines to inform the core about XDP flag changes. GVE support was added around the same time and missed using them.

GVE only changes the flags on error recover or resume. Presumably the flags may change during resume if VM migrated. User would not get the notification and upper devices would not get a chance to recalculate their flags.

Fixes 75eaae158b1b ("gve: Add XDP DROP and TX support for GQI-QPL format")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 drivers/net/ethernet/google/gve/gve_main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ethernet/google/gve/gve_main.c +9 -6
index 8a8f6ab12a98..533e659b15b3 100644
@@ -2241,14 +2241,18 @@ static void gve_service_task(struct work_struct *work)
 
 static void gve_set_netdev_xdp_features(struct gve_priv *priv)
 {
+       xdp_features_t xdp_features;
+
        if (priv->queue_format == GVE_GQI_QPL_FORMAT) {
-               priv->dev->xdp_features = NETDEV_XDP_ACT_BASIC;
-               priv->dev->xdp_features |= NETDEV_XDP_ACT_REDIRECT;
-               priv->dev->xdp_features |= NETDEV_XDP_ACT_NDO_XMIT;
-               priv->dev->xdp_features |= NETDEV_XDP_ACT_XSK_ZEROCOPY;
+               xdp_features = NETDEV_XDP_ACT_BASIC;
+               xdp_features |= NETDEV_XDP_ACT_REDIRECT;
+               xdp_features |= NETDEV_XDP_ACT_NDO_XMIT;
+               xdp_features |= NETDEV_XDP_ACT_XSK_ZEROCOPY;
        } else {
-               priv->dev->xdp_features = 0;
+               xdp_features = 0;
        }
+
+       xdp_set_features_flag(priv->dev, xdp_features);
 }
 
 static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
--

2.47.1

Reviewed-by
#2 lore raw
Quoted 4 lines · Jeroen de Borst
Quoted 13 lines
Quoted 12 lines · Jakub Kicinski

Commit f85949f98206 ("xdp: add xdp_set_features_flag utility routine") added routines to inform the core about XDP flag changes. GVE support was added around the same time and missed using them.

GVE only changes the flags on error recover or resume. Presumably the flags may change during resume if VM migrated. User would not get the notification and upper devices would not get a chance to recalculate their flags.

Fixes 75eaae158b1b ("gve: Add XDP DROP and TX support for GQI-QPL format")

Thanks!

Quoted 2 lines
Quoted 2 lines

---
CC: [email protected]

Reminder: please don't top post

#3 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 6 Jan 2025 10:02:10 -0800 you wrote:

Commit f85949f98206 ("xdp: add xdp_set_features_flag utility routine") added routines to inform the core about XDP flag changes. GVE support was added around the same time and missed using them.

GVE only changes the flags on error recover or resume. Presumably the flags may change during resume if VM migrated. User would not get the notification and upper devices would not get a chance to recalculate their flags.

[...]

Here is the summary with links:
- [net] eth: gve: use appropriate helper to set xdp_features

    https://git.kernel.org/netdev/net/c/db78475ba0d3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html