mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Kory Maincent <kory.maincent@bootlin.com>
Cc: vadim.fedorenko@linux.dev, Nicolai Buchwitz <nb@tipi-net.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net v2 1/2] net: ethtool: don't match a hwtstamp provider on a device without a PHC
Date: Wed, 23 Sep 2026 14:16:42 +0200	[thread overview]
Message-ID: <20260923121644.2194183-2-nb@tipi-net.de> (raw)
In-Reply-To: <20260923121644.2194183-1-nb@tipi-net.de>

A device without a PHC reports phc_index -1. A request for index
0xFFFFFFFF is stored in an int and becomes -1 too, so the two match and
a netdev provider is selected on a device that has none.

Fix this and only match a real PHC index.

Fixes: b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 net/ethtool/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 23db40618fed..23e8282563cc 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -980,7 +980,7 @@ int ethtool_net_get_ts_info_by_phc(struct net_device *dev,
 	if (err)
 		return err;
 
-	if (info->phc_index == hwprov_desc->index &&
+	if (info->phc_index >= 0 && info->phc_index == hwprov_desc->index &&
 	    net_support_hwtstamp_qualifier(dev, hwprov_desc->qualifier))
 		return 0;
 
-- 
2.53.0


       reply	other threads:[~2026-09-23 12:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260923121644.2194183-1-nb@tipi-net.de>
2026-09-23 12:16 ` Nicolai Buchwitz [this message]
2026-09-23 13:00   ` Nicolai Buchwitz
2026-09-24 12:20   ` netdev-bot+sashiko
2026-09-25  9:07     ` Nicolai Buchwitz
2026-09-23 12:16 ` [PATCH net v2 2/2] net: ethtool: let tsconfig reach a PHY-only timestamp provider Nicolai Buchwitz
2026-09-24 12:20   ` netdev-bot+sashiko
2026-09-25  9:15     ` Nicolai Buchwitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923121644.2194183-2-nb@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®