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=1796116702; b=LKBaLlnRaxoPOe9TZRh2SR8fDKqVHZe+KRHE16ldjcJD464nBPHlrLf1XsBrcF+X4fWB 7Cpp7gOheZr4+fANVzT9lPTdgnwbGSPW1ZYfhBVJpX/px2ttPM4iIqTYQC0OT/bhp+ktI oH82eU7mOofLdn+IQM+36WkoqUGc2Poq1sOSbFN6ZmAlyoTgtFPSv6kFIRbaehaRdfcNX egpkdafPaDKriqQDckr9LiN9fEZTmnfyAmAtnHhZbNkstSGb0zJPXoisZ2GkpJW+JmOBk 0IWDKU89Jwj/3MgK85C38El0ywz+y5AFjuiHpLJD5WgbEh76qJB9tXtyhWdtx7X67UQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796116702; 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=J7CmHz+cMVUvq2SdCzrCjOkXKh00iF8mZwrNBAsL+o4=; b=rOFMMUonaxRDu91WhAu/2elLvkUDPv4BWbjw+DA9bOr6ErhgxSrXyny3F79aV/v6dWXc 9ds6qSKYap7t/pKqpNLhtQN+2N4Fmb2HjJSx4k0J0WKpqWUhwfdnLXAnHBgPZIPw46I27 G2iCfUmKMUx4Z779ZQ/UmAQ6v08LvNpX+O+6dXv3RDvEndPJeuYHVjS1ykkCwNoLZrqDy 26JX3RKmeRjaIMK36niTUH/gOIec4pA4rx394ItWaIDPBV8v3NMyXOY4i41TVrEFNWekZ oUqJ94J3syeHR/HEN18Bt2FxBjqO2DE7PHCEd6pMO41ohwkEic4lvjPcGRTNLInReqQ== 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=UJc6CT2S; 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 57AEF606A6B6; Tue, 1 Dec 2026 09:18:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 57AEF606A6B6 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=UJc6CT2S X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6B19H5aJ44134876, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realsil.com.cn; s=dkim; t=1796116625; bh=J7CmHz+cMVUvq2SdCzrCjOkXKh00iF8mZwrNBAsL+o4=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:Content-Transfer-Encoding:MIME-Version; b=UJc6CT2SIrsFzhMKm8U/ChyxIeAWt5WC71i5Jkh2FwrGvLdN5vJT8Rh+jwKH3qWGt RyHNW9W5KTHq+SaGiUwh6hFSLx60+rhcbD3neBvN/RRbFEG6ftqDv/Ad4YSV+g1Wed YXV96WxuQrvRBz8NfcrMkKtHADfITPKAwYIv5X+1flzpH3hbIUl1RkEBOWmalGyD61 0yIVP3UppbCDR9HJFoRi34zi+nAySDoqn9VgCZ8oVC9on6fnejdA/F4eF3Lc9slbN3 inJlMBQxI3T4Oq0h2yrUorUx2ehNEzdNy6zbmR5VzfZmSuwnpSZFJ6GtUPbDvq/sZr 4z7SXQ1KI0Xqw== 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 6B19H5aJ44134876 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 1 Dec 2026 17:17:05 +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; Tue, 1 Dec 2026 17:17:05 +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; Tue, 1 Dec 2026 17:17:05 +0800 From: Javen To: Nicolai Buchwitz 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 Thread-Topic: [PATCH net-next v4 3/3] net: phy: realtek: add hardware timestamping for RTL8127a Thread-Index: AQHdfLusREI69QMHwUie9alKwtUlK7c+iZ7RgAFTcXCAAAKPgIAGGtwwgADrjgCAAM1H4P//rysAgACKXlA= Date: Tue, 1 Dec 2026 09:17:05 +0000 Message-ID: <43f871d3b77848ca8b82c98b183f8919@realsil.com.cn> 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> 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: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Hi Nicolai, > >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 =3D NULL; >> struct net_device *dev =3D req_base->dev; >> struct nlattr **tb =3D 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 =3D 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 =3D dev_set_hwtstamp_phylib(dev, &zero_config, info->e= xtack); >> - if (ret < 0) >> - goto err_free_hwprov; >> + if (has_hwts) { >> + ret =3D dev_set_hwtstamp_phylib(dev, &zero_config, >> + info->extack); >> + if (ret < 0) >> + goto err_free_hwprov; >> + } >> >> /* Change the selected hwtstamp source */ >> __hwprov =3D 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 for review. I will add this patch as the first patch of v5. And thanks for the reminder. I plan to resolve this issue in ptp4l. Thanks, Javen