🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21482

Re: [PATCH net-next v5 22/24] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H

#21482
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 02:26
100 lines
11987 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · 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).

- [Medium] This patch's stated invariant for keep_mac_tx_enabled SoCs
  (RZ/T2H, RZ/N2H; the next patch, "net: dsa: rzn1-a5psw: Add support…

--

net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H

On SoCs with keep_mac_tx_enabled set, this patch stops clearing
CMD_CFG.TX_ENA and gates port transmission through PORT_ENA.TXENA
instead. The TXENA bit is computed from both the STP/admin state and
the link state. CMD_CFG.SW_RESET is no longer written during setup, and
the probe path pulses the switch reset line instead.

> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 751d03b0bde4c..86d5b9d52f8db 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c

[ ... ]

> @@ -996,9 +1037,22 @@ static int a5psw_setup(struct dsa_switch *ds)
>  	dsa_switch_for_each_port(dp, ds) {
>  		port = dp->index;
>  
> -		/* Reset the port */
> -		a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port),
> -				 A5PSW_CMD_CFG_SW_RESET);
> +		/* Gate TX on link state only for user ports */
> +		if (!a5psw->of_data->keep_mac_tx_enabled || !dsa_port_is_user(dp))
> +			a5psw->link_up |= BIT(port);
> +
> +		/*
> +		 * Writing CMD_CFG = SW_RESET also writes TX_ENA as 0, which
> +		 * must never happen on some SoCs. Their switch is reset through
> +		 * its reset line in probe, so the statistics are already
> +		 * cleared; only disable the MAC receive path.
> +		 */
> +		if (a5psw->of_data->keep_mac_tx_enabled)
> +			a5psw_reg_rmw(a5psw, A5PSW_CMD_CFG(port),
> +				      A5PSW_CMD_CFG_RX_ENA, 0);

[Severity: Medium]
Where does TX_ENA actually get set on these SoCs before the first link-up?

The new reset pulse in a5psw_probe() puts every CMD_CFG register back to
its hardware reset value:

	ret = reset_control_reset(reset);

This branch then clears only RX_ENA. TX_ENA keeps whatever value the
reset default gives it.

The only code that writes TX_ENA=1 is the full register write in
a5psw_phylink_mac_link_up():

	a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(dp->index), cmd_cfg);

Unused ports never get there. User ports get there only after their
first PHY link-up, and the CPU port only after its fixed-link comes up.

If the RZ/T2H / RZ/N2H reset value of TX_ENA is 0, would unused ports
keep TX_ENA=0 permanently, and user ports keep it at 0 until their first
link-up? That would contradict the invariant this patch is meant to
enforce. The old SW_RESET path in this same loop wrote TX_ENA=0
explicitly, so the register does accept 0 there.

The following patch in the series ("net: dsa: rzn1-a5psw: Add support
for RZ/T2H Ethernet switch") sets .keep_mac_tx_enabled = true in
rzt2h_of_data, and this behaviour is still present at the end of the
series.

Would something like this set the bit regardless of the reset default?

	a5psw_reg_rmw(a5psw, A5PSW_CMD_CFG(port),
		      A5PSW_CMD_CFG_RX_ENA | A5PSW_CMD_CFG_TX_ENA,
		      A5PSW_CMD_CFG_TX_ENA);

> +		else
> +			a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port),
> +					 A5PSW_CMD_CFG_SW_RESET);
>  
>  		/* Enable only CPU port */
>  		a5psw_port_enable_set(a5psw, port, dsa_port_is_cpu(dp));

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120002549.1908299-1-prabhakar.mahadev-lad.rj%40bp.renesas.com
Technical Details
Message-ID: <179548718931.3135.3714317987961155691@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369966-linux-kernel-netdev=dewy.ru
References: <20261120002549.1908299-23-prabhakar.mahadev-lad.rj@bp.renesas.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369966-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 22/24] net: dsa: rzn1-a5psw: Keep MAC TX
 enabled on RZ/T2H
Date: Tue, 24 Nov 2026 02:26:29 +0000
Organization: Usenet Network
Message-ID: <179548718931.3135.3714317987961155691@kernel.org>
References: <20261120002549.1908299-23-prabhakar.mahadev-lad.rj@bp.renesas.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4034565"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:a3Cx+fjnoP4DRWEIHayBvAMz6PU= sha256:/wMjX3sH4H9slO/9iQUIi9bFF0FvyGO3UPSOZp6ctjI=
	sha1:4R/XntOIly49uziXsANVgpvKW48= sha256:7koHGO3Wbl4iGLiKRm9iaPZPlZnbViRQbzZVn3d4hb8=
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 E506D125DC7; Tue, 24 Nov 2026 05:26:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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 ERcB2GKEIKuu;
	Tue, 24 Nov 2026 05:26: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-369966-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 E0DDD125DCB; Tue, 24 Nov 2026 05:26: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 AD69626DAE; Tue, 24 Nov 2026 02:26:37 +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=1795487197;
	b=B84uyKeu2EzTi5q8eiGN4Mqx9474yzW/jFArHt4hWxljUZMYu2TlRy7092tpgfGxl3GG
	 4xLhKDNLgATpYoKNkjyfF6Qhw2ZAg3et7zSz6zochARzU3mwQ/DSPJKtSEf/CBXAfh9ng
	 h0y39QWrikBXjk+WbyJ5vm5BJhxyvuKfh4RYGN2aEh+Gn3qQVBZhH8qzRtuUiLzYiU3Ol
	 RAMiQzjHDnc4qlcI3VGL4Couo0chmNCB/F+pOLHqJjCUoMsfGvWVylQFtl9p8FcUqbOvF
	 NkbaaT2txSxk1/IiMWJ03nSnzpagP3pV+8IDcfxV2kPI0FPIbvXmdy2kJL9qtqtC/dQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795487197;
	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=mmliaB+t5y87KpSlRozX2kcKHmFURkapiqmxRlQLekI=;
	b=G7lUpVNpLk3TeEcM3/XpoUTSJMxP4B7joQisfX+cA9keaikmO7NeuEGRIz9Ebl0p/WQ4
	 0ekh5CHLRY6fY4ifSIobNe3SHJdm00xM21nKy+4YVH/KNUectV/dmbqgmUn0zpnQJGlvC
	 dcFr9z8OaoCSOfDWtjYe+tzlJoo3FF02XOBGjt2tRmn/8Mw1gibpudSMZYcm9cn82Bl+p
	 JHTt30e8ll/n7F1EsXbd4aZ4x+/plS+7yFNY+eIgFejWx+CV4WHzDd/gPZV8YhrLmVhNr
	 CmFbNDEpgLkvjiGlxcHiJbMLJjGx/rRS5dwBNyfVjkeg1thN8ZRGic7bRQs9GFrKkjA==
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=RES45+72;
	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 7436B606A32A;
	Tue, 24 Nov 2026 02:26:37 +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=RES45+72
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=1795487191;
	b=wHAhHkJ5D4Nq57eXE4x7W4/yMiv9b0vH13WusfXXxtV6RfpzYrlqW8h+POsl3cusAnvo
	 EK6s68XbSVXnljIikSzk4059PyKBZZ/GaqAmJpkqh7ODcsAdqmvaNVkt1OxRzw7Fcb3V3
	 lmLYf/jACF4qpz81CIN2msChGb3mlYE0+lpS1QuPceJpa9zKF4oHUD5fNUBeCe7PkhrJx
	 PgrccCDJVkcGD+NjDyOj5hamf0q9kE4DU2uefSezcbyoKuzi4v+jBz4eypH/GXE+uslGK
	 5nPtjuCq69aqmNgA+v6KJecH0JHJwnmCWklKGPNM9diNQ3wO0MAd2cg02tLmdYEzgBQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795487191;
	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=mmliaB+t5y87KpSlRozX2kcKHmFURkapiqmxRlQLekI=;
	b=WNETkZ+duxK2uh7fLv9Gd8+/eIxhGeMZ8gVI/i9YZUxY/XDZ3S6Bf6HVd6u8PuW3myv9
	 mu6XVFlPjg4Jfxn/pjHgTwKoi88YY1qQbf6IJH7SxguoWNPpc/eDXJrvLphxFumTaQGhU
	 CZVjIRxfy6f992nSsHCnrXXfNFbfcP5RKMrKJKmZ7LZUn7WehySk4jcPAEunkc3eZ8zfG
	 6u/7Nr/F/1tPOr/ZWa2XSPogk5MYGHNl0eMc85Nt0xur4nCXfjEut7bRC4Xu3Hnf74CEN
	 fGkMQwxssBsL4KSj3bpJ0TDJP0ODMcOXo9JVLxa8FLPEUYcKU5BzkMgqWhmIS4qjIAw==
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=RES45+72;
	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 91417606A326;
	Tue, 24 Nov 2026 02:26:31 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B90DC1F000CA;
	Tue, 24 Nov 2026 02:26:29 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795487191;
	bh=mmliaB+t5y87KpSlRozX2kcKHmFURkapiqmxRlQLekI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=RES45+72ZngxLJ4XAQacbxAYPHtbrDv7CBl2zU+BMUM/ZBBnkUxmRc7FNtShRtbhi
	 Di0y5qub/E2dZ1RepjAHQzPEIaGLqBL9w/3kKU3sZkjwlLG0L1Z7/dkvkdpHM0VJhO
	 gSNRkWfliFxdsrvM2SZ4Ipegj5GBXQ1ulVn0VLN6+V2Wy4g+EZaiqABn68dSeIR8aa
	 rnZq21PWwX3ASYUXjuQKTa1Yx4m3cVhOV83U+DUlvR+JiId7TiipHw+7DHq4HLccy2
	 le1vJE/SUCgyVFWuha+BsLBihNq/vSE05olF9vfwRmnPYkpIshbRLD0Vtug59+DwES
	 p2UG1tGY7M99A==
X-Cc: clement.leger@linux.dev, andrew@lunn.ch, olteanv@gmail.com,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
 hkallweit1@gmail.com, linux@armlinux.org.uk, horms@kernel.org,
 p.zabel@pengutronix.de, geert+renesas@glider.be, magnus.damm@gmail.com,
 f.fainelli@gmail.com, ralph.siemsen@linaro.org,
 linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org,
 devicetree@vger.kernel.org, prabhakar.csengg+renesas@gmail.com,
 biju.das.jz@bp.renesas.com, fabrizio.castro.jz@renesas.com,
 prabhakar.mahadev-lad.rj@bp.renesas.com
X-In-Reply-To: <20261120002549.1908299-23-prabhakar.mahadev-lad.rj@bp.renesas.com>
X-sashiko-severity: Medium
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