All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Petr Machata <petrm@nvidia.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<edumazet@google.com>, <pabeni@redhat.com>, <shuah@kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH net-next 6/6] selftests: net: exercise page pool reporting via netlink
Date: Fri, 12 Apr 2024 06:48:00 -0700	[thread overview]
Message-ID: <20240412064800.0530e984@kernel.org> (raw)
In-Reply-To: <874jc7ezia.fsf@nvidia.com>

On Fri, 12 Apr 2024 10:20:47 +0200 Petr Machata wrote:
> > +    def up(self):
> > +        ip("link set dev {} up".format(self.ifname))
> > +
> > +    def down(self):
> > +        ip("link set dev {} down".format(self.ifname))  
> 
> Yeah, what I meant by integration pain with LNST the other day was
> basically this. You end up rewriting the iproute2 API in Python.
> But it is what it is.

Yes, I wasn't sure where to make it a local helper in the test or 
a method of the class. I also don't think we should wrap too much but
I was worried someone will give me feedback in the opposite direction :)

Let me make it a local helper in the test.

I should probably move to format strings, too, not sure now what made 
me use .format().

> > +        ksft_eq(len(attached), 1)
> > +        ksft_eq(len(undetached), 1)
> > +
> > +        # Free the old page and the old pp is gone
> > +        nsim.dfs_write("pp_hold", "n")
> > +        # Freeing check is once a second so we may need to retry
> > +        for i in range(50):
> > +            pp_list = nf.page_pool_get({}, dump=True)
> > +            pp_list = [pp for pp in pp_list if pp.get("ifindex") == nsim.ifindex]
> > +            if len(pp_list) == 1:
> > +                break
> > +            time.sleep(0.05)
> > +        ksft_eq(len(pp_list), 1)  
> 
> Yeah, I don't know if busywait / slowwait sort of a helper is practical
> to write in Python. No idea how to go about it. But the bash experience
> shows it would useful fairly often.

If I wrap:

            pp_list = nf.page_pool_get({}, dump=True)
            pp_list = [pp for pp in pp_list if pp.get("ifindex") == nsim.ifindex]

into a helper, I can probably pass the condition in as a lambda 🤔️
Let me try..

      reply	other threads:[~2024-04-12 13:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  1:28 [PATCH net-next 0/6] selftests: net: exercise page pool reporting via netlink Jakub Kicinski
2024-04-11  1:28 ` [PATCH net-next 1/6] net: netdevsim: add some fake page pool use Jakub Kicinski
2024-04-11  1:28 ` [PATCH net-next 2/6] tools: ynl: don't return None for dumps Jakub Kicinski
2024-04-11 10:12   ` Donald Hunter
2024-04-11  1:28 ` [PATCH net-next 3/6] selftests: net: print report check location in python tests Jakub Kicinski
2024-04-12  7:45   ` Petr Machata
2024-04-11  1:28 ` [PATCH net-next 4/6] selftests: net: print full exception on failure Jakub Kicinski
2024-04-12  8:02   ` Petr Machata
2024-04-11  1:28 ` [PATCH net-next 5/6] selftests: net: support use of NetdevSimDev under "with" in python Jakub Kicinski
2024-04-12  8:07   ` Petr Machata
2024-04-11  1:28 ` [PATCH net-next 6/6] selftests: net: exercise page pool reporting via netlink Jakub Kicinski
2024-04-12  8:20   ` Petr Machata
2024-04-12 13:48     ` Jakub Kicinski [this message]

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=20240412064800.0530e984@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=shuah@kernel.org \
    /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.