summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/net/phy/phylink.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 16cf2dd0ef50..4421f283e910 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -616,8 +616,26 @@ static void phylink_resolve(struct work_struct *w)
}
}
- if (mac_config)
- phylink_mac_config(pl, &link_state);
+ if (mac_config) {
+ if (link_state.interface == pl->link_config.interface) {
+ /* The interface remains unchanged, only the speed,
+ * duplex or pause settings have changed.
+ */
+ phylink_mac_config(pl, &link_state);
+ } else if (cur_link_state) {
+ /* The interface has changed, but the link is up.
+ * Force it down and retrigger resolution.
+ */
+ link_state.link = false;
+ retrigger = true;
+ } else {
+ /* The interface has changed and the link is down.
+ * Reconfigure the MAC and PCS.
+ */
+ phylink_pcs_config(pl, false, &link_state);
+ pl->link_config.interface = link_state.interface;
+ }
+ }
if (link_state.link != cur_link_state) {
pl->old_link_state = link_state.link;