From: Chris Babroski <cbabroski@nvidia.com>
To: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <davthompson@nvidia.com>, <cbabroski@nvidia.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH net-next v1] mlxbf_gige: report unknown speed and duplex when link is down
Date: Wed, 13 Aug 2025 12:33:46 -0400 [thread overview]
Message-ID: <20250813163346.302186-1-cbabroski@nvidia.com> (raw)
The "Speed" and "Duplex" fields displayed by ethtool should report
"Unknown" when the link is down. Currently, the driver always reports
the initially configured link speed and duplex, regardless of the actual
link state.
Implement a get_link_ksettings() callback to update the values reported
to ethtool based on the link state. When the link is down, the driver
now reports unknown speed and duplex as expected.
Signed-off-by: Chris Babroski <cbabroski@nvidia.com>
---
.../mellanox/mlxbf_gige/mlxbf_gige_ethtool.c | 26 ++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
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 8b63968bbee9..c519eeb8ec48 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_ethtool.c
@@ -159,6 +159,30 @@ static void mlxbf_gige_get_pause_stats(struct net_device *netdev,
}
}
+static int mlxbf_gige_get_link_ksettings(struct net_device *ndev,
+ struct ethtool_link_ksettings *cmd)
+{
+ struct phy_device *phydev;
+ int ret;
+
+ ret = phy_ethtool_get_link_ksettings(ndev, cmd);
+ if (ret)
+ return ret;
+
+ phydev = ndev->phydev;
+ if (!phydev)
+ return -ENODEV;
+
+ mutex_lock(&phydev->lock);
+ if (!phydev->link) {
+ cmd->base.speed = SPEED_UNKNOWN;
+ cmd->base.duplex = DUPLEX_UNKNOWN;
+ }
+ mutex_unlock(&phydev->lock);
+
+ return 0;
+}
+
const struct ethtool_ops mlxbf_gige_ethtool_ops = {
.get_link = ethtool_op_get_link,
.get_ringparam = mlxbf_gige_get_ringparam,
@@ -170,6 +194,6 @@ const struct ethtool_ops mlxbf_gige_ethtool_ops = {
.nway_reset = phy_ethtool_nway_reset,
.get_pauseparam = mlxbf_gige_get_pauseparam,
.get_pause_stats = mlxbf_gige_get_pause_stats,
- .get_link_ksettings = phy_ethtool_get_link_ksettings,
+ .get_link_ksettings = mlxbf_gige_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings,
};
base-commit: d9104cec3e8fe4b458b74709853231385779001f
--
2.34.1
next reply other threads:[~2025-08-13 16:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 16:33 Chris Babroski [this message]
2025-08-15 19:11 ` Jakub Kicinski
2025-08-26 18:45 ` Chris Babroski
2025-10-13 15:17 ` Chris Babroski
2025-10-13 17:59 ` Jakub Kicinski
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=20250813163346.302186-1-cbabroski@nvidia.com \
--to=cbabroski@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=davthompson@nvidia.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®