From patchwork Fri Nov 11 03:08:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Mailhol X-Patchwork-Id: 18404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp513470wru; Thu, 10 Nov 2022 19:19:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5/aa+zSeJ/5UcMIOuc88Q0SZk3AOaFkdxORqO81+UieFh8j3eX7o/9mmPQa/CNeI3GVGSS X-Received: by 2002:a62:6dc4:0:b0:56b:c616:287 with SMTP id i187-20020a626dc4000000b0056bc6160287mr563390pfc.73.1668136796077; Thu, 10 Nov 2022 19:19:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136796; cv=none; d=google.com; s=arc-20160816; b=PIgl7A2UM8jhqDAPmX/VLIyIhdn3csWkLv+Rb2n7B8ZRWUVbxAUMO3E/4XubyEgJPP 7zrjM88xy71f1rB1JZVw/uVR6B/voJKWMJ65bfgP7nP1uHPphjKPUnguKjPZai5hlplE 1TQA65gjPhhJ1oxa5+kr/XEdZNDHIAQnCYQAen8byfZMVOovMfSlybJp4HERmGOyiGEe vYZjB9oOrXhPOMDPhJgaV3i401PQkYkSqIGWSFU2vEI3/9sxQb83k9dkpSco/Zj6k9S2 0DmA7iqR835Hf+RH6TiZc0B1nGDDzgk0TDsQvVIgIMaYcU0ClzMMLgtXxUYr206jLFax STfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=sOu5blumveKMHWp1ZyY7od+T/4KT3ocqWbnu0pzAP3M=; b=jcD9gm12HmzA0yD6ZDoS/82gmP7QhQGXc+kc8RYTi1pQbCmt9V/aO4gbYg5QrSHOPu uP8JDa2RJeMJXpDkWBNgWIRDkhsuGUZ27rQnXkpOGWDIQD+ZxzbxyHMoC7vZ8UDmmQpK nQzE2oW8rjLIX/1iiunUJWT0vaCo2Q9xT9sz3DMtQslZRb68scoIVlNDdTDw7nXt+Wyb x8pywbRiB5jXBBRX/mCMbxYHnX667xzA7pVF1u1absqjl4+iHexgvwd4IhsToFu6v/0p GwuAMJMqLBf4cimKrq8NF0EPGzBvacoNm9KRj6pKShmmt0w4w0zuYnJTHJ5G5EJgQRYC 2fCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a631c43000000b004704b5453cbsi1045428pgm.557.2022.11.10.19.19.42; Thu, 10 Nov 2022 19:19:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbiKKDRE (ORCPT + 99 others); Thu, 10 Nov 2022 22:17:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232537AbiKKDRB (ORCPT ); Thu, 10 Nov 2022 22:17:01 -0500 X-Greylist: delayed 450 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 10 Nov 2022 19:16:57 PST Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1CA449B45 for ; Thu, 10 Nov 2022 19:16:57 -0800 (PST) Received: from YC20090004.ad.ts.tri-ad.global ([103.175.111.222]) by smtp.orange.fr with ESMTPA id tKPJoXPuTUoLVtKPpodQWK; Fri, 11 Nov 2022 04:09:25 +0100 X-ME-Helo: YC20090004.ad.ts.tri-ad.global X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Fri, 11 Nov 2022 04:09:25 +0100 X-ME-IP: 103.175.111.222 From: Vincent Mailhol To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Vincent Mailhol , Andrew Lunn , Oleksij Rempel , Dan Williams , Petr Machata , Hao Chen , Amit Cohen , "Gustavo A. R. Silva" , Sean Anderson , linux-kernel@vger.kernel.org, Leon Romanovsky Subject: [PATCH] ethtool: doc: clarify what drivers can implement in their get_drvinfo() Date: Fri, 11 Nov 2022 12:08:38 +0900 Message-Id: <20221111030838.1059-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749168208676495794?= X-GMAIL-MSGID: =?utf-8?q?1749168208676495794?= 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 Signed-off-by: Vincent Mailhol --- 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;