Re: [PATCH net v5 1/2] gve: refuse XDP on queue formats without XDP support
From: Joshua Washington
Date: Mon Nov 09 2026 - 14:48:21 EST
On Mon, Nov 9, 2026 at 2:05 AM Amaan Cheval <amaan.cheval@xxxxxxxxx> wrote:
>
> Commit d8a8ca14c937 ("gve: add XDP_TX and XDP_REDIRECT support for DQ
> RDA") enabled XDP on DQO-RDA by dropping the queue_format check from
> verify_xdp_configuration(), which until then refused every format but
> GQI-QPL. Nothing replaced it: gve_set_netdev_xdp_features() advertises
> no XDP features for DQO-QPL and gve_xdp_xmit() rejects it, but the core
> only checks that ndo_bpf exists, so a native XDP program, and an AF_XDP
> socket on top of it, can still be attached on a queue format the driver
> does not support.
>
> The DQO-QPL RX path was never written for that. Its page accounting
> assumes the driver keeps a reference of its own across every handoff:
> gve_xdp_done_dqo() passes the buffer to xdp_do_redirect() and then
> recycles it with gve_reuse_buffer(), so a redirect target that releases
> the buffer synchronously, such as an AF_XDP socket in copy mode, can
> drop the page's last reference when pagecnt_bias runs out. The page is
> then freed while it is still DMA-mapped and registered in the QPL, and
> the driver posts it back to the device.
>
> Refuse XDP setup in gve_verify_xdp_configuration() whenever the driver
> advertises no XDP features for the current queue format, which today
> means DQO-QPL. A zero-copy XSK pool bind is already refused by the core
> for the same reason, and a copy-mode bind never reaches the driver and
> is harmless without a program.
>
> Fixes: d8a8ca14c937 ("gve: add XDP_TX and XDP_REDIRECT support for DQ RDA")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Amaan Cheval <amaan.cheval@xxxxxxxxx>
Reviewed-by: Joshua Washington <joshwash@xxxxxxxxxx>
> ---
> v5:
> - Check dev->xdp_features instead of queue_format, and reword the
> subject and message around that (Joshua).
> v4: https://lore.kernel.org/netdev/20261106114551.212675-2-amaan.cheval@xxxxxxxxx/
>
> drivers/net/ethernet/google/gve/gve_main.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 2437cd8ba633..fe560f5c5408 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -1723,6 +1723,12 @@ static int gve_verify_xdp_configuration(struct net_device *dev,
> struct gve_priv *priv = netdev_priv(dev);
> u16 max_xdp_mtu;
>
> + if (!(dev->xdp_features & NETDEV_XDP_ACT_BASIC)) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "XDP is not supported on this queue format.");
> + return -EOPNOTSUPP;
> + }
> +
> if (dev->features & NETIF_F_GRO_HW) {
> NL_SET_ERR_MSG_MOD(extack,
> "XDP is not supported when HW-GRO is on.");
> --
> 2.47.3
>
Thanks!