[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221027220013.24276-5-davthompson@nvidia.com>
Date: Thu, 27 Oct 2022 18:00:13 -0400
From: David Thompson <davthompson@...dia.com>
To: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <cai.huoqing@...ux.dev>, <brgl@...ev.pl>,
<limings@...dia.com>, David Thompson <davthompson@...dia.com>,
Asmaa Mnebhi <asmaa@...dia.com>
Subject: [PATCH net-next v1 4/4] mlxbf_gige: add BlueField-3 ethtool_ops
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@...dia.com>
Signed-off-by: Asmaa Mnebhi <asmaa@...dia.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
Powered by blists - more mailing lists