From: Daode Huang Date: Wed, 9 Nov 2016 18:13:49 +0000 (+0000) Subject: net: hns: bug fix about restart auto-negotiation X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=da2ef1e5585bc733c4cccee8390259abeb27f0bf;p=linux-beck.git net: hns: bug fix about restart auto-negotiation When set auto-negotiation off and duplex half, if run "ethtool -r ethX" on port with phy, then the port will be failed to work. It should forbid to start auto-negotiation when auto-negotiate is off. This patch add the limited condition. Reported-by: Jinchuang Tian Signed-off-by: Daode Huang Reviewed-by: Yisen Zhuang Reviewed-by: lipeng Signed-off-by: Salil Mehta Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 87d5c94b2810..3ac2183dbd21 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c @@ -1178,7 +1178,8 @@ static int hns_nic_nway_reset(struct net_device *netdev) struct phy_device *phy = netdev->phydev; if (netif_running(netdev)) { - if (phy) + /* if autoneg is disabled, don't restart auto-negotiation */ + if (phy && phy->autoneg == AUTONEG_ENABLE) ret = genphy_restart_aneg(phy); }