net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
Subsystems (3)
PATCH 1/1 net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
Network drivers sometimes return -EOPNOTSUPP from their get_ts_info() method, and this should not cause the reporting of PHY timestamping information to be prohibited. Handle this error code, and also arrange for ethtool_net_get_ts_info_by_phc() to return -EOPNOTSUPP when the method is not implemented.
This allows e.g. PHYs connected to DSA switches which support timestamping to report their timestamping capabilities.
--- net/ethtool/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ethtool/common.c +2 -2
@@ -905,7 +905,7 @@ int ethtool_net_get_ts_info_by_phc(struct net_device *dev,int err;if (!ops->get_ts_info) -return -ENODEV ; +return -EOPNOTSUPP ;/* Does ptp comes from netdev */ ethtool_init_tsinfo (info);
@@ -973,7 +973,7 @@ int ethtool_get_ts_info_by_phc(struct net_device *dev,int err; err =ethtool_net_get_ts_info_by_phc (dev, info, hwprov_desc); -if (err == -ENODEV ) { +if (err == -ENODEV || err == -EOPNOTSUPP ) {struct phy_device *phy; phy =ethtool_phy_get_ts_info_by_phc (dev, info, hwprov_desc);
Signature · 1 line
2.47.3
Quoted 10 lines · Russell King (Oracle)
Network drivers sometimes return
-EOPNOTSUPPfrom theirget_ts_info()method, and this should not cause the reporting of PHY timestamping information to be prohibited. Handle this error code, and also arrange forethtool_net_get_ts_info_by_phc()to return-EOPNOTSUPPwhen the method is not implemented.This allows e.g. PHYs connected to DSA switches which support timestamping to report their timestamping capabilities.
Signed-off-by Russell King (Oracle) <[email protected]>