* [PATCH v1] phy: avoid adjust_link call if link remains down
@ 2024-05-29 5:03 Oleksij Rempel
2024-05-29 6:22 ` Sascha Hauer
2024-05-29 6:24 ` Sascha Hauer
0 siblings, 2 replies; 4+ messages in thread
From: Oleksij Rempel @ 2024-05-29 5:03 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
Add a check in phy_update_status to skip calling adjust_link when the
link status remains down. This prevents unnecessary adjust_link calls
for PHYs that may change speed and duplex status bits before confirming
link establishment. This issue was observed during debugging a switch
driver, where a PHY took about 6 seconds to establish a link, causing
multiple adjust_link calls.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/phy/phy.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index abd78b2c80..39a48e1519 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -62,6 +62,9 @@ int phy_update_status(struct phy_device *phydev)
phydev->link == oldlink)
return 0;
+ if (!phydev->link && phydev->link == oldlink)
+ return 0;
+
if (phydev->adjust_link)
phydev->adjust_link(edev);
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] phy: avoid adjust_link call if link remains down
2024-05-29 5:03 [PATCH v1] phy: avoid adjust_link call if link remains down Oleksij Rempel
@ 2024-05-29 6:22 ` Sascha Hauer
2024-05-29 6:24 ` Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-05-29 6:22 UTC (permalink / raw)
To: barebox, Oleksij Rempel
On Wed, 29 May 2024 07:03:40 +0200, Oleksij Rempel wrote:
> Add a check in phy_update_status to skip calling adjust_link when the
> link status remains down. This prevents unnecessary adjust_link calls
> for PHYs that may change speed and duplex status bits before confirming
> link establishment. This issue was observed during debugging a switch
> driver, where a PHY took about 6 seconds to establish a link, causing
> multiple adjust_link calls.
>
> [...]
Applied, thanks!
[1/1] phy: avoid adjust_link call if link remains down
https://git.pengutronix.de/cgit/barebox/commit/?id=1851e95fcb68 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] phy: avoid adjust_link call if link remains down
2024-05-29 5:03 [PATCH v1] phy: avoid adjust_link call if link remains down Oleksij Rempel
2024-05-29 6:22 ` Sascha Hauer
@ 2024-05-29 6:24 ` Sascha Hauer
2024-05-29 6:54 ` Oleksij Rempel
1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2024-05-29 6:24 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
On Wed, May 29, 2024 at 07:03:40AM +0200, Oleksij Rempel wrote:
> Add a check in phy_update_status to skip calling adjust_link when the
> link status remains down. This prevents unnecessary adjust_link calls
> for PHYs that may change speed and duplex status bits before confirming
> link establishment. This issue was observed during debugging a switch
> driver, where a PHY took about 6 seconds to establish a link, causing
> multiple adjust_link calls.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/phy/phy.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index abd78b2c80..39a48e1519 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -62,6 +62,9 @@ int phy_update_status(struct phy_device *phydev)
> phydev->link == oldlink)
> return 0;
>
> + if (!phydev->link && phydev->link == oldlink)
> + return 0;
I've changed the check to (!phydev->link && !oldlink) which is a bit
easier to read.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] phy: avoid adjust_link call if link remains down
2024-05-29 6:24 ` Sascha Hauer
@ 2024-05-29 6:54 ` Oleksij Rempel
0 siblings, 0 replies; 4+ messages in thread
From: Oleksij Rempel @ 2024-05-29 6:54 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On Wed, May 29, 2024 at 08:24:21AM +0200, Sascha Hauer wrote:
> > + if (!phydev->link && phydev->link == oldlink)
> > + return 0;
>
> I've changed the check to (!phydev->link && !oldlink) which is a bit
> easier to read.
Thank you! :)
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-29 6:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-29 5:03 [PATCH v1] phy: avoid adjust_link call if link remains down Oleksij Rempel
2024-05-29 6:22 ` Sascha Hauer
2024-05-29 6:24 ` Sascha Hauer
2024-05-29 6:54 ` Oleksij Rempel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox