diff options
author | Fuyun Liang <liangfuyun1@huawei.com> | 2017-11-03 12:18:29 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-03 21:36:49 +0900 |
commit | d63671d27cd1cc1f93f5fcb86eaeee57c8190d46 (patch) | |
tree | 13f29620cc44533d819c0c95f68feb5ca8bfdde9 /drivers | |
parent | 80cb5f3d97aa22ce3aac2737da03d4679722c60f (diff) | |
download | linux-d63671d27cd1cc1f93f5fcb86eaeee57c8190d46.tar.bz2 |
net: hns3: add support for nway_reset
This patch adds nway_reset support for ethtool cmd.
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Lipeng <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c index 7fe193b1ccaf..a21470c72da3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c @@ -832,6 +832,23 @@ static int hns3_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd) } } +static int hns3_nway_reset(struct net_device *netdev) +{ + struct phy_device *phy = netdev->phydev; + + if (!netif_running(netdev)) + return 0; + + /* Only support nway_reset for netdev with phy attached for now */ + if (!phy) + return -EOPNOTSUPP; + + if (phy->autoneg != AUTONEG_ENABLE) + return -EINVAL; + + return genphy_restart_aneg(phy); +} + static const struct ethtool_ops hns3_ethtool_ops = { .self_test = hns3_self_test, .get_drvinfo = hns3_get_drvinfo, @@ -850,6 +867,7 @@ static const struct ethtool_ops hns3_ethtool_ops = { .set_rxfh = hns3_set_rss, .get_link_ksettings = hns3_get_link_ksettings, .set_link_ksettings = hns3_set_link_ksettings, + .nway_reset = hns3_nway_reset, }; void hns3_ethtool_set_ops(struct net_device *netdev) |