[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250324135310.113824-1-o.rempel@pengutronix.de>
Date: Mon, 24 Mar 2025 14:53:10 +0100
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: Michal Kubecek <mkubecek@...e.cz>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>,
kernel@...gutronix.de,
netdev@...r.kernel.org
Subject: [PATCH ethtool v1 1/1] ethtool: fix incorrect MDI-X "Unknown" output for MDI mode
Add a missing case to handle the MDI mode correctly when showing the
current MDI/MDI-X status. Without this, the code may show "Unknown" even
when the status is valid. This regression was introduced in commit
bd1341cd2146 ("add json support for base command").
The logic assumed that `mdi_x = false` was already set at function start
and omitted the `case ETH_TP_MDI:` branch in the switch statement. However,
without an explicit `break`, the code continued into the default case,
resulting in "Unknown" being printed even when the mode was valid.
This patch adds a missing `case ETH_TP_MDI:` with an explicit `break` to
avoid falling into the default case. As a result, users will now correctly
see `MDI-X: off` instead of `Unknown` when the resolved state is MDI.
Fixes: bd1341cd2146 ("add json support for base command")
Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
---
common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/common.c b/common.c
index 4fda4b49d2fd..1ba27e7577b4 100644
--- a/common.c
+++ b/common.c
@@ -171,6 +171,8 @@ void dump_mdix(u8 mdix, u8 mdix_ctrl)
mdi_x_forced = true;
} else {
switch (mdix) {
+ case ETH_TP_MDI:
+ break;
case ETH_TP_MDI_X:
mdi_x = true;
break;
--
2.39.5
Powered by blists - more mailing lists