netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ethtool: doc: clarify what drivers can implement in their get_drvinfo()
@ 2022-11-11  3:08 Vincent Mailhol
  2022-11-11  6:40 ` [PATCH net-next v2] " Vincent Mailhol
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Vincent Mailhol @ 2022-11-11  3:08 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev
  Cc: Vincent Mailhol, Andrew Lunn, Oleksij Rempel, Dan Williams,
	Petr Machata, Hao Chen, Amit Cohen, Gustavo A. R. Silva,
	Sean Anderson, linux-kernel, Leon Romanovsky

Many of the drivers which implement ethtool_ops::get_drvinfo() will
prints the .driver, .version or .bus_info of struct ethtool_drvinfo.
To have a glance of current state, do:

  $ git grep -W "get_drvinfo(struct"

Printing in those three fields is useless because:

  - since [1], the driver version should be the kernel version (at
    least for upstream drivers). Arguably, out of tree drivers might
    still want to set it, but out of tree is not our focus.

  - since [2], the core is able to provide default values for .driver
    and .bus_info.

In summary, drivers may provide @fw_version and @erom_version, the
rest is expected to be done by the core. Update the doc to reflect the
facts.

Also update the dummy driver and simply remove the callback in order
not to confuse the newcomers: most of the drivers will not need this
callback function any more.

[1] commit 6a7e25c7fb48 ("net/core: Replace driver version to be
    kernel version")
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6a7e25c7fb482dba3e80fec953f1907bcb24d52c

[2] commit edaf5df22cb8 ("ethtool: ethtool_get_drvinfo: populate
    drvinfo fields even if callback exits")
Link: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=edaf5df22cb8e7e849773ce69fcc9bc20ca92160

CC: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
Arguably, dummy.c is code and not documentation, but for me, it makes
sense to treat it as documentation, thus I am putting everything in
one single patch.
---
 drivers/net/dummy.c          | 7 -------
 include/uapi/linux/ethtool.h | 6 +++---
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index aa0fc00faecb..c4b1b0aa438a 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -99,14 +99,7 @@ static const struct net_device_ops dummy_netdev_ops = {
 	.ndo_change_carrier	= dummy_change_carrier,
 };
 
-static void dummy_get_drvinfo(struct net_device *dev,
-			      struct ethtool_drvinfo *info)
-{
-	strscpy(info->driver, DRV_NAME, sizeof(info->driver));
-}
-
 static const struct ethtool_ops dummy_ethtool_ops = {
-	.get_drvinfo            = dummy_get_drvinfo,
 	.get_ts_info		= ethtool_op_get_ts_info,
 };
 
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index f341de2ae612..fcee5dbf6c06 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -180,9 +180,9 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
  * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
  * strings in any string set (from Linux 2.6.34).
  *
- * Drivers should set at most @driver, @version, @fw_version and
- * @bus_info in their get_drvinfo() implementation.  The ethtool
- * core fills in the other fields using other driver operations.
+ * Drivers should set at most @fw_version and @erom_version in their
+ * get_drvinfo() implementation. The ethtool core fills in the other
+ * fields using other driver operations.
  */
 struct ethtool_drvinfo {
 	__u32	cmd;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-11-18  4:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-11  3:08 [PATCH] ethtool: doc: clarify what drivers can implement in their get_drvinfo() Vincent Mailhol
2022-11-11  6:40 ` [PATCH net-next v2] " Vincent Mailhol
2022-11-13  7:58   ` Leon Romanovsky
2022-11-13  8:34 ` [PATCH net-next v3] " Vincent Mailhol
2022-11-15  5:27   ` Jakub Kicinski
2022-11-15  7:52     ` Vincent MAILHOL
2022-11-15 16:28       ` Jakub Kicinski
2022-11-16  0:30         ` Vincent MAILHOL
2022-11-16  4:34           ` Vincent MAILHOL
2022-11-16 17:18 ` [PATCH v5] " Vincent Mailhol
2022-11-18  4:50   ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).