summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2020-07-30 22:50:04 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-01-18 10:18:54 +0000
commit2e02a4d407517e7528f8cadaaded070d6598e608 (patch)
treecb6553586cb48030dee9841142c4c85d891a1f29
parent78d0d92ed2f34dace4ace4d45715a358127b1226 (diff)
net: ethtool: allow MAC drivers to override ethtool get_ts_info
Check whether the MAC driver has implemented the get_ts_info() method first, and call it if present. If this method returns -EOPNOTSUPP, defer to the phylib or default implementation. XXX: review any drivers that use phylib and provide get_ts_info(). Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--net/ethtool/common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index c63e0739dc6a..f2ef6d120dc2 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -540,14 +540,18 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)
{
const struct ethtool_ops *ops = dev->ethtool_ops;
struct phy_device *phydev = dev->phydev;
+ int ret;
memset(info, 0, sizeof(*info));
info->cmd = ETHTOOL_GET_TS_INFO;
+ if (ops->get_ts_info) {
+ ret = ops->get_ts_info(dev, info);
+ if (ret != -EOPNOTSUPP)
+ return ret;
+ }
if (phy_has_tsinfo(phydev))
return phy_ts_info(phydev, info);
- if (ops->get_ts_info)
- return ops->get_ts_info(dev, info);
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
SOF_TIMESTAMPING_SOFTWARE;