netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phylink: don't try to stop halted PHY
@ 2022-12-01 17:53 Lucas Stach
  2022-12-01 18:09 ` Russell King (Oracle)
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2022-12-01 17:53 UTC (permalink / raw)
  To: Russell King, Andrew Lunn, Heiner Kallweit; +Cc: netdev, kernel, patchwork-lst

When the PHY driver has encountered a non-recoverable error condition, e.g
due to a failure in MDIO communication it may have already halted the PHY
by calling phy_error(). If that is the case then phylink should not try to
stop the PHY again.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/net/phy/phylink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 6547b6cc6cbe..1e2be9197567 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1935,7 +1935,7 @@ void phylink_stop(struct phylink *pl)
 
 	if (pl->sfp_bus)
 		sfp_upstream_stop(pl->sfp_bus);
-	if (pl->phydev)
+	if (pl->phydev && phy_is_started(pl->phydev))
 		phy_stop(pl->phydev);
 	del_timer_sync(&pl->link_poll);
 	if (pl->link_irq) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: phylink: don't try to stop halted PHY
  2022-12-01 17:53 [PATCH] net: phylink: don't try to stop halted PHY Lucas Stach
@ 2022-12-01 18:09 ` Russell King (Oracle)
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King (Oracle) @ 2022-12-01 18:09 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Andrew Lunn, Heiner Kallweit, netdev, kernel, patchwork-lst

On Thu, Dec 01, 2022 at 06:53:02PM +0100, Lucas Stach wrote:
> When the PHY driver has encountered a non-recoverable error condition, e.g
> due to a failure in MDIO communication it may have already halted the PHY
> by calling phy_error(). If that is the case then phylink should not try to
> stop the PHY again.

No. phylib doesn't say this is necessary, and if you grep the many
network drivers, they don't do such a test.

If we want to do this then obviously all network drivers need to be
updated to do the same test before calling phy_stop()... but it would
be better if phylib avoided being rather silly in this case.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-01 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01 17:53 [PATCH] net: phylink: don't try to stop halted PHY Lucas Stach
2022-12-01 18:09 ` Russell King (Oracle)

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).