netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: set link state to down when creating the phy_device
@ 2018-03-11 14:00 Heiner Kallweit
  2018-03-12 22:10 ` Florian Fainelli
  2018-03-13  1:00 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2018-03-11 14:00 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli; +Cc: netdev@vger.kernel.org

Currently the link state is initialized to "up" when the phy_device is
being created. This is not consistent with the phy state being
initialized to PHY_DOWN.

Usually this doen't do any harm because the link state is updated
once the PHY reaches state PHY_AN. However e.g. if a LAN port isn't
used and the PHY remains down this inconsistency remains and calls
to functions like phy_print_status() give false results.
Therefore change the initialization to link being down.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 478405e54..b28532332 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -374,7 +374,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 	dev->duplex = -1;
 	dev->pause = 0;
 	dev->asym_pause = 0;
-	dev->link = 1;
+	dev->link = 0;
 	dev->interface = PHY_INTERFACE_MODE_GMII;
 
 	dev->autoneg = AUTONEG_ENABLE;
-- 
2.16.2

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

* Re: [PATCH net-next] net: phy: set link state to down when creating the phy_device
  2018-03-11 14:00 [PATCH net-next] net: phy: set link state to down when creating the phy_device Heiner Kallweit
@ 2018-03-12 22:10 ` Florian Fainelli
  2018-03-13  1:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2018-03-12 22:10 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn; +Cc: netdev@vger.kernel.org

On 03/11/2018 07:00 AM, Heiner Kallweit wrote:
> Currently the link state is initialized to "up" when the phy_device is
> being created. This is not consistent with the phy state being
> initialized to PHY_DOWN.
> 
> Usually this doen't do any harm because the link state is updated
> once the PHY reaches state PHY_AN. However e.g. if a LAN port isn't
> used and the PHY remains down this inconsistency remains and calls
> to functions like phy_print_status() give false results.
> Therefore change the initialization to link being down.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

FWIW, I have been working on some patches to try to reduce the amount of
link drops that we are seeing. This particular change may be changed in
the future to try to initialize the link state as early as possible, but
for now this is good.

Thanks!
-- 
Florian

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

* Re: [PATCH net-next] net: phy: set link state to down when creating the phy_device
  2018-03-11 14:00 [PATCH net-next] net: phy: set link state to down when creating the phy_device Heiner Kallweit
  2018-03-12 22:10 ` Florian Fainelli
@ 2018-03-13  1:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-03-13  1:00 UTC (permalink / raw)
  To: hkallweit1; +Cc: andrew, f.fainelli, netdev

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 11 Mar 2018 15:00:37 +0100

> Currently the link state is initialized to "up" when the phy_device is
> being created. This is not consistent with the phy state being
> initialized to PHY_DOWN.
> 
> Usually this doen't do any harm because the link state is updated
> once the PHY reaches state PHY_AN. However e.g. if a LAN port isn't
> used and the PHY remains down this inconsistency remains and calls
> to functions like phy_print_status() give false results.
> Therefore change the initialization to link being down.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied, thank you.

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

end of thread, other threads:[~2018-03-13  1:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-11 14:00 [PATCH net-next] net: phy: set link state to down when creating the phy_device Heiner Kallweit
2018-03-12 22:10 ` Florian Fainelli
2018-03-13  1:00 ` 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).