Skip to contentSkip to conversation

amd-xgbe: Avoid spurious link down messages during interface toggle

PATCH Applied Raju Rangoju 4 participants 5 messages Oct 10, 2025 – Oct 14, 2025

Subsystems (3)
lore
Share & tools
lore

Raju Rangoju

author maintainer
#0 lore raw

PATCH 1/1 amd-xgbe: Avoid spurious link down messages during interface toggle

During interface toggle operations (ifdown/ifup), the driver currently resets the local helper variable 'phy_link' to -1. This causes the link state machine to incorrectly interpret the state as a link change event, resulting in spurious "Link is down" messages being logged when the interface is brought back up.

Preserve the phy_link state across interface toggles to avoid treating the -1 sentinel value as a legitimate link state transition.

Fixes 88131a812b16 ("amd-xgbe: Perform phy connect/disconnect at dev open/stop")
---
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c  | 1 -
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +0 -1
index f0989aa01855..4dc631af7933 100644
@@ -1080,7 +1080,6 @@ static void xgbe_free_rx_data(struct xgbe_prv_data *pdata)
 
 static int xgbe_phy_reset(struct xgbe_prv_data *pdata)
 {
-	pdata->phy_link = -1;
 	pdata->phy_speed = SPEED_UNKNOWN;
 
 	return pdata->phy_if.phy_reset(pdata);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +1 -0
index 1a37ec45e650..7675bb98f029 100644
@@ -1555,6 +1555,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)
 		pdata->phy.duplex = DUPLEX_FULL;
 	}
 
+	pdata->phy_link = 0;
 	pdata->phy.link = 0;
 
 	pdata->phy.pause_autoneg = pdata->pause_autoneg;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Raju Rangoju

During interface toggle operations (ifdown/ifup), the driver currently resets the local helper variable 'phy_link' to -1. This causes the link state machine to incorrectly interpret the state as a link change event, resulting in spurious "Link is down" messages being logged when the interface is brought back up.

Preserve the phy_link state across interface toggles to avoid treating the -1 sentinel value as a legitimate link state transition.

Fixes 88131a812b16 ("amd-xgbe: Perform phy connect/disconnect at dev open/stop")
Quoted 22 lines
---
  drivers/net/ethernet/amd/xgbe/xgbe-drv.c  | 1 -
  drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1 +
  2 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +0 -1
index f0989aa01855..4dc631af7933 100644
@@ -1080,7 +1080,6 @@ static void xgbe_free_rx_data(struct xgbe_prv_data *pdata)
 
  static int xgbe_phy_reset(struct xgbe_prv_data *pdata)
  {
-	pdata->phy_link = -1;
  	pdata->phy_speed = SPEED_UNKNOWN;
 
  	return pdata->phy_if.phy_reset(pdata);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +0 -0
index 1a37ec45e650..7675bb98f029 100644

drivers/net/ethernet/amd/xgbe/xgbe-mdio.c static int xgbe_phy_init(struct xgbe_prv_data *pdata) · line 1559

Quoted 5 lines
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +1 -0
@@ -1555,6 +1555,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)
  		pdata->phy.duplex = DUPLEX_FULL;
  	}
 
+	pdata->phy_link = 0;
  	pdata->phy.link = 0;

Took me a sec to spot the difference between the two :)

Quoted 2 lines
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +0 -0
  	pdata->phy.pause_autoneg = pdata->pause_autoneg;
#2 lore raw
In reply to Raju Rangoju
Quoted 10 lines · Raju Rangoju

During interface toggle operations (ifdown/ifup), the driver currently resets the local helper variable 'phy_link' to -1. This causes the link state machine to incorrectly interpret the state as a link change event, resulting in spurious "Link is down" messages being logged when the interface is brought back up.

Preserve the phy_link state across interface toggles to avoid treating the -1 sentinel value as a legitimate link state transition.

Fixes 88131a812b16 ("amd-xgbe: Perform phy connect/disconnect at dev open/stop")

Did this always happen, that is, did this behavior exist before the recent changes to detect short drops in the phy link status? If it didn't exist prior to those changes, then the Fixes: needs to be against that recent change, possibly limiting the amount of backporting required into stable kernels.

Thanks,
Tom

Quoted 30 lines
---
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c  | 1 -
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +0 -1
index f0989aa01855..4dc631af7933 100644
@@ -1080,7 +1080,6 @@ static void xgbe_free_rx_data(struct xgbe_prv_data *pdata)
 
 static int xgbe_phy_reset(struct xgbe_prv_data *pdata)
 {
-	pdata->phy_link = -1;
 	pdata->phy_speed = SPEED_UNKNOWN;
 
 	return pdata->phy_if.phy_reset(pdata);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +1 -0
index 1a37ec45e650..7675bb98f029 100644
@@ -1555,6 +1555,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)
 		pdata->phy.duplex = DUPLEX_FULL;
 	}
 
+	pdata->phy_link = 0;
 	pdata->phy.link = 0;
 
 	pdata->phy.pause_autoneg = pdata->pause_autoneg;
author maintainer
#3 lore raw
Quoted 7 lines · Tom Lendacky
Quoted 6 lines · Raju Rangoju

During interface toggle operations (ifdown/ifup), the driver currently resets the local helper variable 'phy_link' to -1. This causes the link state machine to incorrectly interpret the state as a link change event, resulting in spurious "Link is down" messages being logged when the interface is brought back up.

Quoted 7 lines
Quoted 4 lines

Preserve the phy_link state across interface toggles to avoid treating the -1 sentinel value as a legitimate link state transition.

Fixes 88131a812b16 ("amd-xgbe: Perform phy connect/disconnect at dev open/stop")

Did this always happen, that is, did this behavior exist before the recent changes to detect short drops in the phy link status?

Yes, this behavior exist before the recent changes to detect short drops.

Quoted 39 lines

If it didn't exist
prior to those changes, then the Fixes: needs to be against that recent change, possibly limiting the amount of backporting required into stable kernels.

Thanks,
Tom

Quoted 30 lines
---
  drivers/net/ethernet/amd/xgbe/xgbe-drv.c  | 1 -
  drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1 +
  2 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +0 -1
index f0989aa01855..4dc631af7933 100644
@@ -1080,7 +1080,6 @@ static void xgbe_free_rx_data(struct xgbe_prv_data *pdata)
 
  static int xgbe_phy_reset(struct xgbe_prv_data *pdata)
  {
-	pdata->phy_link = -1;
  	pdata->phy_speed = SPEED_UNKNOWN;
 
  	return pdata->phy_if.phy_reset(pdata);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +1 -0
index 1a37ec45e650..7675bb98f029 100644
@@ -1555,6 +1555,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)
  		pdata->phy.duplex = DUPLEX_FULL;
  	}
 
+	pdata->phy_link = 0;
  	pdata->phy.link = 0;
 
  	pdata->phy.pause_autoneg = pdata->pause_autoneg;
#4 lore raw
In reply to Raju Rangoju
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 10 lines · On Fri, 10 Oct 2025 12:21:42 +0530 you wrote:

During interface toggle operations (ifdown/ifup), the driver currently resets the local helper variable 'phy_link' to -1. This causes the link state machine to incorrectly interpret the state as a link change event, resulting in spurious "Link is down" messages being logged when the interface is brought back up.

Preserve the phy_link state across interface toggles to avoid treating the -1 sentinel value as a legitimate link state transition.

[...]

Here is the summary with links:
- [net] amd-xgbe: Avoid spurious link down messages during interface toggle

    https://git.kernel.org/netdev/net/c/2616222e4233

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html