]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Fri, 12 Mar 2021 23:04:43 +0000 (18:04 -0500)
committerSasha Levin <sashal@kernel.org>
Fri, 12 Mar 2021 23:04:43 +0000 (18:04 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch b/queue-4.19/net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch
new file mode 100644 (file)
index 0000000..824865e
--- /dev/null
@@ -0,0 +1,58 @@
+From 54d53f24411977e8a9f51cc5bb0c1ed50032b6cb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 27 Feb 2021 11:05:58 +0800
+Subject: net: phy: fix save wrong speed and duplex problem if autoneg is on
+
+From: Guangbin Huang <huangguangbin2@huawei.com>
+
+[ Upstream commit d9032dba5a2b2bbf0fdce67c8795300ec9923b43 ]
+
+If phy uses generic driver and autoneg is on, enter command
+"ethtool -s eth0 speed 50" will not change phy speed actually, but
+command "ethtool eth0" shows speed is 50Mb/s because phydev->speed
+has been set to 50 and no update later.
+
+And duplex setting has same problem too.
+
+However, if autoneg is on, phy only changes speed and duplex according to
+phydev->advertising, but not phydev->speed and phydev->duplex. So in this
+case, phydev->speed and phydev->duplex don't need to be set in function
+phy_ethtool_ksettings_set() if autoneg is on.
+
+Fixes: 51e2a3846eab ("PHY: Avoid unnecessary aneg restarts")
+Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
+Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/phy.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
+index cc454b8c032c..dd4bf4265a5e 100644
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -335,7 +335,10 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
+       phydev->autoneg = autoneg;
+-      phydev->speed = speed;
++      if (autoneg == AUTONEG_DISABLE) {
++              phydev->speed = speed;
++              phydev->duplex = duplex;
++      }
+       phydev->advertising = advertising;
+@@ -344,8 +347,6 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
+       else
+               phydev->advertising &= ~ADVERTISED_Autoneg;
+-      phydev->duplex = duplex;
+-
+       phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl;
+       /* Restart the PHY */
+-- 
+2.30.1
+
index a565c48319323c4de5ccf41f03e469a404a3f320..1a7c09b753990e5a6fcbde65beaa606a8a1241bc 100644 (file)
@@ -38,3 +38,4 @@ sh_eth-fix-trscer-mask-for-r7s9210.patch
 media-usbtv-fix-deadlock-on-suspend.patch
 media-v4l-vsp1-fix-uif-null-pointer-access.patch
 media-v4l-vsp1-fix-bru-null-pointer-access.patch
+net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch