Commit d63671d2 authored by Fuyun Liang's avatar Fuyun Liang Committed by David S. Miller

net: hns3: add support for nway_reset

This patch adds nway_reset support for ethtool cmd.
Signed-off-by: default avatarFuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: default avatarLipeng <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 80cb5f3d
...@@ -832,6 +832,23 @@ static int hns3_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd) ...@@ -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 = { static const struct ethtool_ops hns3_ethtool_ops = {
.self_test = hns3_self_test, .self_test = hns3_self_test,
.get_drvinfo = hns3_get_drvinfo, .get_drvinfo = hns3_get_drvinfo,
...@@ -850,6 +867,7 @@ static const struct ethtool_ops hns3_ethtool_ops = { ...@@ -850,6 +867,7 @@ static const struct ethtool_ops hns3_ethtool_ops = {
.set_rxfh = hns3_set_rss, .set_rxfh = hns3_set_rss,
.get_link_ksettings = hns3_get_link_ksettings, .get_link_ksettings = hns3_get_link_ksettings,
.set_link_ksettings = hns3_set_link_ksettings, .set_link_ksettings = hns3_set_link_ksettings,
.nway_reset = hns3_nway_reset,
}; };
void hns3_ethtool_set_ops(struct net_device *netdev) void hns3_ethtool_set_ops(struct net_device *netdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment