From: Hangbin Liu <hangbin.liu@linux.dev>
To: Andrea Mayer <andrea.mayer@uniroma2.it>
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>
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 [thread overview]
Message-ID: <20261123100908.GA11364@Liu-laptop> (raw)
In-Reply-To: <20261123050952.21dc46abdf5fe4fa235bb68d@uniroma2.it>
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
next prev parent reply other threads:[~2026-11-23 10:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 13:55 [PATCH net-next v4 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
2026-11-19 13:55 ` [PATCH net-next v4 1/5] seg6: split final End process out of flavor processing Hangbin Liu
2026-11-19 13:55 ` [PATCH net-next v4 2/5] seg6: add RFC8986 flavor support for End.X Hangbin Liu
2026-11-23 14:24 ` netdev-bot+sashiko
2026-11-19 13:55 ` [PATCH net-next v4 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Hangbin Liu
2026-11-19 13:55 ` [PATCH net-next v4 4/5] selftests: seg6: explicit cleanup for SRv6 End PSP test Hangbin Liu
2026-11-19 13:55 ` [PATCH net-next v4 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X Hangbin Liu
2026-11-23 4:09 ` Andrea Mayer
2026-11-23 10:09 ` Hangbin Liu [this message]
2026-11-25 2:36 ` Andrea Mayer
2026-11-23 13:40 ` hangbin.liu
2026-11-24 5:47 ` Hangbin Liu
2026-11-25 3:16 ` Andrea Mayer
2026-11-23 14:24 ` netdev-bot+sashiko
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=20261123100908.GA11364@Liu-laptop \
--to=hangbin.liu@linux.dev \
--cc=andrea.mayer@uniroma2.it \
--cc=andrea@common-net.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=justin.iurman@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@kylinos.cn \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.