Article View: linux.kernel.netdev
Article #25660RE: [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping for RTL8127a
From: Javen
Date: Wed, 02 Dec 2026 08:30
Date: Wed, 02 Dec 2026 08:30
64 lines
12016 bytes
12016 bytes
>
>Hi Javen
>
>On 1.12.2026 10:44, javen wrote:
>> From: Javen Xu <javen_xu@realsil.com.cn>
>>
>> The PTP block of the RTL8127a internal PHY also timestamps PTPv2 event
>> messages over UDP in both directions. Register a mii_timestamper for
>> it, so the PHY can provide hardware timestamps without any support
>> from the MAC driver.
>>
>> The timestamps are read out over MDIO, which may sleep, so this is
>> done from the PTP aux worker. Received packets are queued until their
>> timestamp has been read, transmitted packets are completed once the
>> hardware reports their timestamp.
>>
>> The hardware only keeps the most recent timestamp per message type and
>> direction and does not record the sequenceId. Hence only one TX
>> timestamp can be pending at a time, it is dropped if nothing arrives
>> within 15 seconds, and an RX timestamp may be overwritten by a later
>> message of the same type before it has been read.
>>
>> Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>
>> ---
>
>> [...]
>
>> +void rtl8127a_ptp_link_change_notify(struct phy_device *phydev) {
>> + struct rtl8127a_ptp *ptp = phydev->priv;
>> + int ret = 0;
>> +
>> + if (!ptp || !phydev->link)
>> + return;
>> +
>> + mutex_lock(&ptp->lock);
>> + /* Restore timestamping in case the PTP block was reset. */
>> + if (ptp->hw_enabled) {
>> + ret = rtl8127a_ptp_read(ptp, RTL8127A_PTP_CTL);
>> + if (ret >= 0 && !(ret & RTL8127A_PTP_CTL_EN))
>> + ret = __rtl8127a_ptp_hwtstamp_enable(ptp, true);
>
>phy_detach() clears dev->hwprov on down/up, so the PHY is no longer the
>selected after that. Should this still turn timestamping back on?
>
>> [...]
>
>> +static int rtl8127a_ptp_ts_info(struct mii_timestamper *mii_ts,
>> + struct kernel_ethtool_ts_info *info) {
>> + struct rtl8127a_ptp *ptp = container_of(mii_ts, struct rtl8127a_ptp,
>> + mii_ts);
>> +
>> + info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
>
>Please drop TX_SOFTWARE, that's for the MAC to report.
>
>> [...]
>
I will drop this in v6.
Thanks,
Javen
Technical Details
Message-ID:
<03ae5abf3f8844e68b12f0404281501e@realsil.com.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375633-linux-kernel-netdev=dewy.ruReferences:
<20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-5-javen_xu@realsil.com.cn> <ee0e8ff5b792b14d76daefd73359f6f9@tipi-net.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375633-linux-kernel-netdev=dewy.ru From: javen_xu@realsil.com.cn (Javen) Newsgroups: linux.kernel.netdev Subject: RE: [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping for RTL8127a Date: Wed, 2 Dec 2026 08:30:36 +0000 Organization: Usenet Network Message-ID: <03ae5abf3f8844e68b12f0404281501e@realsil.com.cn> References: <20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-5-javen_xu@realsil.com.cn> <ee0e8ff5b792b14d76daefd73359f6f9@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="1923321"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Sq9DqTFp4a1dbTP9kH9s997reyQ= sha256:0pWa9IMOjoqf6HsboODQ3xqV6b0/v8bOkHR4d6uMvew= sha1:tAlXQVWYImFIYuUEG0s9p3AcK+8= sha256:BsOJRg67noyNGuSMNjN13VihUFq9DqtVnwV/ww/j+Po= 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 DD5991175A4; Wed, 2 Dec 2026 11:32:33 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 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, 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 sN7Se6NfBE1s; Wed, 2 Dec 2026 11:32:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-375633-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id DDBB211757C; Wed, 2 Dec 2026 11:32:20 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id CAB8960186E; Wed, 2 Dec 2026 08:32:19 +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=1796200336; b=Ru491q8/+0b4Nh8MFPCfxDrz8bz/e6gnPke5+IMj8iMnz12R/GzCMMlzfo3xtHmSnkA0 /aR0sO7olMyBqnIcvrZZG8eelas5hOMWgPJJfKvc+vmiF2NRYXmjLlUH3IJ3ccXxZ5Xbm /ExGsiyvd4wpjXb8wMo6X7qVoOpB8nFhSjWiBdO3lozivIdGmTLaTVwt3laa7Oez3onyz T2EJWIP35czZaD8kBzbvVfm/NWFAw5/aduiynQC6I6ehNTw1ZVwzTO0iBTqhZoJkgm+8q Q61vMy5Q3wbYYiMtVNLfJkb9k9ie0kWJcQ8JAtUinR0you2ff+nB/F7LawGxptkgbMw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796200336; 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=wQVDq620AMyviF5im9U0N5DhPQaES5BB7HlhdpM2Elo=; b=Pi9WunIirt5IXWpxCuM6Wi/88Be/THQs7RWqs9h9jJIbxrTuCL9+LrguFZdXxEzTyU32 4/LPY+CX/tcQinK3erwaqCHdyleNTg3jk4sB+izhlNTkVfWP3l7EF72R/k7c2O0J11jJ1 OUpCBihjpGqwXAUdwa9jrHPT/mx435BVmgzABDOAHIm7tSdLVl7bqkkmrR3ydv+bnptI5 42m9FvSTOzEdKl36dEBvfRf4BLZ98SEFxqasptGJCi8xWaYhdUNUtLQTMB07UajvnOHcd 3JbNyAJki9AZTpCMm/Fr/NE9k23mMQ78rU8XQTZ/2E9DpBVHJvyQTC/43KrDgAEDtKA== 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=OsF89WtG; 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 8481B606A329; Wed, 2 Dec 2026 08:32:16 +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=OsF89WtG 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=1796200335; b=rY6FOSQSigkB2XE/7nvsoT2FCN+xC3vJNULBsF4f0y/S+Nk95914wKcttV7r1vdUBXTF w/StLn5Ql0Ko5q9OlFT4ty6zyIjpFCR8Q70q4m49q3bWN6AnIuUPvBkdPMCgIyyjcVDvQ KaEnRcbIb4U1wMeg6FogxOQJu7SvAMLNx4nMWYq9YOrh5VD169Myg7oF5oGUzzFeLxisN k//+Q6YgaRo+Cl4Z/w6D3sQ0XPMV7JHmIObfScrDPsmpw3aIB7EKvhAcKLp27fPp3zS9A g6cS7is2KYp/g0qhChKh6xrZa4gkpOW1FVFB9AKKPkJ6GiLStbQFkK3KTIz4IzPPKmA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796200335; 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=wQVDq620AMyviF5im9U0N5DhPQaES5BB7HlhdpM2Elo=; b=SDwA9lnW5ByKMnj4VMIN8G/1NNwqJLhbzTKpSR4DCqWcsBZ7vxc8bFthIeMDd7lpcwuj F2Q8h8mrJpTut8sV6zusd/Bejocb2yrZRYiwSJU3DEWBAUK//4YuuvgJLvxuiu1xIrGz7 IgOolQBP+0a1nLMSXaRwiUPz0ri/V0UZHhs1Gp/hix3bottQrn/7w91WhSEexW2fOJ03b F5xJ3iLJk9yuFOyDoXuuQYWFvUR9tl02NmVWZkvPOmvbIhbr7Qy1ctYmYk2dFuwwwmo43 ep/xM79+m+1itm8rKgCL60riXDeUNuTFP5Ua8A5sXU5mf5uoNlfIZL0Pahx0Eed+fmw== 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=OsF89WtG; 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 BE3BC606A31A; Wed, 2 Dec 2026 08:32:14 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BE3BC606A31A 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 6B28UaLrA817571, 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=1796200237; bh=wQVDq620AMyviF5im9U0N5DhPQaES5BB7HlhdpM2Elo=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:Content-Transfer-Encoding:MIME-Version; b=OsF89WtGvPMxDaCqK2pgdQAS9xRvk7jQ/rq7VspqgzK+DTQeNDXLScjfBoFOoumpa aIFV0hgiLeZpGmKUBnAbNbF8Q1ztPLi52PBFUYBaFLO0+BB7r3PEz9SRIhbVNGzukA tORj2iOtC8jqDobs/fuwM8TCNhn+36xNsf0Q/Lj8VisnsST6XU0egtVwHJnfBYxI/3 IWTgeH6BtJ12K5c5ik0WF2jwxb5wZvTSNivLgDqogEuj4dyoEsnCRz/v8xGmNFe9Ov raNjc3NaJBUgnJTzXhnBn/jBTwFm0IdW3f5rKDNuPpV1KIfIuRAlVmqjyE5XqEkRLh vB0DuLIknuVGg== 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 6B28UaLrA817571 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 2 Dec 2026 16:30:36 +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; Wed, 2 Dec 2026 16:30:36 +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; Wed, 2 Dec 2026 16:30:36 +0800 X-CC: "andrew@lunn.ch" <andrew@lunn.ch>, "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>, "vladimir.oltean@nxp.com" <vladimir.oltean@nxp.com> X-Thread-Topic: [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping for RTL8127a X-Thread-Index: AQHdgXihaEYQLeG5/USFqFs+kWjdLrdHdpkAgAH1KCA= X-In-Reply-To: <ee0e8ff5b792b14d76daefd73359f6f9@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