From: Andrew Lunn <andrew@lunn.ch> Date: 2016-09-28 08:33:52
The phy_start() is used to indicate the PHY is now ready to do its
work. The state is changed, normally to PHY_UP which means that both
the MAC and the PHY are ready.
If the phy driver is using polling, when the next poll happens, the
state machine notices the PHY is now in PHY_UP, and kicks off
auto-negotiation, if needed.
If however, the PHY is using interrupts, there is no polling. The phy
is stuck in PHY_UP until the next interrupt comes along. And there is
no reason for the PHY to interrupt.
Have phy_start() schedule the state machine to run, which both speeds
up the polling use case, and makes the interrupt use case actually
work.
This problems exists whenever there is a state change which will not
cause an interrupt. Trigger the state machine in these cases,
e.g. phy_error().
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/phy.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
@@ -785,8 +802,7 @@ void phy_change(struct phy_device *phydev)}/* reschedule state queue work to run as soon as possible */-cancel_delayed_work_sync(&phydev->state_queue);-queue_delayed_work(system_power_efficient_wq,&phydev->state_queue,0);+phy_trigger_machine(phydev);return;ignore:
@@ -875,6 +891,8 @@ void phy_start(struct phy_device *phydev)/* if phy was suspended, bring the physical link up again */if(do_resume)phy_resume(phydev);++phy_trigger_machine(phydev);}EXPORT_SYMBOL(phy_start);
The phy_start() is used to indicate the PHY is now ready to do its
work. The state is changed, normally to PHY_UP which means that both
the MAC and the PHY are ready.
If the phy driver is using polling, when the next poll happens, the
state machine notices the PHY is now in PHY_UP, and kicks off
auto-negotiation, if needed.
If however, the PHY is using interrupts, there is no polling. The phy
is stuck in PHY_UP until the next interrupt comes along. And there is
no reason for the PHY to interrupt.
Have phy_start() schedule the state machine to run, which both speeds
up the polling use case, and makes the interrupt use case actually
work.
This problems exists whenever there is a state change which will not
cause an interrupt. Trigger the state machine in these cases,
e.g. phy_error().
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
@@ -785,8 +802,7 @@ void phy_change(struct phy_device *phydev)}/* reschedule state queue work to run as soon as possible */-cancel_delayed_work_sync(&phydev->state_queue);-queue_delayed_work(system_power_efficient_wq,&phydev->state_queue,0);+phy_trigger_machine(phydev);return;ignore:
@@ -875,6 +891,8 @@ void phy_start(struct phy_device *phydev)/* if phy was suspended, bring the physical link up again */if(do_resume)phy_resume(phydev);++phy_trigger_machine(phydev);}EXPORT_SYMBOL(phy_start);
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-09-29 07:08:45
On Wed, Sep 28, 2016 at 02:31:54PM -0700, Florian Fainelli wrote:
On 09/28/2016 01:32 AM, Andrew Lunn wrote:
quoted
The phy_start() is used to indicate the PHY is now ready to do its
work. The state is changed, normally to PHY_UP which means that both
the MAC and the PHY are ready.
If the phy driver is using polling, when the next poll happens, the
state machine notices the PHY is now in PHY_UP, and kicks off
auto-negotiation, if needed.
If however, the PHY is using interrupts, there is no polling. The phy
is stuck in PHY_UP until the next interrupt comes along. And there is
no reason for the PHY to interrupt.
Have phy_start() schedule the state machine to run, which both speeds
up the polling use case, and makes the interrupt use case actually
work.
This problems exists whenever there is a state change which will not
cause an interrupt. Trigger the state machine in these cases,
e.g. phy_error().
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Hi Florian
Yes, i was thinking it probably should have a fixes: tag and be a
separate patch. The hard part will be figuring out when this actually
broke, or does it go all the way back to when interrupt support was
added?
Andrew