Message ID | 20221126162211.93322-6-mailhol.vincent@wanadoo.fr (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | can: etas_es58x: report firmware, bootloader and hardware version | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Series ignored based on subject |
On Sun, Nov 27, 2022 at 01:22:10AM +0900, Vincent Mailhol wrote: > Implement ethtool_ops::get_drvinfo() in order to report the firmware > version. > > Firmware version 0.0.0 has a special meaning and just means that we > could not parse the product information string. In such case, do > nothing (i.e. leave the .fw_version string empty). > > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
On Sun, 27 Nov 2022 01:22:10 +0900 Vincent Mailhol wrote: > Implement ethtool_ops::get_drvinfo() in order to report the firmware > version. > > Firmware version 0.0.0 has a special meaning and just means that we > could not parse the product information string. In such case, do > nothing (i.e. leave the .fw_version string empty). devlink_compat_running_version() does not work?
On Tue. 29 Nov. 2022 at 07:29, Jakub Kicinski <kuba@kernel.org> wrote: > On Sun, 27 Nov 2022 01:22:10 +0900 Vincent Mailhol wrote: > > Implement ethtool_ops::get_drvinfo() in order to report the firmware > > version. > > > > Firmware version 0.0.0 has a special meaning and just means that we > > could not parse the product information string. In such case, do > > nothing (i.e. leave the .fw_version string empty). > > devlink_compat_running_version() does not work? I was not aware of this one. Thank you for pointing this out. If I correctly understand, devlink_compat_running_version() is supposed to allow ethtool to retrieve the firmware version from devlink, right? Currently it does not work. I guess it is because I am not using SET_NETDEV_DEVLINK_PORT()? I initially thought that this was optional. I will continue to investigate and see if it is possible to completely remove the .get_drvinfo() callback. Yours sincerely, Vincent Mailhol
On Wed, 30 Nov 2022 02:12:27 +0900 Vincent MAILHOL wrote: > I was not aware of this one. Thank you for pointing this out. > If I correctly understand, devlink_compat_running_version() is > supposed to allow ethtool to retrieve the firmware version from > devlink, right? Yes. > Currently it does not work. I guess it is because I am not using > SET_NETDEV_DEVLINK_PORT()? I initially thought that this was optional. It's optional but breaks the linking hence the fallback can't kick in. I guess "optional-ity" is a spectrum :) > I will continue to investigate and see if it is possible to completely > remove the .get_drvinfo() callback.
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index e81ef23d8698..12968aef41af 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -1979,7 +1979,28 @@ static const struct net_device_ops es58x_netdev_ops = { .ndo_eth_ioctl = can_eth_ioctl_hwts, }; +/** + * es58x_get_drvinfo() - Get the firmware version. + * @netdev: CAN network device. + * @drvinfo: Driver information. + * + * Populate @drvinfo with the firmware version. The core will populate + * the rest. + */ +static void es58x_get_drvinfo(struct net_device *netdev, + struct ethtool_drvinfo *drvinfo) +{ + struct es58x_device *es58x_dev = es58x_priv(netdev)->es58x_dev; + struct es58x_sw_version *fw_ver = &es58x_dev->firmware_version; + + if (es58x_sw_version_is_set(fw_ver)) + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), + "%02u.%02u.%02u", + fw_ver->major, fw_ver->minor, fw_ver->revision); +} + static const struct ethtool_ops es58x_ethtool_ops = { + .get_drvinfo = es58x_get_drvinfo, .get_ts_info = can_ethtool_op_get_ts_info_hwts, };
Implement ethtool_ops::get_drvinfo() in order to report the firmware version. Firmware version 0.0.0 has a special meaning and just means that we could not parse the product information string. In such case, do nothing (i.e. leave the .fw_version string empty). Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> --- *N.B.* Drivers had to also fill ethtool_drvinfo::driver and ethtool_drvinfo::bus_info. Starting this month, this is not needed anymore because of commit edaf5df22cb8 ("ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits"). https://git.kernel.org/netdev/net-next/c/edaf5df22cb8 --- drivers/net/can/usb/etas_es58x/es58x_core.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)