]> git.ipfire.org Git - thirdparty/linux.git/commit
vhost-net: wake queue of tun/tap after ptr_ring consume
authorSimon Schippers <simon.schippers@tu-dortmund.de>
Sun, 10 May 2026 15:15:27 +0000 (17:15 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 14 May 2026 00:52:55 +0000 (17:52 -0700)
commitbaf808fe4fcd35767ab732b4ab2ea80dabfd97a6
tree3df08ea9781841b9f60d136fab3d3c1376da9526
parentd4c22d70d7253dd727c71484c58d504f6c630343
vhost-net: wake queue of tun/tap after ptr_ring consume

Add tun_wake_queue() to tun.c and export it for use by vhost-net. The
function validates that the file belongs to a tun/tap device and that
the tfile exists, dereferences the tun_struct under RCU, and delegates
to __tun_wake_queue().

vhost_net_buf_produce() now calls tun_wake_queue() after a successful
batched consume of the ring to allow the netdev subqueue to be woken up.
The point is to allow the queue to be stopped when it gets full, which
is required for traffic shaping - implemented by the following
"avoid ptr_ring tail-drop when a qdisc is present".

Without the corresponding queue stopping, this patch alone causes no
throughput regression for a tap+vhost-net setup sending to a qemu VM:
3.857 Mpps to 3.891 Mpps.

Details: AMD Ryzen 5 5600X at 4.3 GHz, 3200 MHz RAM, isolated QEMU
threads, XDP drop program active in VM, pktgen sender; Avg over
50 runs @ 100,000,000 packets. SRSO and spectre v2 mitigations disabled.

Co-developed-by: Tim Gebauer <tim.gebauer@tu-dortmund.de>
Signed-off-by: Tim Gebauer <tim.gebauer@tu-dortmund.de>
Signed-off-by: Simon Schippers <simon.schippers@tu-dortmund.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://patch.msgid.link/20260510151529.43895-3-simon.schippers@tu-dortmund.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/tun.c
drivers/vhost/net.c
include/linux/if_tun.h