Skip to content

Commit 201825f

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
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. Fixes: b9e3f7d ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology") Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Kory Maincent <kory.maincent@bootlin.com> Link: https://patch.msgid.link/E1uwiW3-00000004jRF-3CnC@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2690cb0 commit 201825f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/ethtool/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ int ethtool_net_get_ts_info_by_phc(struct net_device *dev,
905905
int err;
906906

907907
if (!ops->get_ts_info)
908-
return -ENODEV;
908+
return -EOPNOTSUPP;
909909

910910
/* Does ptp comes from netdev */
911911
ethtool_init_tsinfo(info);
@@ -973,7 +973,7 @@ int ethtool_get_ts_info_by_phc(struct net_device *dev,
973973
int err;
974974

975975
err = ethtool_net_get_ts_info_by_phc(dev, info, hwprov_desc);
976-
if (err == -ENODEV) {
976+
if (err == -ENODEV || err == -EOPNOTSUPP) {
977977
struct phy_device *phy;
978978

979979
phy = ethtool_phy_get_ts_info_by_phc(dev, info, hwprov_desc);

0 commit comments

Comments
 (0)