[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171128132932.27196-1-antoine.tenart@free-electrons.com>
Date: Tue, 28 Nov 2017 14:29:32 +0100
From: Antoine Tenart <antoine.tenart@...e-electrons.com>
To: rmk@...linux.org.uk, andrew@...n.ch, f.fainelli@...il.com,
davem@...emloft.net
Cc: Yan Markman <ymarkman@...vell.com>,
gregory.clement@...e-electrons.com,
thomas.petazzoni@...e-electrons.com,
miquel.raynal@...e-electrons.com, nadavh@...vell.com,
mw@...ihalf.com, stefanc@...vell.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Antoine Tenart <antoine.tenart@...e-electrons.com>
Subject: [PATCH net] net: phylink: fix link state on phy-connect
From: Yan Markman <ymarkman@...vell.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@...vell.com>
[Antoine: commit message]
Signed-off-by: Antoine Tenart <antoine.tenart@...e-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
Powered by blists - more mailing lists