提交 f21105df 编写于 作者: D David Daney

netdev: octeon_mgmt: Improve ethtool_ops.

Correctly show no link when the interface is down, and return
-EOPNOTSUPP for things that don't work.  This quiets the ethtool
program when run on down interfaces.
Signed-off-by: NDavid Daney <david.daney@cavium.com>
Acked-by: NDavid S. Miller <davem@davemloft.net>
上级 3d305850
...@@ -1379,7 +1379,7 @@ static int octeon_mgmt_get_settings(struct net_device *netdev, ...@@ -1379,7 +1379,7 @@ static int octeon_mgmt_get_settings(struct net_device *netdev,
if (p->phydev) if (p->phydev)
return phy_ethtool_gset(p->phydev, cmd); return phy_ethtool_gset(p->phydev, cmd);
return -EINVAL; return -EOPNOTSUPP;
} }
static int octeon_mgmt_set_settings(struct net_device *netdev, static int octeon_mgmt_set_settings(struct net_device *netdev,
...@@ -1393,14 +1393,28 @@ static int octeon_mgmt_set_settings(struct net_device *netdev, ...@@ -1393,14 +1393,28 @@ static int octeon_mgmt_set_settings(struct net_device *netdev,
if (p->phydev) if (p->phydev)
return phy_ethtool_sset(p->phydev, cmd); return phy_ethtool_sset(p->phydev, cmd);
return -EINVAL; return -EOPNOTSUPP;
}
static int octeon_mgmt_nway_reset(struct net_device *dev)
{
struct octeon_mgmt *p = netdev_priv(dev);
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (p->phydev)
return phy_start_aneg(p->phydev);
return -EOPNOTSUPP;
} }
static const struct ethtool_ops octeon_mgmt_ethtool_ops = { static const struct ethtool_ops octeon_mgmt_ethtool_ops = {
.get_drvinfo = octeon_mgmt_get_drvinfo, .get_drvinfo = octeon_mgmt_get_drvinfo,
.get_link = ethtool_op_get_link,
.get_settings = octeon_mgmt_get_settings, .get_settings = octeon_mgmt_get_settings,
.set_settings = octeon_mgmt_set_settings .set_settings = octeon_mgmt_set_settings,
.nway_reset = octeon_mgmt_nway_reset,
.get_link = ethtool_op_get_link,
}; };
static const struct net_device_ops octeon_mgmt_ops = { static const struct net_device_ops octeon_mgmt_ops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册