[net-next,v3,1/5] mlxsw: minimal: fix mlxsw_m_module_get_drvinfo() to correctly report driver name
Message ID | 20221127130919.638324-2-mailhol.vincent@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5108377wrr; Sun, 27 Nov 2022 05:13:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf5XE6RgCkH90w5sB7KAw0CPyi47R9TGIwp0Y9PoOuY6BZJ1nrlgCFtzo1vqZBwvImCRam8e X-Received: by 2002:a17:90b:507:b0:213:971d:9022 with SMTP id r7-20020a17090b050700b00213971d9022mr50151928pjz.47.1669554811624; Sun, 27 Nov 2022 05:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669554811; cv=none; d=google.com; s=arc-20160816; b=mlGEVz/uKVuxveNd7m9dAcsb4Rrc/3vx9w+mOQAW2ClPZ6bLvUakRJR/lfBiQMo6g9 63JX3LZb5YOhS5UJiXB3S3F5z21+9SMUX4MFvv3iDSpwhy28+2AORq75H8e5VyPbhDzp 2Gr5euKKhtnZh59ghKZdxKq/5ACF2GKVUSGZc5HGbrtLaFleVnclk4T6FxWQ5iWGTbIT OfH/ssHlmmKhSB8XrR2mj2rEUMxrLf/Pmul3CEotodtWySg7D4+WTgMVLJf4E1v9wbfm 4dU7Tcnv2F51TF+fg6fxCRJglAMeG3YljkPta8NybSzntHFD0O07zNPGsbPiBLrEOZjw AgxQ== 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=0ZsXPiwPOVu7JihBSzIX9RMliHJg1zhwJcyiOwYn5LE=; b=hZ+ftsK3wLASopWgFQlWTTxGVVCmMBoBc3tYSkNiZC8cHWfcBDsrdgt0Iouex+5fhW ybBv49er85LYnAnrkbiiZbyS9sxRbExfVAr/P+dSgzHEkouUlydbDSCEhgC1oCC2iVP2 6Td1Pz3T1lSeLBl3WLTDd6U3fHJ30h4HGM3R6ZdyTzikaxB7alRMxAB88Ms+ASqdJ9hq KrcavYlnk4rmJK23C1TXSZtl5Vno237BnJAxjA0qz0GTH44ctJFpH1UvPMYFlxKnB92W XWRiYQFKCdzjap3BosxMS4jXrex0htlg2gsEACO6ZRHJHMhUYAdJfcA5z+Ec2IwPelnK zudQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KwJMKBZe; 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 g14-20020a65580e000000b004769246309dsi9694947pgr.501.2022.11.27.05.13.18; Sun, 27 Nov 2022 05:13:31 -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=KwJMKBZe; 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 S229436AbiK0NKJ (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 99 others); Sun, 27 Nov 2022 08:10:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbiK0NKE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 27 Nov 2022 08:10:04 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A120DDF6C; Sun, 27 Nov 2022 05:09:58 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id p12so7813352plq.4; Sun, 27 Nov 2022 05:09:58 -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=0ZsXPiwPOVu7JihBSzIX9RMliHJg1zhwJcyiOwYn5LE=; b=KwJMKBZedewWTw2AYgadSrDQJh5K2xX0zFcZDpqAsOMhznSyUoNmuTIG+/DMG+evxd SWjXdQyeXnwoGbQxFBekzMnAuZDeV5dSl6PwXdzNzkb45jJC+8K8j1myIffH6fmXqzE3 VD9cUWqGlAKdzpnDikGQXNMNPVdY1yUGugFJ++7CmRhP3fL1HlIZt/1ZEZ5ckPpLnUX4 6ilBV0dhoGa07b8xjMJF+WXsiYuOyZWIXmI7s1/BOHDSbh7Lg2QWkKv9LFnFFwnFVePN MTRBsE53vqKkTMGHNPRmiWsiVIugI8n+Gy9030V7S3QGpwQiMsjepWBhiYHOz2O8OfYb 65Hg== 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=0ZsXPiwPOVu7JihBSzIX9RMliHJg1zhwJcyiOwYn5LE=; b=CdgrDpMq7SkR/QDCQhTVEbuA8EfSsmla1748vtMyVk+oQLGGmy4YQIHec8pdyLFWCe LbAWy2phYLR2/1k3k5U3nCgEBsfTPArNVHLG7257sG+kM1+KTwqw3+EUXQWOE7AMLViz ijk8SCQ0S2Y1tOtBUPHMa+7JuO3FO4nqKjSP99RNY0xsfGT/Q9n7dIGMjrqOhHj972wm e8xUeDhm7fx+hQvpfmKvmyd32CZqRyp4Bhq+Zr2TWvhkgK5RQEgLtjjL0bSdR25U4VfJ EwiFnzVzfw+COcIeInEr3M8sqY452L1v0BmUuZct6/oOKaMo/iT0HzR9Oy3EYK1W9OAw AAvg== X-Gm-Message-State: ANoB5pnCQoY17Ko9VMYkdZl8AToa9rKPlkUZEE9T5mHOat8A2Pner/0u 5kkL1EOCkilJoP+L1jOQj38= X-Received: by 2002:a17:902:c946:b0:186:99e3:c079 with SMTP id i6-20020a170902c94600b0018699e3c079mr27225014pla.149.1669554597977; Sun, 27 Nov 2022 05:09:57 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id q17-20020a170902eb9100b00188a908cbddsm6710225plg.302.2022.11.27.05.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 05:09:57 -0800 (PST) Sender: Vincent Mailhol <vincent.mailhol@gmail.com> From: Vincent Mailhol <mailhol.vincent@wanadoo.fr> To: Jiri Pirko <jiri@nvidia.com>, netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org> Cc: "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, linux-kernel@vger.kernel.org, Boris Brezillon <bbrezillon@kernel.org>, Arnaud Ebalard <arno@natisbad.org>, Srujana Challa <schalla@marvell.com>, Kurt Kanzenbach <kurt@linutronix.de>, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, Michael Chan <michael.chan@broadcom.com>, Ioana Ciornei <ioana.ciornei@nxp.com>, Dimitris Michailidis <dmichail@fungible.com>, Yisen Zhuang <yisen.zhuang@huawei.com>, Salil Mehta <salil.mehta@huawei.com>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, Sunil Goutham <sgoutham@marvell.com>, Linu Cherian <lcherian@marvell.com>, Geetha sowjanya <gakula@marvell.com>, Jerin Jacob <jerinj@marvell.com>, hariprasad <hkelam@marvell.com>, Subbaraya Sundeep <sbhatta@marvell.com>, Taras Chornyi <tchornyi@marvell.com>, Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leon@kernel.org>, Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>, Simon Horman <simon.horman@corigine.com>, Shannon Nelson <snelson@pensando.io>, drivers@pensando.io, Ariel Elior <aelior@marvell.com>, Manish Chopra <manishc@marvell.com>, Jonathan Lemon <jonathan.lemon@gmail.com>, Vadim Fedorenko <vadfed@fb.com>, Richard Cochran <richardcochran@gmail.com>, Vadim Pasternak <vadimp@mellanox.com>, Shalom Toledo <shalomt@mellanox.com>, linux-crypto@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org, oss-drivers@corigine.com, Jiri Pirko <jiri@mellanox.com>, Herbert Xu <herbert@gondor.apana.org.au>, Hao Chen <chenhao288@hisilicon.com>, Guangbin Huang <huangguangbin2@huawei.com>, Minghao Chi <chi.minghao@zte.com.cn>, Shijith Thotton <sthotton@marvell.com>, Vincent Mailhol <mailhol.vincent@wanadoo.fr>, Ido Schimmel <idosch@mellanox.com> Subject: [PATCH net-next v3 1/5] mlxsw: minimal: fix mlxsw_m_module_get_drvinfo() to correctly report driver name Date: Sun, 27 Nov 2022 22:09:15 +0900 Message-Id: <20221127130919.638324-2-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221127130919.638324-1-mailhol.vincent@wanadoo.fr> References: <20221122154934.13937-1-mailhol.vincent@wanadoo.fr> <20221127130919.638324-1-mailhol.vincent@wanadoo.fr> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750636526891677544?= X-GMAIL-MSGID: =?utf-8?q?1750655105999232284?= |
Series |
net: devlink: return the driver name in devlink_nl_info_fill
|
|
Commit Message
Vincent Mailhol
Nov. 27, 2022, 1:09 p.m. UTC
Currently, mlxsw_m_module_get_drvinfo() reports the device_kind. The
device_kind is not necessarily the same as the device_name. For
example, the mlxsw_i2c implementation sets up the device_kind as
ic2_client::name in [1] which indicates the type of the device
(e.g. chip name), not the actual driver name.
Fix it so that it correctly reports the driver name.
[1] mlxsw_i2c_probe() from drivers/net/ethernet/mellanox/mlxsw/i2c.c
Link: https://elixir.bootlin.com/linux/v6.1-rc1/source/drivers/net/ethernet/mellanox/mlxsw/i2c.c#L714
Fixes: 9bbd7efbc055 ("mlxsw: i2c: Extend initialization with querying firmware info")
CC: Shalom Toledo <shalomt@mellanox.com>
CC: Ido Schimmel <idosch@mellanox.com>
CC: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/ethernet/mellanox/mlxsw/minimal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Sun, Nov 27, 2022 at 10:09:15PM +0900, Vincent Mailhol wrote: > Currently, mlxsw_m_module_get_drvinfo() reports the device_kind. The > device_kind is not necessarily the same as the device_name. For > example, the mlxsw_i2c implementation sets up the device_kind as > ic2_client::name in [1] which indicates the type of the device > (e.g. chip name), not the actual driver name. > > Fix it so that it correctly reports the driver name. > > [1] mlxsw_i2c_probe() from drivers/net/ethernet/mellanox/mlxsw/i2c.c > Link: https://elixir.bootlin.com/linux/v6.1-rc1/source/drivers/net/ethernet/mellanox/mlxsw/i2c.c#L714 Before the series: # ethtool -i eth2 | grep driver driver: mlxsw_minimal After the series: # ethtool -i eth2 | grep driver driver: mlxsw_minimal See: https://elixir.bootlin.com/linux/v6.1-rc1/source/drivers/net/ethernet/mellanox/mlxsw/minimal.c#L721 The current code is consistent with the PCI driver: https://elixir.bootlin.com/linux/v6.1-rc1/source/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c#L17 Which also correctly reports the driver name. So I prefer to keep the code as-is. Thanks > > Fixes: 9bbd7efbc055 ("mlxsw: i2c: Extend initialization with querying firmware info") > CC: Shalom Toledo <shalomt@mellanox.com> > CC: Ido Schimmel <idosch@mellanox.com> > CC: Vadim Pasternak <vadimp@mellanox.com> > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> > --- > drivers/net/ethernet/mellanox/mlxsw/minimal.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c > index 6b56eadd736e..9b37ddbe0cba 100644 > --- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c > +++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c > @@ -92,7 +92,7 @@ static void mlxsw_m_module_get_drvinfo(struct net_device *dev, > struct mlxsw_m_port *mlxsw_m_port = netdev_priv(dev); > struct mlxsw_m *mlxsw_m = mlxsw_m_port->mlxsw_m; > > - strscpy(drvinfo->driver, mlxsw_m->bus_info->device_kind, > + strscpy(drvinfo->driver, dev_driver_string(dev->dev.parent), > sizeof(drvinfo->driver)); > snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), > "%d.%d.%d", > -- > 2.37.4 >
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c index 6b56eadd736e..9b37ddbe0cba 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c @@ -92,7 +92,7 @@ static void mlxsw_m_module_get_drvinfo(struct net_device *dev, struct mlxsw_m_port *mlxsw_m_port = netdev_priv(dev); struct mlxsw_m *mlxsw_m = mlxsw_m_port->mlxsw_m; - strscpy(drvinfo->driver, mlxsw_m->bus_info->device_kind, + strscpy(drvinfo->driver, dev_driver_string(dev->dev.parent), sizeof(drvinfo->driver)); snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d",