Re: [PATCH net-next v5 13/22] ethtool: provide driver/device information in GET_INFO request

From: Jiri Pirko
Date: Wed Mar 27 2019 - 16:14:18 EST


Mon, Mar 25, 2019 at 06:08:33PM CET, mkubecek@xxxxxxx wrote:
>Implement GET_INFO request to get basic driver and device information as
>provided by ETHTOOL_GDRVINFO ioct command. The information is read only so
>that the corresponding SET_INFO message is only used in kernel replies.
>
>Move most of ethtool_get_drvinfo() int common.c so that the code can be
>shared by both ioctl and netlink interface.
>
>Signed-off-by: Michal Kubecek <mkubecek@xxxxxxx>
>---
> Documentation/networking/ethtool-netlink.txt | 43 ++++-
> include/uapi/linux/ethtool_netlink.h | 30 ++++
> net/ethtool/Makefile | 2 +-
> net/ethtool/common.c | 52 ++++++
> net/ethtool/common.h | 2 +
> net/ethtool/info.c | 158 +++++++++++++++++++
> net/ethtool/ioctl.c | 50 +-----
> net/ethtool/netlink.c | 8 +
> net/ethtool/netlink.h | 1 +
> 9 files changed, 299 insertions(+), 47 deletions(-)
> create mode 100644 net/ethtool/info.c
>
>diff --git a/Documentation/networking/ethtool-netlink.txt b/Documentation/networking/ethtool-netlink.txt
>index 1508c16a236e..cffa508ca6c6 100644
>--- a/Documentation/networking/ethtool-netlink.txt
>+++ b/Documentation/networking/ethtool-netlink.txt
>@@ -129,6 +129,8 @@ List of message types
> ETHNL_CMD_EVENT notification only
> ETHNL_CMD_GET_STRSET
> ETHNL_CMD_SET_STRSET response only
>+ ETHNL_CMD_GET_INFO
>+ ETHNL_CMD_SET_INFO response only
>
> All constants use ETHNL_CMD_ prefix, usually followed by "GET", "SET" or "ACT"
> to indicate the type.
>@@ -209,6 +211,45 @@ ETHA_STRSET_COUNTS tells kernel to only return string counts of the sets, not
> the actual strings.
>
>
>+GET_INFO
>+--------
>+
>+GET_INFO requests information provided by ioctl commands ETHTOOL_GDRVINFO,
>+ETHTOOL_GPERMADDR and ETHTOOL_GET_TS_INFO to provide basic device information.
>+Common pattern is that all information is read only so that SET_INFO message
>+exists but is only used by kernel for replies to GET_INFO requests. There is
>+also no corresponding notification.
>+
>+Request contents:
>+
>+ ETHA_INFO_DEV (nested) device identification
>+ ETHA_INFO_INFOMASK (u32) info mask
>+ ETHA_INFO_COMPACT (flag) request compact bitsets
>+
>+Info mask bits meaning:
>+
>+ ETH_INFO_IM_DRVINFO driver info (GDRVINFO)
>+ ETH_INFO_IM_PERMADDR permanent HW address (GPERMADDR)
>+ ETH_INFO_IM_TSINFO timestamping info (GET_TS_INFO)
>+
>+Kernel response contents:
>+
>+ ETHA_INFO_DEV (nested) device identification
>+ ETHA_INFO_DRVINFO (nested) driver information
>+ ETHA_DRVINFO_DRIVER (string) driver name
>+ ETHA_DRVINFO_FWVERSION (string) firmware version
>+ ETHA_DRVINFO_BUSINFO (string) device bus address
>+ ETHA_DRVINFO_EROM_VER (string) expansion ROM version

These are already very nicely supported in devlink. No need to duplicate
here.