[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240124145033.1c711fd1@device-28.home>
Date: Wed, 24 Jan 2024 14:50:33 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com, Eric Dumazet <edumazet@...gle.com>, Paolo
Abeni <pabeni@...hat.com>, Russell King <linux@...linux.org.uk>,
linux-arm-kernel@...ts.infradead.org, Christophe Leroy
<christophe.leroy@...roup.eu>, Herve Codina <herve.codina@...tlin.com>,
Florian Fainelli <f.fainelli@...il.com>, Heiner Kallweit
<hkallweit1@...il.com>, Vladimir Oltean <vladimir.oltean@....com>,
Köry Maincent <kory.maincent@...tlin.com>, Jesse Brandeburg
<jesse.brandeburg@...el.com>, Jonathan Corbet <corbet@....net>, Marek
Behún <kabel@...nel.org>, Piergiorgio Beruto
<piergiorgio.beruto@...il.com>, Oleksij Rempel <o.rempel@...gutronix.de>,
Nicolò Veronese <nicveronese@...il.com>, Simon Horman
<horms@...nel.org>
Subject: Re: [PATCH net-next v5 07/13] net: ethtool: Introduce a command to
list PHYs on an interface
Hello Andrew,
On Fri, 5 Jan 2024 14:17:10 +0100
Andrew Lunn <andrew@...n.ch> wrote:
> > > > +int ethnl_phy_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
> > > > +{
> > > > + struct ethnl_phy_dump_ctx *ctx = (void *)cb->ctx;
> > > > + struct net *net = sock_net(skb->sk);
> > > > + unsigned long ifindex = 1;
> > >
> > > This doesn't look right, if dump gets full you gotta pick up
> > > when previous call left off.
> >
> > I wasn't aware that this was the expected DUMP behaviour. So I should
> > keep track of the last dev and last phy_index dumped in the dump_ctx I
> > guess ? I'm not sure how I'm going to test this though, I only have
> > devices with at most 2 PHYs :(
>
> At a guess....
>
> You are supposed to dump until you are out of space in the buffer. You
> then return what you have, and expect another call so you can continue
> with the rest.
>
> Rather than fill the buffer, just hack the code to only put in a
> single PHY, and then return with the same condition of a full
> buffer. Hopefully you should get a second call, and you can then test
> your logic for picking up from where you left off.
>
> Another option might be to add PHY support to netdevsim. Add a debugfs
> interface to allow you to create arbitrary PHY topologies? You can
> then even add a test script.
Sorry for the delayed answer, I just took a few hours to give it a try,
and I was able to spin some very basic PHY support for the netdevsim,
allowing to attach arbitrary instances of fixed_phy devices. I can
therefore use that as a mean of testing the dump operation, I'll try to
include that in the next iteration, that should pave the way for some
testability of more PHY stuff hopefully.
Thanks for the suggestion,
Maxime
Powered by blists - more mailing lists