🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15239

[PATCH net-next 1/3] tun: don't probe the transport header of packets written by userspace

#15239
From: Antonio Quartulli
Date: Thu, 12 Nov 2026 15:06
30 lines
9995 bytes
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
Technical Details
Message-ID: <20261112150612.3866546-2-antonio@mandelbit.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361963-linux-kernel-netdev=dewy.ru
References: <20261112150612.3866546-1-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361963-linux-kernel-netdev=dewy.ru
From: antonio@mandelbit.com (Antonio Quartulli)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <20261112150612.3866546-2-antonio@mandelbit.com>
References: <20261112150612.3866546-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1113854"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:isfVaOaBVZdxh4HbSCLRdHgP3Uw= sha256:86tcDFrwQGzR/a7/M4cU7UCNmn6/C49JGkQSnu3hOPE=
	sha1:Oc9b4pbPskLKL9b6LwW4SljK9jU= sha256:IGZQbVFgiPCr6ZdsMi3k3Jpq+CJtSA6wLwZjRmRQyDs=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 194741142B7; Thu, 12 Nov 2026 18:16:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=mandelbit.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id NTHFnb_FAD0g;
	Thu, 12 Nov 2026 18:16:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-361963-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 4384B1142B2; Thu, 12 Nov 2026 18:16:40 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id E89101295C6; Thu, 12 Nov 2026 15:06:35 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794495988;
	b=ZI4tnnuNbzoQIJmTGMEYhrjLEaAM4MxLcQY44ntRW9N6g7N5q6NStB5bkjUPX6uXXWQo
	 hAaKy3Ff9TqO3qh22uR0pJNWQfncR9qJwHU2JCiusEH1Fu1Gukolk4765WAutQza9q4RM
	 gIsOlrWLAFe4XdmqDhtI8rPm7+lSgRUg91oFu/7taEiB68mRCznbNEZKNXC0FusOwo2G7
	 4XMvXWJGUJ+UZzQwGH7RD4UJ9LJzDRJyFAHqi06VFJoZTC72SymTX4UhP9c/E12YaIA0u
	 /FLTnuWM4Kl1ylW0d6atbUlOoxKbV03aw7QJiwdovRSR+JpEXNtqAbudgAZfa+14FlQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794495988;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=laK0kWFJEsw7C69ZvNRo76sT8cC2CLNNT+pm452UcSs=;
	b=ga7q0HRLM4KJYHQci3TEaGZW6LaMyXC0PQdFr9g5zjuGAZZljOi6Gu3+mBsg45g8bZZb
	 hAJC//8yb3X0W8nAVBT0FrstIb3i88HZA3bk2K4S2oLXZ67OZFyN9nQynsSNpKxfV3N2O
	 YHA/8I/W0my1ZIBxH8vreGpRg5EkjPPHeFl9rqGD/JZNAzdsJqxXIOVFo55FfFBAcNXzJ
	 4DybJrOXPuH2+Sd6LVKQ0AfkrHMD5w+n0NkLBte04g4Ymc6OIQQVEtW7RpSx2HwZe93RW
	 MwSInBiAtABX85KJIA2bCClZ8RswePSFU9iFETkZbzqkEDJp0TO2z6kHqlR/3IpDd4A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=aQKX1mN9;
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 85517606A88A;
	Thu, 12 Nov 2026 15:06:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=aQKX1mN9
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.61
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794495987;
	b=GTZzqA5ZJ4mpnlOpobVwiXllR9RDGgStLaIkKF7AGpaC9oJOwtnYlsR3nBmotgjwb7sq
	 JRaJZzEe/RYHt5RmFbT9Jt4fX/usJ36y3qDOs91ycHUhP6abCz8OizCn+EIwCSz/pwQme
	 ugL84U9nepjt6ekWtMQkrF71mZwgT0w8YN4DfQikjBFedOXSUqBFqtwQlwW2CwAxPFOe5
	 HX7ulabImwZHnF1wCzLAN27yE+/IWmQMmYU/WCK1sGfVL/jFF+/YHkJUuriwMfn0lUTty
	 ADSn/MEpn71lTKnnwWNPv90ZouaxWY8inxqEjY8WToWIMbj2Ru1j7mO3soFeBAFmpBw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794495987;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=laK0kWFJEsw7C69ZvNRo76sT8cC2CLNNT+pm452UcSs=;
	b=g05ZJIjxOB7DybWyMNFoO9CpSh47MHbqHlyHiLaluAfBOgs1o843M7sKJRBJlFL8mn4R
	 pPqubJ4JEQ/VR/vLL7fuOhyXM+7NgsYqr51yacLgjULsX2E3La+10rXvQx5dkiut4zSQV
	 03Ym0lry+VCuU2uNfZq+939FpUOg/SQVEY3xcaiC/9MlEqyFEwPudwqIZnCK17e7Y3G07
	 EUcFgKG2fGC5mJ9bNI2pwSyb/UGW5Jg1Ju4QtzIop1gQddJH+4o4Rxb5ret7Xd2XlsgME
	 /kSlJoVZ2JyVcV+0AXjpw7ubcaMFwvTFdDCkegAn21D6pLttdqD89Az0TGK6XiO3Caw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=aQKX1mN9;
	arc=none smtp.remote-ip=195.10.208.61
X-Received: from mout-b-201.mailbox.org (mout-b-201.mailbox.org [195.10.208.61])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7306606A333;
	Thu, 12 Nov 2026 15:06:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A7306606A333
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-201.mailbox.org (Postfix) with ESMTPS id 4jQNy16SK5zLm09;
	Thu, 12 Nov 2026 16:06:17 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1794495977;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=laK0kWFJEsw7C69ZvNRo76sT8cC2CLNNT+pm452UcSs=;
	b=aQKX1mN9tXzJQGvUd1yC8jpr5E0UhZ2/SEAEUDgm+lB02QxHujxSTsfhL0Q9Z0sqVXvSFr
	iiaRFfzjl57FemQmO1mC5W0vVXW7EHqkror0QMUWkRUKNpywlj+n0udvYIvi3efyXMfAIJ
	fTfmZ2bJk4u+QKC3tiPdG/cM9cfJ7W7rOzxc76a8dTlFWln6rVnr5vi4VbUPRYZXLQbIuL
	S9tQxYHgKIsXvnYcMSW61115XHwJ1JxPuX5FGAGBp2n3klzOIeowM7nEWhMsXqT3CP80mz
	trXJQHaQ5gTcbHEPm0njsnFCC4zrdXZffPFiv1K2Zjkqx/m6vENUGhUkhPQadQ==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com
X-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
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <20261112150612.3866546-1-antonio@mandelbit.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Rspamd-Queue-Id: 4jQNy16SK5zLm09