diff mbox series

[net] eth: gve: use appropriate helper to set xdp_features

Message ID 20250106180210.1861784-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit db78475ba0d3c66d430f7ded2388cc041078a542
Delegated to: Netdev Maintainers
Headers show
Series [net] eth: gve: use appropriate helper to set xdp_features | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 4 maintainers not CCed: andrew+netdev@lunn.ch ast@kernel.org daniel@iogearbox.net hramamurthy@google.com
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-01-07--18-00 (tests: 883)

Commit Message

Jakub Kicinski Jan. 6, 2025, 6:02 p.m. UTC
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")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: jeroendb@google.com
CC: pkaligineedi@google.com
CC: shailend@google.com
CC: hawk@kernel.org
CC: john.fastabend@gmail.com
CC: willemb@google.com
CC: bpf@vger.kernel.org
---
 drivers/net/ethernet/google/gve/gve_main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Jeroen de Borst Jan. 6, 2025, 11:25 p.m. UTC | #1
Reviewed-By: Jeroen de Borst <jeroendb@google.com>



On Mon, Jan 6, 2025 at 10:02 AM Jakub Kicinski <kuba@kernel.org> 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.
>
> Fixes: 75eaae158b1b ("gve: Add XDP DROP and TX support for GQI-QPL format")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: jeroendb@google.com
> CC: pkaligineedi@google.com
> CC: shailend@google.com
> CC: hawk@kernel.org
> CC: john.fastabend@gmail.com
> CC: willemb@google.com
> CC: bpf@vger.kernel.org
> ---
>  drivers/net/ethernet/google/gve/gve_main.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 8a8f6ab12a98..533e659b15b3 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -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
>
Willem de Bruijn Jan. 7, 2025, 9:30 a.m. UTC | #2
Jeroen de Borst wrote:
> Reviewed-By: Jeroen de Borst <jeroendb@google.com>
> 
> 
> 
> On Mon, Jan 6, 2025 at 10:02 AM Jakub Kicinski <kuba@kernel.org> 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.
> >
> > Fixes: 75eaae158b1b ("gve: Add XDP DROP and TX support for GQI-QPL format")
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Willem de Bruijn <willemb@google.com>

Thanks!

> > ---
> > CC: jeroendb@google.com

Reminder: please don't top post
patchwork-bot+netdevbpf@kernel.org Jan. 8, 2025, 2:20 a.m. UTC | #3
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 8a8f6ab12a98..533e659b15b3 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -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)