diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2020-06-28 11:57:59 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2020-06-28 13:52:09 +0100 |
commit | f3ef30dcbf997778aebb2bb9894524c8bd2524bd (patch) | |
tree | d0f3c066765f470cfe8fe46ebf1a8a4c71115b6f | |
parent | 1255a2ddb9a9e68fea13d8abf566547cbbf132e0 (diff) |
net: phylink: ensure link is down when changing interface
The only PHYs that are used with phylink which change their interface
are the BCM84881 and MV88X3310 family, both of which only change their
interface modes on link-up events. However, rather than relying upon
this behaviour by the PHY, we should give a stronger guarantee when
resolving that the link will be down whenever we change the interface
mode. This patch implements that stronger guarantee for resolve.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/net/phy/phylink.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 62d458de9138..8e10e5512553 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -620,8 +620,18 @@ static void phylink_resolve(struct work_struct *w) } } - if (mac_config) + if (mac_config) { + if (link_state.interface != pl->link_config.interface) { + /* The interface has changed, force the link down and + * then reconfigure. + */ + if (cur_link_state) { + phylink_link_down(pl); + cur_link_state = false; + } + } phylink_mac_config(pl, &link_state); + } if (link_state.link != cur_link_state) { pl->old_link_state = link_state.link; |