Netdev List
 help / color / mirror / Atom feed
From: Joe Damato <jdamato@fastly.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	David Wei <dw@davidwei.uk>, Eric Dumazet <edumazet@google.com>,
	open list <linux-kernel@vger.kernel.org>,
	Paolo Abeni <pabeni@redhat.com>
Subject: Re: [RFC net 0/1] Fix netdevim to correctly mark NAPI IDs
Date: Tue, 15 Apr 2025 18:39:27 -0700	[thread overview]
Message-ID: <Z_8KT7LYUgyZQhI-@LQ3V64L9R2> (raw)
In-Reply-To: <20250415171154.0382c7f7@kernel.org>

On Tue, Apr 15, 2025 at 05:11:54PM -0700, Jakub Kicinski wrote:
> On Tue, 15 Apr 2025 12:39:11 -0700 Joe Damato wrote:
> > On Mon, Mar 31, 2025 at 04:39:17PM -0700, Jakub Kicinski wrote:
> > > Up to you. The patch make me wonder how many other corner cases / bugs
> > > we may be missing in drivers. And therefore if we shouldn't flesh out
> > > more device-related tests. But exercising the core code makes sense
> > > in itself so no strong feelings.  
> > 
> > Sorry to revive this old thread, but I have a bit of time to get
> > this fixed now. I have a patch for netdevsim but am trying to figure
> > out what the best way to write a test for this is.
> > 
> > Locally, I've hacked up a tools/testing/selftests/drivers/net/napi_id.py
> > 
> > I'm using NetDrvEpEnv, but am not sure: is there an easy way in
> > Python to run stuff in a network namespace? Is there an example I
> > can look at?
> > 
> > In my Python code, I was thinking that I'd call fork and have each
> > python process (client and server) set their network namespace
> > according to the NetDrvEpEnv cfg... but wasn't sure if there was a
> > better/easier way ?
> > 
> > It looks like tools/testing/selftests/net/rds/test.py uses
> > LoadLibrary to call setns before creating a socket.
> > 
> > Should I go in that direction too?
> 
> Why do you need a netns? The NetDrvEpEnv will create one for you
> automatically and put one side of the netdevsim into it.
> Do you mean that you need to adjust that other endpoint?
> It's done the same way as if it was a remote machine:
> 
> 	cmd(..., host=cfg.remote)

Maybe I'm just thinking about it wrong and/or describing it poorly.

The idea was that napi_id.py test forks. One process does a
listen()/accept() and the other does a connect(). The accept side
checks that the napi ID is non-zero. For that to work, both
processes need their netdevsims to be able to talk to each other.

> If you really need a netnes check out
> tools/testing/selftests/net/lib/py/netns.py

I'll take a look, but I'm probably just missing something about how
to properly use NetDrvEpEnv.

  reply	other threads:[~2025-04-16  1:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-29  0:00 [RFC net 0/1] Fix netdevim to correctly mark NAPI IDs Joe Damato
2025-03-29  0:00 ` [RFC net 1/1] netdevsim: Mark NAPI ID on skb in nsim_rcv Joe Damato
2025-03-31 20:36 ` [RFC net 0/1] Fix netdevim to correctly mark NAPI IDs Jakub Kicinski
2025-03-31 22:32   ` Joe Damato
2025-03-31 23:39     ` Jakub Kicinski
2025-04-15 19:39       ` Joe Damato
2025-04-16  0:11         ` Jakub Kicinski
2025-04-16  1:39           ` Joe Damato [this message]
2025-04-16  1:56             ` Joe Damato

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=Z_8KT7LYUgyZQhI-@LQ3V64L9R2 \
    --to=jdamato@fastly.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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