Article View: linux.kernel.netdev
Article #25143[PATCH net-next v5 1/4] net: ethtool: tsconfig: allow selecting a provider
From: javen
Date: Tue, 01 Dec 2026 09:44
Date: Tue, 01 Dec 2026 09:44
62 lines
11075 bytes
11075 bytes
From: Javen <javen_xu@realsil.com.cn>
A hwtstamp provider can obly ne selected with ETHTOOL_MSG_TSCONFIG_SET
when the device already has an active time stamping source: a MAC
implementing ndo_hwtstamp_set(), a PHY flagged as default_timestamp, or
a previously selected dev->hwprov.
This patch makes it possible to select a PHY time stamper on a MAC
without time stamping support. New phy drivers are expected to reply on
dev->hwprov rather than default_timestamp.
Signed-off-by: Javen <javen_xu@realsil.com.cn>
---
Changes in v5:
- new file.
---
net/ethtool/tsconfig.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/net/ethtool/tsconfig.c b/net/ethtool/tsconfig.c
index 2db0e7ba8b9f..9c983666a1b0 100644
--- a/net/ethtool/tsconfig.c
+++ b/net/ethtool/tsconfig.c
@@ -300,14 +300,16 @@ static int ethnl_set_tsconfig(struct ethnl_req_info *req_base,
struct hwtstamp_provider *hwprov = NULL;
struct net_device *dev = req_base->dev;
struct nlattr **tb = info->attrs;
+ bool has_hwts;
int ret;
if (!netif_device_present(dev))
return -ENODEV;
- if (!dev->netdev_ops->ndo_hwtstamp_set &&
- !phy_is_default_hwtstamp(dev->phydev) &&
- !netdev_ops_lock_dereference(dev->hwprov, dev))
+ has_hwts = dev->netdev_ops->ndo_hwtstamp_set ||
+ phy_is_default_hwtstamp(dev->phydev) ||
+ netdev_ops_lock_dereference(dev->hwprov, dev);
+ if (!has_hwts && !tb[ETHTOOL_A_TSCONFIG_HWTSTAMP_PROVIDER])
return -EOPNOTSUPP;
if (tb[ETHTOOL_A_TSCONFIG_HWTSTAMP_PROVIDER]) {
@@ -411,9 +413,12 @@ static int ethnl_set_tsconfig(struct ethnl_req_info *req_base,
/* Disable current time stamping if we try to enable
* another one
*/
- ret = dev_set_hwtstamp_phylib(dev, &zero_config, info->extack);
- if (ret < 0)
- goto err_free_hwprov;
+ if (has_hwts) {
+ ret = dev_set_hwtstamp_phylib(dev, &zero_config,
+ info->extack);
+ if (ret < 0)
+ goto err_free_hwprov;
+ }
/* Change the selected hwtstamp source */
__hwprov = rcu_replace_pointer(dev->hwprov, hwprov,
--
2.43.0
Technical Details
Message-ID:
<20261201094454.1150-2-javen_xu@realsil.com.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374918-linux-kernel-netdev=dewy.ruReferences:
<20261201094454.1150-1-javen_xu@realsil.com.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374918-linux-kernel-netdev=dewy.ru From: javen_xu@realsil.com.cn (javen) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v5 1/4] net: ethtool: tsconfig: allow selecting a provider Date: Tue, 1 Dec 2026 17:44:51 +0800 Organization: Usenet Network Message-ID: <20261201094454.1150-2-javen_xu@realsil.com.cn> References: <20261201094454.1150-1-javen_xu@realsil.com.cn> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1676959"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:DdQwCpdAkhQZwMkkb7Cc1fnVdTE= sha256:uxp1+vkkqHfqSvUH9LIEYD82+IIAhyBiaMxMxr+Nfhg= sha1:7huKO3BqIICWDv5pHpg4ZYc1iVE= sha256:nA92WbP/QrPGYM9pTL/rJmoBGDIKOS1gL97Dvu1/OeY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D2B76117314; Tue, 1 Dec 2026 12:46:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=realsil.com.cn X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dPlQWMS74Vf2; Tue, 1 Dec 2026 12:46:55 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374918-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=realsil.com.cn X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 30934117310; Tue, 1 Dec 2026 12:46:46 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 2F194370D4; Tue, 1 Dec 2026 09:46:14 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796118371; b=H5bmYeesJA4+B/kOlhL5yxIfGRJi41i9Kf+NE3P+GcvvpUlxd3A5tngGY2BBoczfuEfb GXS602ChI1srG+Ap/cSYVJgifU6lmqRrhNgWc09Tk4jui3C2DhabJ2Z3KWdf17pJlm7vP OPOCLgQRu1z+5kZHU7xxdt73VaVxeuPjC9/+Y/KRWbTCx3/+Vrz5hqp4WgAzYPSQP374w TyIIRnKfZL1VHWOaQWvcFCaz18cZB0n81t8QfxucMsMWIhxWrl8pSkN4k07wUO53rfVlQ 8bn4CDo4T3+1rozV0pJLfxmOyWCAGFemydqvEj5VIvBGubG+FKHemzIC5aUhlJOlacg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796118371; h=X-Original-To:Received:DMARC-Filter:X-SpamFilter-By:DKIM-Signature: Received:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Transfer-Encoding:Content-Type; bh=N4N3X/bz2fbMOGRtaO3LeMJ9hZ3vYTJKofhsX6470t0=; b=oGhrpkM2iA/+h6etiWRp7tPV5gEBhxL+HS6eruvRe+0JnisNUZ8s/R+xCGEKea0Sue+x V5Ac2hC+M1u2D5XqUHJ3f9U+BKqYCWs/xE8vumtu+03NMy+41RbArJNxXkqiSJumbhoCV BkNll8I2bQSei4L592s4ga3Ja3seQrqCHlsANNNaK6yXeF4qpqqJNSbUIqQYyKIZCh7zO iqbhjJiqNloT723Owj616wnUWtA1u7oKdIbNJwFtXlO9rwy5U39QdIE7JGu1XgLk3jr5O KpUgXzMAQTHYkimsZWFgIOtUnDBBBp9Pw2GDWUVX3rwZ+W5UPJtuymbjIzu/CQSJHKw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=avPvorDK; dmarc=pass header.from=realsil.com.cn; spf=pass smtp.mailfrom=realsil.com.cn; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EF4F606A69B; Tue, 1 Dec 2026 09:46:11 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=avPvorDK X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=211.75.126.72 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796118370; b=i5US8ho/dcSpj0tufeS0Ej2u6POVHJ1ZjPKyPhCalWgelwHN8FExvkqDGMH8VJFUBDS/ oZRdIxorRJkIwCuKGxe8gVbwGWbkoiTGylrLxM7rrTQJXI8SVDr5KPe2i2XFZzqde4uAu bJrOAsoH/XWn1mnfYLdkEZgsP6nbTjJRbp9jd1gBzQVCd6V7ar3skwqSM/v6g8MLAw9YE qKy6ndOaa4XfdwjD9Zi2+ZzBhq0N7TKR7Fa8UNij8yKOXaxFiMWjussnjJzm4/ir01SZr i21YA+3KG8yhm1nbBGcGWDmq1BUnfHW3xwTI+yveAnaYv/CH3PRceR82QlzPaThRxtA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796118370; h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received:Received: Received:From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=N4N3X/bz2fbMOGRtaO3LeMJ9hZ3vYTJKofhsX6470t0=; b=MaDYheTayKdNBKluC9vEeJOMECwl9p+6JHOCuivEZqN35/gY/rqtBAm3ytGH4g8USRlJ BckxcMZcVE3piNnmi3xUMy6r616AweWatihabXuS3IFC8PPaiGCWVRgq8U+WQqAkoJhBJ QPja9Is1xAryyO2ykMaFJFgOimwWqlQ74PBiODiKXs/aAIWt9nKN0tdMOyDW47+I+jQ8n /oZD6WlFPNO5MHoMdnrDWZadcxENnq2+OIjXbm1BJ7vgVQR3HC9+WO/5d5N/Eu5R70Gmm BsVE6a9QiAEUt9gnnE1KwIUs5BixSONOZkYZIVVWUK1tIM3EMqFYY3LsP++L2F74YPQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=realsil.com.cn; spf=pass smtp.mailfrom=realsil.com.cn; dkim=pass header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=avPvorDK; arc=none smtp.remote-ip=211.75.126.72 X-Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C24B606A33C; Tue, 1 Dec 2026 09:46:09 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9C24B606A33C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realsil.com.cn X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realsil.com.cn X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6B19ixpfF4146949, This message is accepted by code: ctloc85258 X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realsil.com.cn; s=dkim; t=1796118299; bh=N4N3X/bz2fbMOGRtaO3LeMJ9hZ3vYTJKofhsX6470t0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=avPvorDKdTYMQ9DOrNZwAOiQsgGg+DjyO3qh5Z4GwgDNVuW2nvsVuCcWhd8DP9oEp fVQfwVqcoY4QlgwJUQEZt72rTsX5C7dUKeE1BBqZ1JVzPizYEsTJHHg/Jb02CBihgH IXH34kkZtGb8X0/hY8mSm0buwgn6BB8re6cjaVUsGqCv19Co98mlu5dAjmB9hkSDI4 QbVzxx+1XeOnucGhq/9j+uWxH0Tb6ujq7CvlggG6L9JGRsXgziCeGhD72KoQAfeiu1 5JczYiX/0iFdJyEPSv+qvYb9ass4yNUDEPEw/4ja1Kpts1Nmpw/1nICp8Wo/AgiYyW U15o1FMhIb8FQ== X-Received: from RS-EX-MBS1.realsil.com.cn ([172.29.17.101]) by rtits2.realtek.com.tw (8.15.2/3.29/5.94) with ESMTPS id 6B19ixpfF4146949 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 1 Dec 2026 17:44:59 +0800 X-Received: from RS-EX-MBS1.realsil.com.cn (172.29.17.101) by RS-EX-MBS1.realsil.com.cn (172.29.17.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Tue, 1 Dec 2026 17:44:58 +0800 X-Received: from 172.29.37.154 (172.29.37.152) by RS-EX-MBS1.realsil.com.cn (172.29.17.101) with Microsoft SMTP Server id 15.2.2562.56 via Frontend Transport; Tue, 1 Dec 2026 17:44:58 +0800 X-CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <daniel@makrotopia.org>, <vladimir.oltean@nxp.com>, Javen <javen_xu@realsil.com.cn> X-Mailer: git-send-email 2.50.1.windows.1 X-In-Reply-To: <20261201094454.1150-1-javen_xu@realsil.com.cn> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list