Skip to content

Commit ed29ca8

Browse files
liuyonglong86davem330
authored andcommitted
net: hns: Restart autoneg need return failed when autoneg off
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 <[email protected]> Signed-off-by: Peng Li <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 263c6d7 commit ed29ca8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/net/ethernet/hisilicon/hns/hns_ethtool.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,16 +1157,18 @@ static int hns_get_regs_len(struct net_device *net_dev)
11571157
*/
11581158
static int hns_nic_nway_reset(struct net_device *netdev)
11591159
{
1160-
int ret = 0;
11611160
struct phy_device *phy = netdev->phydev;
11621161

1163-
if (netif_running(netdev)) {
1164-
/* if autoneg is disabled, don't restart auto-negotiation */
1165-
if (phy && phy->autoneg == AUTONEG_ENABLE)
1166-
ret = genphy_restart_aneg(phy);
1167-
}
1162+
if (!netif_running(netdev))
1163+
return 0;
11681164

1169-
return ret;
1165+
if (!phy)
1166+
return -EOPNOTSUPP;
1167+
1168+
if (phy->autoneg != AUTONEG_ENABLE)
1169+
return -EINVAL;
1170+
1171+
return genphy_restart_aneg(phy);
11701172
}
11711173

11721174
static u32

0 commit comments

Comments
 (0)