Skip to content

Commit

Permalink
net: hns: Restart autoneg need return failed when autoneg off
Browse files Browse the repository at this point in the history
The hns driver of earlier devices, when autoneg off, restart autoneg
will return -EINVAL, so make the hns driver for the latest devices
do the same.

Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yonglong Liu authored and David S. Miller committed Jan 28, 2019
1 parent 263c6d7 commit ed29ca8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,16 +1157,18 @@ static int hns_get_regs_len(struct net_device *net_dev)
*/
static int hns_nic_nway_reset(struct net_device *netdev)
{
int ret = 0;
struct phy_device *phy = netdev->phydev;

if (netif_running(netdev)) {
/* if autoneg is disabled, don't restart auto-negotiation */
if (phy && phy->autoneg == AUTONEG_ENABLE)
ret = genphy_restart_aneg(phy);
}
if (!netif_running(netdev))
return 0;

return ret;
if (!phy)
return -EOPNOTSUPP;

if (phy->autoneg != AUTONEG_ENABLE)
return -EINVAL;

return genphy_restart_aneg(phy);
}

static u32
Expand Down

0 comments on commit ed29ca8

Please sign in to comment.