Commit 83326b1e authored by Florian Fainelli's avatar Florian Fainelli Committed by Luis Henriques

net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS

commit d5c3d846 upstream.

Commit 2c7b4921 ("phy: fix the use of PHY_IGNORE_INTERRUPT") changed
a hunk in phy_state_machine() in the PHY_RUNNING case which was not
needed. The change essentially makes the PHY library treat PHY devices
with PHY_IGNORE_INTERRUPT to keep polling for the PHY device, even
though the intent is not to do it.

Fix this by reverting that specific hunk, which makes the PHY state
machine wait for state changes, and stay in the PHY_RUNNING state for as
long as needed.

Fixes: 2c7b4921 ("phy: fix the use of PHY_IGNORE_INTERRUPT")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent db6207de
...@@ -824,10 +824,10 @@ void phy_state_machine(struct work_struct *work) ...@@ -824,10 +824,10 @@ void phy_state_machine(struct work_struct *work)
phydev->adjust_link(phydev->attached_dev); phydev->adjust_link(phydev->attached_dev);
break; break;
case PHY_RUNNING: case PHY_RUNNING:
/* Only register a CHANGE if we are polling or ignoring /* Only register a CHANGE if we are polling and link changed
* interrupts and link changed since latest checking. * since latest checking.
*/ */
if (!phy_interrupt_is_valid(phydev)) { if (phydev->irq == PHY_POLL) {
old_link = phydev->link; old_link = phydev->link;
err = phy_read_status(phydev); err = phy_read_status(phydev);
if (err) if (err)
...@@ -926,6 +926,11 @@ void phy_state_machine(struct work_struct *work) ...@@ -926,6 +926,11 @@ void phy_state_machine(struct work_struct *work)
if (err < 0) if (err < 0)
phy_error(phydev); phy_error(phydev);
/* Only re-schedule a PHY state machine change if we are polling the
* PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
* between states from phy_mac_interrupt()
*/
if (phydev->irq == PHY_POLL)
queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
PHY_STATE_TIME * HZ); PHY_STATE_TIME * HZ);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment