public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel•org>
To: Pedro Tammela <pctammela@mojatatu•com>
Cc: netdev@vger•kernel.org, jhs@mojatatu•com,
	xiyou.wangcong@gmail•com, jiri@resnulli•us, davem@davemloft•net,
	edumazet@google•com, kuba@kernel•org, pabeni@redhat•com,
	shuah@kernel•org, victor@mojatatu•com
Subject: Re: [PATCH net-next 3/6] selftests: tc-testing: use netns delete from pyroute2
Date: Mon, 20 Nov 2023 17:35:15 +0000	[thread overview]
Message-ID: <20231120173515.GD245676@kernel.org> (raw)
In-Reply-To: <20231117171208.2066136-4-pctammela@mojatatu.com>

On Fri, Nov 17, 2023 at 02:12:05PM -0300, Pedro Tammela wrote:
> When pyroute2 is available, use the native netns delete routine instead
> of calling iproute2 to do it. As forks are expensive with some kernel
> configs, minimize its usage to avoid kselftests timeouts.
> 
> Signed-off-by: Pedro Tammela <pctammela@mojatatu•com>

I have a suggestion for a follow up below, but this change looks good to me.

Reviewed-by: Simon Horman <horms@kernel•org>

> ---
>  .../testing/selftests/tc-testing/plugin-lib/nsPlugin.py  | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
> index 2b8cbfdf1083..920dcbedc395 100644
> --- a/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
> +++ b/tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
> @@ -64,7 +64,10 @@ class SubPlugin(TdcPlugin):
>          if self.args.verbose:
>              print('{}.post_case'.format(self.sub_class))
>  
> -        self._ns_destroy()
> +        if netlink == True:
> +            self._nl_ns_destroy()
> +        else:
> +            self._ns_destroy()

As an aside, I think it would to rename _ns_* to
_iproute2_ns_* or similar, to make the distinction with _nl_ns_* clearer.

>  
>      def post_suite(self, index):
>          if self.args.verbose:
> @@ -174,6 +177,10 @@ class SubPlugin(TdcPlugin):
>          '''
>          self._exec_cmd_batched('pre', self._ns_create_cmds())
>  
> +    def _nl_ns_destroy(self):
> +        ns = self.args.NAMES['NS']
> +        netns.remove(ns)
> +
>      def _ns_destroy_cmd(self):
>          return self._replace_keywords('netns delete {}'.format(self.args.NAMES['NS']))
>  
> -- 
> 2.40.1
> 

  reply	other threads:[~2023-11-20 17:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 17:12 [PATCH net-next 0/6] selftests: tc-testing: more updates to tdc Pedro Tammela
2023-11-17 17:12 ` [PATCH net-next 1/6] selftests: tc-testing: cap parallel tdc to 4 cores Pedro Tammela
2023-11-20 17:38   ` Simon Horman
2023-11-17 17:12 ` [PATCH net-next 2/6] selftests: tc-testing: move back to per test ns setup Pedro Tammela
2023-11-20 17:38   ` Simon Horman
2023-11-17 17:12 ` [PATCH net-next 3/6] selftests: tc-testing: use netns delete from pyroute2 Pedro Tammela
2023-11-20 17:35   ` Simon Horman [this message]
2023-11-17 17:12 ` [PATCH net-next 4/6] selftests: tc-testing: leverage -all in suite ns teardown Pedro Tammela
2023-11-20 17:39   ` Simon Horman
2023-11-17 17:12 ` [PATCH net-next 5/6] selftests: tc-testing: timeout on unbounded loops Pedro Tammela
2023-11-20 17:35   ` Simon Horman
2023-11-17 17:12 ` [PATCH net-next 6/6] selftests: tc-testing: report number of workers in use Pedro Tammela
2023-11-20 17:40   ` Simon Horman
2023-11-17 20:47 ` [PATCH net-next 0/6] selftests: tc-testing: more updates to tdc Jamal Hadi Salim
2023-11-21  2:07 ` Jakub Kicinski
2023-11-21  2:10 ` patchwork-bot+netdevbpf

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=20231120173515.GD245676@kernel.org \
    --to=horms@kernel$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=jhs@mojatatu$(echo .)com \
    --cc=jiri@resnulli$(echo .)us \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=pctammela@mojatatu$(echo .)com \
    --cc=shuah@kernel$(echo .)org \
    --cc=victor@mojatatu$(echo .)com \
    --cc=xiyou.wangcong@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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