Netdev List
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@mandelbit.com>
To: willemdebruijn.kernel@gmail.com, jasowangio@gmail.com
Cc: Antonio Quartulli <antonio@mandelbit.com>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	sdf@fomichev.me, netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH net-next 1/3] tun: don't probe the transport header of packets written by userspace
Date: Thu, 12 Nov 2026 16:06:03 +0100	[thread overview]
Message-ID: <20261112150612.3866546-2-antonio@mandelbit.com> (raw)
In-Reply-To: <20261112150612.3866546-1-antonio@mandelbit.com>

tun_get_user() runs the flow dissector on every written packet only to
set the transport header. Packets that need it early already get it:
skb_partial_csum_set() for NEEDS_CSUM, __virtio_net_hdr_to_skb() for
GSO. For the rest, the IPv4/IPv6 receive paths set it, as for packets
from NICs.

Drop the probe: ~200 fewer instructions per 1400-byte packet, -6.5%
when dropped at the raw table, -2.4% through conntrack and NAT
(emulated Cortex-A7).

Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
 drivers/net/tun.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 8920c797acfd..9fc60a73fb96 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1960,7 +1960,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 		net_zcopy_complete(NULL, msg_control, false);
 
 	skb_reset_network_header(skb);
-	skb_probe_transport_header(skb);
 	skb_record_rx_queue(skb, tfile->queue_index);
 
 	if (skb_xdp) {
-- 
2.56.0


  reply	other threads:[~2026-11-12 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 15:06 [PATCH net-next 0/3] tun: trim per-packet work on the write path Antonio Quartulli
2026-11-12 15:06 ` Antonio Quartulli [this message]
2026-11-12 15:06 ` [PATCH net-next 2/3] tun: don't disable BHs for the XDP program check of every packet Antonio Quartulli
2026-11-12 15:06 ` [PATCH net-next 3/3] tun: skip the virtio-net header parsing without IFF_VNET_HDR Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112150612.3866546-2-antonio@mandelbit.com \
    --to=antonio@mandelbit.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hawk@kernel.org \
    --cc=jasowangio@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox