🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20877

Re: [PATCH net-next v4 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X

#20877
From: Hangbin Liu
Date: Mon, 23 Nov 2026 10:09
220 lines
16213 bytes
Hi Andrea,

Thanks a lot for you detailed review. I will fix all of them in next version.
I just have some questions about a few comments.

On Mon, Nov 23, 2026 at 05:09:52AM +0100, Andrea Mayer wrote:
> > [snip]
> > +# Given the description of a router as an input, the function returns its
> > +# adjacent route id, or 0 if a host adjacent.
> > +# i.e. input: "1", output: ""
> > +#      input: "1>2", output: "2"
> > +#      input: "1>h", output: "0"
> > +__get_srv6_adjacent_id()
> > +{
> > +	local adjacent="${1#*>}"
> > +
> > +	[[ "${adjacent}" == "${1}" ]] && return
> > +	[[ "${adjacent}" == "h" ]] && adjacent=0
> 
> Nit, a style preference: I would use if blocks here, as in the rest
> of the selftest. With cut -s -d'>' -f2, this function could also read
> the ">" as you already do in __get_srv6_node_id().

I plan to use

	echo "${element}" | cut -s -d'>' -f2 | sed 's/h/0/'

> 
> > [snip]
> > @@ -819,33 +964,44 @@ __setup_rt_policy()
> >  	local function
> >  	local op_type
> >  	local node
> > +	local act
> > +	local sid
> >  	local n
> >  
> >  	in_nsname="$(get_rtname "${encap_rt}")"
> >  
> >  	for n in ${policy_rts}; do
> > +		# Abort if policy format is incorrect:
> > +		# 1. "1>h:psp" that has ">" but not "End.X"
> > +		# 2. "1:psp:End.X" that has "End.X" but no ">"
> > +		if [[ "${n}" == *">"* && "${n}" != *"End.X"* ]] || \
> > +			[[ "${n}" != *">"* && "${n}" == *"End.X"* ]]; then
> > +			echo "Incorrect operation format: ${n}" && false
> > +		fi
> 
> The check is there, but ret is not set. With "1>h:psp", the End tests
> pass and then the run ends as SKIP:
> 
>     Incorrect operation format: 1>h:psp
>     SKIP: Setting up the testing environment failed
> 
> Could it set ret to ksft_fail? Also, the check looks at the element as
> a whole, while the parameter and the nh6 are computed for each node.
> For example, "4>2,2:next-csid,psp:End.X" passes it although the node
> "2" has no adjacency, and the setup then fails in ip, on the nh6. A
> function that checks each node, called in place of this check, would
> cover both:
> 
> 	if ! __check_srv6_rtcfg "${n}"; then
> 		ret="${ksft_fail}"
> 		return 1
> 	fi
> 
> It would take the nodes and the behavior from the parsers that
> __setup_rt_policy() already uses, not from the text of the element.
> Just as an idea, something like this in __check_srv6_rtcfg():
> 
> 	nodes="$(__get_srv6_rtcfg_id "${element}")"
> 	op_type="$(__get_srv6_rtcfg_op "${element}")"
> 	act="$(__get_srv6_rtcfg_act "${element}")"
> 
> 	if ! op_has_next_csid "${op_type}" && \
> 	   echo "${nodes}" | grep -q ","; then
> 		echo "${element}: only NEXT-C-SID takes more than one node"
> 		return 1
> 	fi
> 
> 	for node in $(echo "${nodes}" | sed 's/,/ /g'); do
> 		rt="$(__get_srv6_node_id "${node}")"
> 		param="$(__get_srv6_param "${act}" "${node}")"
> 
> 		case "${act}" in
> 		"End")
> 			if [ "${node}" != "${rt}" ]; then
> 				echo "${element}: End takes no parameter"
> 				return 1
> 			fi
> 			;;
> 		"End.X")
> 			if [ -z "${param}" ]; then
> 				echo "${element}: End.X needs an adjacency"
> 				return 1
> 			fi
> 			;;

This check seems not enough with error config like "4>2h:psp:End.X".
Should we limit the param to 0-4?

> 		esac
> 	done
> 
> IMO a case per behavior would also make End.T easier to add, both for
> the flavor core that your 1/5 mentions for End.X/T and for NEXT-C-SID,
> which I am working on.
> 
> > [snip]
> > @@ -1031,6 +1187,25 @@ setup_end_flv_psp()
> >  	SETUP_ERR=0
> >  }
> >  
> > +setup_endx_flv_psp()
> > +{
> > +	SETUP_ERR=1
> > +
> > +	setup_hs_lo_addr 1 1 "${ENDX_CSID_PSP_FUNC}"
> > +	setup_hs_lo_addr 2 2 "${ENDX_CSID_PSP_FUNC}"
> > +
> > +	# The same SRv6 policies with setup_end_flv_psp except using End.X
> > +	setup_rt_policy_ipv6 2 1 "3>4:noflv:End.X 4>2:psp:End.X 2>h:psp:End.X"
> > +	setup_rt_policy_ipv6 1 2 "1>h:psp:End.X"
> > +
> > +	setup_rt_policy_ipv6 "2:${ENDX_CSID_PSP_FUNC}" 1 \
> > +		"3>4:next-csid,psp:End.X 4>2,2>h:next-csid,psp:End.X"
> > +	setup_rt_policy_ipv6 "1:${ENDX_CSID_PSP_FUNC}" 2 \
> > +		"4>3,3>1,1>h:next-csid,psp:End.X"
> > +
> > +	SETUP_ERR=0
> > +}
> 
> On v3, Sashiko asked whether the End.X tests would pass with End.X
> working as End. In this topology, the nh6 of each End.X is also the
> next hop that a lookup of the new DA gives, and the tests pass in both
> cases. An unreachable route in table 90 for the next SID, on rt-4 for
> (i.a) and on rt-3 for (i.c), would make End fail and leave End.X
> working. This is close to what Sashiko suggested on v3. What do you
> think about adding these two routes to the End.X scenario, each with
> its defer?

Hmm, we add the SIDs with End.X action, and the address also has parameters.
e.g. for (1.a) we add fcff:4::2af1, which unreachable route should we add
then? Cause we don't use fcff:2::ef1 at all.

BTW, is there any reason we add the unreachable route on rt-4 for (i.a) and on
rt-3 for (i.c)? In the consumed SRH testing, we can only add the extra on
ingress route. e.g.

#   (i.a) hs-1 -> hs-2: on the packets with DA=fcff:3::400a, rt-1 inserts the   
#         extra SRH with SID List=fcff:4::e,fcff:3::400a, and rt-4 consumes
#         it. 
#         Path: hs-1 -> rt-1 [ -> rt-4 ] -> rt-3 -> rt-4 -> rt-2 -> hs-2        
#   (i.c) hs-1 -> hs-2: on the packets with DA=fcbb:0:34a9::, rt-1 inserts the  
#         extra SRH with SID List=fcff:4::e,fcbb:0:34a9::, and rt-4 consumes
#         it.
#         Path: hs-1 -> rt-1 [ -> rt-4 ] -> rt-3 -> rt-4 -> rt-2 -> hs-2  

Which means we need the end action on rt-4.

> 
> > [snip]
> >  test_kernel_supp_or_ksft_skip()
> > [snip]
> >  	if ! ip -netns "${test_netns}" -6 route \
> >  		add "${IPv6_TESTS_ADDR}" encap seg6local \
> > -		action End flavors "${flavor}" dev "${DUMMY_DEVNAME}"; then
> > -		echo "SKIP: ${flavor} flavor not supported in kernel"
> > +		"${policy[@]}" dev "${DUMMY_DEVNAME}"; then
> > +		echo "SKIP: ${action} flavor ${flavor} not supported in kernel"
> 
> A note on this probe. On older kernels this add can succeed without
> the flavor, and the tests then fail instead of being skipped. This
> happens with End.X on v6.5, and with End on v6.0. I was thinking of
> sending a separate patch that reads the route back, for the End and
> the End.X probe. There is no need to wait for it. Does it work for
> you?

OK, I will add a checking for the added route.

> 
> > [snip]
> > +if test_kernel_supp_or_ksft_skip End.X psp; then
> > +	test_endx_flv
> > +fi
> 
> When the probe finds no End.X PSP, the End.X tests do not show up in
> the summary. The v4 skips only that scenario, as suggested on v3,
> which is good. On my patch that added the consumed SRH tests, you
> suggested to return at once when the srh match is missing. I kept the
> check in each test because log_test_skipped() then logs each test and
> counts it in "Tests skipped". IMHO the End.X scenario could do the
> same, to be consistent. Does it sound reasonable to you?

Sorry, I didn't get what you mean here. Do you want to run
the check before each end.x testing and report skip one by one?

e.g.

	if test_kernel_supp_or_ksft_skip End.X psp; then
        	host_srv6_end_flv_psp_tests "End.X"
	else
		echo "SKIP..."
	fi

	if test_kernel_supp_or_ksft_skip End.X psp; then
	        host_srv6_end_flv_next_csid_psp_tests "End.X"
	else
		echo "SKIP..."
	fi

	if test_kernel_supp_or_ksft_skip End.X psp; then
	        host_srv6_endx_flv_consumed_srh_tests
	else
		echo "SKIP..."
	fi

Thanks
Hangbin
Technical Details
Message-ID: <20261123100908.GA11364@Liu-laptop>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369218-linux-kernel-netdev=dewy.ru
References: <20261119-srv6_flavors_endx-v4-0-284cdb484eee@kylinos.cn> <20261119-srv6_flavors_endx-v4-5-284cdb484eee@kylinos.cn> <20261123050952.21dc46abdf5fe4fa235bb68d@uniroma2.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369218-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 5/5] selftests: seg6: add PSP flavor testing
 for SRv6 End.X
Date: Mon, 23 Nov 2026 18:09:08 +0800
Organization: Usenet Network
Message-ID: <20261123100908.GA11364@Liu-laptop>
References: <20261119-srv6_flavors_endx-v4-0-284cdb484eee@kylinos.cn>
 <20261119-srv6_flavors_endx-v4-5-284cdb484eee@kylinos.cn>
 <20261123050952.21dc46abdf5fe4fa235bb68d@uniroma2.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3848431"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:JMA9lAMNpq92C4zUOQxoaMKlh9c= sha256:wa5FeegbWxErW95uTpWAxf0VpuxCTfeqw2ChMBeTKfQ=
	sha1:dpq5M/RwIlSDTyKpNwewrps63SQ= sha256:gDPz59OGLg3etQawjdRiXzFCugy32GMaBQycB4xSOl4=
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 BF6B2125D9A; Mon, 23 Nov 2026 13:09:45 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, URIBL_BLOCKED=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 JH9kxyNez2-m;
	Mon, 23 Nov 2026 13:09:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369218-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id DEFA8125D98; Mon, 23 Nov 2026 13:09:33 +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 B7FF429612; Mon, 23 Nov 2026 10:09:26 +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=1795428566;
	b=ndHxFm6R8r1fw1W0LkucnL/N+tir9LzwNlxDBKTK8DtkqEJhStzh7V/4GMi0iFbYL/mV
	 AWxGy8mzMiQzmTCyVP/1mDTTPCf00TL3tOHc/huwpICcI05Av3WaJ1syoQ2jjrgLOUTMy
	 HzBdNo4e6KuQZdwZpeBXXQIOEGR5C0Gaaq2tTJnwLrYQEG8KXrzgARHqrlNyuHHiEMRTu
	 Nz1p1OQOoRmtSjKiHrMEl87SOhJRKit//dLmunb8xqQG813G/Q+KGXoEgMfrhgKppZVas
	 KwC3Sny3l0hoViwTpEXCEY6ZJNJCqJL6M7x1q+ge95IZCz/Awf7J+jAzRWdSqW50q7A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795428566;
	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=UzDd0SmU9JGmt2OnzA2QPSIsnM/OhlSQ1LdpomQPeVc=;
	b=WVJD/h3hfSChBaHhqDo0aAm70XRJ9YGu7QFyrXB1L0+x31od3AAdUxQSsNSh0H03SxIo
	 dksCIbG903GoUXpDiTK46tY73pPqLl4LvGfRKRW/Op1VXwff+3B0yzZp74nXO7Cy5fmm+
	 qYcttjtt5uV2trrKJfDUzICxkxhgDd96Pz/RCluXYBlZwtgI3rmVqoYpn8lGvVF1skZzk
	 9BCO3rfDO8+0lT1HZX67oT2yJezegIo4IwjSgd3LxHB0UjEWZpA/+xyiVaMgwNN7bmLDG
	 yGEtMY3p56UtT/FhBDh1gySabO002ee7TFEId2PT2yOoajlUcXKEj2XJFu23Cy3lpUQ==
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=euJdA8EB;
	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 8EC72606A31E;
	Mon, 23 Nov 2026 10:09:26 +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=euJdA8EB
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.56
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795428560;
	b=opL9K4QZHrsa6Dgy04CZwaOvJ0YH5HGOCBzuivmHW+wE9SKv51p3nQnonfZGV0qp9jgJ
	 K90jFNN7zFEDFtcqdiWsLYs10etzhhtmlR0FvgkIWf9F9UExqNHdEfdMe95QPqggCSxmS
	 eKjQAt2HXu4cPRYVbnfRdSTA0CtWMNsjLMda/bpHKL3bjBIwKhzGWQZpQgVcPGvV4IF01
	 Rt6fi3JPu+d7hIrejIl+AmKmuLI8Wdsdt5OKS1KXF8tn82ZImndgyWx3A+L3GtsN9yECI
	 7/KWVbUD/hQR/BSx0eoqk3lJTkruUh797M5s/fw8EbPw+NlZByYHuHG+wMNt38qk92A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795428560;
	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=UzDd0SmU9JGmt2OnzA2QPSIsnM/OhlSQ1LdpomQPeVc=;
	b=kwDqmicDrNBsQlivZxCAr+/Dj0km0yVl2ksYmWF+CApzRq7+N1t94Wmmjc5DaRt1kloL
	 lXSBTGoMj5xCGPPhZTpt4X470ZC86qDcUlXW5YvOd54u7FvVEDadY/VR5018BhK8jSpov
	 awzGiPG1EfMLZIH7/9vKQF4dsHzAsDDBeMh4bpHeiFzkdNtp5xnB3AJuf3qUQLfOlMXRQ
	 uN2YyrztBuigr0XASmT4ztj18dGmxmmIy/wrzV7kMuP6vIPcmcv94R6I8EDG8fwxD+u5U
	 KaWike49wySnap53DAzHvdt+bIu6socEV1tCmIKfugWt/w5yGjpn5L0YhgmYtpIzqnA==
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=euJdA8EB;
	arc=none smtp.remote-ip=95.215.58.56
X-Received: from mta1.migadu.com (out-56.mta1.migadu.com [95.215.58.56])
	(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 AEED4606A321
	for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 10:09:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AEED4606A321
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=GRIGe4MYSmcamc/GomLgN/fYZ1+yWn5x99Cm2Hh0m+E=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1795428557; v=1; x=1796033357;
 b=euJdA8EBP4mOaNaki4eFa/6T3fp6J77vej0S8q4+PFeFckVlaATHyoLSCcWVaWdqTJJBh7Hw
 D/RDs7PoFiGRh0TsHq5NF40pzKOtQKy5BG3w4kLtF+FbSIYTns0Jd1P0IVcuFOPNmNEVfze7csX
 64BRkMRElTCPc025BYOs9n5U=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta11.migadu.com with ESMTPS id 7fd23bef945703c4;
	Mon, 23 Nov 2026 10:09:17 +0000
X-Mizu-Trace-ID: 7fd23bef945703c4
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>, Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Hangbin Liu <liuhangbin@kylinos.cn>,
	Stefano Salsano <stefano.salsano@uniroma2.it>,
	Justin Iurman <justin.iurman@gmail.com>,
	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: <20261123050952.21dc46abdf5fe4fa235bb68d@uniroma2.it>