From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=211.75.126.72 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== 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== 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 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) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BE3BC606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realsil.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realsil.com.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=OsF89WtG X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6B28UaLrA817571, This message is accepted by code: ctloc85258 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== 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 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 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 From: Javen To: Nicolai Buchwitz CC: "andrew@lunn.ch" , "hkallweit1@gmail.com" , "linux@armlinux.org.uk" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "maxime.chevallier@bootlin.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "daniel@makrotopia.org" , "vladimir.oltean@nxp.com" Subject: RE: [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping for RTL8127a Thread-Topic: [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping for RTL8127a Thread-Index: AQHdgXihaEYQLeG5/USFqFs+kWjdLrdHdpkAgAH1KCA= Date: Wed, 2 Dec 2026 08:30:36 +0000 Message-ID: <03ae5abf3f8844e68b12f0404281501e@realsil.com.cn> References: <20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-5-javen_xu@realsil.com.cn> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 > >Hi Javen > >On 1.12.2026 10:44, javen wrote: >> From: Javen Xu >> >> 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 >> --- > >> [...] > >> +void rtl8127a_ptp_link_change_notify(struct phy_device *phydev) { >> + struct rtl8127a_ptp *ptp =3D phydev->priv; >> + int ret =3D 0; >> + >> + if (!ptp || !phydev->link) >> + return; >> + >> + mutex_lock(&ptp->lock); >> + /* Restore timestamping in case the PTP block was reset. */ >> + if (ptp->hw_enabled) { >> + ret =3D rtl8127a_ptp_read(ptp, RTL8127A_PTP_CTL); >> + if (ret >=3D 0 && !(ret & RTL8127A_PTP_CTL_EN)) >> + ret =3D __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 =3D container_of(mii_ts, struct rtl8127a_= ptp, >> + mii_ts); >> + >> + info->so_timestamping =3D SOF_TIMESTAMPING_TX_SOFTWARE | > >Please drop TX_SOFTWARE, that's for the MAC to report. > >> [...] > I will drop this in v6. Thanks, Javen