[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZ6Rq+K6oD9auaNzt1kJAW0nz9Hs=ODDvOiEaiKi2_1KVNA8g@mail.gmail.com>
Date: Thu, 10 Nov 2022 17:34:55 +0900
From: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Leon Romanovsky <leon@...nel.org>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Guangbin Huang <huangguangbin2@...wei.com>,
Sean Anderson <sean.anderson@...o.com>,
Tom Rix <trix@...hat.com>,
Tonghao Zhang <xiangxia.m.yue@...il.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Marco Bonelli <marco@...eim.net>
Subject: Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate
drvinfo fields even if callback exits
On Thu. 10 nov. 2022 at 05:26, Jakub Kicinski <kuba@...nel.org> wrote:
> On Wed, 9 Nov 2022 19:52:13 +0200 Leon Romanovsky wrote:
> > On Tue, Nov 08, 2022 at 12:57:54PM +0900, Vincent Mailhol wrote:
> > > If ethtool_ops::get_drvinfo() callback isn't set,
> > > ethtool_get_drvinfo() will fill the ethtool_drvinfo::name and
> > > ethtool_drvinfo::bus_info fields.
> > >
> > > However, if the driver provides the callback function, those two
> > > fields are not touched. This means that the driver has to fill these
> > > itself.
> >
> > Can you please point to such drivers?
>
> What you mean by "such drivers" is not clear from the quoted context,
> at least to me.
An example:
https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/broadcom/bnx2.c#L7041
This driver wants to set fw_version but needs to also fill the driver
name and bus_info. My patch will enable *such drivers* to only fill
the fw_version and delegate the rest to the core.
> > One can argue that they don't need to touch these fields in a first
> > place and ethtool_drvinfo should always overwrite them.
>
> Quite likely most driver prints to .driver and .bus_info can be dropped
> with this patch in place. Then again, I'm suspecting it's a bit of a
> chicken and an egg problem with people adding new drivers not having
> an incentive to add the print in the core and people who want to add
> the print in the core not having any driver that would benefit.
> Therefore I'd lean towards accepting Vincent's patch as is even if
> the submission can likely be more thorough and strict.
If we can agree that no drivers should ever print .driver and
.bus_info, then I am fine to send a clean-up patch to remove all this
after this one gets accepted. However, I am not willing to invest time
for nothing. So would one of you be ready to sign-off such a clean-up
patch?
> While I'm typing - I've used dev_driver_string() to get the driver
> name in the past. Perhaps something to consider?
I am not sure of that one. If dev->dev.parent->driver is not set, it
defaults to dev_bus_name() which is .bus_info, isn't it?
https://elixir.bootlin.com/linux/latest/source/drivers/base/core.c#L2181
For the end user, it might be better to display an empty driver name
in 'ethtool -i' rather than reporting the bus_info twice?
I mean, if you ask me for my opinion, then my answer is "I am not
sure". If you have confidence that dev_driver_string() is better, then
I will send a v2 right away.
Yours sincerely,
Vincent Mailhol
Powered by blists - more mailing lists