From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290523; b=L9XG46NmQAkLz4/dyIoD34NIZqJcTzQVBMFdgWUvtdzMtMGnZN2YCOp8QJK4CkJ4BA5p MlrJydYQ8ySACtQWu04tKAC19REbdty0NtIw4pmkYMOCnw8HuWdrvP92G24/aAM1Ufxtc yQOUkSbOL0OhvG5AejJHVywQLya9auca9Jl7UixJvW5EzhdivXyYc87HxaiXS0hpKS+Ns 01V16CZiM0hiNbuSkqBCiW8eV2QacOdLqfiw1/7ef8jySX1HHNatXNygbU+e8J1G60XdR b6HnntBh6zzcTkCosPLTIKz/9G3Oqt1GimyFB52HKW2gcnx1diJ9ytbDf1xiuC9nRgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290523; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=lBlcWGvwbrDNoKpRxd4ypR5VQ71rNdOOeAJOEzwqVEI=; b=vLq7uPe+RRPUGisOhP8BTb1WfE2yuQ6Xqa7BXZwEjwyGxbXoWgt8uYYuZMMCkl+uv5SS IKHcFO81WrXhT+CQ4WHHrAZ67YMD/Ed5DNxArtNumyN4/HFOtLgxOhI5mSqtDqr6ykkjN o8MLr1QQZbeaYcORyuvC/DsBVhFq8dfrO4fnbLWdhZJsqKB6FrqpBgfoPz0bGYOVoLiun 2eFYtVkP7XFIiV5CQ7TOIPao6b1/zYYmx8fNsxd7ti8ydp1o2ken3tEDrjNCeTnq0PafC bcmrf2caGuB+j9TVpCzqIagKPTx4V/ysdnUaYIQ9wws1nCH8vzASA2/J4aXU9btjo9g== 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=ZmaQ9tVE; arc=none smtp.remote-ip=100.103.45.18 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 64609606A32D for ; Thu, 3 Dec 2026 09:35:23 +0000 (UTC) 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=ZmaQ9tVE Received: by smtp.kernel.org (Postfix) with ESMTPSA id F08D31F00896; Thu, 3 Dec 2026 09:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290523; bh=lBlcWGvwbrDNoKpRxd4ypR5VQ71rNdOOeAJOEzwqVEI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ZmaQ9tVEsTWrFeV3qUZrrJtnlkaQ9+te1SabAFWWSQg3wbFx/cA8YsnKJ946iGmqb TZZnfC/HJUumiDP7v4ZCQUsJAN4DrQmOlmccZvtmzEOP6MwNLIrPoaOL/L2RhfHCwC 1pb2RLTdcA909J9ZTIdmi3ydwJmP22UuDex99wLZP8zngDMxivN2FdhV4N1vDwL8OA YIiIv0nj0m0/vmb6TIuwUZ9yA6qxsC2aoYJ5xQVnd+nbzf4rgpA7V/szsKUL506fPu 12XpUqchaRy3dBpiTppS7HRos9uz8V5oo4Th6N7pQtY63Mst27UjgWC97VjjNU9J32 h7bj1iGJ4xj/Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v6 14/15] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Reply-To: sashiko-reviews@lists.linux.dev To: Prabhakar Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, wsa+renesas@sang-engineering.com In-Reply-To: <20261202093357.15693-15-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20261202093357.15693-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20261202093357.15693-15-prabhakar.mahadev-lad.rj@bp.renesas.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:35:22 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] net: dsa: rzn1-a5psw: tx_allowed conflates admin enable and STP state -- commit 199f37d694278c06a0ad4680d71540126836f14a Author: Lad Prabhakar net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H This commit keeps CMD_CFG.TX_ENA enabled on SoCs that require it, gating port transmission through PORT_ENA.TXENA based on link and port state and pulsing the hardware reset line during probe instead of issuing CMD_CFG.SW_RESET. > diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c > index 03d7f928e3e63..e4fd4425f52ed 100644 > --- a/drivers/net/dsa/rzn1_a5psw.c > +++ b/drivers/net/dsa/rzn1_a5psw.c > @@ -133,11 +133,20 @@ static void a5psw_set_learncount(struct a5psw *a5ps= w, u32 mode) > FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE, mode)); > } > =20 > -static void a5psw_port_tx_enable(struct a5psw *a5psw, int port, bool ena= ble) > +/* Must be called with reg_lock held */ > +static void a5psw_port_tx_update(struct a5psw *a5psw, int port) > { > u32 mask =3D A5PSW_PORT_ENA_TX(port); > - u32 reg =3D enable ? mask : 0; > + u32 reg; > =20 > + reg =3D a5psw_reg_readl(a5psw, A5PSW_PORT_ENA) & ~mask; > + if (a5psw->tx_allowed & a5psw->link_up & BIT(port)) > + reg |=3D mask; > + a5psw_reg_writel(a5psw, A5PSW_PORT_ENA, reg); > +} > + > +static void a5psw_port_tx_enable(struct a5psw *a5psw, int port, bool ena= ble) > +{ > /* Even though the port TX is disabled through TXENA bit in the > * PORT_ENA register, it can still send BPDUs. This depends on the tag > * configuration added when sending packets from the CPU port to the > @@ -146,18 +155,38 @@ static void a5psw_port_tx_enable(struct a5psw *a5ps= w, int port, bool enable) > * This allows to implement STP support when ports are in a state where > * forwarding traffic should be stopped but BPDUs should still be sent. > */ > - a5psw_reg_rmw(a5psw, A5PSW_PORT_ENA, mask, reg); > + spin_lock(&a5psw->reg_lock); > + > + if (enable) > + a5psw->tx_allowed |=3D BIT(port); > + else > + a5psw->tx_allowed &=3D ~BIT(port); > + > + a5psw_port_tx_update(a5psw, port); > + > + spin_unlock(&a5psw->reg_lock); > } > =20 > -static void a5psw_port_enable_set(struct a5psw *a5psw, int port, bool en= able) > +static void a5psw_port_link_set(struct a5psw *a5psw, int port, bool up) > { > - u32 port_ena =3D 0; > + spin_lock(&a5psw->reg_lock); > =20 > - if (enable) > - port_ena |=3D A5PSW_PORT_ENA_TX_RX(port); > + if (up) > + a5psw->link_up |=3D BIT(port); > + else > + a5psw->link_up &=3D ~BIT(port); > + > + a5psw_port_tx_update(a5psw, port); > =20 > - a5psw_reg_rmw(a5psw, A5PSW_PORT_ENA, A5PSW_PORT_ENA_TX_RX(port), > - port_ena); > + spin_unlock(&a5psw->reg_lock); > +} > + > +static void a5psw_port_enable_set(struct a5psw *a5psw, int port, bool en= able) > +{ > + u32 rx_mask =3D BIT(port + A5PSW_PORT_ENA_RX_SHIFT); > + > + a5psw_reg_rmw(a5psw, A5PSW_PORT_ENA, rx_mask, enable ? rx_mask : 0); > + a5psw_port_tx_enable(a5psw, port, enable); > } [Severity: Medium] Does sharing a single a5psw->tx_allowed bitmask between a5psw_port_enable_set() and a5psw_port_stp_state_set() allow one state to overwrite the other? Both callers update a5psw->tx_allowed through a5psw_port_tx_enable(). When a bridged port is in BR_STATE_DISABLED and is brought administratively up, dsa_port_enable_rt() calls a5psw_port_enable() -> a5psw_port_enable_set(a5psw, port, true) without changing the port's STP state (since dp->bridge is set). That sets BIT(port) in a5psw->tx_allowed, so when the link comes up, a5psw_phylink_mac_link_up() -> a5psw_port_link_set() enables A5PSW_PORT_ENA_TX(port) even though the port is still in BR_STATE_DISABLED (remaining enabled while the bridge device itself is down, or until linkwatch and deferred switchdev STP work run). Conversely, when an administratively down port leaves a bridge, dsa_port_switchdev_unsync_attrs() resets its STP state to BR_STATE_FORWARDING via a5psw_port_stp_state_set() -> a5psw_port_tx_enable(a5psw, port, true), setting BIT(port) in a5psw->tx_allowed (and immediately enabling A5PSW_PORT_ENA_TX in hardware when keep_mac_tx_enabled is false) while the port is still administratively disabled. Tracking administrative enable and STP forwarding in separate bitmasks combined in a5psw_port_tx_update() would avoid this. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202093357.1569= 3-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=3D14