RE: [PATCH net-next v20 10/13] rtase: Implement ethtool function

From: Justin Lai
Date: Tue Jun 18 2024 - 07:13:12 EST


>
> > > > + strscpy(drvinfo->bus_info, pci_name(tp->pdev), 32);
> > >
> > > Can you double check that overwriting these fields is actually needed?
> > > I think core will fill this in for you in ethtool_get_drvinfo()
> >
> > I have removed this line of code for testing. Before removing the
> > code, I could obtain bus info by entering "ethtool -i". However, after
> > removing the code, entering "ethtool -i" no longer retrieves the bus info.
>
> https://elixir.bootlin.com/linux/latest/source/net/ethtool/ioctl.c#L710
>
> if (ops->get_drvinfo) {
> ops->get_drvinfo(dev, &rsp->info);
> if (!rsp->info.bus_info[0] && parent)
> strscpy(rsp->info.bus_info, dev_name(parent),
> sizeof(rsp->info.bus_info));
>
> This suggests you have not set the parent device.
>
> Andrew
Hi Andrew,
I understand your explanation. However, when we input ethtool -i,
shouldn't we aim to get the bus info of the actual device rather than
the parent device? That's why I think we need to add this line.