mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 23:21:46 +00:00
net: dsa: Allow providing PHY statistics from CPU port
Implement the same type of ethtool diversion that we have for ETH_SS_STATS and make it work with ETH_SS_PHY_STATS. This allows providing PHY level statistics for CPU ports that are directly connecting to a PHY device. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6207a78c09
commit
cf96357303
3 changed files with 106 additions and 5 deletions
|
@ -383,3 +383,60 @@ void dsa_port_link_unregister_of(struct dsa_port *dp)
|
|||
else
|
||||
dsa_port_setup_phy_of(dp, false);
|
||||
}
|
||||
|
||||
int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data)
|
||||
{
|
||||
struct phy_device *phydev;
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
if (of_phy_is_fixed_link(dp->dn))
|
||||
return ret;
|
||||
|
||||
phydev = dsa_port_get_phy_device(dp);
|
||||
if (IS_ERR_OR_NULL(phydev))
|
||||
return ret;
|
||||
|
||||
ret = phy_ethtool_get_strings(phydev, data);
|
||||
put_device(&phydev->mdio.dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dsa_port_get_phy_strings);
|
||||
|
||||
int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data)
|
||||
{
|
||||
struct phy_device *phydev;
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
if (of_phy_is_fixed_link(dp->dn))
|
||||
return ret;
|
||||
|
||||
phydev = dsa_port_get_phy_device(dp);
|
||||
if (IS_ERR_OR_NULL(phydev))
|
||||
return ret;
|
||||
|
||||
ret = phy_ethtool_get_stats(phydev, NULL, data);
|
||||
put_device(&phydev->mdio.dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dsa_port_get_ethtool_phy_stats);
|
||||
|
||||
int dsa_port_get_phy_sset_count(struct dsa_port *dp)
|
||||
{
|
||||
struct phy_device *phydev;
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
if (of_phy_is_fixed_link(dp->dn))
|
||||
return ret;
|
||||
|
||||
phydev = dsa_port_get_phy_device(dp);
|
||||
if (IS_ERR_OR_NULL(phydev))
|
||||
return ret;
|
||||
|
||||
ret = phy_ethtool_get_sset_count(phydev);
|
||||
put_device(&phydev->mdio.dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dsa_port_get_phy_sset_count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue