linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phylink: fix link state on phy-connect
@ 2017-11-28 13:29 Antoine Tenart
  2017-11-28 13:56 ` Andrew Lunn
  2017-11-28 15:53 ` Russell King
  0 siblings, 2 replies; 19+ messages in thread
From: Antoine Tenart @ 2017-11-28 13:29 UTC (permalink / raw)
  To: rmk, andrew, f.fainelli, davem
  Cc: Yan Markman, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, mw, stefanc, netdev, linux-kernel, Antoine Tenart

From: Yan Markman <ymarkman@marvell.com>

When calling successively _connect, _disconnect and _connect again, if
the link configuration changed whilst being down from the phylink
perspective, the last _connect would stay in an incorrect old speed.
Fixes this by setting the link configuration parameters to an unknown
value when calling phylink_bringup_phy.

Fixes: 9525ae83959b ("phylink: add phylink infrastructure")
Signed-off-by: Yan Markman <ymarkman@marvell.com>
[Antoine: commit message]
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/phy/phylink.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index e3bbc70372d3..c2cec3eef67d 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -621,6 +621,16 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
 	if (ret)
 		return ret;
 
+	/* On _disconnect, the phy state machine and phylink resolve
+	 * are stopped before executing full gracefull down/reset state.
+	 * The further _connect starts with incorrect init state. Let's set
+	 * init values here.
+	 */
+	pl->phy_state.link = false;
+	pl->link_config.pause = MLO_PAUSE_AN;
+	pl->link_config.speed = SPEED_UNKNOWN;
+	pl->link_config.duplex = DUPLEX_UNKNOWN;
+
 	phy->phylink = pl;
 	phy->phy_link_change = phylink_phy_change;
 
-- 
2.14.3

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

end of thread, other threads:[~2017-12-02 14:59 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 13:29 [PATCH net] net: phylink: fix link state on phy-connect Antoine Tenart
2017-11-28 13:56 ` Andrew Lunn
2017-11-28 14:10   ` Antoine Tenart
2017-11-28 15:53 ` Russell King
2017-11-28 15:56   ` Russell King
2017-11-29  7:22     ` Antoine Tenart
2017-11-29 19:33     ` [EXT] " Yan Markman
2017-11-29 19:59       ` Russell King - ARM Linux
2017-11-29 21:06         ` [EXT] " Yan Markman
2017-11-29 21:20           ` Russell King - ARM Linux
2017-11-30  8:51             ` Yan Markman
2017-11-30 10:10               ` Russell King - ARM Linux
2017-11-30 13:28                 ` Russell King - ARM Linux
2017-12-01 17:07                   ` Grygorii Strashko
2017-12-01 17:24                     ` Russell King - ARM Linux
2017-12-01 17:36                       ` Florian Fainelli
2017-12-01 17:47                         ` Russell King - ARM Linux
2017-12-02 11:08                           ` Yan Markman
2017-12-02 14:58                             ` Russell King - ARM Linux

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