Article View: linux.kernel.netdev
Article #25165Re: [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping for RTL8127a
From: Nicolai Buchwitz
Date: Tue, 01 Dec 2026 10:36
Date: Tue, 01 Dec 2026 10:36
62 lines
10431 bytes
10431 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.
> [...]
Thanks,
Nicolai
Technical Details
Message-ID:
<ee0e8ff5b792b14d76daefd73359f6f9@tipi-net.de>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374942-linux-kernel-netdev=dewy.ruReferences:
<20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-5-javen_xu@realsil.com.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374942-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 4/4] net: phy: realtek: add hardware timestamping for RTL8127a Date: Tue, 01 Dec 2026 11:36:30 +0100 Organization: Usenet Network Message-ID: <ee0e8ff5b792b14d76daefd73359f6f9@tipi-net.de> References: <20261201094454.1150-1-javen_xu@realsil.com.cn> <20261201094454.1150-5-javen_xu@realsil.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1687047"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ghYL08YGLTpQ9UePFzeZbuiWp/c= sha256:2vslu2a3TifANfv8CFFp7zc4Uunxn1LXMH2uGcQAD2Y= sha1:Lk98AhMzwDVTMvxW1NE8v3jNNys= sha256:RmCLcK+jB9cMS9mYJDAQCZHHWgVn18raDyYHKwDk3Bs= 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 4F15111732C; Tue, 1 Dec 2026 13:36:55 +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=tipi-net.de 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 NXrNZp_H6k2Q; Tue, 1 Dec 2026 13:36:48 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374942-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id C29A1117301; Tue, 1 Dec 2026 13:36:39 +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 8D6C726E12; Tue, 1 Dec 2026 10:36:38 +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=1796121396; b=CZRRBnomzdYcCKV+Iwu4XDp9vnexmKYGCl4KooLFdaCYosFJ3wXgT9lA4HigrKYGOO6J Mb1L9RQ1f2sVvQU/9Tc9TIa61flXIjFMYVZkHW3uTXdd9pNXhG2kQ1LnQcC/Rpr67m2OG wv6Xsmel2XcTkXf7QMXH+yjMD1mfmgvqVPEn45YOcrnDbZsmGs5gbBMqw6peEApWRW5dA 0ci+8/Z7kkNZ1WDThItPuWs6/Y4zFjseUR16V6Fv7ecGbifFNvZm4FJS30wU+4DB1ga+8 syyUAPsmf2jnRu4cd6/rk7Kj7QZkNERZsp/KhXLI9WEDF7+hBBgkw/+yvKxrP7pcCig== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796121396; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=vAq9CoFsGG3GXtTVv4fb3tMMoJLXvpud+FmTylKaKrY=; b=reI+OGAkiOXvDOCZdWjb7+3Ifk0ZQFh8ebrhehJ+QcAbRvuUaCc9A2mUl6rXwtQZYMCX /zeo1tAnf4tDcnJzwO+/m3Qm7LkVtd4JR/6DiI6fA4H1n3WdsYthYgR5RoX5Z2Nblo9Yi b/dRkfmVwSiMfLavTLnntYfSXW7wfpSH1lrw1CruDOZ5LtI60sjmjmJo/nWGlLTZItRVG nuHuAKjccMrMRoSJUP+ySdiQ42On5fEJtLll5oBB9keVYxNAPaVKu9Ur8yDQzFPcK5jcR YQmoBcEjxygIF7dRWIIg7npTH+uKlGRB4+ZNN+7SIi25NGllj+KLbiI4fI0NPywjEhg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=q6iD9co8; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; 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 6761E606A327; Tue, 1 Dec 2026 10:36:36 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=q6iD9co8 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796121395; b=2ipQY1paL/DUZ0u4BCr+bpIGgKRkCeOZv/htNCTMwELYe5XMUuA8UeLt1SO2BbizM2p9 nn+pnDQc7yEsNPqW0egbgKeoUocL2I9MM2ex7wrwuWy0ZA6vmRb0b/+1xHyfmJNjG8/n1 RoaRjL4yXQhEUpsBB+TP5vUZlCPwjGraXr9wZcu/t6qVmoXPTKjalymRPYFjFwMgh/Xem /YBBdyHO1SbwOwmyKgkJYW8ki1nzWsj9eFDiBFbd2PjpEhnr1QDrQ4pcvSnWoKeZ9ssWc qJMbV5kIQQ76XWRMyeGANaGemjFYIZW2pV3bLVTIcJRhumhBcQPD3854z8h41JbjNbA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796121395; h=DMARC-Filter:Received:DKIM-Signature:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=vAq9CoFsGG3GXtTVv4fb3tMMoJLXvpud+FmTylKaKrY=; b=yG6dGE4M+MoUmS4oOPqNDag/aV+XqgDdRCe5ZP+znYJDePFP2szcqVPLWui4uVeC9iKF VldkIj8utTn2oQd0AZbBDnCJzjnFwlwcJ8dI4Ei8ytzdWPSTglxG6PoQlERoXxY4InH34 l/3/v2qjvk5qWnzYRAh/luAS3Ln/MIdiv7qyQkirgAqxF3NtxckpFSr4B/OF4ICnB8Xvo Q3xkgwzgroRUDpxREOwdsVeThdAfb7kJTijqDrrDomr9Xsc8kTlwobG9DSLx3b9lPUucP JnlNe4xxduT53sTLVGaC675YRD6usH95igpZiKfSM+wNQHLm4ttQKA5b13Pxz2dBgQQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=q6iD9co8; arc=none smtp.remote-ip=194.13.80.246 X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 124F7606A31A; Tue, 1 Dec 2026 10:36:34 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 124F7606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 06D4DA157F; Tue, 01 Dec 2026 11:36:30 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1796121392; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=vAq9CoFsGG3GXtTVv4fb3tMMoJLXvpud+FmTylKaKrY=; b=q6iD9co8KnBx5QqOcRKXwDDQLe1rd0306OlI8mfhrlvUjREn5vzmSggyTmEWncAP+b6k1k CUTY2NuA83ry8qmjfc/4FiNyKA/Dss1UyORiklkwIYTbVoPndQ28FmKiK/ZEUep2O82SvY mt4iv5IQvkhrJOzf1YVT7wOd1mZVsCm5Y8A2IVVVKJN7vep5eQzkl2fke9YLZOzKJhzRW2 EB+D0lUXoFdehYPEFmY7INRk6XsYrNLa6g/+8T95BBgmZjX32Sci1bpd2spsLnOS4LWBHJ Lw6byI74FlnhxA5QYd9ZQAy1TtxvONwGz4Qi/0ESo3uOB6AjZJ0mbk/KSP470A== 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 X-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 X-In-Reply-To: <20261201094454.1150-5-javen_xu@realsil.com.cn> X-Sender: nb@tipi-net.de X-Last-TLS-Session-Version: TLSv1.3