From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 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== 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== 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 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) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9807F606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=4BVS0GVg 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) 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: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Date: Tue, 01 Dec 2026 09:50:34 +0100 From: Nicolai Buchwitz To: Javen Cc: Andrew Lunn , Vladimir Oltean , 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 Subject: Re: [PATCH net-next v4 3/3] net: phy: realtek: add hardware timestamping for RTL8127a In-Reply-To: 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> <15f473435a41440da45c6d070edc1128@realsil.com.cn> <07ddc9e6-2604-47d4-9e68-eedfaa4ee142@lunn.ch> <43e9de91177b4ffaa7b1c22c45109578@realsil.com.cn> <907fa080-bc18-4c1f-8b52-b06b892cdaa5@lunn.ch> Message-ID: X-Sender: nb@tipi-net.de Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 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