Article View: linux.kernel.netdev
Article #25596Re: [PATCH net-next v5 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X
From: Andrea Mayer
Date: Wed, 02 Dec 2026 03:38
Date: Wed, 02 Dec 2026 03:38
207 lines
17939 bytes
17939 bytes
On Tue, 1 Dec 2026 10:53:21 +0800
Hangbin Liu <hangbin.liu@linux.dev> wrote:
Hi Hangbin,
> > Hi Hangbin,
> > thanks for the v5, and for all the work across the versions.
> >
> > The main points are on the commit message, setup_rt_unreachable() and
> > the probe helper. The rest are smaller points.
>
> Thanks for your review. I'm really not good at documentation :)
> I appreciate your help. I will update them with my best effort.
Happy to help :)
> [snip]
> > > Hi Andrea, The changelog line is getting extremely long. Please let me
> > > know if you'd like me to split this into smaller pieces. Thanks a lot
> > > for your kind review.
> >
> > To me most of the changes look tied together. The new helpers are
> > added for the End.X elements, and without the End.X scenario their
> > End.X parts would have no user.
> >
> > One part that could be split out is the read back of the route in
> > the probe. It also applies to the End probe, which is already in the
> > tree, so it could be its own patch, before this one.
>
> Sorry, which probe do you mean? I didn't get.
I mean the read back in __test_kernel_supp_or_ksft_skip(), the
"route show | grep" after the route is added. It also runs for End,
while the End probe in the tree, test_kernel_supp_or_ksft_skip(), adds
the route and does not read it back. This was about your question on
splitting it into smaller pieces.
> [snip]
> > > + case "${op_type}" in
> > > + "psp")
> > > + sid="${LOCATOR_SERVICE}:${adj}::/32"
> > > + devname="veth-rt-${rt}-${adj}"
> > > + net_prefix="$(get_network_prefix "${rt}" "${adj}")"
> > > + ip -netns "${nsname}" -6 route \
> > > + change unreachable "${sid}" \
> > > + table "${LOCALSID_TABLE_ID}"
> > > + defer ip -netns "${nsname}" -6 route \
> > > + change "${sid}" \
> > > + table "${LOCALSID_TABLE_ID}" \
> > > + via "${net_prefix}::${adj}" dev "${devname}"
> > > + ;;
> >
> > This case changes the underlay /32 into an unreachable route and
> > restores it in the defer. As in the next-csid,psp case below, an
> > unreachable route for the exact address, e.g. fcff:4::2af1, would
> > leave the underlay /32 as it is. Or am I missing something?
>
> The psp and next-csid,psp use different unreach route
>
> psp use fcff:4::/32 or fcff:2::/32
> next-csid,,psp use exact route like fcbb:0:42a9:20a9:: or fcbb:0:20a9::
>
> The previous routing on rt3 for End is
> fcff:4::/32 table 90 via fcf0:0:3:4::4 dev veth-rt-3-4
>
> I changed it to unreachable so End.X doesn't read the nh via it.
I asked if I was missing something on the psp case because the two
cases of the same function do it in two different ways, and I was
wondering about the reason behind it. In the current setup the /32
and the exact route give the same test results, the difference is in
the effect: while the End.X tests run, the /32 makes every address under
fcff:4::/32 unreachable on rt-3, e.g. fcff:4::e, the End SID of rt-4.
The exact route makes only fcff:4::2af1 unreachable, and the underlay
/32 stays. For the reasons above, I would have used the exact SID in
the psp case too, as you rightly did in the next-csid,psp case.
> >
> > > + "next-csid,psp")
> > > + sid="$(build_csid_container "${adj}" "End.X" \
> > > + "${ENDX_CSID_PSP_FUNC}")"
> > > + ip -netns "${nsname}" -6 route \
> > > + add unreachable "${sid}" \
> > > + table "${LOCALSID_TABLE_ID}"
> > > + defer ip -netns "${nsname}" -6 route \
> > > + delete "${sid}" \
> > > + table "${LOCALSID_TABLE_ID}"
> > > + ;;
> > > + esac
> > > +}
> >
> > If the /32 is not needed, why not make the function take two
> > arguments, the router and the element of the next SID, as in the
> > Policies? For example:
> >
> > setup_rt_unreachable 3 "4>2:psp:End.X"
> > setup_rt_unreachable 3 "4>2,2>h:next-csid,psp:End.X"
> >
> > The SID could then come from get_rt_sid() or build_csid_container(),
> > as in __setup_rt_policy().
>
> The when defer the PSP route, we need nh6 addr and device name.
> If we take the total element like "4>2:psp:End.X", we still need
> to get the "4>2" part first then call __get_srv6_adjacent_id() to
> get the "${adj}", I think it takes 2 more efforts.
>
> I can make the function take 2 arguments if you want.
Thanks for considering it. With the exact route, the three arguments
are fine too, with "4>2" in $2 for the exact SID. The defer becomes a
delete, as in the next-csid,psp case, and as far as I can see the next
hop and the device are no longer needed.
> >
> > > + setup_rt_unreachable 3 4 "psp"
> > > + setup_rt_unreachable 4 2 "psp"
> > > + setup_rt_unreachable 3 "4>2,2>h" "next-csid,psp"
> > > + setup_rt_unreachable 4 "2>h" "next-csid,psp"
> >
> > If the function keeps its three arguments, the exact address could come
> > from "4>2" in $2, and "2>h" would keep the two calls in the same form:
>
> Hmm, you want to add exact unreach route for PSP. e.g.
> unreachable fcff:4::2af1 on rt3? That OK for me. I think
> unreachable fcff:4::2af1 and unreachable fcff:4::/32 take the same effect
> on rt-3, no?
>
> >
> > setup_rt_unreachable 3 "4>2" "psp"
> > setup_rt_unreachable 4 "2>h" "psp"
> >
> > "psp" can stay, as it is already the <op> of the element of the next
> > SID, 4>2:psp:End.X.
The results of the tests are the same, the difference is in the
effect described above.
On rt-4 the exact SID would be fcff:2::0af1.
> [snip]
> > > +test_kernel_supp_or_ksft_skip End psp
> > > +test_kernel_supp_or_ksft_skip End.X psp && HAS_ENDX_PSP=true
> >
> > Here the helper exits for End and returns for End.X when the action
> > is not supported, but its name says that it skips. In v4 the probe
> > was inside this helper, while in v5 it is on its own, in
> > __test_kernel_supp_or_ksft_skip(), and returns on every path. Could
> > the probe be renamed, for example to check_kernel_support(), and called
> > directly by the End.X line, as check_srh_match_support() is? Then the
> > helper could always exit when the probe fails, and the test results
> > stay the same:
> >
> > # Exit with ksft_skip when check_kernel_support() fails, e.g. when
> > # the action with the flavor is not supported.
> > test_kernel_supp_or_ksft_skip()
> > {
> > local action="$1"
> > local flavor="$2"
> >
> > if ! check_kernel_support "${action}" "${flavor}"; then
> > exit "${ksft_skip}"
> > fi
> > }
> > ...
> > test_kernel_supp_or_ksft_skip End psp
> > if check_kernel_support End.X psp; then
> > HAS_ENDX_PSP=true
> > fi
>
> OK, with this, the End is the only caller of test_kernel_supp_or_ksft_skip().
> Maybe let End also calls check_kernel_support and exit directly? e.g.
>
> if ! check_kernel_support End psp; then
> exit "${ksft_skip}"
> fi
> if check_kernel_support End.X psp; then
> HAS_ENDX_PSP=true
> fi
>
> If make it shorter
>
> ! check_kernel_support End psp && exit "${ksft_skip}"
> check_kernel_support End.X psp && HAS_ENDX_PSP=true
In general, I prefer to keep the logic in functions. Here,
test_kernel_supp_or_ksft_skip() would stay for End, and the End.X if
would go in a small function that sets HAS_ENDX_PSP, as
check_srh_match_support() sets HAS_SRH_MATCH:
# Set HAS_ENDX_PSP when the kernel supports End.X with the PSP flavor.
check_endx_psp_support()
{
if check_kernel_support End.X psp; then
HAS_ENDX_PSP=true
fi
}
...
test_kernel_supp_or_ksft_skip End psp
check_endx_psp_support
Your if blocks are shorter, and it is a matter of taste. If you prefer
them with check_kernel_support() alone, that is fine with me too.
I appreciate your work on this, thanks.
Ciao,
Andrea
Technical Details
Message-ID:
<20261202043855.92f9711185e07636c42a669f@uniroma2.it>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375527-linux-kernel-netdev=dewy.ruReferences:
<20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn> <20261126-srv6_flavors_endx-v5-5-4d8232eec404@kylinos.cn> <20261201011421.0f393abeefcb9c4f3c5f0ee4@uniroma2.it> <aw42oTMEOCMvC22o@fedora>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375527-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 5/5] selftests: seg6: add PSP flavor testing
for SRv6 End.X
Date: Wed, 2 Dec 2026 04:38:55 +0100
Organization: Usenet Network
Message-ID: <20261202043855.92f9711185e07636c42a669f@uniroma2.it>
References: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn>
<20261126-srv6_flavors_endx-v5-5-4d8232eec404@kylinos.cn>
<20261201011421.0f393abeefcb9c4f3c5f0ee4@uniroma2.it>
<aw42oTMEOCMvC22o@fedora>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="1879754"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:euz+zh7oQ/57I1lyB0opdNHoavk= sha256:FnurwB3DWTEy9VAx9tDolj5JcqdHZBnm4RWRnfbejzw=
sha1:+EWizzS0ZKUry+FveXMHso72sjM= sha256:NjDCYVgm+7o77L2qVYyE0bTFL5J27Ds30btBVnhjqQs=
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 25BEF117548; Wed, 2 Dec 2026 06:40:16 +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=V/CuiTgw; dkim=pass (2048-bit key)
header.d=uniroma2.it header.b=TTh1nCUM
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 E6VwOAT4VpIC;
Wed, 2 Dec 2026 06:40:12 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375527-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 3772B117547; Wed, 2 Dec 2026 06:39:56 +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 CAC7B2602E; Wed, 2 Dec 2026 03:39:54 +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=1796182794;
b=nAQtpIAPC/y49nnp39P4gg0HousvHf3wxlehC4BcXJTKaD2D/UAa8U6ySsNdAGAKGqo1
UX6k2D7vts/XslnjnlIhXnnIg0pxVBeOcsAGmPPqmUZD1ezAc4elhOOH8ST5FRdq8MRTk
WYf1fefpHdhK9e/JWsoAznn/fWE9dDujJYgFbwTv3/z/I5IYS/NgFJMZNwYELS/+fED4l
q6EPNwEB5+incN6zw1qF+ic51/y7YFOZJpr2ErmQwB+p5/BcDTrBckKuQ62+QZH1JUgbR
NtFbxtEwAUWkywUoQzl7McRJnROZCqcXXr4hi2qenijmU6TsuIAQT27DDTbxL7Vd3Pw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796182794;
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=T95iJ/9VUCy6PCRCkhP/YiTi6jP0smgNnTwAzOYKF6g=;
b=QcIVcv7l4R7dzUxN8XVySEp1bGPjCYRANbo2wBuQDsP12YTS3GnV3vMg3I97nIy1pgGt
gE1p+uk3xqCEB/mcEWHlcyKeQqjvgVmyhhCSJZbh7mpDwpV0j0nJ52Ta33mTaZtiDX/u3
+Z92MfXhW+/hJvXvCG8GDX5OIbCXQbkfewPP9hcYU6G5d3nCQqYGTg3d/Jac0wLvNbhQm
0fW77vlEwKd3A6kiyjlfDurvwwA1AoU8jNOmvvzFQQ7ljskSUcpIAL9ptJ5/p9ftdFUHD
z7Ar1KR3LljeJ6d16/1G3a1dxJxGqD65ryOlgryE2VCXyeUO4T9wTK2N89ADv8FS0Cg==
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="V/CuiTgw";
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=TTh1nCUM;
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 32374606A337;
Wed, 2 Dec 2026 03:39:54 +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=V/CuiTgw;
dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=TTh1nCUM
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.80.4.32
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796182793;
b=f0fAkqX8WRe+pUaaTSZ0LOTqMdKaelNj69B5n1lsKCMa7FG+OX0M3cQh/sv+/otQRxjB
meWc4WvtbXyQeq/3ApXenmO8zX+I+8Mg1or1z7ycuZAzm+vi4X3EEU8P2FGHABWKvDt3o
btvIQ4vOlI7Du+PdqlEFhl3Ty5BpU2i5Uty+8RqhCSdgfvwAwZYeC7xsH6cjZnLs5+/a2
Pv4yVSv9lPsdJ5+RjjM40elKuOyLM6zjCsxilEBb/ts599pEZ4tr6b4aUrOEEWrZKbb7T
MdrZm0k+OUIDmg1EHqOKVQNlyVEWxsFM0aDQ2CCn8LYGYWqWlFMpilozQCk1qBPpJcw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796182793;
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=T95iJ/9VUCy6PCRCkhP/YiTi6jP0smgNnTwAzOYKF6g=;
b=ETVs0p1bzaJX/3LYDd44CWAUAu7oHA8OYKBbolIt5wlnOCQWafkj8ZVjWa7rsY3wqJSL
IE/K8AQDkOOvFZAsaly2mYHnbpJLBosMgNzTAO4jXbr7QxEWcrl4IKZxlVmYQs4guKs6r
ZML2fBcsG36JRYX9C6siz/cGbfEAd+fCo4bY+7A5Tn/3MPbA9gCy31fEEjqIQBkyv7eBB
Nqux/SZAASljAXpA2QonXMzyuJs8wcadtmTdZKJtU+iRlAzZYs0lrWoQbJ6qN+1AEAncE
J0tIEcvCqTthFyXP1PBfezHzM7K3CEukpX90ry4j+cKqjynKVcE2FTwFaxdDFmZUrJw==
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="V/CuiTgw";
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=TTh1nCUM;
arc=none smtp.remote-ip=160.80.4.32
X-Received: from smtp.uniroma2.it (smtp-2015.uniroma2.it [160.80.4.32])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A34B606A32C;
Wed, 2 Dec 2026 03:39:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7A34B606A32C
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 6B23d053002458;
Wed, 2 Dec 2026 04:39:05 +0100
X-Received: from lubuntu-18.04 (unknown [160.80.103.126])
by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id D1E501228D0;
Wed, 2 Dec 2026 04:38:55 +0100 (CET)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
s=ed201904; t=1796182736; 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=T95iJ/9VUCy6PCRCkhP/YiTi6jP0smgNnTwAzOYKF6g=;
b=V/CuiTgw1nOqK2pst7nOtHg140GJJ98/3b+MR4bjBtQhtKUVrlL5+cqt6LCO6oh8pDG937
uurTzW/Z9GI11cDA==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
t=1796182736; 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=T95iJ/9VUCy6PCRCkhP/YiTi6jP0smgNnTwAzOYKF6g=;
b=TTh1nCUMluyb8MQju5Vt//el+LChH+G4tnoXkgRi9CjcEa+J5a+2kV0jNEitVLp2dcqZ2d
rqdxGVnf8Ew9uYicKgPC9HjV5cNzv2DvjuxM5+0+qQUjOLAdHxkuNxEgBrAhNI/sH28rfI
Rtx61NXCypkfI+UeMegDhJ0wLaSOir4GbCt7hWg6D/0Tzl9x5VtRwZgqJqU/8+bBUjteSe
5kYfJhqb508HAV+ozWIOiuWVxW40e1BZnJ+8WIYFBub4tz8vSeVFeEMuZzbG7WrkPZNRpu
PggWnE0Ta8Bv0Ex4LeOmWbF26Yxm6Evw7l4qdv+DvwjuV/jze1eIUZa8k2cAEw==
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>,
Shuah Khan
<shuah@kernel.org>, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Hangbin Liu <liuhangbin@kylinos.cn>,
Justin Iurman <justin.iurman@gmail.com>,
Stefano Salsano
<stefano.salsano@uniroma2.it>,
Andrea Mayer <andrea@common-net.org>,
Andrea
Mayer <andrea.mayer@uniroma2.it>
X-In-Reply-To: <aw42oTMEOCMvC22o@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