Re: [PATCH RFC net-next v4 06/14] xsk: support dynamic xmit.more control for batch xmit

sashiko-bot
2026-04-15T09:35:39Z

Sashiko AI review found 1 potential issue(s):
- [High] Stalled TX queue due to missing hardware doorbell ring on early loop exit
--

commit 6d7c8f2ad056eb4cb2eec8d360e632f9ef9044f5
Author: Jason Xing <kernelxing@tencent.com>

xsk: support dynamic xmit.more control for batch xmit

This commit updates xsk batch transmission to only set xmit.more to false for
the last skb in the send queue, aiming to reduce unnecessary IRQs and improve
batching performance.

> diff --git a/net/core/dev.c b/net/core/dev.c
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4873,6 +4873,7 @@ int xsk_direct_xmit_batch(struct xdp_sock *xs, struct net_device *dev)
> struct sk_buff_head *send_queue = &xs->batch.send_queue;
> int ret = NETDEV_TX_BUSY;
> struct sk_buff *skb;
> + bool more = true;
>
> local_bh_disable();
> HARD_TX_LOCK(dev, txq, smp_processor_id());

[ ... ]

> @@ -4892,8 +4893,12 @@ int xsk_direct_xmit_batch(struct xdp_sock *xs, struct net_device *dev)
> __skb_queue_head(send_queue, skb);
> break;
> }
> +
> + if (!skb_peek(send_queue))
> + more = false;
> +
> skb_set_queue_mapping(skb, queue_id);
> - ret = netdev_start_xmit(skb, dev, txq, false);
> + ret = netdev_start_xmit(skb, dev, txq, more);
> if (ret != NETDEV_TX_OK) {
> if (ret == NETDEV_TX_BUSY)
> __skb_queue_head(send_queue, skb);
> break;
> }
> }

If an error occurs and the loop breaks early, does this leave previously
transmitted packets stalled in the driver's TX ring?

Since more is passed as true for all packets prior to the failure, the
network driver defers ringing the hardware TX doorbell.

If the code breaks out of the loop due to validate_xmit_skb_list() failing,
netif_xmit_frozen_or_drv_stopped(), or netdev_start_xmit() returning
NETDEV_TX_BUSY, the loop terminates without ever passing more = false to the
driver.

Could this omission prevent the hardware from being notified to transmit
the successfully processed packets that preceded the error?

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260415082654.21026-1-kerneljasonxing@gmail.com?part=6