Article View: linux.kernel.netdev
Article #25120RE: [PATCH net-next v4 3/3] net: phy: realtek: add hardware timestamping for RTL8127a
From: Javen
Date: Tue, 01 Dec 2026 09:17
Date: Tue, 01 Dec 2026 09:17
90 lines
13436 bytes
13436 bytes
Hi Nicolai,
>
>Hi Javen
>
>On 1.12.2026 06:50, Javen wrote:
>
>> [...]
>
>> There are two places in ethnl_set_tsconfig() that block it:
>> 1. The entry check returns -EOPNOTSUPP before the provider attribute
>> is even parsed, since there is no ndo_hwtstamp_set(), no default PHY
>> and no hwprov yet.
>> 2. Before switching the provider, the current source is disabled with
>> a zero config through dev_set_hwtstamp_phylib(). With no hwprov and no
>> default PHY it goes to the MAC path and returns -EOPNOTSUPP, as there
>> is nothing to disable.
>>
>> With the change below, the request is only let through when a provider
>> is given.
>>
>> 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;
>
>Looks right. My gate (036778a4fad1) only covered the default PHY, and
>tsconfig_set_hwprov_from_desc() already refuses a NETDEV source without
>ndo_hwtstamp_set, so this can only select a PHY.
>
>>
>> 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,
>>
>> Is this the right way to fix it? If so, I will add it as the first
>> patch of v5.
>
>IMHO yes.
>
>Note that rtl8169_close() disconnects the PHY, and phy_detach() clears
>dev->hwprov. So user space has to select the PHY again after every
>down/up.
>
Thanks for review.
I will add this patch as the first patch of v5.
And thanks for the reminder. I plan to resolve this issue in ptp4l.
Thanks,
Javen
Technical Details
Message-ID:
<43f871d3b77848ca8b82c98b183f8919@realsil.com.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374891-linux-kernel-netdev=dewy.ruReferences:
<20261125090217.1198-1-javen_xu@realsil.com.cn> <20261125090217.1198-1-javen_xu@realsil.com.cn> <20261125090217.1198-4-javen_xu@realsil.com.cn> <20261125090217.1198-4-javen_xu@realsil.com.cn> <awathfkR13ZQH6g9@lxl00025.wbi.nxp.com> <15f473435a41440da45c6d070edc1128@realsil.com.cn> <07ddc9e6-2604-47d4-9e68-eedfaa4ee142@lunn.ch> <43e9de91177b4ffaa7b1c22c45109578@realsil.com.cn> <907fa080-bc18-4c1f-8b52-b06b892cdaa5@lunn.ch> <a25da8faf3a644f7b73f283d1498f858@realsil.com.cn> <d6e37f9025e047d73b684c184673c122@tipi-net.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374891-linux-kernel-netdev=dewy.ru From: javen_xu@realsil.com.cn (Javen) Newsgroups: linux.kernel.netdev Subject: RE: [PATCH net-next v4 3/3] net: phy: realtek: add hardware timestamping for RTL8127a Date: Tue, 1 Dec 2026 09:17:05 +0000 Organization: Usenet Network Message-ID: <43f871d3b77848ca8b82c98b183f8919@realsil.com.cn> References: <20261125090217.1198-1-javen_xu@realsil.com.cn> <20261125090217.1198-1-javen_xu@realsil.com.cn> <20261125090217.1198-4-javen_xu@realsil.com.cn> <20261125090217.1198-4-javen_xu@realsil.com.cn> <awathfkR13ZQH6g9@lxl00025.wbi.nxp.com> <15f473435a41440da45c6d070edc1128@realsil.com.cn> <07ddc9e6-2604-47d4-9e68-eedfaa4ee142@lunn.ch> <43e9de91177b4ffaa7b1c22c45109578@realsil.com.cn> <907fa080-bc18-4c1f-8b52-b06b892cdaa5@lunn.ch> <a25da8faf3a644f7b73f283d1498f858@realsil.com.cn> <d6e37f9025e047d73b684c184673c122@tipi-net.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1672127"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:cVQcjEaPlFyLtSy5byBnurdGVFE= sha256:TXGRgitDvcTXCQraBT5P871xh5L1/AZfeFAz3GvGvPY= sha1:enEgnX2Xdtf4qeiPkfHN3AbY1BM= sha256:PR6I+z9ANXKmJ94TewWTKWNj3D04LvtJeqXo8G74DiE= Content-Language: zh-CN 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 6B9D61172F7; Tue, 1 Dec 2026 12:19:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.151 X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31 tests=[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] 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 CB78zOQw69Jf; Tue, 1 Dec 2026 12:19:07 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374891-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 9B1A81172F4; Tue, 1 Dec 2026 12:18:58 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id E26A827BAD; Tue, 1 Dec 2026 09:18:36 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796116703; b=qMqmazPQuzSKLM/tjSRPulYS8mFEJ/juJwL0dpdziikWoeK2Iomqm/XXHXy8C81RDYm9 +Ftmmhg1NSVa+Mht2zpfskK6tYYQ2Sz2qiBWhiR1r8oay2lQ1H8/wzK6mfeeDQl+GjZIm 2YRoYpEJBStOx7YRxuZrk24LHZyb40ba01J26tH71Jqp8jshwWy8AaGcglJ5zDWyIkbIr B1sac2qWyHTLqkP3sV+uAymleRglXk+r1fAnTjw4bhRFLmnV8n2nOUn7mUu5s2T07YHV+ UrWtNZuXG5Og3174ghaZ0BUFJp7vq7CBmwLJkiSzRPLU1eXLZoH5DUvHDDTkxYsSADQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796116703; h=X-Original-To:Received:DMARC-Filter:X-SpamFilter-By:DKIM-Signature: Received:Received:Received:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language: Content-Language:Content-Type:Content-Transfer-Encoding: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version; bh=J7CmHz+cMVUvq2SdCzrCjOkXKh00iF8mZwrNBAsL+o4=; b=EfRteAsHWXe+157nSQU9gADRe+X3gyXqKpo06NZzafF4Uo+p6D+SFRtIfHAOb0BC0uJT qYoW+3UvAXDfKusHKs+bJIs33EPd8/uSaG/GZwwIVuxJB6T0YcfxZkqvb5fQOs5cyPKzz /ZFPLujiKi1tyRq6d2f3iZTOoeZ5qIjEh/2pRAKQziajVihxQzHNO+/aLFQsPKIA+W1U9 AAB+Fj0JrGJxWSn6e8QfmqVU4J40C3vwKSGkDfaBc5W4HP3t4TRcXPkDI5PJLW3+GHHer 33fqg48rurGdywleQI7p79m7C0LVD/jKfIw+9dUIxpylxGdYpJpmIKDCyIWXLcdzSMA== 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=UJc6CT2S; dmarc=pass header.from=realsil.com.cn; spf=pass smtp.mailfrom=realsil.com.cn; arc=fail 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 933AB606A68C; Tue, 1 Dec 2026 09:18:23 +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=UJc6CT2S 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=1796116702; b=LKBaLlnRaxoPOe9TZRh2SR8fDKqVHZe+KRHE16ldjcJD464nBPHlrLf1XsBrcF+X4fWB 7Cpp7gOheZr4+fANVzT9lPTdgnwbGSPW1ZYfhBVJpX/px2ttPM4iIqTYQC0OT/bhp+ktI oH82eU7mOofLdn+IQM+36WkoqUGc2Poq1sOSbFN6ZmAlyoTgtFPSv6kFIRbaehaRdfcNX egpkdafPaDKriqQDckr9LiN9fEZTmnfyAmAtnHhZbNkstSGb0zJPXoisZ2GkpJW+JmOBk 0IWDKU89Jwj/3MgK85C38El0ywz+y5AFjuiHpLJD5WgbEh76qJB9tXtyhWdtx7X67UQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796116702; h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received:Received: Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID: References:In-Reply-To:Accept-Language:Content-Language: x-originating-ip:Content-Type:Content-Transfer-Encoding:MIME-Version; bh=J7CmHz+cMVUvq2SdCzrCjOkXKh00iF8mZwrNBAsL+o4=; b=rOFMMUonaxRDu91WhAu/2elLvkUDPv4BWbjw+DA9bOr6ErhgxSrXyny3F79aV/v6dWXc 9ds6qSKYap7t/pKqpNLhtQN+2N4Fmb2HjJSx4k0J0WKpqWUhwfdnLXAnHBgPZIPw46I27 G2iCfUmKMUx4Z779ZQ/UmAQ6v08LvNpX+O+6dXv3RDvEndPJeuYHVjS1ykkCwNoLZrqDy 26JX3RKmeRjaIMK36niTUH/gOIec4pA4rx394ItWaIDPBV8v3NMyXOY4i41TVrEFNWekZ oUqJ94J3syeHR/HEN18Bt2FxBjqO2DE7PHCEd6pMO41ohwkEic4lvjPcGRTNLInReqQ== 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=UJc6CT2S; 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 57AEF606A6B6; Tue, 1 Dec 2026 09:18:20 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 57AEF606A6B6 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 6B19H5aJ44134876, 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=1796116625; bh=J7CmHz+cMVUvq2SdCzrCjOkXKh00iF8mZwrNBAsL+o4=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:Content-Transfer-Encoding:MIME-Version; b=UJc6CT2SIrsFzhMKm8U/ChyxIeAWt5WC71i5Jkh2FwrGvLdN5vJT8Rh+jwKH3qWGt RyHNW9W5KTHq+SaGiUwh6hFSLx60+rhcbD3neBvN/RRbFEG6ftqDv/Ad4YSV+g1Wed YXV96WxuQrvRBz8NfcrMkKtHADfITPKAwYIv5X+1flzpH3hbIUl1RkEBOWmalGyD61 0yIVP3UppbCDR9HJFoRi34zi+nAySDoqn9VgCZ8oVC9on6fnejdA/F4eF3Lc9slbN3 inJlMBQxI3T4Oq0h2yrUorUx2ehNEzdNy6zbmR5VzfZmSuwnpSZFJ6GtUPbDvq/sZr 4z7SXQ1KI0Xqw== X-Received: from RS-EX-MBS3.realsil.com.cn ([172.29.17.103]) by rtits2.realtek.com.tw (8.15.2/3.29/5.94) with ESMTPS id 6B19H5aJ44134876 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 1 Dec 2026 17:17:05 +0800 X-Received: from RS-EX-MBS3.realsil.com.cn (172.29.17.103) by RS-EX-MBS3.realsil.com.cn (172.29.17.103) 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:17:05 +0800 X-Received: from RS-EX-MBS3.realsil.com.cn ([172.29.17.103]) by RS-EX-MBS3.realsil.com.cn ([172.29.17.103]) with mapi id 15.02.2562.056; Tue, 1 Dec 2026 17:17:05 +0800 X-CC: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <vladimir.oltean@nxp.com>, "hkallweit1@gmail.com" <hkallweit1@gmail.com>, "linux@armlinux.org.uk" <linux@armlinux.org.uk>, "davem@davemloft.net" <davem@davemloft.net>, "edumazet@google.com" <edumazet@google.com>, "kuba@kernel.org" <kuba@kernel.org>, "pabeni@redhat.com" <pabeni@redhat.com>, "maxime.chevallier@bootlin.com" <maxime.chevallier@bootlin.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "daniel@makrotopia.org" <daniel@makrotopia.org> X-Thread-Topic: [PATCH net-next v4 3/3] net: phy: realtek: add hardware timestamping for RTL8127a X-Thread-Index: AQHdfLusREI69QMHwUie9alKwtUlK7c+iZ7RgAFTcXCAAAKPgIAGGtwwgADrjgCAAM1H4P//rysAgACKXlA= X-In-Reply-To: <d6e37f9025e047d73b684c184673c122@tipi-net.de> X-Accept-Language: zh-CN, en-US 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