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

Jason Xing
2026-04-15T08:27:38Z

From: Jason Xing <kernelxing@tencent.com>

Only set xmit.more false for the last skb.

In theory, only making xmit.more false for the last packets to be
sent in each round can bring much benefit like avoid triggering too
many irqs.

Compared to the numbers for batch mode, a huge improvement (26%) can
be seen on i40e/ixgbe driver since the cost of triggering irqs is
expensive.

Suggested-by: Jesper Dangaard Brouer <hawk@kernel.org>
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
net/core/dev.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index e33a2406d8ca..a6abd621a7f3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4901,6 +4901,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());
@@ -4920,8 +4921,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);
--
2.41.3