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
Subject: Re: [PATCH net-next v18 07/15] net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D
Date: Wed, 02 Dec 2026 23:58:53 +0000 [thread overview]
Message-ID: <179625593322.3146.8283656347914128389@kernel.org> (raw)
In-Reply-To: <72a97f84-770a-45a7-bed6-c0f148767730@yahoo.com>
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
next prev parent reply other threads:[~2026-12-02 23:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1383a67b-15e4-4c76-8bbf-65d3cbfa1fc1.ref@yahoo.com>
2026-12-01 23:48 ` [PATCH net-next v18 00/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-12-01 23:50 ` [PATCH net-next v18 01/15] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-12-01 23:51 ` [PATCH net-next v18 02/15] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-12-01 23:51 ` [PATCH net-next v18 03/15] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-12-01 23:51 ` [PATCH net-next v18 04/15] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-12-01 23:51 ` [PATCH net-next v18 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-12-02 23:58 ` netdev-bot+sashiko
2026-12-01 23:51 ` [PATCH net-next v18 06/15] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-12-01 23:51 ` [PATCH net-next v18 07/15] net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D Mieczyslaw Nalewaj
2026-12-02 23:58 ` netdev-bot+sashiko [this message]
2026-12-01 23:51 ` [PATCH net-next v18 08/15] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-12-01 23:55 ` [PATCH net-next v18 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-12-01 23:55 ` [PATCH net-next v18 10/15] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-12-02 23:58 ` netdev-bot+sashiko
2026-12-01 23:56 ` [PATCH net-next v18 11/15] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-12-01 23:56 ` [PATCH net-next v18 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-12-02 23:58 ` netdev-bot+sashiko
2026-12-01 23:56 ` [PATCH net-next v18 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling Mieczyslaw Nalewaj
2026-12-01 23:56 ` [PATCH net-next v18 14/15] net: dsa: realtek: rtl8365mb: use PCP numbering on family D Mieczyslaw Nalewaj
2026-12-01 23:56 ` [PATCH net-next v18 15/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-12-02 23:58 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179625593322.3146.8283656347914128389@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alvin.sipraga@analog.com \
--cc=andrew@lunn.ch \
--cc=contact@c127.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fabianotassotti@gmail.com \
--cc=gabonpivovich@gmail.com \
--cc=gusfmora@gmail.com \
--cc=kuba@kernel.org \
--cc=kuncy7@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luizluca@gmail.com \
--cc=maxime.chevallier@bootlin.com \
--cc=namiltd@yahoo.com \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox