netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Thompson <davthompson@nvidia.com>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <cai.huoqing@linux.dev>,
	<brgl@bgdev.pl>, <limings@nvidia.com>,
	David Thompson <davthompson@nvidia.com>,
	Asmaa Mnebhi <asmaa@nvidia.com>
Subject: [PATCH net-next v1 4/4] mlxbf_gige: add BlueField-3 ethtool_ops
Date: Thu, 27 Oct 2022 18:00:13 -0400	[thread overview]
Message-ID: <20221027220013.24276-5-davthompson@nvidia.com> (raw)
In-Reply-To: <20221027220013.24276-1-davthompson@nvidia.com>

This patch adds logic to support initialization of a
BlueField-3 specific "ethtool_ops" data structure. The
BlueField-3 data structure supports the "set_link_ksettings"
callback, while the BlueField-2 data structure does not.

Signed-off-by: David Thompson <davthompson@nvidia.com>
Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
---
 .../ethernet/mellanox/mlxbf_gige/mlxbf_gige.h    |  3 ++-
 .../mellanox/mlxbf_gige/mlxbf_gige_ethtool.c     | 16 +++++++++++++++-
 .../mellanox/mlxbf_gige/mlxbf_gige_main.c        |  4 +++-
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h
index e9bd09ee0b1f..cbabdac3ecb0 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h
@@ -200,7 +200,8 @@ struct sk_buff *mlxbf_gige_alloc_skb(struct mlxbf_gige *priv,
 int mlxbf_gige_request_irqs(struct mlxbf_gige *priv);
 void mlxbf_gige_free_irqs(struct mlxbf_gige *priv);
 int mlxbf_gige_poll(struct napi_struct *napi, int budget);
-extern const struct ethtool_ops mlxbf_gige_ethtool_ops;
+extern const struct ethtool_ops mlxbf_gige_bf2_ethtool_ops;
+extern const struct ethtool_ops mlxbf_gige_bf3_ethtool_ops;
 void mlxbf_gige_update_tx_wqe_next(struct mlxbf_gige *priv);
 
 #endif /* !defined(__MLXBF_GIGE_H__) */
diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_ethtool.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_ethtool.c
index 41ebef25a930..92c1c9e7f4cb 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_ethtool.c
@@ -124,7 +124,7 @@ static void mlxbf_gige_get_pauseparam(struct net_device *netdev,
 	pause->tx_pause = 1;
 }
 
-const struct ethtool_ops mlxbf_gige_ethtool_ops = {
+const struct ethtool_ops mlxbf_gige_bf2_ethtool_ops = {
 	.get_link		= ethtool_op_get_link,
 	.get_ringparam		= mlxbf_gige_get_ringparam,
 	.get_regs_len           = mlxbf_gige_get_regs_len,
@@ -136,3 +136,17 @@ const struct ethtool_ops mlxbf_gige_ethtool_ops = {
 	.get_pauseparam		= mlxbf_gige_get_pauseparam,
 	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
 };
+
+const struct ethtool_ops mlxbf_gige_bf3_ethtool_ops = {
+	.get_link		= ethtool_op_get_link,
+	.get_ringparam		= mlxbf_gige_get_ringparam,
+	.get_regs_len           = mlxbf_gige_get_regs_len,
+	.get_regs               = mlxbf_gige_get_regs,
+	.get_strings            = mlxbf_gige_get_strings,
+	.get_sset_count         = mlxbf_gige_get_sset_count,
+	.get_ethtool_stats      = mlxbf_gige_get_ethtool_stats,
+	.nway_reset		= phy_ethtool_nway_reset,
+	.get_pauseparam		= mlxbf_gige_get_pauseparam,
+	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
+	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
+};
diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
index 16a404a49d28..77dea6564e65 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
@@ -436,7 +436,6 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
 
 	SET_NETDEV_DEV(netdev, &pdev->dev);
 	netdev->netdev_ops = &mlxbf_gige_netdev_ops;
-	netdev->ethtool_ops = &mlxbf_gige_ethtool_ops;
 	priv = netdev_priv(netdev);
 	priv->netdev = netdev;
 
@@ -453,9 +452,12 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
 	priv->hw_version = soc_version;
 
 	if (priv->hw_version == MLXBF_GIGE_VERSION_BF3) {
+		netdev->ethtool_ops = &mlxbf_gige_bf3_ethtool_ops;
 		err = mlxbf_gige_config_uphy(priv);
 		if (err)
 			return err;
+	} else {
+		netdev->ethtool_ops = &mlxbf_gige_bf2_ethtool_ops;
 	}
 
 	/* Attach MDIO device */
-- 
2.30.1


  parent reply	other threads:[~2022-10-27 22:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 22:00 [PATCH net-next v1 0/4] mlxbf_gige: add BlueField-3 support David Thompson
2022-10-27 22:00 ` [PATCH net-next v1 1/4] mlxbf_gige: add MDIO support for BlueField-3 David Thompson
2022-10-27 22:00 ` [PATCH net-next v1 2/4] mlxbf_gige: support 10M/100M/1G speeds on BlueField-3 David Thompson
2022-10-27 23:14   ` Andrew Lunn
2022-10-27 22:00 ` [PATCH net-next v1 3/4] mlxbf_gige: add BlueField-3 Serdes configuration David Thompson
2022-10-27 23:25   ` Andrew Lunn
2022-10-28 15:08     ` Asmaa Mnebhi
2022-10-27 22:00 ` David Thompson [this message]
2022-10-27 23:29   ` [PATCH net-next v1 4/4] mlxbf_gige: add BlueField-3 ethtool_ops Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221027220013.24276-5-davthompson@nvidia.com \
    --to=davthompson@nvidia.com \
    --cc=asmaa@nvidia.com \
    --cc=brgl@bgdev.pl \
    --cc=cai.huoqing@linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=limings@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).