net: phy: dp83tg720: switch to adaptive polling and remove random delays
authorDavid Jander <david@protonic.nl>
Thu, 12 Jun 2025 10:41:57 +0000 (12:41 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Jun 2025 01:09:47 +0000 (18:09 -0700)
commitcc8aeb0f535f3214c2aad13a384e93a55db15569
tree09953cae1fc89a833ae1c61ddb77abc63069ff8f
parent491e991f781611c7977a69a1e243fc56cef61e3c
net: phy: dp83tg720: switch to adaptive polling and remove random delays

Now that the PHY reset logic includes a role-specific asymmetric delay
to avoid synchronized reset deadlocks, the previously used randomized
polling intervals are no longer necessary.

This patch removes the get_random_u32_below()-based logic and introduces
an adaptive polling strategy:
- Fast polling for a short time after link-down
- Slow polling if the link remains down
- Slower polling when the link is up

This balances CPU usage and responsiveness while avoiding reset
collisions. Additionally, the driver still relies on polling for
all link state changes, as interrupt support is not implemented,
and link-up events are not reliably signaled by the PHY.

The polling parameters are now documented in the updated top-of-file
comment.

Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250612104157.2262058-4-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/dp83tg720.c