From: Andrea Mayer <andrea.mayer@uniroma2.it>
To: Hangbin Liu <hangbin.liu@linux.dev>
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>
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 [thread overview]
Message-ID: <20261104212546.1222c4cfcccaecf68f326cdf@uniroma2.it> (raw)
In-Reply-To: <aulI7pl1oWRKzXgt@fedora>
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
next prev parent reply other threads:[~2026-11-04 20:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 22:50 [PATCH net 0/6] seg6: fix skb checksum updates with CHECKSUM_COMPLETE Andrea Mayer
2026-10-31 22:50 ` [PATCH net 1/6] seg6: fix skb checksum update helpers Andrea Mayer
2026-11-03 1:25 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 2/6] seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit Andrea Mayer
2026-11-03 1:27 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 3/6] seg6: update skb checksum when SRv6 behaviors advance to the next SID Andrea Mayer
2026-11-03 2:15 ` Hangbin Liu
2026-11-04 19:51 ` Andrea Mayer
2026-10-31 22:50 ` [PATCH net 4/6] seg6: discard CHECKSUM_COMPLETE after the End.BPF program Andrea Mayer
2026-11-03 2:28 ` Hangbin Liu
2026-11-04 20:13 ` Andrea Mayer
2026-10-31 22:50 ` [PATCH net 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation Andrea Mayer
2026-11-03 2:37 ` Hangbin Liu
2026-11-04 20:25 ` Andrea Mayer [this message]
2026-11-05 3:23 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 6/6] selftests: seg6: add test for skb checksum with CHECKSUM_COMPLETE Andrea Mayer
2026-11-03 3:26 ` Hangbin Liu
2026-11-04 20:48 ` Andrea Mayer
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=20261104212546.1222c4cfcccaecf68f326cdf@uniroma2.it \
--to=andrea.mayer@uniroma2.it \
--cc=andrea@common-net.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=david.lebrun@uclouvain.be \
--cc=dlebrun@google.com \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=hangbin.liu@linux.dev \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=m.xhonneux@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=stefano.salsano@uniroma2.it \
/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
all inboxes | Powered by JetHome®