Skip to contentSkip to conversation

phylib: fixes for PHY_RESUMING state changes

PATCH Applied Wade Farnsworth 3 participants 3 messages Jul 1, 2009 – Jul 2, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phylib: fixes for PHY_RESUMING state changes

The PHY_HALTED state disables phydev->link, but the link will not be updated upon entering PHY_RESUMING. Add a call to phy_read_status() to update the link before entering PHY_RUNNING. If the link is not up at this point, enter the PHY_NOLINK state instead.

Also, when transitioning from PHY_RESUMING to PHY_RUNNING, calls to netif_carrier_on() and phydev->adjust_link() are missing. Add the calls similar to the other transitions to PHY_RUNNING.

---
 drivers/net/phy/phy.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)
drivers/net/phy/phy.c +22 -3
index 3ff1f42..4c49a21 100644
@@ -919,13 +919,32 @@ static void phy_state_machine(struct work_struct *work)
 				 * Otherwise, it's 0, and we're
 				 * still waiting for AN */
 				if (err > 0) {
-					phydev->state = PHY_RUNNING;
+					err = phy_read_status(phydev);
+					if (err)
+						break;
+
+					if (phydev->link) {
+						phydev->state = PHY_RUNNING;
+						netif_carrier_on(phydev->attached_dev);
+					} else
+						phydev->state = PHY_NOLINK;
+					phydev->adjust_link(phydev->attached_dev);
 				} else {
 					phydev->state = PHY_AN;
 					phydev->link_timeout = PHY_AN_TIMEOUT;
 				}
-			} else
-				phydev->state = PHY_RUNNING;
+			} else {
+				err = phy_read_status(phydev);
+				if (err)
+					break;
+
+				if (phydev->link) {
+					phydev->state = PHY_RUNNING;
+					netif_carrier_on(phydev->attached_dev);
+				} else
+					phydev->state = PHY_NOLINK;
+				phydev->adjust_link(phydev->attached_dev);
+			}
 			break;
 	}
 
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Wade Farnsworth

The PHY_HALTED state disables phydev->link, but the link will not be updated upon entering PHY_RESUMING. Add a call to phy_read_status() to update the link before entering PHY_RUNNING. If the link is not up at this point, enter the PHY_NOLINK state instead.

Also, when transitioning from PHY_RESUMING to PHY_RUNNING, calls to netif_carrier_on() and phydev->adjust_link() are missing. Add the calls similar to the other transitions to PHY_RUNNING.

maintainer Applied
#2 lore raw

From: Andy Fleming <[email protected]>
Date: Wed, 1 Jul 2009 19:34:24 -0500

Quoted 9 lines · Wade Farnsworth
Quoted 7 lines

The PHY_HALTED state disables phydev->link, but the link will not be updated upon entering PHY_RESUMING. Add a call to phy_read_status() to
update the link before entering PHY_RUNNING. If the link is not up at this point, enter the PHY_NOLINK state instead.

Quoted 8 lines
Quoted 6 lines

Also, when transitioning from PHY_RESUMING to PHY_RUNNING, calls to netif_carrier_on() and phydev->adjust_link() are missing. Add the calls
similar to the other transitions to PHY_RUNNING.

Applied.