BPF List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kuba@kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	michael.chan@broadcom.com, manishc@marvell.com,
	joshwash@google.com, hramamurthy@google.com, tariqt@nvidia.com,
	saeedm@nvidia.com, daniel@iogearbox.net, hawk@kernel.org,
	sdf@fomichev.me, willemb@google.com,
	przemyslaw.kitszel@intel.com, bpf@vger.kernel.org
Subject: Re: [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core
Date: Sun, 22 Nov 2026 17:03:03 +0000	[thread overview]
Message-ID: <179536698358.3135.1764700076873359155@kernel.org> (raw)
In-Reply-To: <20261118232315.3593731-4-kuba@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Generic (SKB-mode) XDP attach now fails on devices where
  NETIF_F_GRO_HW is fixed on, i.e. present in dev->features but missing…
- [Medium] dev_xdp_attach() now sets dev->xdp_pending = 1 and calls
  dev_xdp_clear_rx_agg() before dev_xdp_install() runs its validation.
- [Low] The commit fixes concrete user-visible bugs but carries no Fixes:
  tag.

--

net: state the "XDP excludes HW-GRO" rule in the core

This commit moves the "XDP excludes HW-GRO" policy into the core. While an
XDP program is attached or pending, __netdev_update_features() now clears
NETIF_F_GRO_HW. The XDP attach paths call a new helper,
dev_xdp_clear_rx_agg(), which refuses the attach if HW-GRO cannot be
turned off, and the warn-only dev_disable_gro_hw() is removed.

> The device also lost the bit from wanted_features for good, so HW-GRO
> never came back after detach - on mlx5 that took header-data split
> with it, and with it devmem and io_uring zero-copy Rx.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

[Severity: Low]
Should this carry a Fixes: tag? Two things combine to cause the splat and
the permanent loss of NETIF_F_GRO_HW from wanted_features:

  - the HDS-forces-GRO_HW logic in mlx5e_fix_features()
  - the warn-and-continue behavior of dev_disable_gro_hw()

The mlx5 logic was added by:

  Fixes: 46bcce5dfd33 ("net/mlx5e: Support ethtool tcp-data-split settings")

Without a tag, stable and backport tooling can't tell which kernels are
affected. If the series is meant only for net-next, this can be ignored.

> diff --git a/net/core/dev.c b/net/core/dev.c
> index d88af07aea290..c0bb5eb9fdea0 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c

[ ... ]

> @@ -10612,6 +10594,32 @@ static void dev_xdp_set_prog(struct net_device *dev, enum bpf_xdp_mode mode,
>  	dev->xdp_state[mode].prog = prog;
>  }
>  
> +/* Try to clear HW-GRO before the driver reconfigures for XDP.
> + * Driver may add features back in via ndo_fix_features(), due to feature
> + * dependencies. In that case we can't run XDP at all.
> + */
> +static int dev_xdp_clear_rx_agg(struct net_device *dev,
> +				struct netlink_ext_ack *extack)
> +{
> +	if (!(dev->features & NETIF_F_GRO_HW))
> +		return 0;
> +	if (!(dev->hw_features & NETIF_F_GRO_HW)) {
> +		NL_SET_ERR_MSG(extack,
> +			       "unable to disable HW-GRO, fixed on");
> +		return -EOPNOTSUPP;
> +	}

[Severity: Medium]
Does this stop generic XDP from attaching to virtio_net devices where
GRO_HW is fixed on?

virtnet_probe() adds GRO_HW to dev->features whenever GUEST_TSO4/6 is
negotiated. It only adds it to hw_features when CTRL_GUEST_OFFLOADS is
negotiated, and that needs the optional ctrl vq:

drivers/net/virtio_net.c:virtnet_probe() {
    ...
	if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
	    virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6))
		dev->features |= NETIF_F_GRO_HW;
    ...
	if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) &&
	    (vi->guest_offloads_capable & GUEST_OFFLOAD_GRO_HW_MASK))
		dev->hw_features |= NETIF_F_GRO_HW;
    ...
}

Before this patch, generic_xdp_install()->dev_disable_gro_hw() printed
the "failed to disable GRO_HW!" warning and then attached the program
anyway. Now dev_xdp_attach()->dev_xdp_clear_rx_agg() returns -EOPNOTSUPP
before dev_xdp_install() is reached.

virtnet_xdp_set() already refuses native XDP on these setups:

drivers/net/virtio_net.c:virtnet_xdp_set() {
    ...
		NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing GRO_HW/CSUM, disable GRO_HW/CSUM first");
		return -EOPNOTSUPP;
    ...
}

So xdpgeneric was the only option left, for example for loaders that fall
back from native to SKB mode.

The refusal matches the new rule. Even so, could the commit message say
that generic XDP attaches which used to succeed are now rejected? The
check is still there at the end of the series, where it also covers LRO.

[ ... ]

> @@ -10875,19 +10900,36 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
>  			return -EOPNOTSUPP;
>  		}
>  
> +		if (new_prog) {
> +			dev->xdp_pending = 1;
> +			err = dev_xdp_clear_rx_agg(dev, extack);
> +			if (err)
> +				goto err_clear_pending;
> +		}
> +
>  		err = dev_xdp_install(dev, mode, bpf_op, extack, flags, new_prog);
>  		if (err)
> -			return err;
> +			goto err_clear_pending;
>  	}

[Severity: Medium]
Is it intended that the hardware gets reconfigured here before
dev_xdp_install() has validated the request?

dev_xdp_clear_rx_agg() calls netdev_update_features(), which ends up in
ndo_set_features(). These checks in dev_xdp_install() only run after
that:

  - native and generic XDP active at the same time
  - an offloaded program without HW_MODE
  - a device-bound program on the wrong device or in SKB mode
  - a BPF_XDP_DEVMAP or BPF_XDP_CPUMAP attach type
  - tcp-data-split enabled with a non-frags program
  - a bound memory provider

The core used to reject such requests without touching the device. Now
it turns HW-GRO off first, the request fails, and err_clear_pending calls
netdev_update_features() again to turn HW-GRO back on.

On bnxt, a GRO_HW change toggles BNXT_FLAG_TPA, so
bnxt_set_features() calls bnxt_reinit_features():

drivers/net/ethernet/broadcom/bnxt/bnxt.c:bnxt_reinit_features() {
	bnxt_close_nic(bp, irq_re_init, link_re_init);
	bp->flags = flags;
	if (update_tpa)
		bnxt_set_ring_params(bp);
	return bnxt_open_nic(bp, irq_re_init, link_re_init);
}

One rejected attach therefore costs two full close/open cycles of the
NIC, memory provider queues included.

If either bnxt_open_nic() call fails, __netdev_update_features() only
logs "set_features() failed". Could that leave the device with its rings
freed while it is still IFF_UP?

netif_xdp_propagate() already runs its hds and memory provider checks
before it calls dev_xdp_clear_rx_agg(). Could dev_xdp_attach() also run
the dev_xdp_install() pre-checks before clearing rx aggregation? The
ordering is the same at the end of the series.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org

  parent reply	other threads:[~2026-11-22 17:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 1/8] net: stop making HW-GRO depend on SW GRO Jakub Kicinski
2026-11-22 17:03   ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup Jakub Kicinski
2026-11-19 21:40   ` Willem de Bruijn
2026-11-22 17:03   ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core Jakub Kicinski
2026-11-19 22:59   ` Willem de Bruijn
2026-11-20 22:13     ` Jakub Kicinski
2026-11-22 17:03   ` netdev-bot+sashiko [this message]
2026-11-18 23:23 ` [PATCH net-next 4/8] net: state the "XDP excludes LRO" " Jakub Kicinski
2026-11-19 23:02   ` Willem de Bruijn
2026-11-19 23:24   ` sashiko-bot
2026-11-22 17:03   ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 5/8] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling Jakub Kicinski
2026-11-19 15:42   ` Dragos Tatulea
2026-11-22 17:03   ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 6/8] eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 7/8] eth: qede: drop the now-dead HW-GRO vs XDP handling Jakub Kicinski
2026-11-22 17:03   ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock Jakub Kicinski
2026-11-18 23:44   ` Ankit Garg
2026-11-19 22:14   ` Harshitha Ramamurthy
2026-11-22 17:03   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179536698358.3135.1764700076873359155@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=hramamurthy@google.com \
    --cc=joshwash@google.com \
    --cc=kuba@kernel.org \
    --cc=manishc@marvell.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=saeedm@nvidia.com \
    --cc=sdf@fomichev.me \
    --cc=tariqt@nvidia.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox