Commit d97e7497 authored by Lucas Stach's avatar Lucas Stach Committed by David S. Miller

net: fec: restart the FEC when PHY speed changes

Proviously we would only restart the FEC when PHY link or duplex state
changed. PHY does not always bring down the link for speed changes, in
which case we would not detect any change and keep FEC running.

Switching link speed without restarting the FEC results in the FEC being
stuck in an indefinite state, generating error conditions for every
packet.
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cca7af38
...@@ -934,24 +934,28 @@ static void fec_enet_adjust_link(struct net_device *ndev) ...@@ -934,24 +934,28 @@ static void fec_enet_adjust_link(struct net_device *ndev)
goto spin_unlock; goto spin_unlock;
} }
/* Duplex link change */
if (phy_dev->link) { if (phy_dev->link) {
if (fep->full_duplex != phy_dev->duplex) { if (!fep->link) {
fec_restart(ndev, phy_dev->duplex);
/* prevent unnecessary second fec_restart() below */
fep->link = phy_dev->link; fep->link = phy_dev->link;
status_change = 1; status_change = 1;
} }
}
/* Link on or off change */ if (fep->full_duplex != phy_dev->duplex)
if (phy_dev->link != fep->link) { status_change = 1;
fep->link = phy_dev->link;
if (phy_dev->link) if (phy_dev->speed != fep->speed) {
fep->speed = phy_dev->speed;
status_change = 1;
}
/* if any of the above changed restart the FEC */
if (status_change)
fec_restart(ndev, phy_dev->duplex); fec_restart(ndev, phy_dev->duplex);
else } else {
if (fep->link) {
fec_stop(ndev); fec_stop(ndev);
status_change = 1; status_change = 1;
}
} }
spin_unlock: spin_unlock:
......
...@@ -240,6 +240,7 @@ struct fec_enet_private { ...@@ -240,6 +240,7 @@ struct fec_enet_private {
phy_interface_t phy_interface; phy_interface_t phy_interface;
int link; int link;
int full_duplex; int full_duplex;
int speed;
struct completion mdio_done; struct completion mdio_done;
int irq[FEC_IRQ_NUM]; int irq[FEC_IRQ_NUM];
int bufdesc_ex; int bufdesc_ex;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment