From: Javen <javen_xu@realsil.com.cn>
To: Nicolai Buchwitz <nb@tipi-net.de>
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>
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 [thread overview]
Message-ID: <03ae5abf3f8844e68b12f0404281501e@realsil.com.cn> (raw)
In-Reply-To: <ee0e8ff5b792b14d76daefd73359f6f9@tipi-net.de>
>
>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
prev parent reply other threads:[~2026-12-02 8:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:44 [PATCH net-next v5 0/4] net: phy: realtek: add PTP support " javen
2026-12-01 9:44 ` [PATCH net-next v5 1/4] net: ethtool: tsconfig: allow selecting a provider javen
2026-12-01 10:06 ` Nicolai Buchwitz
2026-12-01 10:34 ` Maxime Chevallier
2026-12-01 10:44 ` Nicolai Buchwitz
2026-12-01 9:44 ` [PATCH net-next v5 2/4] r8169: hold MDIO bus lock while loading firmware javen
2026-12-01 10:18 ` Nicolai Buchwitz
2026-12-02 13:17 ` Andrew Lunn
2026-12-01 9:44 ` [PATCH net-next v5 3/4] net: phy: realtek: add PTP clock support for RTL8127a javen
2026-12-01 10:23 ` Nicolai Buchwitz
2026-12-02 8:55 ` Javen
2026-12-02 12:20 ` Nicolai Buchwitz
2026-12-02 13:21 ` Andrew Lunn
2026-12-01 9:44 ` [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping " javen
2026-12-01 10:36 ` Nicolai Buchwitz
2026-12-02 8:30 ` Javen [this message]
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=03ae5abf3f8844e68b12f0404281501e@realsil.com.cn \
--to=javen_xu@realsil.com.cn \
--cc=andrew@lunn.ch \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.com \
/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®