[PATCH net-nex 2/2] net: mvneta: Don't speed down the PHY when changing mtu

From: Jisheng Zhang
Date: Mon Jul 27 2020 - 07:54:32 EST


We found a case where the phy link speed is changed to 10Mbps
then back to 1000Mbps when changing the mtu:

ethtool -s eth0 wol g
ip link set eth0 mtu 1400

Add a simple check to avoid unnecessary phylink_speed_down() when
changing the mtu.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@xxxxxxxxxxxxx>
---
drivers/net/ethernet/marvell/mvneta.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index c9b6b0f85bb0..9cdbb05277eb 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3651,7 +3651,8 @@ static void mvneta_stop_dev(struct mvneta_port *pp)

set_bit(__MVNETA_DOWN, &pp->state);

- if (device_may_wakeup(&pp->dev->dev))
+ if (device_may_wakeup(&pp->dev->dev) &&
+ pp->pkt_size == MVNETA_RX_PKT_SIZE(pp->dev->mtu))
phylink_speed_down(pp->phylink, false);

phylink_stop(pp->phylink);
--
2.28.0.rc0