mirror of https://lore.kernel.org/lkml/
 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>,
	Stefano Salsano <stefano.salsano@uniroma2.it>,
	Andrea Mayer <andrea@common-net.org>
Subject: Re: [PATCH net-next v3 4/5] selftest: seg6: explicit cleanup for SRv6 End PSP test
Date: Mon, 16 Nov 2026 14:27:17 +0800	[thread overview]
Message-ID: <avqiRTii9HYwXVXd@fedora> (raw)
In-Reply-To: <20261116053407.53b79a5dceef802586952e96@uniroma2.it>

Hi Andrea,
On Mon, Nov 16, 2026 at 05:34:07AM +0100, Andrea Mayer wrote:
> On Thu, 12 Nov 2026 17:27:59 +0800
> Hangbin Liu <hangbin.liu@linux.dev> wrote:
> 
> > The End PSP tests install policy and localsid state but rely on the
> > global namespace teardown to remove it. That leaves flavor-specific
> > state behind once more tests share this script.
> >
> > Use defer and defer_scopes_cleanup to remove the PSP specified
> > configurations. i.e.
> >
> >   * cafe::1, cafe::1:e9, cafe::2, cafe::2:e9 route and proxy on rt1, rt2
> >   * fcbb:0::x0e9 End next-csid,psp policies on rt 1,2,3,4
> >   * fcff:x::0ef1 End psp polices on rt 1,2,4
> 
> Hi Hangbin,
> 
> A few nits on the message:
> - The code uses defer_scope_pop, not defer_scopes_cleanup.
> - The NEXT-C-SID End SIDs are fcbb:0:x0e9::/48, not fcbb:0::x0e9.
> - "polices" is a typo.
> - The subject prefix is "selftest: seg6:", while the other selftest
>   patches of the series use "selftests: seg6:".

Thanks for the detailed review, I will fix them.

> 
> >
> > Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
> > [snip]
> > diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
> > index 0ed5bfe99029..374b43661c28 100755
> > --- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
> > +++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
> > @@ -759,6 +759,8 @@ setup_rt_endpoint()
> >  		add "${sid}" table "${LOCALSID_TABLE_ID}" \
> >  		encap seg6local action ${behavior_cfg} \
> >  		dev "${DUMMY_DEVNAME}"
> > +	defer ip -netns "${nsname}" -6 route \
> > +		del "${sid}" table "${LOCALSID_TABLE_ID}"
> >  }
> >  
> >  # Add an SRv6 Endpoint behavior to each router of a Policy element <nodeid:op>.
> > @@ -801,10 +803,16 @@ setup_rt_host_proxy()
> >  	ip -netns "$(get_rtname "${rt}")" -6 neigh add \
> >  		proxy "${IPv6_HS_NETWORK}::${hs}" \
> >  		dev "${RT2HS_DEVNAME}"
> > +	defer ip -netns "$(get_rtname "${rt}")" -6 neigh del \
> > +		proxy "${IPv6_HS_NETWORK}::${hs}" \
> > +		dev "${RT2HS_DEVNAME}"
> >  
> >  	ip -netns "$(get_rtname "${rt}")" -6 neigh add \
> >  		proxy "${IPv6_HS_NETWORK}::${hs}:${func}" \
> >  		dev "${RT2HS_DEVNAME}"
> > +	defer ip -netns "$(get_rtname "${rt}")" -6 neigh del \
> > +		proxy "${IPv6_HS_NETWORK}::${hs}:${func}" \
> > +		dev "${RT2HS_DEVNAME}"
> >  }
> >  
> >  # This helper function builds and installs the SID List (i.e. SRv6 Policy)
> > @@ -882,6 +890,8 @@ __setup_rt_policy()
> >  		add "${IPv6_HS_NETWORK}::${dst}" \
> >  		encap seg6 mode inline segs "${policy}" \
> >  		dev "${DUMMY_DEVNAME}"
> > +	defer ip -netns "${in_nsname}" -6 route \
> > +		del "${IPv6_HS_NETWORK}::${dst}"
> >  }
> >  
> >  # see __setup_rt_policy
> 
> If you agree to keep the proxy entry in __setup_rt_policy(), as
> proposed on patch 3, its defer can go next to the defer of the route.
> Something like:
> 
> 	ip -netns "${in_nsname}" -6 route \
> 		add "${IPv6_HS_NETWORK}::${dst}" \
> 		encap seg6 mode inline segs "${policy}" \
> 		dev "${DUMMY_DEVNAME}"
> 	defer ip -netns "${in_nsname}" -6 route \
> 		del "${IPv6_HS_NETWORK}::${dst}"
> 
> 	ip -netns "${in_nsname}" -6 neigh \
> 		add proxy "${IPv6_HS_NETWORK}::${dst}" \
> 		dev "${RT2HS_DEVNAME}"
> 	defer ip -netns "${in_nsname}" -6 neigh \
> 		del proxy "${IPv6_HS_NETWORK}::${dst}" \
> 		dev "${RT2HS_DEVNAME}"
> 
> > @@ -1460,11 +1470,13 @@ set +e
> >  router_tests
> >  host2gateway_tests
> >  
> > +defer_scope_push
> >  set -e
> >  setup_end_flv_psp
> >  set +e
> >  host_srv6_end_flv_psp_tests
> >  host_srv6_end_flv_next_csid_psp_tests
> >  host_srv6_end_flv_consumed_srh_tests
> > +defer_scope_pop
> >  
> >  print_log_test_results
> 
> setup_hs_lo_addr() has no defer. The loopback addresses cafe::1:e9
> and cafe::2:e9, and the routes that setup_hs_lo_addr() adds on rt-1
> and rt-2, stay after defer_scope_pop. Only the End PSP scenario uses
> them. Could setup_hs_lo_addr() defer their removal too, like the
> Policies? Something like:
> 
> 	ip -netns "${hsname}" addr add "${addr}/128" dev lo nodad
> 	defer ip -netns "${hsname}" addr del "${addr}/128" dev lo
> 
> 	ip -netns "${rtname}" -6 route \
> 		add "${addr}" \
> 		via "${IPv6_HS_NETWORK}::${hs}" dev "${RT2HS_DEVNAME}"
> 	defer ip -netns "${rtname}" -6 route \
> 		del "${addr}"

I will update the defer with your suggestions.

Thanks
Hangbin

  reply	other threads:[~2026-11-16  6:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  9:27 [PATCH net-next v3 0/5] seg6: add End.X PSP flavor support and selftests Hangbin Liu
2026-11-12  9:27 ` [PATCH net-next v3 1/5] seg6: split final End process out of flavor processing Hangbin Liu
2026-11-12  9:27 ` [PATCH net-next v3 2/5] seg6: add RFC8986 flavor support for End.X Hangbin Liu
2026-11-12  9:27 ` [PATCH net-next v3 3/5] selftests: seg6: move SRv6 End PSP setup into its own helper Hangbin Liu
2026-11-16  4:26   ` Andrea Mayer
2026-11-16  6:20     ` Hangbin Liu
2026-11-12  9:27 ` [PATCH net-next v3 4/5] selftest: seg6: explicit cleanup for SRv6 End PSP test Hangbin Liu
2026-11-16  4:34   ` Andrea Mayer
2026-11-16  6:27     ` Hangbin Liu [this message]
2026-11-12  9:28 ` [PATCH net-next v3 5/5] selftests: seg6: add PSP flavor testing for SRv6 End.X Hangbin Liu

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=avqiRTii9HYwXVXd@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®