netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: improve resuming from hibernation
@ 2019-05-01 20:14 Heiner Kallweit
  2019-05-01 20:34 ` Andrew Lunn
  2019-05-04  4:51 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2019-05-01 20:14 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev

I got an interesting report [0] that after resuming from hibernation
the link has 100Mbps instead of 1Gbps. Reason is that another OS has
been used whilst Linux was hibernated. And this OS speeds down the link
due to WoL. Therefore, when resuming, we shouldn't expect that what
the PHY advertises is what it did when hibernating.
Easiest way to do this is removing state PHY_RESUMING. Instead always
go via PHY_UP that configures PHY advertisement.

[0] https://bugzilla.kernel.org/show_bug.cgi?id=202851

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy.c | 7 +------
 include/linux/phy.h   | 9 +--------
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 984de9872..1a146c5c5 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -43,7 +43,6 @@ static const char *phy_state_to_str(enum phy_state st)
 	PHY_STATE_STR(NOLINK)
 	PHY_STATE_STR(FORCING)
 	PHY_STATE_STR(HALTED)
-	PHY_STATE_STR(RESUMING)
 	}
 
 	return NULL;
@@ -859,10 +858,7 @@ void phy_start(struct phy_device *phydev)
 			goto out;
 	}
 
-	if (phydev->state == PHY_READY)
-		phydev->state = PHY_UP;
-	else
-		phydev->state = PHY_RESUMING;
+	phydev->state = PHY_UP;
 
 	phy_start_machine(phydev);
 out:
@@ -897,7 +893,6 @@ void phy_state_machine(struct work_struct *work)
 		break;
 	case PHY_NOLINK:
 	case PHY_RUNNING:
-	case PHY_RESUMING:
 		err = phy_check_link_status(phydev);
 		break;
 	case PHY_FORCING:
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 4a03f8a46..073fb151b 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -308,13 +308,7 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
  *
  * HALTED: PHY is up, but no polling or interrupts are done. Or
  * PHY is in an error state.
- *
- * - phy_start moves to RESUMING
- *
- * RESUMING: PHY was halted, but now wants to run again.
- * - If we are forcing, or aneg is done, timer moves to RUNNING
- * - If aneg is not done, timer moves to AN
- * - phy_stop moves to HALTED
+ * - phy_start moves to UP
  */
 enum phy_state {
 	PHY_DOWN = 0,
@@ -324,7 +318,6 @@ enum phy_state {
 	PHY_RUNNING,
 	PHY_NOLINK,
 	PHY_FORCING,
-	PHY_RESUMING
 };
 
 /**
-- 
2.21.0


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

* Re: [PATCH net-next] net: phy: improve resuming from hibernation
  2019-05-01 20:14 [PATCH net-next] net: phy: improve resuming from hibernation Heiner Kallweit
@ 2019-05-01 20:34 ` Andrew Lunn
  2019-05-04  4:51 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-05-01 20:34 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Florian Fainelli, David Miller, netdev

On Wed, May 01, 2019 at 10:14:21PM +0200, Heiner Kallweit wrote:
> I got an interesting report [0] that after resuming from hibernation
> the link has 100Mbps instead of 1Gbps. Reason is that another OS has
> been used whilst Linux was hibernated. And this OS speeds down the link
> due to WoL. Therefore, when resuming, we shouldn't expect that what
> the PHY advertises is what it did when hibernating.
> Easiest way to do this is removing state PHY_RESUMING. Instead always
> go via PHY_UP that configures PHY advertisement.

Hi Heiner

Going via PHY_UP is reasonable. I'm doing the same in my WIP cable
test code, to restore the PHY after it finishes the test.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next] net: phy: improve resuming from hibernation
  2019-05-01 20:14 [PATCH net-next] net: phy: improve resuming from hibernation Heiner Kallweit
  2019-05-01 20:34 ` Andrew Lunn
@ 2019-05-04  4:51 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-05-04  4:51 UTC (permalink / raw)
  To: hkallweit1; +Cc: andrew, f.fainelli, netdev

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Wed, 1 May 2019 22:14:21 +0200

> I got an interesting report [0] that after resuming from hibernation
> the link has 100Mbps instead of 1Gbps. Reason is that another OS has
> been used whilst Linux was hibernated. And this OS speeds down the link
> due to WoL. Therefore, when resuming, we shouldn't expect that what
> the PHY advertises is what it did when hibernating.
> Easiest way to do this is removing state PHY_RESUMING. Instead always
> go via PHY_UP that configures PHY advertisement.
> 
> [0] https://bugzilla.kernel.org/show_bug.cgi?id=202851
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied.

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

end of thread, other threads:[~2019-05-04  4:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 20:14 [PATCH net-next] net: phy: improve resuming from hibernation Heiner Kallweit
2019-05-01 20:34 ` Andrew Lunn
2019-05-04  4:51 ` David Miller

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