Re: [PATCH net-next v5 13/22] ethtool: provide driver/device information in GET_INFO request
From: Jiri Pirko <jiri@resnulli.us>
Date: 2019-03-27 20:14:18
Also in:
lkml
Mon, Mar 25, 2019 at 06:08:33PM CET, mkubecek@suse.cz wrote:
quoted hunk ↗ jump to hunk
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 <redacted> --- 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.cdiff --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 onlyAll 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, notthe 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.