Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7641150rwb; Tue, 15 Nov 2022 15:41:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6rLSd03ZTJR0NloHpA42XSzAHskOVZhunJ8Mkt7l6OO4oCh6NEoUKxF+9GypR6c6hHOuxD X-Received: by 2002:a05:6402:1a53:b0:463:bef9:b64a with SMTP id bf19-20020a0564021a5300b00463bef9b64amr17223917edb.422.1668555680776; Tue, 15 Nov 2022 15:41:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668555680; cv=none; d=google.com; s=arc-20160816; b=yE4l6+W5gM/ZkM+RpcSSJaEj/qHF0IFxKJ+iiSP8OVCrix8kZnDzBAJpAReb+LYwz8 zpKxB/KYRmKZQTJPEpe6OVMYk4h2HOFVNNIcUREX9kV4s2QoNDUoQOfQlMJzH9fCSSSA i1Zx6I4MIOs/KNxUEme7PNOsuwUiP/fEqarKOM0MbcqnFQnax9SjyRm6eBwfk5qK6vaO iwS/0cm1MSNSBy7t8Z9V7rXT1slDB9eZluhvueUhSNAc19Gl/UJw73kKgyxROndTNubd IOhd/c9YjusTUfQI7s2ix4g2A+iT2t6htWz7Beh6oyS0V+3cKUOpUP7SvOXUNGcMh1I0 lNOg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=PXT6t4V5rZmP6BoieWbc03yVr+oSUgcqfVfJ/T8w1cI=; b=hJbSQSZEMYb32HWBZokqpKpbxC0xibGgSd6knUT6SRGsQudnNgVo7+aOcOvt0JDON7 0xZHeELZLwN/lHc36pYZMBvk/3HnJl0F0aOlXJ/+x7wo7eF2V6vJ/8jbMpIavBIQSltU Q+4KPwAVVsDQay9twKcpbYebjTJB3IAyP2SkK4cU/Ve6UFsCglTRQ+DYJ8X99pdWvS32 2KAg8QqkHKE6MCX6z8fBpE5bwl1A2Rdn4LV7YFiUYRwABfKDDhR2XqRVFMbamKgNrO1h aphSZV4K6DOMh7sdlkwX0KD5gyzA8rP89Ts3AbmNLqoCJcv8G6ulWHoZDBbJn8gj1QSU UT2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hmz4b2Jl; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc41-20020a1709071c2900b007878c9d73a2si11231988ejc.426.2022.11.15.15.40.59; Tue, 15 Nov 2022 15:41:20 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hmz4b2Jl; 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 S230223AbiKOXfd (ORCPT + 90 others); Tue, 15 Nov 2022 18:35:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbiKOXfc (ORCPT ); Tue, 15 Nov 2022 18:35:32 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B1D325E94; Tue, 15 Nov 2022 15:35:31 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id l2so14821063pld.13; Tue, 15 Nov 2022 15:35:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=PXT6t4V5rZmP6BoieWbc03yVr+oSUgcqfVfJ/T8w1cI=; b=hmz4b2JlE/NJbO7xVmWS7MVl8kMleGGd+w6QCKLC/ZHYBkqJa2ed60T8w48IrERv9/ 0ktfpsNSNDFXO+ntj+cW5URJ/0Y32oliZg+d1VEEWPIbE4xTgjyDv3PsVV1A/GTyE/NM lOuEkYxQvumP34JIMsqLvCck/jcz3DYxhc3DCDll0D6LZnKk14i5mtOcyVH3Wu+Ncmn8 H2W3wjwTJAzES3FNF5IiL/EoUiWJFHMdQwl+FAF1SK653f5HGsC/845b80/209nlok7g 9k+X/pKTuBauSd9LOUGcn9MbXl50dg6hU/ES7eCWsgLQ6W4zvnMSznqFgJB0KZf4yBb7 Gi1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PXT6t4V5rZmP6BoieWbc03yVr+oSUgcqfVfJ/T8w1cI=; b=siuPcwVREj90ck/Hhex19wH4lO6UElAnLz+BhXK6Gje/OEjyYZM54rQZ2CgLphy+h3 wpwb5SoIMsTTBZms9da8qu/9D3BKlFVMGk7ozAyHLI58yHhwtLDuJc97/0074naGQEXw hJqCX+1Rs28eEaDpOXIAnr3xf5BVu8ONoHm37Scjae9WCK8PoiHTYzq9r1InEmGHApxJ sN7eFDwG7Y1lDTY3+gPdH3BFrIppvdyvvBHt0792jh7LIcKdGdxy4hhqj9JFLfGRlHzd BHiJstxrng45vItzXxt22MyCdhnmxAfuxvFP8uPHX28QOYu/iHdrng1MdGJ7uREwNVVs ViAg== X-Gm-Message-State: ANoB5pmxSI8T0IgTZeYVLX/5OIGlkyBSUr3if27GmJ7GcQjhlK3cj72o YGxi30OHUnDquP74+S6pbSg= X-Received: by 2002:a17:90a:6508:b0:213:3918:f2a2 with SMTP id i8-20020a17090a650800b002133918f2a2mr695024pjj.218.1668555330639; Tue, 15 Nov 2022 15:35:30 -0800 (PST) Received: from XH22050090-L.ad.ts.tri-ad.global ([103.175.111.222]) by smtp.gmail.com with ESMTPSA id k4-20020a170902c40400b00186a68ec086sm10555362plk.193.2022.11.15.15.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 15:35:30 -0800 (PST) Sender: Vincent Mailhol 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 net-next v4] ethtool: doc: clarify what drivers can implement in their get_drvinfo() Date: Wed, 16 Nov 2022 08:35:24 +0900 Message-Id: <20221115233524.805956-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.25.1 In-Reply-To: 20221111030838.1059-1-mailhol.vincent@wanadoo.fr References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no 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 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 a custom version, 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 and discourage developers from implementing the get_drvinfo() callback. 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/torvalds/linux/c/6a7e25c7fb48 [2] commit edaf5df22cb8 ("ethtool: ethtool_get_drvinfo: populate drvinfo fields even if callback exits") Link: https://git.kernel.org/netdev/net-next/c/edaf5df22cb8 Reviewed-by: Leon Romanovsky Signed-off-by: Vincent Mailhol --- * Changelog * v3 -> v4: * rephrasing of the documentation according to Jakub's comments. v2 -> v3: * add Reviewed-by: Leon Romanovsky tag. * use shorter links. v1 -> v2: * forgot the net-next prefix in the patch subject... Sorry for the noise. --- drivers/net/dummy.c | 7 ------- include/uapi/linux/ethtool.h | 12 +++++++----- 2 files changed, 7 insertions(+), 12 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 dc2aa3d75b39..e801bd4bd6c7 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -159,8 +159,10 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) * in its bus driver structure (e.g. pci_driver::name). Must * not be an empty string. * @version: Driver version string; may be an empty string - * @fw_version: Firmware version string; may be an empty string - * @erom_version: Expansion ROM version string; may be an empty string + * @fw_version: Firmware version string; driver defined; may be an + * empty string + * @erom_version: Expansion ROM version string; driver defined; may be + * an empty string * @bus_info: Device bus address. This should match the dev_name() * string for the underlying bus device, if there is one. May be * an empty string. @@ -180,9 +182,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. + * Modern drivers no longer have to implement the get_drvinfo() + * callback. Most fields are correctly filled in by the core using + * system information, or populated using other driver operations. */ struct ethtool_drvinfo { __u32 cmd; -- 2.25.1