]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
veth: fix queue index used to wake the peer txq in veth_poll
authorJonas Köppeler <j.koeppeler@tu-berlin.de>
Thu, 6 Aug 2026 11:43:49 +0000 (13:43 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 10 Aug 2026 22:57:47 +0000 (15:57 -0700)
veth_poll() derives the index of the peer TX queue to wake from
rq->xdp_rxq.queue_index. That field is only initialized by
xdp_rxq_info_reg() in veth_enable_xdp_range(), which runs only when an
XDP program is attached. On the plain GRO/NAPI path
(veth_napi_enable_range()) xdp_rxq_info_reg() is never called, so
queue_index stays 0 for every queue, as priv->rq is zero-allocated.

So in a multi-queue setup with GRO enabled and no XDP program attached,
every NAPI instance looks at the peer's TX queue 0. If veth_xmit() stops
peer TX queue 1 because the ptr_ring is full (NETDEV_TX_BUSY), nothing
ever wakes it again: the poller draining queue 1 wakes queue 0 instead.
veth implements no ndo_tx_timeout, so the netdev watchdog does not kick
in either, and the queue stays stopped indefinitely.

Derive the index from the position of the rq within priv->rq instead,
which is correct regardless of whether XDP was ever enabled.

Scripts to reproduce the stall are available at
https://github.com/netoptimizer/veth-backpressure-performance-testing

Fixes: dc82a33297fc ("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops")
Signed-off-by: Jonas Köppeler <j.koeppeler@tu-berlin.de>
Tested-by: Jesper Dangaard Brouer <hawk@kernel.org>
Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
Link: https://patch.msgid.link/20260806-veth-fix-poll-queue-idx-v1-1-c5357fb7573d@tu-berlin.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/veth.c

index f80f6584a6ff9d1b3fefc6fd1d9512a9b093c14d..6ab84c837a332dc71b3177bdf8954e6d4056b0d9 100644 (file)
@@ -967,7 +967,7 @@ static int veth_poll(struct napi_struct *napi, int budget)
        struct veth_rq *rq =
                container_of(napi, struct veth_rq, xdp_napi);
        struct veth_priv *priv = netdev_priv(rq->dev);
-       int queue_idx = rq->xdp_rxq.queue_index;
+       int queue_idx = rq - priv->rq;
        struct netdev_queue *peer_txq;
        struct veth_stats stats = {};
        struct net_device *peer_dev;