From: Amaan Cheval <amaan.cheval@gmail.com>
To: netdev@vger.kernel.org
Cc: joshwash@google.com, hramamurthy@google.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, bcf@google.com,
jordanrhee@google.com, przemyslaw.kitszel@intel.com,
maciej.fijalkowski@intel.com, pkaligineedi@google.com,
maolson@google.com, csully@google.com, willemb@google.com,
yangchun@google.com, npl@google.com, awogbemila@google.com,
shailend@google.com, nktgrg@google.com, maxyuan@google.com,
bpf@vger.kernel.org, john.fastabend@gmail.com, hawk@kernel.org,
sdf@fomichev.me, daniel@iogearbox.net, ast@kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Amaan Cheval <amaan.cheval@gmail.com>
Subject: [PATCH net v5 1/2] gve: refuse XDP on queue formats without XDP support
Date: Mon, 9 Nov 2026 15:34:36 +0530 [thread overview]
Message-ID: <20261109100437.331423-2-amaan.cheval@gmail.com> (raw)
In-Reply-To: <20261109100437.331423-1-amaan.cheval@gmail.com>
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@vger.kernel.org
Signed-off-by: Amaan Cheval <amaan.cheval@gmail.com>
---
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@gmail.com/
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
next prev parent reply other threads:[~2026-11-09 10:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 10:04 [PATCH net v5 0/2] gve: fix RX page refcount overflow with the pagecnt bias Amaan Cheval
2026-11-09 10:04 ` Amaan Cheval [this message]
2026-11-09 10:04 ` [PATCH net v5 2/2] gve: fix RX page refcount overflow from INT_MAX pagecnt_bias Amaan Cheval
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=20261109100437.331423-2-amaan.cheval@gmail.com \
--to=amaan.cheval@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=awogbemila@google.com \
--cc=bcf@google.com \
--cc=bpf@vger.kernel.org \
--cc=csully@google.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=hramamurthy@google.com \
--cc=john.fastabend@gmail.com \
--cc=jordanrhee@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=maolson@google.com \
--cc=maxyuan@google.com \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=npl@google.com \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@fomichev.me \
--cc=shailend@google.com \
--cc=stable@vger.kernel.org \
--cc=willemb@google.com \
--cc=yangchun@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
all inboxes | Powered by JetHome®