All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	Justin Iurman <justin.iurman@gmail.com>,
	Stefano Salsano <stefano.salsano@uniroma2.it>,
	Andrea Mayer <andrea@common-net.org>
Subject: Re: [PATCH net-next v5 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X
Date: Wed, 2 Dec 2026 13:46:34 +0800	[thread overview]
Message-ID: <aw-wNnf6Bz0AbFF6@fedora> (raw)
In-Reply-To: <20261202043855.92f9711185e07636c42a669f@uniroma2.it>

On Wed, Dec 02, 2026 at 04:38:55AM +0100, Andrea Mayer wrote:
> > [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.

Got it, I will split the test_kernel_supp_or_ksft_skip change out, with
rename the sub-function to check_kernel_support. This could make the new
patch smaller.

> 
> > [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.

I see. I will use the exact route.

> 
> > [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 will keep it with your style.

Thanks
Hangbin

  reply	other threads:[~2026-12-02  5:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  6:27 [PATCH net-next v5 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
2026-11-26  6:27 ` [PATCH net-next v5 1/5] seg6: split final End process out of flavor processing Hangbin Liu
2026-11-30  3:55   ` Andrea Mayer
2026-11-26  6:27 ` [PATCH net-next v5 2/5] seg6: add RFC8986 flavor support for End.X Hangbin Liu
2026-11-30  4:03   ` Andrea Mayer
2026-11-26  6:27 ` [PATCH net-next v5 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Hangbin Liu
2026-11-30  3:47   ` Andrea Mayer
2026-11-26  6:27 ` [PATCH net-next v5 4/5] selftests: seg6: explicit cleanup for SRv6 End PSP test Hangbin Liu
2026-11-26  6:27 ` [PATCH net-next v5 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X Hangbin Liu
2026-12-01  0:14   ` Andrea Mayer
2026-12-01  2:53     ` Hangbin Liu
2026-12-02  3:38       ` Andrea Mayer
2026-12-02  5:46         ` Hangbin Liu [this message]
2026-11-29  2:38 ` [PATCH net-next v5 0/5] seg6: add End.X PSP flavor support and selftests Andrea Mayer

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=aw-wNnf6Bz0AbFF6@fedora \
    --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.