net: Move PHY statistics code into PHY library helpers

In order to make it possible for network device drivers that do not
necessarily have a phy_device attached, but still report PHY statistics,
have a preliminary refactoring consisting in creating helper functions
that encapsulate the PHY device driver knowledge within PHYLIB.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Florian Fainelli
2018-04-25 12:12:47 -07:00
committed by David S. Miller
parent 8349440733
commit c59530d0d5
3 changed files with 76 additions and 30 deletions

View File

@@ -1066,6 +1066,26 @@ int phy_ethtool_nway_reset(struct net_device *ndev);
#if IS_ENABLED(CONFIG_PHYLIB)
int __init mdio_bus_init(void);
void mdio_bus_exit(void);
int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data);
int phy_ethtool_get_sset_count(struct phy_device *phydev);
int phy_ethtool_get_stats(struct phy_device *phydev,
struct ethtool_stats *stats, u64 *data);
#else
int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)
{
return -EOPNOTSUPP;
}
int phy_ethtool_get_sset_count(struct phy_device *phydev)
{
return -EOPNOTSUPP;
}
int phy_ethtool_get_stats(struct phy_device *phydev,
struct ethtool_stats *stats, u64 *data)
{
return -EOPNOTSUPP;
}
#endif
extern struct bus_type mdio_bus_type;