ar71xx: ag71xx: update ethtool support
Remove references to broken and mostly deprecated phy_ethtool_ioctl, use new {s,g}et_link_ksettings and add nway_reset which was previously handled in phy_ethtool_ioctl. Cc: John Crispin <john@phrozen.org> Ref: https://bugs.openwrt.org/index.php?do=details&task_id=1982 Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
parent
206af613b2
commit
971d358579
1 changed files with 14 additions and 34 deletions
|
@ -14,38 +14,6 @@
|
||||||
#include "ag71xx.h"
|
#include "ag71xx.h"
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
|
|
||||||
static int ag71xx_ethtool_get_settings(struct net_device *dev,
|
|
||||||
struct ethtool_cmd *cmd)
|
|
||||||
{
|
|
||||||
struct ag71xx *ag = netdev_priv(dev);
|
|
||||||
struct phy_device *phydev = ag->phy_dev;
|
|
||||||
|
|
||||||
if (!phydev)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
|
|
||||||
return phy_ethtool_gset(phydev, cmd);
|
|
||||||
#else
|
|
||||||
return phy_ethtool_ioctl(phydev, cmd);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ag71xx_ethtool_set_settings(struct net_device *dev,
|
|
||||||
struct ethtool_cmd *cmd)
|
|
||||||
{
|
|
||||||
struct ag71xx *ag = netdev_priv(dev);
|
|
||||||
struct phy_device *phydev = ag->phy_dev;
|
|
||||||
|
|
||||||
if (!phydev)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
|
|
||||||
return phy_ethtool_sset(phydev, cmd);
|
|
||||||
#else
|
|
||||||
return phy_ethtool_ioctl(phydev, cmd);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ag71xx_ethtool_get_drvinfo(struct net_device *dev,
|
static void ag71xx_ethtool_get_drvinfo(struct net_device *dev,
|
||||||
struct ethtool_drvinfo *info)
|
struct ethtool_drvinfo *info)
|
||||||
{
|
{
|
||||||
|
@ -127,14 +95,26 @@ static int ag71xx_ethtool_set_ringparam(struct net_device *dev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ag71xx_ethtool_nway_reset(struct net_device *dev)
|
||||||
|
{
|
||||||
|
struct ag71xx *ag = netdev_priv(dev);
|
||||||
|
struct phy_device *phydev = ag->phy_dev;
|
||||||
|
|
||||||
|
if (!phydev)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
return genphy_restart_aneg(phydev);
|
||||||
|
}
|
||||||
|
|
||||||
struct ethtool_ops ag71xx_ethtool_ops = {
|
struct ethtool_ops ag71xx_ethtool_ops = {
|
||||||
.set_settings = ag71xx_ethtool_set_settings,
|
|
||||||
.get_settings = ag71xx_ethtool_get_settings,
|
|
||||||
.get_drvinfo = ag71xx_ethtool_get_drvinfo,
|
.get_drvinfo = ag71xx_ethtool_get_drvinfo,
|
||||||
.get_msglevel = ag71xx_ethtool_get_msglevel,
|
.get_msglevel = ag71xx_ethtool_get_msglevel,
|
||||||
.set_msglevel = ag71xx_ethtool_set_msglevel,
|
.set_msglevel = ag71xx_ethtool_set_msglevel,
|
||||||
.get_ringparam = ag71xx_ethtool_get_ringparam,
|
.get_ringparam = ag71xx_ethtool_get_ringparam,
|
||||||
.set_ringparam = ag71xx_ethtool_set_ringparam,
|
.set_ringparam = ag71xx_ethtool_set_ringparam,
|
||||||
|
.get_link_ksettings = phy_ethtool_get_link_ksettings,
|
||||||
|
.set_link_ksettings = phy_ethtool_set_link_ksettings,
|
||||||
.get_link = ethtool_op_get_link,
|
.get_link = ethtool_op_get_link,
|
||||||
.get_ts_info = ethtool_op_get_ts_info,
|
.get_ts_info = ethtool_op_get_ts_info,
|
||||||
|
.nway_reset = ag71xx_ethtool_nway_reset,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue