netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: Ensure the state machine is called when phy is UP
@ 2016-04-15 19:56 Alexandre Belloni
  2016-04-15 20:10 ` Florian Fainelli
  0 siblings, 1 reply; 15+ messages in thread
From: Alexandre Belloni @ 2016-04-15 19:56 UTC (permalink / raw)
  To: Florian Fainelli, David S . Miller
  Cc: Nicolas Ferre, netdev, linux-kernel, Alexandre Belloni

Commit d5c3d84657db ("net: phy: Avoid polling PHY with
PHY_IGNORE_INTERRUPTS") removed the last polling done on the phy. Since
then, the last actual poll done on the phy happens PHY_STATE_TIME seconds
(that is actually one second) after registering the phy. If the interface
is not UP by that time, any previous IRQ indicating the link is up is
ignored. Moreover, nothing will start the autonegociation so the phy will
simply change from READY to UP and never actually go to RUNNING.

The one second delay explains why the issue is not seen when booting from
NFS or when the interface is configured at boot time.

To solve that, ensure the state machine is called as soon as the state
changes from READY to UP.

Fixes: d5c3d84657db ("net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS")
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 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 5590b9c182c9..25f6bfd1c8fd 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -787,6 +787,9 @@ void phy_start(struct phy_device *phydev)
 		break;
 	case PHY_READY:
 		phydev->state = PHY_UP;
+		cancel_delayed_work_sync(&phydev->state_queue);
+		queue_delayed_work(system_power_efficient_wq,
+				   &phydev->state_queue, 0);
 		break;
 	case PHY_HALTED:
 		/* make sure interrupts are re-enabled for the PHY */
-- 
2.8.0.rc3

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

end of thread, other threads:[~2016-09-19 13:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CALnQHM0edN=40GHHwRrOMkQEMsHk2haRoj21bwD2ySfYoLGVvA@mail.gmail.com>
2016-05-17 23:35 ` [PATCH] net: phy: Ensure the state machine is called when phy is UP David Mosberger
2016-05-19 16:31   ` Alexandre Belloni
2016-05-19 17:17     ` David Mosberger
2016-04-15 19:56 Alexandre Belloni
2016-04-15 20:10 ` Florian Fainelli
2016-04-15 20:56   ` Alexandre Belloni
2016-04-15 22:05     ` Andrew Lunn
2016-04-15 22:17       ` Alexandre Belloni
2016-04-15 22:23         ` Florian Fainelli
2016-04-18 22:14           ` Alexandre Belloni
2016-04-18 22:17             ` Florian Fainelli
2016-04-18 22:42               ` Alexandre Belloni
2016-04-15 22:30         ` Andrew Lunn
2016-04-15 22:45           ` Alexandre Belloni
2016-09-19 13:15             ` Nicolas Ferre

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