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=1796255935; b=mSLBn79n9DmKDIm7uTBUOykJedup478Y6PRNN0FdJWK5b5V0ZzM4nDXwJ/M9l9SEn5wv cergns76I0V3TCUydYVqjb3OnZeYoSpV6wE/TbpjJpDf3YB0LT4AiglBlaHXzZ69FEUgY JwLcJqFAC+gfMRaGuxjifxkI33oHJ1FRzTh9Bg1ueJzNtUd/sVyxQsGGwp99dTJeRqxRQ KBALFcyGIPOGvvGQ9XrDFdd0u5ESsS7WYcXMcRhSSSv5V20rkSjcZH20/dIkYhwAn+qkw RsT0769LnD+z1+V69WQoPUjVya2ynFsg/S9ndVQYBmC4+UjAF3skwpcfto4mdRWrvDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796255935; 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=leuUrmO05l0SdC32ppY1st3huc/D9i7xa6jkorZOXFA=; b=SsehcaqcCUdcToPzg3Tt0ACg2xE6qrR2sNBoHICgpbFBkojvhI8pJyz1QJejRwdlp5Yr j4cQUWcLIK2uaX7iUi1ACuute+pSGUQLMASFGNY54Y3LLEy/K5yvLFzOUPvYxAk2cN9zs 4Euen46R+t1SIRwDRPNdQ8d4s9ndTy1Dq/mC8AGOjth1FC6pRXPAoVjE5cDfiKeaduW0u UvmQm/edj7l+N5mTD83mtuGXTPkQJHXk4yaXKf+vCIYQzbPYtsDPoVgHPk2z9Dk7uiAlq jj657yGUVIBmJwP4J3XLi/ztmB2ifSeexxTZS7g494rH3w7OsS98JtUB0oHT4JLwt+w== 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=JVBn0cBH; 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 2863E606A330; Wed, 2 Dec 2026 23:58:54 +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=JVBn0cBH Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D571F00893; Wed, 2 Dec 2026 23:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796255934; bh=leuUrmO05l0SdC32ppY1st3huc/D9i7xa6jkorZOXFA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JVBn0cBHkkb8h/vrPRvWYdoNv+a5W6sguLoDaaIXr5JNr4leD7caQxZyods2GPYAL O89ndUDZ9qVO+bmnDvItfh1COdhia64SpIGTOxMdN8TXJg51PE0wEmdg9cpXY061yx AO5+0HniAf1GbhIkULAhXfPGvwSQy8NRMOKjPZ+YNkn1/eGGa4Wymxl/R5U9koUmRv 58w4PY0KPqhEXKWrIS3m7QFSJPy0CppPaIpiTDPW7f0Raid/oa1uKU350ScDcrIr6y vTQP6hEPNyDzjZdAxWaC6OdIMX7bwO98kO2PS/kcCHubTdETQZ/VQc2suYSOIhWtb3 CkYgNOf/Ftijg== Subject: Re: [PATCH net-next v18 07/15] net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D From: netdev-bot+sashiko@kernel.org To: namiltd@yahoo.com Cc: linusw@kernel.org, andrew@lunn.ch, olteanv@gmail.com, kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, linux@armlinux.org.uk, luizluca@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alvin.sipraga@analog.com, gusfmora@gmail.com, kuncy7@gmail.com, fabianotassotti@gmail.com, gabonpivovich@gmail.com, contact@c127.dev, o.rempel@pengutronix.de Date: Wed, 02 Dec 2026 23:58:53 +0000 Message-ID: <179625593322.3146.8283656347914128389@kernel.org> In-Reply-To: <72a97f84-770a-45a7-bed6-c0f148767730@yahoo.com> References: <72a97f84-770a-45a7-bed6-c0f148767730@yahoo.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message says the rewrite is 'a separate function, rtl8365mb_d_vlan_4k_set_ivl(), so that an error path can do a best-… - [Low] When a 4K entry read or write fails partway through rtl8365mb_d_vlan_4k_set_ivl(), the rollback loop restores IVL_EN on a… -- net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D This patch adds two-word 4K VLAN table pack/unpack helpers for family D. On family D, IVL_EN now follows a switch-wide policy: IVL while any user port is VLAN filtering, SVL otherwise. A vlan_4k_used bitmap records the populated VIDs, so a vlan_filtering flip rewrites only those entries and then flushes L2 on every user port. > diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.c b/drivers/net/dsa/realtek/rtl8365mb_vlan.c > index 566c6bc1449af..2f2a1b21e6b2d 100644 > --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.c > +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.c [ ... ] > @@ -277,6 +325,133 @@ int rtl8365mb_c_vlan_4k_write(struct realtek_priv *priv, [ ... ] > +int rtl8365mb_d_vlan_4k_set_ivl(struct dsa_switch *ds, bool want_ivl) > +{ [ ... ] > + for_each_set_bit(vid, priv->vlan_4k_used, VLAN_N_VID) { > + ret = fi->vlan_4k_read(priv, vid, &vlan4k); > + if (ret) > + goto rollback; > + if (!vlan4k.member || vlan4k.ivl_en == want_ivl) > + continue; > + > + vlan4k.ivl_en = want_ivl; > + ret = fi->vlan_4k_write(priv, &vlan4k); > + if (ret) > + goto rollback; > + } > + > + dsa_switch_for_each_user_port(dp, ds) > + rtl83xx_port_fast_age(ds, dp->index); > + > + return 0; > + > +rollback: > + /* Best effort: restore IVL_EN on the entries rewritten so far (without > + * flushing L2 entries). IVL_EN is switch-wide, so before the scan > + * every entry in use had the old value (!want_ivl) and every entry > + * below @failed that now has want_ivl was rewritten above. The entry > + * that failed is included: its write may have reached the chip before > + * the error was reported. > + */ > + failed = vid + 1; > + for_each_set_bit(vid, priv->vlan_4k_used, failed) { > + if (fi->vlan_4k_read(priv, vid, &vlan4k)) > + continue; > + if (!vlan4k.member || vlan4k.ivl_en != want_ivl) > + continue; > + vlan4k.ivl_en = !want_ivl; > + fi->vlan_4k_write(priv, &vlan4k); > + } > + return ret; > +} [Severity: Low] What happens if a read or write fails inside this rollback loop? The result of fi->vlan_4k_write() is ignored, and an entry whose read fails is skipped. Either way, that VID can keep the new IVL_EN value. The error is then returned up this path: rtl8365mb_port_vlan_filtering() rtl8365mb_d_vlan_4k_refresh_ivl() rtl8365mb_d_vlan_4k_set_ivl() DSA keeps the old vlan_filtering state, so rtl8365mb_d_want_ivl() reports the old policy while that VID uses the new learning key. The rollback path also does no flush, so dynamic entries learned under the temporary key stay in the LUT. This needs a second management bus error during the rollback, and it seems to correct itself: - rtl8365mb_vlan_4k_port_set() recomputes ivl_en on the next membership change for that VID. - The next real flip skips entries already at the target value and flushes all user ports. - The stale learned entries age out. The code comment and the commit message also call this best effort. Would it make sense to at least log a per-VID rollback failure here, so that a diverging entry is visible? > diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.h b/drivers/net/dsa/realtek/rtl8365mb_vlan.h > index 009b12777505c..f6230eb931ef1 100644 > --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.h > +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.h [ ... ] > @@ -43,4 +47,9 @@ int rtl8365mb_vlan_4k_port_del(struct dsa_switch *ds, int port, > int rtl8365mb_vlan_pvid_port_set(struct dsa_switch *ds, int port, u16 vid, > struct netlink_ext_ack *extack); > int rtl8365mb_vlan_pvid_port_clear(struct dsa_switch *ds, int port, u16 vid); > + > +bool rtl8365mb_d_want_ivl(struct dsa_switch *ds, int port, bool filtering); > +int rtl8365mb_d_vlan_4k_set_ivl(struct dsa_switch *ds, bool want_ivl); [Severity: Low] The commit message says: The rewrite itself is a separate function, rtl8365mb_d_vlan_4k_set_ivl(), so that an error path can do a best-effort restore of the previous IVL_EN values (only the internal rollback loop skips flushing L2 entries). Is this accurate? The only caller of rtl8365mb_d_vlan_4k_set_ivl() is rtl8365mb_d_vlan_4k_refresh_ivl() in rtl8365mb_vlan.c. The only restore is the rollback loop inside rtl8365mb_d_vlan_4k_set_ivl() itself. Neither error path in rtl8365mb_port_vlan_filtering() calls it: not the undo_egress_mode path added here, and not the undo_pbfid path added later in the series. Neither rtl8365mb_d_vlan_4k_set_ivl() nor rtl8365mb_d_want_ivl() is used outside rtl8365mb_vlan.c anywhere in the series. Could they be made static and removed from this header? Otherwise, could the commit message be updated to match the code? > +int rtl8365mb_d_vlan_4k_refresh_ivl(struct dsa_switch *ds, int port, > + bool filtering); > #endif /* _REALTEK_RTL8365MB_VLAN_H */ -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/1383a67b-15e4-4c76-8bbf-65d3cbfa1fc1%40yahoo.com