netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
@ 2025-09-09 14:07 Russell King (Oracle)
  2025-09-11 16:56 ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King (Oracle) @ 2025-09-09 14:07 UTC (permalink / raw)
  To: Kory Maincent
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Simon Horman

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.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 net/ethtool/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 4f58648a27ad..92e6a681c797 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -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);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
@ 2025-09-11 14:43 Russell King (Oracle)
  2025-09-11 21:37 ` Kory Maincent
  2025-09-13  0:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-09-11 14:43 UTC (permalink / raw)
  To: Kory Maincent
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Simon Horman

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: b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
--
v2: add Fixes: tag
---
 net/ethtool/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 4f58648a27ad..92e6a681c797 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -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);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
  2025-09-09 14:07 [PATCH net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method Russell King (Oracle)
@ 2025-09-11 16:56 ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-09-11 16:56 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Kory Maincent, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, netdev, Paolo Abeni

On Tue, Sep 09, 2025 at 03:07:17PM +0100, Russell King (Oracle) wrote:
> 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.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
  2025-09-11 14:43 Russell King (Oracle)
@ 2025-09-11 21:37 ` Kory Maincent
  2025-09-13  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: Kory Maincent @ 2025-09-11 21:37 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Simon Horman

On Thu, 11 Sep 2025 15:43:15 +0100
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> 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.

You forgot the v2 in the subject prefix.

Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>

Thank you!
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
  2025-09-11 14:43 Russell King (Oracle)
  2025-09-11 21:37 ` Kory Maincent
@ 2025-09-13  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-13  0:40 UTC (permalink / raw)
  To: Russell King
  Cc: kory.maincent, andrew, davem, edumazet, kuba, netdev, pabeni,
	horms

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 11 Sep 2025 15:43:15 +0100 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method
    https://git.kernel.org/netdev/net/c/201825fb4278

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-13  0:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 14:07 [PATCH net] net: ethtool: handle EOPNOTSUPP from ethtool get_ts_info() method Russell King (Oracle)
2025-09-11 16:56 ` Simon Horman
  -- strict thread matches above, loose matches on Subject: below --
2025-09-11 14:43 Russell King (Oracle)
2025-09-11 21:37 ` Kory Maincent
2025-09-13  0:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).