From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.80.4.32 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796084104; b=ashJkyaWe5Jb6QSnsthVFt3bnxhUt+AFLhjknFEHFtltBxg6+GPmfzbAl3Rb3yZ8q5vd QSVzOpGUdDXKarNSxmFFcObjziL6I5x8WGDCqnAeNN91OcJYcwZ/X6FHH2705aP42ViWz +qXbOfw/8NL+hOknSa3zRyr0GExGkuAqj/fB4zpXnnguKXaRhDe6e3jySOV1diG6yQdd5 x2R9YMYlNFLS1FPxYMUkkmsC629mvwr0n31t/GWy6tEn61VK7MG7df3qfBww7jY4OZ+IC rdxatp6TShsIgwMXexleLiXk+W5eTpOxw0nz/egZZDOg5unHtpEXT+yOC4+0HA8Yf4Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796084104; 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=sI9RofJq10NDhYwg/a0HdQUGKrWQf+bu4k91Pa/0x7M=; b=GDl/7BRcz3F6lD4WXJew69lIrLbYXIeO9TtvJKDuy3edP1SdFqtMVUv3Eg8MPHeQEWUN 5rqn+tmzQs3B+iEOGNAAo6SuPwej3UFRTKwsiiT1xNCHVPSYlUePg6bYuPdzJOYSenDY1 ZSaFtdaogRaNRS1NUa6ailCkfGAzD/xB+8cTAQRv3PW75sOWM6yFo6upemX2RNf2tiwZh +iez4I5VboC8VBsINJ5ugAmUflNGgchApfEHdKWcTd4uoFkiaUFzAzg1YJCN2xoZE1Mdp QpZ2tZg+PIcGTsmaA+WIY22fqMTQFKW8b429Wqyu6/0NFnjXF+eKRmzKa7WG7vwhOGQ== 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=GzM5fA26; dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=wLSoLwXs; arc=none smtp.remote-ip=160.80.4.32 Received: from smtp.uniroma2.it (smtp.uniroma2.it [160.80.4.32]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87D71606A329; Tue, 1 Dec 2026 00:15:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 87D71606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniroma2.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniroma2.it 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=GzM5fA26; dkim=pass (2048-bit key, unprotected) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=wLSoLwXs 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 6B10ERVI012808; Tue, 1 Dec 2026 01:14:32 +0100 Received: from lubuntu-18.04 (unknown [160.80.103.126]) by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id AF34F12030F; Tue, 1 Dec 2026 01:14:22 +0100 (CET) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it; s=ed201904; t=1796084063; 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=sI9RofJq10NDhYwg/a0HdQUGKrWQf+bu4k91Pa/0x7M=; b=GzM5fA269fhhyqLkgNkVRrOZJmho2BmXYmcSlGfMlYDLvqGjVAu5gx79JQssuTl/Ul/n6X RGrGVlmkC3/yf8Dg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904; t=1796084063; 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=sI9RofJq10NDhYwg/a0HdQUGKrWQf+bu4k91Pa/0x7M=; b=wLSoLwXsplADi8u2yxdLM1bf1pGse1sREom4CqlxhSMoI9rcC3raU8GhoOd8+wlsqL9af4 8g56NZl87PrgYksMhexrnXEW7R6GKA31uxCb8rvQw7ALIakdpbmZQFevXlNK1Ai8PkE1F+ xGouPGQEYkO9Ku2nYnEHF+UPbf5nX0ISpPl14zAUduyLf1M57yigUUk9cW4q9rqkqk9+MD f65FCzmRjUJ7m96SFtCM3LQsEuStdXHYDUobR6bmclSbd41bba+/LFVlrIentzk7Lre1pg jIz8wGj2VaHaZszj/h/GMiagyTC4LdyRl7ZT4R2Ad3R4N6DDJnGOG4xpQelfiQ== Date: Tue, 1 Dec 2026 01:14:21 +0100 From: Andrea Mayer To: Hangbin Liu Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Hangbin Liu , Justin Iurman , Stefano Salsano , Andrea Mayer , Andrea Mayer Subject: Re: [PATCH net-next v5 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X Message-Id: <20261201011421.0f393abeefcb9c4f3c5f0ee4@uniroma2.it> In-Reply-To: <20261126-srv6_flavors_endx-v5-5-4d8232eec404@kylinos.cn> References: <20261126-srv6_flavors_endx-v5-0-4d8232eec404@kylinos.cn> <20261126-srv6_flavors_endx-v5-5-4d8232eec404@kylinos.cn> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015 X-Virus-Status: Clean On Thu, 26 Nov 2026 14:27:27 +0800 Hangbin Liu wrote: 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. > From: Hangbin Liu > > Add an End.X flavor scenario to srv6_end_flavors_test.sh that applies > the same PSP policies as the End scenario, alone and combined with > NEXT-C-SID, with every node bound through its adjacency (e.g. 4>2 for > rt-4 towards rt-2, 2>h towards the host). > > Teach the policy helpers about elements: > - __get_srv6_node_id() and __get_srv6_adjacent_id() return the node > and adjacent id > - __get_srv6_rtcfg_act() extracts the action > - __get_srv6_act_cfg() derives the End.X next hop (nh6) > - __get_srv6_param() takes the behavior parameter (adjacency for > End.X, 0 for End) > - __get_srv6_func() picks the Function for an pair > - build_csid()/get_rt_sid() encode the parameter and adjacency into > the SIDs (e.g. fcbb:0:34a9:: is End.X on rt-3 towards rt-4) > - __check_srv6_rtcfg() validates each element node against the > behavior with a per-act regular expression > > Reuse the existing psp and next-csid,psp helpers for End.X, and add a > consumed-SRH test that inserts the extra SRH on the ingress router, > since the End.X policy forces the next hop. > > Install unreachable routes in table 90 for the next SID of each End.X > hop under test, so that a broken End.X that falls back to End fails the > lookup while a working End.X still forwards via nh6. If I read the setup right, the routes are not for each End.X hop, only for the ones on rt-3 and rt-4 from hs-1 to hs-2. These seem to be enough, as on these hops the packets take the paths of input_action_end_x() without flavors, with the RFC 8986 flavors and with the NEXT-C-SID shift. Thanks also for the route on rt-4 for (i.c), which is the one for the shift. > > Extend test_kernel_supp_or_ksft_skip() to probe End.X psp as well as > End psp. Failures after a successful probe no longer abort the run, and > when End.X psp is missing the scenario is skipped through > log_test_skipped() so it still appears in the summary. iproute2 already > supports the PSP flavor with End.X. > > Add the packet path to each test section so the route taken by the > traffic is clear. > > Signed-off-by: Hangbin Liu > --- > > 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. Just an idea on the length of the message. The other paragraphs already say what the tests cover, how they catch an End.X that falls back to End, and when they are skipped. IMHO the list of the helpers is the part that could be shorter, for example a few lines on what changes in the elements and in the SIDs, such as the adjacency in the End.X SIDs (e.g. fcff:3::400a, fcbb:0:34a9::). > [snip] > +# Given the encapsulation action, current router and next hop as input, the > +# function will return the action-specific configuration. > +# i.e. input: "End.X 2 0", output: "End.X nh6 cafe::2" > +# input: "End.X 4 2", output: "End.X nh6 fcf0:0:2:4::2" > +__get_srv6_act_cfg() > +{ > + local act="$1" > + local rt="$2" > + local neigh="$3" Nit: as in the examples of the other helpers, the three arguments could be quoted one by one, "End.X" "2" "0". > [snip] > get_rt_sid() > { > - local rt="$1" > + local node="$1" > local op_type="$2" > - local func="$3" > + local act="$3" > + local func="$4" > + local param > local csid > > if op_has_next_csid "${op_type}"; then > - csid="$(build_csid "${rt}" "${func}")" > + rt="$(__get_srv6_node_id "${node}")" > + param="$(__get_srv6_param "${act}" "${node}")" > + csid="$(build_csid "${rt}" "${param}" "${func}")" > echo "${LCBLOCK_ADDR}:${csid}::/${LCBLOCK_NODEFUNC_BLEN}" > return > fi > > - echo "${LOCATOR_SERVICE}:${rt}::${func}" > + case "${act}" in > + "End.X") > + rt="$(__get_srv6_node_id "${node}")" > + param="$(__get_srv6_param "${act}" "${node}")" > + echo "${LOCATOR_SERVICE}:${rt}::${param}${func}" > + ;; > + *) > + echo "${LOCATOR_SERVICE}:${node}::${func}" > + ;; > + esac > } rt is not local anymore. > [snip] > # cafe::x:yy on the loopback of the host (e.g. 2:e9) > # $2 - SRv6 router configured for enforcing the SRv6 Policy > # $3 - compact way to represent a list of SRv6 routers with their operations > -# (i.e. behaviors) that each of them needs to perform. Every > +# (i.e. behaviors) that each of them needs to perform. Every > +# Nit: "" is alone on its line. The lines of this paragraph could be rewrapped. > # element constructs a SID that is associated with the behavior on > # the node. The list of such elements forms an SRv6 Policy. Nit: with , the behavior no longer comes from , which now gives only its flavors. "(i.e. behaviors)" and "associated with the behavior " need an update, and so does the comment of __get_srv6_rtcfg_op(). > # For "next-csid,psp", is a comma-separated list of node IDs. > # The element constructs a C-SID container with the C-SIDs of these > # nodes, e.g. "4,2:next-csid,psp" gives fcbb:0:40e9:20e9::. > +# For End.X, the includes ">" and the adjacency ("h" for the > +# host), and is "End.X". > __setup_rt_policy() > [snip] > +# Set up an unreachable route on a router so that a lookup of the next SID > +# fails under End, while End.X still forwards via its adjacency (nh6). > +# args: > +# $1 - router to configure > +# $2 - adjacent router, or a NEXT-C-SID node list (e.g. "4" or "4>2,2>h") > +# $3 - operation of the element (e.g. "psp" or "next-csid,psp") > +setup_rt_unreachable() > +{ > + local rt="$1" > + local adj="$2" > + local op_type="$3" > + local net_prefix > + local devname > + local nsname > + local sid > + > + nsname="$(get_rtname "${rt}")" > + > + 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? > + "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(). > [snip] > +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 as in 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" > + > + # (i.a) add fcff:4::/32 unreachable on rt-3 and fcff:2::/32 on rt-4 > + # (i.c) add fcbb:0:42a9:20a9:: unreachable on rt-3 and fcbb:0:20a9:: > + # on rt-4 Nit: "on rt-4" could be aligned under "add" with spaces after the "#", rather than a space and a tab, as in the rest of the file. > + 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: setup_rt_unreachable 3 "4>2" "psp" setup_rt_unreachable 4 "2>h" "psp" "psp" can stay, as it is already the of the element of the next SID, 4>2:psp:End.X. > [snip] > +__check_srv6_rtcfg() > +{ > + local element="$1" > + local op_type > + local node_re > + local nodes > + local act > + > [snip] > + for node in $(echo "${nodes}" | sed 's/,/ /g'); do > + if [[ ! "${node}" =~ ${node_re} ]]; then node is not local, so the loop writes the node of its caller, __setup_rt_policy(). > [snip] > -test_kernel_supp_or_ksft_skip() > +__test_kernel_supp_or_ksft_skip() > { > - local flavor="$1" > + local action="$1" > + local flavor="$2" > local test_netns > + local policy=() > > test_netns="kflv-$(mktemp -u XXXXXXXX)" > + policy=(action "${action}" flavors "${flavor}") > + if [ "$action" == "End.X" ]; then Nit, a style preference: "${action}" here, as on the line above. > [snip] > +# Exit directly if the End action is not supported; return 1 for other > +# actions when they are not supported. > +test_kernel_supp_or_ksft_skip() > +{ > + local ret > + > + __test_kernel_supp_or_ksft_skip "$1" "$2" > + ret="$?" > + > + if [ "$ret" -ne 0 ] && [ "$1" == "End" ]; then > exit "${ksft_skip}" > fi > > - ip netns del "${test_netns}" > + return $ret > } > [snip] > +test_endx_flv() > +{ > + if ! ${HAS_ENDX_PSP}; then > + log_section "SRv6 connectivity test hosts (h1 <-> h2, End.X)" > + log_test_skipped "SRv6 End.X tests, no End.X PSP in the kernel" Nit: in v4 the probe exited when it could not set up its netns or its dummy device. In v5 it returns, so this message is also printed in these cases, and the kernel is not checked. A message like "End.X PSP probe failed" would be accurate in every case, as the probe already prints the reason. > [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 Thanks again, Ciao, Andrea