🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24107

Re: [PATCH v2 2/2] net: phy: motorcomm: add downshift tunable support for YT8531S

#24107
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 09:37
109 lines
11506 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] This patch quietly reverts the fix made by the previous commit
  in the series, "net: phy: motorcomm: return -ETIMEDOUT on BMCR reset…

--

net: phy: motorcomm: add downshift tunable support for YT8531S

This patch adds ETHTOOL_PHY_DOWNSHIFT tunable support for the YT8531S.
The tunable is backed by the Speed Auto Downgrade Control Register (0x14).
The new value is committed with a UTP-space soft reset through
yt8521_modify_bmcr_paged().

> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index ba3421ca4d733..8de87897bcde1 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c

[ ... ]

> @@ -1595,13 +1598,102 @@ static int yt8521_modify_bmcr_paged(struct phy_device *phydev, int page,
>  			if (!(ret & BMCR_RESET))
>  				return phy_restore_page(phydev, old_page, 0);
>  		}
> -		ret = -ETIMEDOUT;
>  	}
>
>  err_restore_page:
>  	return phy_restore_page(phydev, old_page, ret);
>  }

[Severity: High]
Was the removal of ret = -ETIMEDOUT here intended? It undoes the previous
patch in the series ("net: phy: motorcomm: return -ETIMEDOUT on BMCR reset
timeout"). After both patches, yt8521_modify_bmcr_paged() is the same as
it was before the series.

The commit message says the opposite:

    This also relies on the previous fix, which makes the
    helper report a timeout instead of a stale positive BMCR value.

The v2 changelog doesn't mention this change either. Could it be left over
from moving the new functions below the helper?

Without the assignment, if BMCR_RESET is still set after the 500 polls,
ret still holds the last __phy_read() value. That value is positive and
has BMCR_RESET set. It falls through to phy_restore_page(), which returns
it unchanged. The kernel-doc for the helper says it returns 0 or a
negative errno.

The existing callers only check for negative values:

yt8521_modify_utp_fiber_bmcr() {
    ...
		ret = yt8521_modify_bmcr_paged(phydev, YT8521_RSSR_UTP_SPACE,
					       mask, set);
		if (ret < 0)
			return ret;
    ...
}

So yt8521_soft_reset(), config_aneg, suspend and resume again treat a PHY
stuck in reset as success. That is the bug the previous patch was meant
to fix.

> +static int yt8531s_set_downshift(struct phy_device *phydev, u8 cnt)
> +{

[ ... ]

> +	err = phy_modify_paged(phydev, YT8521_RSSR_UTP_SPACE,
> +			       YTPHY_SPEED_AUTO_DOWNGRADE_CONTROL_REG,
> +			       mask, set);
> +	if (err < 0)
> +		return err;
> +
> +	return yt8521_modify_bmcr_paged(phydev, YT8521_RSSR_UTP_SPACE,
> +					0, BMCR_RESET);
> +}

This new caller also hits the problem. It returns the helper's result
directly, so a reset timeout gives a positive value:

ethtool_set_tunable()
  set_phy_tunable()
    yt8531s_set_tunable()
      yt8531s_set_downshift()
        yt8521_modify_bmcr_paged(phydev, YT8521_RSSR_UTP_SPACE, 0, BMCR_RESET)

set_phy_tunable() in net/ethtool/ioctl.c passes that value back from the
ETHTOOL_STUNABLE ioctl, and userspace checks for < 0.

Because the SADCR change only takes effect after the UTP reset, wouldn't
userspace be told the downshift setting was applied when it was not?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125091638.1847020-1-mjkchengke%40163.com
Technical Details
Message-ID: <179594505001.3146.1116683394141107973@kernel.org>
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-373439-linux-kernel-netdev=dewy.ru
References: <20261125091638.1847020-2-mjkchengke@163.com>

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-373439-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 2/2] net: phy: motorcomm: add downshift tunable support
 for YT8531S
Date: Sun, 29 Nov 2026 09:37:30 +0000
Organization: Usenet Network
Message-ID: <179594505001.3146.1116683394141107973@kernel.org>
References: <20261125091638.1847020-2-mjkchengke@163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1141899"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:04W5BByhuuKdmh8ZOKtOiN+dNF8= sha256:VuhbdV3nvHUIRD0JBvuK2Hx9F2OgFm6Zb9eFtSir6G8=
	sha1:O5ULV3AE8WYVnLyFaHPeKH1UKAc= sha256:le/l8xf7k6FMBkpP4/UC75rTns+3e2xsKZ5Ih1C8AN0=
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 48ECF125F98; Sun, 29 Nov 2026 12:37:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org
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 X4Yg9IGm-HDS;
	Sun, 29 Nov 2026 12:37:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373439-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 51B7D125F94; Sun, 29 Nov 2026 12:37:36 +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 E44BF26901; Sun, 29 Nov 2026 09:37:32 +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=1795945052;
	b=vRFTig78uLlpM17caEpFI1CKAm1pcWlpwEC0knW73ycRDMAl6h+rgP4gqPS/m+atWi/s
	 ynTxrrwKBPBZspsqjNlKcLQusvabmTAU48AyqtB9l29dtXq2zeIPcY/730asOwuIfh9yU
	 izfgjsLdII/VGbBHEAeEe+P9Otf7KOUiY5BsepAS1jtV04Pzi2P0/vkOCnlYVvA4kOQBb
	 z+FIsdbhm3UvzCrn3rV6TUfrcru7PZ7R+MCbIuragMFVih++25LRu63mLJ3KmO90M0a1z
	 OKZnqrw8Q42vABZqf5BzwKxQlbj61+Kg6MGIGxOThHEEeNamC9GUtVxin3fjjfuFTHA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795945052;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=lgx43oReKrKNa+FZbvSuM5tKwrJNFH7pOtP/AwIY+vc=;
	b=rUrzbIMj9DBSnAFzh5A1qLyYPtJofljiZlpSgi7OD+EyA/CGhBjtHJvRGvfCxOL3wUCr
	 lMOzgIXLcXlBHYJA83iVKajaW/elxUV3a68j3gTovzR8OktMohoXj36YBaXdoxWvyAGrE
	 4cRIccT8b8KCppF5Gtk9+nXavhJG5mgxeAcwa+ll2hI/W379THWaL6i8iIBeWX1uGZ3BB
	 qirNafxQH2u28RbBZkJzyXyqMpZxgegvPAZYT+o7/5itnHmfAWfSCq5urPzZbWCHClsYw
	 2u3iKumrosGXr+EdkH3tcxaxfOOsHXCVu2EyGMJXKNXML68uWwaw51VUQT1wn8AWf3Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h4OVhz92;
	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 85202606A330;
	Sun, 29 Nov 2026 09:37:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h4OVhz92
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795945051;
	b=wj2Iurxy0KRT/rVPa7QasrapEcCcjYdF5zqIY4XFCVLF4GopVnfk6t31BYtqpXplMCYY
	 KOZ1ud3qEj+5byRV8kc4kC4U7G+6YeMqRzGRFbxXoiECbmonsjPPCOK2R2ABvPLuDLHlU
	 njXeeeV4oQiP3bhaqQzZy97PNwqYxjllczi4n6v+5QVH4gbHX3E9msnGoYf/HYOawwAiU
	 EoNpHGsAon8ToSp6M2Q4zvkbemlW1fhMCCWONS7xpNqR2MnByvFX5hxnMejkPSEKdm5yg
	 srVyZqvd+63ONtsdyUdVJFIkyhaheoXpg8EULuTtVUH1Zf/HsQOt95PiN74MED7AxIw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795945051;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=lgx43oReKrKNa+FZbvSuM5tKwrJNFH7pOtP/AwIY+vc=;
	b=OVI5cKyV5cN+mC7zqM/95gpd4L0WqC0glkEBTmJJZtZBViLtc/cG7qnrXoL9j98Xh9HD
	 ugJTym/gaQ3WKl5xgx0q88jYjusVoiQ6te2oXToZSDtl2K41mTrEpxBm4vBtDehQs7cN/
	 ffofXeGxWhPs2X438qBCwK6d7GaUVvDiUZj8xv9ahsoV342ilOqOHCaBPsnDtwOy197za
	 ys3Tu3FnQqc8NdNpLjTnLkkPp6K6Y5Fp/J5wYQgDZCdYYvVPNR7tovT4/MrVHXe7wa+lm
	 WJuK0YlkT1f1rJOhhu7gsWITcC5qmeNddeNF7MBHPiMM5p4riERZ7KHGQCSo1KVxGlw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h4OVhz92;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(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 A8B4A606A335
	for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 09:37:31 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75ECE1F00898;
	Sun, 29 Nov 2026 09:37:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795945051;
	bh=lgx43oReKrKNa+FZbvSuM5tKwrJNFH7pOtP/AwIY+vc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=h4OVhz92UTsYVaH6NUcyo2L5q+jK5mmLxMfo3Dy6WcmvI1o3Njk8zXvPiStr5thBE
	 BIH6sFfKl0jwB8BUcf5M9cozZ5XeLV6uPDgedaoFH4SozAtzHbFixKzlFXSkJvpZYY
	 w3+6QyqDI1p616s12UmhRoNl/bU36CAsbaySiptaavjKzCniSaoeDYbIYT2GnxkeWm
	 Bbl922wyNnZ9YWiyjkiQWAtPDTtiZgQqVj8u4qJDgBMOAsXaR5e9Lldd8YkKsqJwNS
	 +4afj3xddGrSA3AdxJXp6wnKrIJ19F+wPz/UjiQnl4fmcTO6ixmPKnV1TGOj3orbDs
	 7mzugGMKgGpXw==
X-Cc: Frank.Sae@motor-comm.com, netdev@vger.kernel.org, andrew@lunn.ch,
 hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
 edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
X-In-Reply-To: <20261125091638.1847020-2-mjkchengke@163.com>
X-sashiko-severity: High
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