Article View: linux.kernel.netdev
Article #11476Re: [PATCH net 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation
From: Hangbin Liu
Date: Thu, 05 Nov 2026 03:23
Date: Thu, 05 Nov 2026 03:23
69 lines
11222 bytes
11222 bytes
On Wed, Nov 04, 2026 at 09:25:46PM +0100, Andrea Mayer wrote: > 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. > Oh, I miss-read the change. This is rcsum is only for inner header. The outer header will be updated via later skb_postpush_rcsum(). Thanks Hangbin
Technical Details
Message-ID:
<auv2v3HH4xX5nyNP@fedora>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357050-linux-kernel-netdev=dewy.ruReferences:
<20261031225033.64-1-andrea.mayer@uniroma2.it> <20261031225033.64-6-andrea.mayer@uniroma2.it> <aulI7pl1oWRKzXgt@fedora> <20261104212546.1222c4cfcccaecf68f326cdf@uniroma2.it>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-357050-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation Date: Thu, 5 Nov 2026 11:23:43 +0800 Organization: Usenet Network Message-ID: <auv2v3HH4xX5nyNP@fedora> References: <20261031225033.64-1-andrea.mayer@uniroma2.it> <20261031225033.64-6-andrea.mayer@uniroma2.it> <aulI7pl1oWRKzXgt@fedora> <20261104212546.1222c4cfcccaecf68f326cdf@uniroma2.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3551601"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:vtGwhhdIHhbLivVXPhPezD96Bv8= sha256:o7DLYzzOETOVZ0j3AERUlqYgY/nI6/MDxZt3m/FAmR8= sha1:bsT3zxEPb8pZ1NHHNF6GJv+pKGc= sha256:hAonXmdcS98lF3SK0ot4qxWOKGDbsiaK/Lznmor6glI= Content-Disposition: inline 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 EED33112E7F; Thu, 5 Nov 2026 06:26:08 +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 (1024-bit key) header.d=linux.dev 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 10YcSfnVYzYj; Thu, 5 Nov 2026 06:26:05 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-357050-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 4960A112E3F; Thu, 5 Nov 2026 06:25:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 420C72B058; Thu, 5 Nov 2026 03:24:00 +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=1793849036; b=fqEiTDUWWL5KaiS/MlqPPGM4sIJOxksKzaFp1f9hHjw40x0vVErgM90mPBzXdMv1vY1Q bnHwATDZXwJKce2kHI6stmjvsKsWXv7XaK20OkpHqjT46cNUfNIavgh4J/pJbPSGOWvhH tTWkLJNBBVqW8Qf+vx/OxSXzT8/xnahbW+ru31rnxbi+HoQK/BReFI9DzO9hE+VeZY1G6 Mq4dIEYE+mAcoVD9bFgYcsM5oi5xIIdgJSXGe3JHtqpWrH3DTClJyK6YXgy2RR8e2b0rp ovI71Fjzrhba3eQ8umr8f5Vrnla6BczrHuaWFaO/VpdaRxIq3fif+7RFNJ1tpQ0VBAg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793849036; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=RMhQUIdBSBohHBv0s+jn+92qXMfv8S1VzeMvLzZBnBQ=; b=j6qqXrG23dSg74tmju7PrpXR2x2FUMPNr7Nted936ZyoiJkoNFF79vJSc6rPzuiAg0UC uC6QsYdci8+N1UQkyeoIfsEUTTww1uIArFJljUYrFKZJ1wBT3GfOZnIIRdpKIvrpT3B/f zcT7otXRfTwZH34VWkeXPT8NE0dtpVuZbaZ8URaKlLNIQSv8R6e+VqKZC5e+cDjKAnB4l 2AfHB2ABxQjsy38SMRJdWzMJ8UFitb0tEu0H3bsPQ0Zw9cx/qUcN9FBGlhdmBN2XPc4cU D8MV5Ms+oNz4laXP6/jmJpkPvdtoVcjqrH2oVSJiTLJE8mt2VNdvy43cdb1ghkbjDQw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OawRORAq; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 43EBE606D802; Thu, 5 Nov 2026 03:23:56 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OawRORAq X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.21 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793849035; b=ul0SemTZehlfDv2wMlXClyxn1wtDncGBv6Uyp8H2ASnP/BOkMFFWZ0CvkyHE6ryNDBZU 3PsYwS3usRwJ3X9/OswJ/CEsqPyOSMiA4EQ5vP0HpEI2GNyhRoj9JfJHqudAirQG9sAB5 bjWpzwOvduHygQA9zwTUQdgS3O3f7fbPcXopJRdCHxf9Jahbn3mC4D0xrxbVXbzEPLGHA 5KvjnZPxLv+v5KUuTE33UntbZk6lqvYfrB7v18ox/BG1z16+vBzN00Xt4gKPWT5IdjaiP sx4Mid4IEwMcFa3fHIgn55w9Xa34iiHC6GIdC9ir0LUv5j/5fZoeHArPR/3p8SVj3tg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793849035; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=RMhQUIdBSBohHBv0s+jn+92qXMfv8S1VzeMvLzZBnBQ=; b=jQPJDomF/im2XbiK3xYd6/okzmgW1AHfAiLL96Z+mjBqdKYS2kNT684TC0XmRs5yhhr/ dY6akhbaAaT2Acgs5W4WLogTiOugEIIfeWCN58F1DB/0LArNNmpWp35VamMcNOA+N9BzQ y1J+jHcDtIlQsj3asLGU2nvkboRiYvpJWix6LU48TSw6jd35wLWuRCWzqc0biLjo/NAAA E/Akq8rkoBYr1Cvb0dwSciCzAOphoCuPJMjeu10sm2BkfFAPP3yQGBX4re1vQmuZI5Pal acFnJVZE1/6YwQIOIu2JnGZyz3j0PlcL0sSuG3CF/HOzht3Ghtec2M267sAHzkOVrYw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OawRORAq; arc=none smtp.remote-ip=91.218.175.21 X-Received: from mta0.migadu.com (out-21.mta0.migadu.com [91.218.175.21]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AD6B606A32D for <netdev@vger.kernel.org>; Thu, 5 Nov 2026 03:23:54 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6AD6B606A32D X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=9TwfhhyQYL6sezbrnoxAIpd4i92BRlemNb9m/b/o/JM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793849032; v=1; x=1794453832; b=OawRORAqIlGTqBo4KxA1Lm4jZSUfwHAKiWD8M//FYWY455xbcu2ExiDH2R9qu/gNYkTydUOy FKpSYpD/B8wuVw7h0v8MdES5u2d7Uw78QEQrlgUrDabfYDyis0MqYWNVVxgEXU86B8ZIJDvUO9q 7h+GpM8hJkvG3TJqJD617K10= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta10.migadu.com with ESMTPS id 195ef7053fc6f30c; Thu, 05 Nov 2026 03:23:52 +0000 X-Mizu-Trace-ID: 195ef7053fc6f30c X-Migadu-Flow: FLOW_OUT 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> 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-In-Reply-To: <20261104212546.1222c4cfcccaecf68f326cdf@uniroma2.it>