Patch "net: phy: fix save wrong speed and duplex problem if autoneg is on" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: phy: fix save wrong speed and duplex problem if autoneg is on

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 54d53f24411977e8a9f51cc5bb0c1ed50032b6cb
Author: Guangbin Huang <huangguangbin2@xxxxxxxxxx>
Date:   Sat Feb 27 11:05:58 2021 +0800

    net: phy: fix save wrong speed and duplex problem if autoneg is on
    
    [ 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@xxxxxxxxxx>
    Signed-off-by: Huazhong Tan <tanhuazhong@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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 */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux