Article View: linux.kernel.netdev
Article #11294Re: [PATCH net 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation
From: Andrea Mayer
Date: Wed, 04 Nov 2026 20:25
Date: Wed, 04 Nov 2026 20:25
64 lines
12488 bytes
12488 bytes
On Tue, 3 Nov 2026 10:37:34 +0800 Hangbin Liu <hangbin.liu@linux.dev> wrote: > [snip] > > skb_mac_header_rebuild(skb); > > - skb_push(skb, skb->mac_len); > > + skb_push_rcsum(skb, skb->mac_len); > > > > if (tinfo->mode == SEG6_IPTUN_MODE_L2ENCAP) > > err = __seg6_do_srh_encap(skb, tinfo->srh, > > -- > > 2.43.0 > > > > Should we put the skb_push_rcsum() inside of __seg6_do_srh_encap() and > seg6_do_srh_encap_red()? They all do skb_mac_header_rebuild() again. > [snip] Hi Hangbin, I am not sure where exactly you would like to put skb_push_rcsum() in these two functions. I can read it in two ways. 1) Right after skb_mac_header_rebuild(), for example in __seg6_do_srh_encap(): skb_push(skb, tot_len); skb_reset_network_header(skb); skb_mac_header_rebuild(skb); + if (proto == IPPROTO_ETHERNET) + skb_push_rcsum(skb, skb->mac_len); hdr = ipv6_hdr(skb); Here the outer headers are already pushed, and skb_mac_header_rebuild() moves the MAC header in front of them, outside skb->data. The push then makes the packet start with that MAC header, instead of the outer IPv6 header. 2) Before the outer headers are pushed, for example in __seg6_do_srh_encap(): + if (proto == IPPROTO_ETHERNET) + skb_push_rcsum(skb, skb->mac_len); + inner_hdr = ipv6_hdr(skb); flowlabel = seg6_make_flowlabel(net, skb, inner_hdr); This can work, with the push removed from seg6_do_srh(), but the L2 case in seg6_do_srh() would still keep the skb_mac_header_was_set() check and the headroom for the MAC header, and part of the L2 handling would move into __seg6_do_srh_encap() and seg6_do_srh_encap_red(). __seg6_do_srh_encap() is also used by the ENCAP mode, End.B6.Encaps and bpf_push_seg6_encap(), and seg6_do_srh_encap_red() by the ENCAP_RED mode. So the first way does not work. In the second one I do not see a real advantage, and it would split the L2 handling between three functions. For this reason I would like to keep the change as it is in the patch. What do you think? If you meant something else, please let me know. Thanks, Andrea
Technical Details
Message-ID:
<20261104212546.1222c4cfcccaecf68f326cdf@uniroma2.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356906-linux-kernel-netdev=dewy.ruReferences:
<20261031225033.64-1-andrea.mayer@uniroma2.it> <20261031225033.64-6-andrea.mayer@uniroma2.it> <aulI7pl1oWRKzXgt@fedora>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356906-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 5/6] seg6: account for the MAC header in skb
checksum on L2 encapsulation
Date: Wed, 4 Nov 2026 21:25:46 +0100
Organization: Usenet Network
Message-ID: <20261104212546.1222c4cfcccaecf68f326cdf@uniroma2.it>
References: <20261031225033.64-1-andrea.mayer@uniroma2.it>
<20261031225033.64-6-andrea.mayer@uniroma2.it>
<aulI7pl1oWRKzXgt@fedora>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="3494295"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Fabo6wOTUjeKD0Y+Zj7sHMIysp0= sha256:I8oJuH+aXfer83cnp0oRjZX2R7N1QamlBYYouo+6N+8=
sha1:ENmK4YPLjAjJSa98SoZAqHImH30= sha256:ER4nucsupicU5TesOjLTBUm8PmuQsFLT54lW76xTGrI=
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 65CA5112D9E; Thu, 5 Nov 2026 00:42:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -4.874
X-Spam-Status: No, score=-4.874 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
NICE_REPLY_A=-1.724, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=neutral
reason="invalid (unsupported algorithm ed25519-sha256)"
header.d=uniroma2.it header.b=ldLCA6rR; dkim=pass (2048-bit key)
header.d=uniroma2.it header.b=mjJK1j5Q
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 Q1w61VV_cJtN;
Thu, 5 Nov 2026 00:42:16 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-356906-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=uniroma2.it
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 9030B112D93; Thu, 5 Nov 2026 00:42:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 7BE36622B1D; Wed, 4 Nov 2026 21:16:19 +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=1793824013;
b=U+znFAjgrUuWA4uTlQRiOWyROdOA7idUMRd5e+Py+FW1/g7E01v5KMLN8k03vFUXGPGm
hxdNmjk9QRlylx9p8fHR36dPo92lSBq2UTkbFZr+V6hqnJukGPHkObXt/KIOH4mIxA0eY
nrKIHZmSH8GJdkpFTLUYl0KvtTuf2KTx3IX8oRhokBVaR5mDnaFCTmxx0b6qYrfaIJneC
KT2D13RboTyqpqCT0Wm77ot+KvPrTP4vPcnDeqYGAf3KbOGjlVY1pyZ2txeGLb/5bx0RJ
5yK70GEifAYQ++7Ax1CbYJOYofecQWG7uw9N+mx3eH9b11Cqi4aDb52mv2ZQUEXiBeQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793824013;
h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
DKIM-Signature:Date:From:To:Cc:Subject:Message-Id:In-Reply-To:
References:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:Mime-Version:
Content-Type:Content-Transfer-Encoding:X-Virus-Scanned:
X-Virus-Status;
bh=Zy0da+RmL4OG3OVXsPiCDxk1YUO9Mt8OW1eMIQoj6ps=;
b=4Zz+3wFY9Fprszoys0JL3nmqnhD+OPAmjzSrclA9ycf3KAHx8GdZuynC79heYTk5PN25
QqmwrEdoqt5tozLt4TWEo4DXU8XAPkDy9xYgJQ1lwhyS8NCq2Ox34Q2wWz2TiO2ET/N2O
YY+DzAfUDNVOEEXmhceAb1Qr85h65pLMKlGwWItxLlk10eWxZR/VZtly7una0NPloxtYx
ymV00+iMdYu4ps5aphVuuK9OuIsO2lon8mxv1eas18lk3iB4Y/1fDYjWY3wxuz++nCS9G
yayowACedEZRA7Sm78mWQH7l3zIGXVCBBFVJvVuVGCh3Y9fBQZxgQi7J7xgbEsOd/GA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=ldLCA6rR;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=mjJK1j5Q;
dmarc=pass header.from=uniroma2.it;
spf=pass smtp.mailfrom=uniroma2.it;
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 49F3C6073533;
Wed, 4 Nov 2026 20:26:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=ldLCA6rR;
dkim=pass (2048-bit key, unprotected) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=mjJK1j5Q
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.80.4.35
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793824002;
b=Vb3dJzMy//kPHC9cNeyrYIsct+dH7SmDKefoU/SmN3ODL8tlx2nJTeRlkYNPNlC5Yy6g
dOqApALWU61uvFepgF5kd633cTzLDLX8N+ZIF6whO6vzGn1V91LixY2e7dWvRcWxtqmCL
l0U3B+cRGkD5fRpScqMmAvHK/HqUtmpnzezjkI5smzWZATYLR7H43iCCj3d5qCPvl3EZ0
ZxBGwCM3xBwiAWl0MeKfLzUqg1M+txwOQ9P3urYiP273abmaHBPdTyZow1KD3Gtned8IJ
LHmsqrRPAOMkJqRIzTqRIIIRJLnSU2tYYv3UnqjAqNI4pduz8nmYt0Tp6JJgnou9DVQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793824002;
h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:Date:
From:To:Cc:Subject:Message-Id:In-Reply-To:References:X-Mailer:
Mime-Version:Content-Type:Content-Transfer-Encoding:X-Virus-Scanned:
X-Virus-Status;
bh=Zy0da+RmL4OG3OVXsPiCDxk1YUO9Mt8OW1eMIQoj6ps=;
b=pk3hzerbAyADDlPt0qXQMABGbBz7RtYylfurkTcQIwNEp6LkM109NhEAr47JxTskL0BN
tVlGbnHahqcHdBm7PwejDqjUk+UmKEPijxvG5HieznZdn+FcJUaeqRhYh08667EcXr8Zq
9HA5fY4s2MMxYFkt+pdhtVDcXuEemBNXsCptDxFTNmD9IQ/s/uZ8QezDVj8z7/vqK5bUh
Ekh7G2dJxOq4rda/rKmopXQdPP6SChq9oAW3hiO8kvlnhhstekyD8hwfPug5k8h2QdmCl
jvTnmPwgPcIQhSQWFuCa7UAEExhvGMocyjI6FQDlrVzcDFtNiMsYoPqMT1+44yqp6NA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=uniroma2.it;
spf=pass smtp.mailfrom=uniroma2.it;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=ldLCA6rR;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=mjJK1j5Q;
arc=none smtp.remote-ip=160.80.4.35
X-Received: from smtp.uniroma2.it (smtp-2015.uniroma2.it [160.80.4.35])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FA62606A33B;
Wed, 4 Nov 2026 20:26:39 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1FA62606A33B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniroma2.it
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniroma2.it
X-Received: from smtpauth-2019-1.uniroma2.it (smtpauth-2019-1.uniroma2.it [160.80.5.46])
by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 6A4KPoV6026281;
Wed, 4 Nov 2026 21:25:55 +0100
X-Received: from lubuntu-18.04 (unknown [160.80.103.126])
by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id 402991209D4;
Wed, 4 Nov 2026 21:25:46 +0100 (CET)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
s=ed201904; t=1793823946; h=from:from:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=Zy0da+RmL4OG3OVXsPiCDxk1YUO9Mt8OW1eMIQoj6ps=;
b=ldLCA6rRq3os4tvfZIs6fO/PijLgBdg7VxyRstRpyQ9UzRMGOXI6uI0AQHbokBPMrJuLwa
Kl5lYnzZCYRTtACg==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
t=1793823946; h=from:from:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=Zy0da+RmL4OG3OVXsPiCDxk1YUO9Mt8OW1eMIQoj6ps=;
b=mjJK1j5QTbfhSGv23Dw+64AcWgl6YE3lhTwdbo9BKazkGHYVDBUCH3yBSasN8iDyAlY2v4
1gj/cFeZWVg3/yM3QiIq4NrngPkIJ4Jb9bZbzS4bKomXQjPeCBFJGTcAOYHSZucyC7chzT
Jemqedpx7QfoyHHukGFnZ9WbRLTmzqp5RxTNBqBJR5MKJZLB43p6la/eyLKv+Lz1Q+i26T
8ZN0REU41k1FXHEUgTIMDi+41Y29r3zJ8SHW2Dz8IJvUcoCUBqe5BnNamLuf8Rduu3afIH
yUVSaQ6Gj3os5xhH+bM2tWbMmUH2rosbTpIt9v9hYU+WR7MQmjZnytkh6B0LMQ==
X-Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet
<edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni
<pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
David Ahern
<dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>,
Shuah Khan
<shuah@kernel.org>, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
bpf@vger.kernel.org, David Lebrun
<david.lebrun@uclouvain.be>,
Daniel Borkmann <daniel@iogearbox.net>,
Mathieu Xhonneux <m.xhonneux@gmail.com>,
David Lebrun <dlebrun@google.com>,
Stefano Salsano <stefano.salsano@uniroma2.it>,
Andrea Mayer
<andrea@common-net.org>,
Andrea Mayer <andrea.mayer@uniroma2.it>
X-In-Reply-To: <aulI7pl1oWRKzXgt@fedora>
X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
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-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015
X-Virus-Status: Clean