From: Peng Li Date: Tue, 18 Dec 2018 11:37:56 +0000 (+0800) Subject: net: hns3: synchronize speed and duplex from phy when phy link up X-Git-Tag: archive/raspbian/5.2.17-1+rpi1^2^2^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=dd451020100934502fe5ca17ac50f09969de7b27;p=linux.git net: hns3: synchronize speed and duplex from phy when phy link up Driver calls phy_connect_direct and registers hclge_mac_adjust_link to synchronize mac speed and duplex from phy. It is better to synchronize mac speed and duplex from phy when phy link up. Signed-off-by: Peng Li Signed-off-by: David S. Miller Gbp-Pq: Topic bugfix/arm64/huawei-taishan Gbp-Pq: Name 0019-net-hns3-synchronize-speed-and-duplex-from-phy-when-.patch --- diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c index a75b70ce41f..bdbec85265f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c @@ -181,6 +181,10 @@ static void hclge_mac_adjust_link(struct net_device *netdev) int duplex, speed; int ret; + /* When phy link down, do nothing */ + if (netdev->phydev->link == 0) + return; + speed = netdev->phydev->speed; duplex = netdev->phydev->duplex;