Re: [PATCH v2 1/2] can: c_can: add ethtool support
From: Andrew Lunn
Date: Thu May 13 2021 - 17:13:53 EST
On Thu, May 13, 2021 at 09:36:37PM +0200, Dario Binacchi wrote:
> With commit 132f2d45fb23 ("can: c_can: add support to 64 message objects")
> the number of message objects used for reception / transmission depends
> on FIFO size.
> The ethtools API support allows you to retrieve this info. Driver info
> has been added too.
Hi Dario
Nice to see the API being re-used for something other than Ethernet.
> +static void c_can_get_drvinfo(struct net_device *netdev,
> + struct ethtool_drvinfo *info)
> +{
> + struct c_can_priv *priv = netdev_priv(netdev);
> + struct platform_device *pdev = to_platform_device(priv->device);
> +
> + strscpy(info->driver, "c_can", sizeof(info->driver));
> + strscpy(info->version, "1.0", sizeof(info->version));
version is pretty meaningless. This driver could be backported into
some enterprise kernel with a huge number of patches. Or more likely,
some in car infotainment kernel with a lot of vendor patches. Lots of
things around the driver change, but it still tells you version
1.0. So we don't recommend filling this in. The ethtool core will then
fill the version what kernel the driver is actually being used in:
https://elixir.bootlin.com/linux/latest/source/net/ethtool/ioctl.c#L706
Andrew