* [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
@ 2022-11-08 3:57 Vincent Mailhol
2022-11-09 17:52 ` Leon Romanovsky
2022-11-10 17:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 16+ messages in thread
From: Vincent Mailhol @ 2022-11-08 3:57 UTC (permalink / raw)
To: netdev, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Guangbin Huang, Hao Chen, Sean Anderson, Tom Rix, Tonghao Zhang,
Wolfram Sang, Marco Bonelli, linux-kernel, Vincent Mailhol
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.
Allow the driver to leave those two fields empty and populate them in
such case. This way, the driver can rely on the default values for the
name and the bus_info. If the driver provides values, do nothing.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
net/ethtool/ioctl.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 57e7238a4136..546f931c3b6c 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -713,15 +713,22 @@ static int
ethtool_get_drvinfo(struct net_device *dev, struct ethtool_devlink_compat *rsp)
{
const struct ethtool_ops *ops = dev->ethtool_ops;
+ struct device *parent = dev->dev.parent;
rsp->info.cmd = ETHTOOL_GDRVINFO;
strscpy(rsp->info.version, UTS_RELEASE, sizeof(rsp->info.version));
if (ops->get_drvinfo) {
ops->get_drvinfo(dev, &rsp->info);
- } else if (dev->dev.parent && dev->dev.parent->driver) {
- strscpy(rsp->info.bus_info, dev_name(dev->dev.parent),
+ if (!rsp->info.bus_info[0] && parent)
+ strscpy(rsp->info.bus_info, dev_name(parent),
+ sizeof(rsp->info.bus_info));
+ if (!rsp->info.driver[0] && parent && parent->driver)
+ strscpy(rsp->info.driver, parent->driver->name,
+ sizeof(rsp->info.driver));
+ } else if (parent && parent->driver) {
+ strscpy(rsp->info.bus_info, dev_name(parent),
sizeof(rsp->info.bus_info));
- strscpy(rsp->info.driver, dev->dev.parent->driver->name,
+ strscpy(rsp->info.driver, parent->driver->name,
sizeof(rsp->info.driver));
} else if (dev->rtnl_link_ops) {
strscpy(rsp->info.driver, dev->rtnl_link_ops->kind,
--
2.37.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-08 3:57 [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits Vincent Mailhol
@ 2022-11-09 17:52 ` Leon Romanovsky
2022-11-09 20:26 ` Jakub Kicinski
2022-11-10 17:40 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2022-11-09 17:52 UTC (permalink / raw)
To: Vincent Mailhol
Cc: netdev, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Guangbin Huang, Hao Chen, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli, linux-kernel
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? One can argue that they don't need
to touch these fields in a first place and ethtool_drvinfo should always
overwrite them.
Thanks
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-09 17:52 ` Leon Romanovsky
@ 2022-11-09 20:26 ` Jakub Kicinski
2022-11-10 8:34 ` Vincent MAILHOL
0 siblings, 1 reply; 16+ messages in thread
From: Jakub Kicinski @ 2022-11-09 20:26 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Vincent Mailhol, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Hao Chen, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
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.
> 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.
While I'm typing - I've used dev_driver_string() to get the driver
name in the past. Perhaps something to consider?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-09 20:26 ` Jakub Kicinski
@ 2022-11-10 8:34 ` Vincent MAILHOL
2022-11-10 9:11 ` Leon Romanovsky
2022-11-10 16:59 ` Jakub Kicinski
0 siblings, 2 replies; 16+ messages in thread
From: Vincent MAILHOL @ 2022-11-10 8:34 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Leon Romanovsky, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu. 10 nov. 2022 at 05:26, Jakub Kicinski <kuba@kernel.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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 8:34 ` Vincent MAILHOL
@ 2022-11-10 9:11 ` Leon Romanovsky
2022-11-10 11:43 ` Vincent MAILHOL
` (2 more replies)
2022-11-10 16:59 ` Jakub Kicinski
1 sibling, 3 replies; 16+ messages in thread
From: Leon Romanovsky @ 2022-11-10 9:11 UTC (permalink / raw)
To: Vincent MAILHOL
Cc: Jakub Kicinski, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu, Nov 10, 2022 at 05:34:55PM +0900, Vincent MAILHOL wrote:
> On Thu. 10 nov. 2022 at 05:26, Jakub Kicinski <kuba@kernel.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.
Sorry for being misleading, It looks like I typed only part of the sentence
which I had in my mind. I wanted to see if any driver exists which prints
drv_name and bus_info different from default.
>
> > > 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?
I will be happy to see such patch and will review it, but can't add sign-off
as I'm not netdev maintainer.
Thanks
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 9:11 ` Leon Romanovsky
@ 2022-11-10 11:43 ` Vincent MAILHOL
2022-11-10 12:00 ` Leon Romanovsky
2022-11-10 13:41 ` Andrew Lunn
2022-11-10 17:01 ` Jakub Kicinski
2 siblings, 1 reply; 16+ messages in thread
From: Vincent MAILHOL @ 2022-11-10 11:43 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Jakub Kicinski, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu. 10 Nov. 2022 at 18:11, Leon Romanovsky <leon@kernel.org> wrote:
> On Thu, Nov 10, 2022 at 05:34:55PM +0900, Vincent MAILHOL wrote:
> > On Thu. 10 nov. 2022 at 05:26, Jakub Kicinski <kuba@kernel.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.
>
> Sorry for being misleading, It looks like I typed only part of the sentence
> which I had in my mind. I wanted to see if any driver exists which prints
> drv_name and bus_info different from default.
>
> >
> > > > 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?
>
> I will be happy to see such patch and will review it, but can't add sign-off
> as I'm not netdev maintainer.
Well, if you want to review, just have a look at:
$ git grep -W "get_drvinfo(struct"
Unless some driver names their callback function in some non standard
way, that should be pretty it. Regardless, this will give you a fair
representation of the current situation.
There are a few nuances. For example, some drivers use dev_name() for
the .bus_info, while some others use pci_name(). I am not sure if this
makes a difference... Also, there are many hardcoded names for .driver
and I do not have the courage to check all of them. I am OK to blindly
remove all that mess but no more.
Yours sincerely,
Vincent Mailhol
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 11:43 ` Vincent MAILHOL
@ 2022-11-10 12:00 ` Leon Romanovsky
2022-11-10 15:53 ` Vincent MAILHOL
0 siblings, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2022-11-10 12:00 UTC (permalink / raw)
To: Vincent MAILHOL
Cc: Jakub Kicinski, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu, Nov 10, 2022 at 08:43:25PM +0900, Vincent MAILHOL wrote:
> On Thu. 10 Nov. 2022 at 18:11, Leon Romanovsky <leon@kernel.org> wrote:
> > On Thu, Nov 10, 2022 at 05:34:55PM +0900, Vincent MAILHOL wrote:
> > > On Thu. 10 nov. 2022 at 05:26, Jakub Kicinski <kuba@kernel.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.
> >
> > Sorry for being misleading, It looks like I typed only part of the sentence
> > which I had in my mind. I wanted to see if any driver exists which prints
> > drv_name and bus_info different from default.
> >
> > >
> > > > > 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?
> >
> > I will be happy to see such patch and will review it, but can't add sign-off
> > as I'm not netdev maintainer.
>
> Well, if you want to review, just have a look at:
> $ git grep -W "get_drvinfo(struct"
BTW, in some of the callbacks, if driver doesn't exists, they print "N/A",
while in your patch it will be empty string.
Thanks
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 9:11 ` Leon Romanovsky
2022-11-10 11:43 ` Vincent MAILHOL
@ 2022-11-10 13:41 ` Andrew Lunn
2022-11-10 17:01 ` Jakub Kicinski
2 siblings, 0 replies; 16+ messages in thread
From: Andrew Lunn @ 2022-11-10 13:41 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Vincent MAILHOL, Jakub Kicinski, netdev, David S . Miller,
Eric Dumazet, Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
> I will be happy to see such patch and will review it, but can't add sign-off
> as I'm not netdev maintainer.
Anybody can review any patch, and give an Acked-by or Reviewed-by. It
is up to the Maintainer doing the actual merge to decided if it has
any actual weight.
Andrew
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 12:00 ` Leon Romanovsky
@ 2022-11-10 15:53 ` Vincent MAILHOL
2022-11-10 17:22 ` Leon Romanovsky
0 siblings, 1 reply; 16+ messages in thread
From: Vincent MAILHOL @ 2022-11-10 15:53 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Jakub Kicinski, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu. 10 Nov. 2022 at 21:00, Leon Romanovsky <leon@kernel.org> wrote:
> On Thu, Nov 10, 2022 at 08:43:25PM +0900, Vincent MAILHOL wrote:
> > On Thu. 10 Nov. 2022 at 18:11, Leon Romanovsky <leon@kernel.org> wrote:
> > > On Thu, Nov 10, 2022 at 05:34:55PM +0900, Vincent MAILHOL wrote:
> > > > On Thu. 10 nov. 2022 at 05:26, Jakub Kicinski <kuba@kernel.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.
> > >
> > > Sorry for being misleading, It looks like I typed only part of the sentence
> > > which I had in my mind. I wanted to see if any driver exists which prints
> > > drv_name and bus_info different from default.
> > >
> > > >
> > > > > > 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?
> > >
> > > I will be happy to see such patch and will review it, but can't add sign-off
> > > as I'm not netdev maintainer.
> >
> > Well, if you want to review, just have a look at:
> > $ git grep -W "get_drvinfo(struct"
>
> BTW, in some of the callbacks, if driver doesn't exists, they print "N/A",
> while in your patch it will be empty string.
Indeed and this is inconsistent. For example, no one sets
.erom_version to "N/A". So you will have some of the fields set to
"N/A" and some others set to an empty string. The "N/A" thing was a
mistake to begin with. I will not change my patch.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 8:34 ` Vincent MAILHOL
2022-11-10 9:11 ` Leon Romanovsky
@ 2022-11-10 16:59 ` Jakub Kicinski
1 sibling, 0 replies; 16+ messages in thread
From: Jakub Kicinski @ 2022-11-10 16:59 UTC (permalink / raw)
To: Vincent MAILHOL
Cc: Leon Romanovsky, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu, 10 Nov 2022 17:34:55 +0900 Vincent MAILHOL wrote:
> > 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
I don't think so? We put dev_name() into bus_info, which is usually
the address of the device on the bus (e.g. (D)BDF for PCI, like
0000:00:14.3). The name of the bus is pci. dev_driver_string() will
also fall back to printing class name.
> 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.
Well, it doesn't matter. I asked because handful of popular drivers
use dev_driver_string(). But.. these are drivers so parent->driver
will be set and it ends up not making any difference.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 9:11 ` Leon Romanovsky
2022-11-10 11:43 ` Vincent MAILHOL
2022-11-10 13:41 ` Andrew Lunn
@ 2022-11-10 17:01 ` Jakub Kicinski
2022-11-10 17:20 ` Leon Romanovsky
2022-11-11 6:43 ` Vincent MAILHOL
2 siblings, 2 replies; 16+ messages in thread
From: Jakub Kicinski @ 2022-11-10 17:01 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Vincent MAILHOL, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu, 10 Nov 2022 11:11:38 +0200 Leon Romanovsky wrote:
> I will be happy to see such patch and will review it, but can't add sign-off
> as I'm not netdev maintainer.
Did we finish the version removal work? :S
Personally I'd rather direct any effort towards writing a checkpatch /
cocci / python check that catches new cases than cleaning up the pile
of drivers we have. A lot of which are not actively used..
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 17:01 ` Jakub Kicinski
@ 2022-11-10 17:20 ` Leon Romanovsky
2022-11-11 6:43 ` Vincent MAILHOL
1 sibling, 0 replies; 16+ messages in thread
From: Leon Romanovsky @ 2022-11-10 17:20 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Vincent MAILHOL, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Thu, Nov 10, 2022 at 09:01:27AM -0800, Jakub Kicinski wrote:
> On Thu, 10 Nov 2022 11:11:38 +0200 Leon Romanovsky wrote:
> > I will be happy to see such patch and will review it, but can't add sign-off
> > as I'm not netdev maintainer.
>
> Did we finish the version removal work? :S
Good point :)
>
> Personally I'd rather direct any effort towards writing a checkpatch /
> cocci / python check that catches new cases than cleaning up the pile
> of drivers we have. A lot of which are not actively used..
I thought about this too, but came to conclusion what first step is to
remove "version" from in-kernel API. It will reduce drastically desire
to add driver version to new drivers.
"There is no shame in doing the right thing, even if its too late.".
BTW, I hope that we all learned that allowing drivers to return free
string to users will always lead to disaster.
Thanks
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 15:53 ` Vincent MAILHOL
@ 2022-11-10 17:22 ` Leon Romanovsky
0 siblings, 0 replies; 16+ messages in thread
From: Leon Romanovsky @ 2022-11-10 17:22 UTC (permalink / raw)
To: Vincent MAILHOL
Cc: Jakub Kicinski, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Fri, Nov 11, 2022 at 12:53:16AM +0900, Vincent MAILHOL wrote:
> On Thu. 10 Nov. 2022 at 21:00, Leon Romanovsky <leon@kernel.org> wrote:
> > On Thu, Nov 10, 2022 at 08:43:25PM +0900, Vincent MAILHOL wrote:
> > > On Thu. 10 Nov. 2022 at 18:11, Leon Romanovsky <leon@kernel.org> wrote:
> > > > On Thu, Nov 10, 2022 at 05:34:55PM +0900, Vincent MAILHOL wrote:
> > > > > On Thu. 10 nov. 2022 at 05:26, Jakub Kicinski <kuba@kernel.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.
> > > >
> > > > Sorry for being misleading, It looks like I typed only part of the sentence
> > > > which I had in my mind. I wanted to see if any driver exists which prints
> > > > drv_name and bus_info different from default.
> > > >
> > > > >
> > > > > > > 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?
> > > >
> > > > I will be happy to see such patch and will review it, but can't add sign-off
> > > > as I'm not netdev maintainer.
> > >
> > > Well, if you want to review, just have a look at:
> > > $ git grep -W "get_drvinfo(struct"
> >
> > BTW, in some of the callbacks, if driver doesn't exists, they print "N/A",
> > while in your patch it will be empty string.
>
> Indeed and this is inconsistent. For example, no one sets
> .erom_version to "N/A". So you will have some of the fields set to
> "N/A" and some others set to an empty string. The "N/A" thing was a
> mistake to begin with. I will not change my patch.
I don't see anyone asking you to change your patch drastically. This
discussion is more about next steps.
Thanks
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-08 3:57 [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits Vincent Mailhol
2022-11-09 17:52 ` Leon Romanovsky
@ 2022-11-10 17:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 16+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-10 17:40 UTC (permalink / raw)
To: Vincent MAILHOL
Cc: netdev, davem, edumazet, kuba, pabeni, huangguangbin2, chenhao288,
sean.anderson, trix, xiangxia.m.yue, wsa+renesas, marco,
linux-kernel
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 8 Nov 2022 12:57:54 +0900 you 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.
>
> [...]
Here is the summary with links:
- [net-next,v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
https://git.kernel.org/netdev/net-next/c/edaf5df22cb8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-10 17:01 ` Jakub Kicinski
2022-11-10 17:20 ` Leon Romanovsky
@ 2022-11-11 6:43 ` Vincent MAILHOL
2022-11-11 16:13 ` Leon Romanovsky
1 sibling, 1 reply; 16+ messages in thread
From: Vincent MAILHOL @ 2022-11-11 6:43 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Leon Romanovsky, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Fri. 11 Nov. 2022 à 02:01, Jakub Kicinski <kuba@kernel.org> wrote:
> On Thu, 10 Nov 2022 11:11:38 +0200 Leon Romanovsky wrote:
> > I will be happy to see such patch and will review it, but can't add sign-off
> > as I'm not netdev maintainer.
>
> Did we finish the version removal work? :S
>
> Personally I'd rather direct any effort towards writing a checkpatch /
> cocci / python check that catches new cases than cleaning up the pile
> of drivers we have. A lot of which are not actively used..
Agree, but I will not work on that (because of other personal
priorities). If someone else wants to do it, go ahead :)
What I can do is update the documentation:
https://lore.kernel.org/netdev/20221111064054.371965-1-mailhol.vincent@wanadoo.fr/
Yours sincerely,
Vincent Mailhol
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits
2022-11-11 6:43 ` Vincent MAILHOL
@ 2022-11-11 16:13 ` Leon Romanovsky
0 siblings, 0 replies; 16+ messages in thread
From: Leon Romanovsky @ 2022-11-11 16:13 UTC (permalink / raw)
To: Vincent MAILHOL
Cc: Jakub Kicinski, netdev, David S . Miller, Eric Dumazet,
Paolo Abeni, Guangbin Huang, Sean Anderson, Tom Rix,
Tonghao Zhang, Wolfram Sang, Marco Bonelli
On Fri, Nov 11, 2022 at 03:43:36PM +0900, Vincent MAILHOL wrote:
> On Fri. 11 Nov. 2022 à 02:01, Jakub Kicinski <kuba@kernel.org> wrote:
> > On Thu, 10 Nov 2022 11:11:38 +0200 Leon Romanovsky wrote:
> > > I will be happy to see such patch and will review it, but can't add sign-off
> > > as I'm not netdev maintainer.
> >
> > Did we finish the version removal work? :S
> >
> > Personally I'd rather direct any effort towards writing a checkpatch /
> > cocci / python check that catches new cases than cleaning up the pile
> > of drivers we have. A lot of which are not actively used..
>
> Agree, but I will not work on that (because of other personal
> priorities). If someone else wants to do it, go ahead :)
It's ok, Jakub referred to me. I sent a lot of patches like this.
https://lore.kernel.org/netdev/5d76f3116ee795071ec044eabb815d6c2bdc7dbd.1649922731.git.leonro@nvidia.com/
>
> What I can do is update the documentation:
> https://lore.kernel.org/netdev/20221111064054.371965-1-mailhol.vincent@wanadoo.fr/
>
>
> Yours sincerely,
> Vincent Mailhol
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-11-11 16:13 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 3:57 [PATCH net-next v1] ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits Vincent Mailhol
2022-11-09 17:52 ` Leon Romanovsky
2022-11-09 20:26 ` Jakub Kicinski
2022-11-10 8:34 ` Vincent MAILHOL
2022-11-10 9:11 ` Leon Romanovsky
2022-11-10 11:43 ` Vincent MAILHOL
2022-11-10 12:00 ` Leon Romanovsky
2022-11-10 15:53 ` Vincent MAILHOL
2022-11-10 17:22 ` Leon Romanovsky
2022-11-10 13:41 ` Andrew Lunn
2022-11-10 17:01 ` Jakub Kicinski
2022-11-10 17:20 ` Leon Romanovsky
2022-11-11 6:43 ` Vincent MAILHOL
2022-11-11 16:13 ` Leon Romanovsky
2022-11-10 16:59 ` Jakub Kicinski
2022-11-10 17:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).