Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] tun: trim per-packet work on the write path
@ 2026-11-24 23:59 Antonio Quartulli
  2026-11-24 23:59 ` [PATCH net-next v2 1/2] tun: don't disable BHs for the XDP program check of every packet Antonio Quartulli
  2026-11-24 23:59 ` [PATCH net-next v2 2/2] tun: skip the virtio-net header parsing without IFF_VNET_HDR Antonio Quartulli
  0 siblings, 2 replies; 3+ messages in thread
From: Antonio Quartulli @ 2026-11-24 23:59 UTC (permalink / raw)
  To: willemdebruijn.kernel, jasowangio
  Cc: Antonio Quartulli, andrew+netdev, davem, edumazet, kuba, pabeni,
	ast, daniel, hawk, john.fastabend, sdf, netdev, bpf

Profiling a link-bonding daemon that writes every packet to a tun device
showed tun doing per-packet work its packets do not need:

1. a BH-disabled RCU section, only to check for tun's XDP program, which
   only TAP devices can have
2. the parsing of an all-zero virtio-net header without IFF_VNET_HDR

Together they cut the instructions per 1400-byte UDP packet written to a
TUN device by 3.2% when an iptables raw-table rule drops it on ingress,
and by 1.9% when it is forwarded to a dummy device. Counted under qemu
-icount on x86_64, with ERMS/FSRM hidden so that user copies are not
counted per byte; the counts include the syscall, so tun's own share of
the saving is larger. The tun selftests pass.

v2:
- Drop the patch that stopped probing the transport header: tc ematches
  and generic XDP rely on it (Sashiko)
- Rename the XDP check variable, which shadowed another one (Sashiko)
- Patch 2: adapt to the has_eth argument tun_vnet_hdr_tnl_to_skb()
  gained in 73e08d50eb13
- Rebase on net-next and re-measure

v1: https://lore.kernel.org/netdev/20261112150612.3866546-1-antonio@mandelbit.com/

Antonio Quartulli (2):
  tun: don't disable BHs for the XDP program check of every packet
  tun: skip the virtio-net header parsing without IFF_VNET_HDR

 drivers/net/tun.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)


base-commit: a4c450594f5d1dc0fc4daacfb95d40554d99dead
-- 
2.56.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-25  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 23:59 [PATCH net-next v2 0/2] tun: trim per-packet work on the write path Antonio Quartulli
2026-11-24 23:59 ` [PATCH net-next v2 1/2] tun: don't disable BHs for the XDP program check of every packet Antonio Quartulli
2026-11-24 23:59 ` [PATCH net-next v2 2/2] tun: skip the virtio-net header parsing without IFF_VNET_HDR Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox