diff options
Diffstat (limited to 'drivers/net/phy/phy.c')
| -rw-r--r-- | drivers/net/phy/phy.c | 48 | 
1 files changed, 48 insertions, 0 deletions
| diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 05c1e8ef15e6..a98ed12c0009 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1277,3 +1277,51 @@ int phy_ethtool_nway_reset(struct net_device *ndev)  	return phy_restart_aneg(phydev);  }  EXPORT_SYMBOL(phy_ethtool_nway_reset); + +int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data) +{ +	if (!phydev->drv) +		return -EIO; + +	mutex_lock(&phydev->lock); +	phydev->drv->get_strings(phydev, data); +	mutex_unlock(&phydev->lock); + +	return 0; +} +EXPORT_SYMBOL(phy_ethtool_get_strings); + +int phy_ethtool_get_sset_count(struct phy_device *phydev) +{ +	int ret; + +	if (!phydev->drv) +		return -EIO; + +	if (phydev->drv->get_sset_count && +	    phydev->drv->get_strings && +	    phydev->drv->get_stats) { +		mutex_lock(&phydev->lock); +		ret = phydev->drv->get_sset_count(phydev); +		mutex_unlock(&phydev->lock); + +		return ret; +	} + +	return -EOPNOTSUPP; +} +EXPORT_SYMBOL(phy_ethtool_get_sset_count); + +int phy_ethtool_get_stats(struct phy_device *phydev, +			  struct ethtool_stats *stats, u64 *data) +{ +	if (!phydev->drv) +		return -EIO; + +	mutex_lock(&phydev->lock); +	phydev->drv->get_stats(phydev, stats, data); +	mutex_unlock(&phydev->lock); + +	return 0; +} +EXPORT_SYMBOL(phy_ethtool_get_stats); |