Article View: linux.kernel.netdev
Article #25091Re: [PATCH net-next v4 3/3] net: phy: realtek: add hardware timestamping for RTL8127a
From: Nicolai Buchwitz
Date: Tue, 01 Dec 2026 08:50
Date: Tue, 01 Dec 2026 08:50
83 lines
11638 bytes
11638 bytes
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,
Nicolai
Technical Details
Message-ID:
<d6e37f9025e047d73b684c184673c122@tipi-net.de>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-374859-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>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-374859-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v4 3/3] net: phy: realtek: add hardware timestamping for RTL8127a Date: Tue, 01 Dec 2026 09:50:34 +0100 Organization: Usenet Network Message-ID: <d6e37f9025e047d73b684c184673c122@tipi-net.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1664731"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:bmy3C1lBqSNzXSTYf/osfS32XvY= sha256:hO9l+Q0ZmCFs1mAiGo1ttWKqWBpX2flDlWxxS2lumPQ= sha1:iDg5xqqwyAu1sNYtGwsrmPQJCd8= sha256:M4XLdSRnwwlH0du5VK3ek2W4O37CsZAc5s4upcMKcz8= 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 58FE01172D9; Tue, 1 Dec 2026 11:51:12 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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 i72ckwZpkyU2; Tue, 1 Dec 2026 11:51:08 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374859-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id D644911729A; Tue, 1 Dec 2026 11:50:59 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id DE16F30A1E; Tue, 1 Dec 2026 08:50:55 +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=1796115055; b=MXZ5hHVh4CSS/EOMGK2CdbeIGQ+rJyI709Ne3hqmVBzpSfjRxTg9Mq8cD/Mw+1BxWZQS AcjAHNUiyJcvn5rGcNAHKu/6YzMv73EHCg4Ga/ZwoXvG7odBC7FE1muv/Sps4j02KLoot 2bGwZy+/YUGAjWHmEP4Vq2lFE/c4G6Hb5LVfo46Yhoqv37TX8iDSEkQgXnO1MkivvkZuq 3qCE1cC+AycCtrs17Ou+95IZgwKF+OK72oHQ0rWW1ziETh6xRpKxWSHbdC0PwJNOJfWjM 7ux4bfjizDV35tpUv2cl14PWZCRKbH5C3byQB8UNpns9oMEzBPHlKysOLxlpaQUxOEw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796115055; 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=wNDQOGAni1JubFArjd6Q1dOiOPTV98EoX0ezYUnEMyI=; b=ifMbLWM04m7A732tHHrPzQBviVUKKYSc2pb9ahVhUmOv4jwKGYFFnmXOGOGmdVQ4vs1F ws/cwOUnm1lmWMF8Ia98R63UGQijhz68Df6k1vvCNzKuy0KvSlQGyPvlhX2hxYy0+Qb00 L2Yx1AFRtuaPJd8CervsQoUTw9ojFivSONJttOLR2fzASYpAeFxdrk6AS5+k/Ifo5JFGT sm8E+8e1oF97fI6Vx25ACPY4XzwB0u8KvxgYG6Q4GliNehYcihqMakvXBxrziUHOiI0gh LnME33sruirqdvGzLNEcJ1CK/j+JfWHjDoTuM1XVP9yP28JnikLy8xDpR3D9E8mxjdQ== 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=4BVS0GVg; 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 B5980606A32D; Tue, 1 Dec 2026 08:50:55 +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=4BVS0GVg 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=1796115049; b=FnIkUZ7PSP0QO0RahiEeVhSuZbq4YNA71q7+1EJyRNsLqes1ifRdWjwuF4Q8yDazhNbS 93KRigAD8OBzwI/zyz97CNsoqV603dqz+ewPydINfFg53GILl5VTJoVGpjg67ZADKy7a6 jVghY4JB/qMa5lLP4eekhB5YmRvRjYKubPv7O5hGfoBCB9ofbrWDojsvTGeOgr1My/R0r Wzs7l6yz51Gl7+KG2Wpj4SfEJkNu1I8T7+ZaRwOhd25Gf3UjhpBKQ6p387LRJSuOHc2Se dykbsUB2ewfMXhzAT/cY/63FyB0cWyLHKpTWYnQfxjYdBpWVBAFWD20AmOlywf0/UKQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796115049; 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=wNDQOGAni1JubFArjd6Q1dOiOPTV98EoX0ezYUnEMyI=; b=VSJ0+2pN+wcz6OJx+bIdUdiFoAqexMvFmxvXsQLj4rJZl3AclmfP04aO5yXvX7guZjSc b2n+LTTH9HW8uyQcv51uMzHbYLwORYmCUoOqc4IaCxDNg5t5gTlyHBP/PwfEtd5asOqm4 wUfe8r4/HmsftFVydTRaM9OZj2r9hNerOG0YFFOzdfrp8UQvZywK9rcEOplaCah7XKhiC w30vCL6ny05MxkIR3LRFZSIDEC3JqjfSrUWvltYiwnNFHPOV5d4SfhAl/iQWgoMnSxW4L 3pLOz/IGE4QB9gaeE+rAA4Sen9evdmphOzP9nl7xSBssR2fY8s4VxL2AGuyf3bjRP/A== 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=4BVS0GVg; 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) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9807F606A31A; Tue, 1 Dec 2026 08:50:48 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9807F606A31A 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 AEC95A012B; Tue, 01 Dec 2026 09:50:34 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1796115038; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=wNDQOGAni1JubFArjd6Q1dOiOPTV98EoX0ezYUnEMyI=; b=4BVS0GVgvm7CnbyK4TAZ4Mr2W4yamfiasUgcCUWRNmPKZJRntC+b97CUk8vlt0W8B0Mpzm Qbkk50OyM0+zLo3jEbtDesWLlffRlSNCEIQJWsnM5T+/ZVARKiG9JQfizrTfd3wTT83Heo PLDtENR3/xOL4ycXsgFeuSjSmzFvqsHzQZCvYjyF2no7UWsgODRsKCMWM7jprLUZjzJrQk 198wGWAAhf195wkEn7nLIToMKkoMr5X8uUXe33UJpu0X/gyJ+4sCOfDr81RMW6Bdlc6ksb WReHAsL1ABj+7AKjEc2x4fPWDPJTUMExy9gOfV5C06Vl8x0oytiZZVk5I/pFBQ== 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 <andrew@lunn.ch>, Vladimir Oltean <vladimir.oltean@nxp.com>, 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 X-In-Reply-To: <a25da8faf3a644f7b73f283d1498f858@realsil.com.cn> X-Sender: nb@tipi-net.de X-Last-TLS-Session-Version: TLSv1.3