Skip to content

Commit c40f0df

Browse files
Russell King (Oracle)longlimsft
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 a510b47 commit c40f0df

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
@@ -925,7 +925,7 @@ int ethtool_net_get_ts_info_by_phc(struct net_device *dev,
925925
int err;
926926

927927
if (!ops->get_ts_info)
928-
return -ENODEV;
928+
return -EOPNOTSUPP;
929929

930930
/* Does ptp comes from netdev */
931931
ethtool_init_tsinfo(info);
@@ -993,7 +993,7 @@ int ethtool_get_ts_info_by_phc(struct net_device *dev,
993993
int err;
994994

995995
err = ethtool_net_get_ts_info_by_phc(dev, info, hwprov_desc);
996-
if (err == -ENODEV) {
996+
if (err == -ENODEV || err == -EOPNOTSUPP) {
997997
struct phy_device *phy;
998998

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

0 commit comments

Comments
 (0)