Skip to content

tun: trim per-packet work on the write path

Antonio Quartulli bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tun: don't probe the transport header of packets written by userspacedrivers/net/tun.c+0 -11 reply
2/3tun: don't disable BHs for the XDP program check of every packetdrivers/net/tun.c+8 -60 replies
3/3tun: skip the virtio-net header parsing without IFF_VNET_HDRdrivers/net/tun.c+4 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/3] tun: trim per-packet work on the write path

Profiling a link-bonding daemon on an embedded router (Cortex-A7), which injects every packet with a write() to a tun device, showed tun doing per-packet work its packets do not need:

1. a flow dissector run, only to set the transport header
2. a BH-disabled RCU section, only to check for an XDP program, which only TAP devices can have
3. the parsing of an all-zero virtio-net header without IFF_VNET_HDR

Per 1400-byte packet written and dropped at the raw table, instruction counts (qemu -icount) drop by 6.5% for 1 (Cortex-A7), 2.3% for 2 and 1.6% for 3 (x86). The tun selftests pass.

Antonio Quartulli (3):
tun: don't probe the transport header of packets written by userspace
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 | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
Signature · 1 line
2.56.0