From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1] phy: avoid adjust_link call if link remains down
Date: Wed, 29 May 2024 07:03:40 +0200 [thread overview]
Message-ID: <20240529050340.3227789-1-o.rempel@pengutronix.de> (raw)
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
next reply other threads:[~2024-05-29 5:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 5:03 Oleksij Rempel [this message]
2024-05-29 6:22 ` Sascha Hauer
2024-05-29 6:24 ` Sascha Hauer
2024-05-29 6:54 ` Oleksij Rempel
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=20240529050340.3227789-1-o.rempel@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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