Netdev List
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH net-next v11 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
Date: Thu, 19 Nov 2026 22:36:30 +0000	[thread overview]
Message-ID: <179512779012.3136.12590210308172981547@kernel.org> (raw)
In-Reply-To: <7edbdf93-91e1-4dd1-9ecf-35863cecc277@yahoo.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

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

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] rtl8365mb_d_vlan_4k_refresh_ivl()
  (drivers/net/dsa/realtek/rtl8365mb_vlan.c) does not roll back when it…
- [Low] When the switch-wide IVL state flips,
  rtl8365mb_d_vlan_4k_refresh_ivl()…

--

net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D

This patch adds two-word CVLAN pack/unpack helpers for family D in the
rtl8365mb driver. On family D, IVL_EN is set only while at least one user
port is VLAN filtering. When a vlan_filtering change flips the
switch-wide state, rtl8365mb_d_vlan_4k_refresh_ivl() rewrites IVL_EN in
the active 4K entries.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.c b/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> index 566c6bc1449af..f3ac2940a0ed4 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.c

[ ... ]

> @@ -277,6 +323,96 @@ int rtl8365mb_c_vlan_4k_write(struct realtek_priv *priv,

[ ... ]

> +/* Must be called with &priv->vlan_lock held. */
> +int rtl8365mb_d_vlan_4k_refresh_ivl(struct dsa_switch *ds, int port,
> +				    bool filtering)
> +{

[ ... ]

> +	fi = rtl8365mb_get_family_info(priv);
> +
> +	for (vid = 1; vid < VLAN_N_VID; vid++) {
> +		ret = fi->vlan_4k_read(priv, vid, &vlan4k);

[Severity: Low]
How long does this scan take on real hardware? Each of the 4095 iterations
is a full rtl8365mb_table_query(). That is two busy polls through
regmap_read_poll_timeout(), an address write, a command write and a bulk
read, all under priv->map_lock.

Over realtek-mdio, each register access is several MDIO frames
(realtek_mdio_read() does 3 writes and 1 read). That works out to roughly
0.5-1 ms per entry.

This runs from the port_vlan_filtering callback with rtnl_lock and
priv->vlan_lock held:

rtl8365mb_port_vlan_filtering()
    mutex_lock(&priv->vlan_lock);
    ret = rtl8365mb_d_vlan_4k_refresh_ivl(ds, port, vlan_filtering);
    mutex_unlock(&priv->vlan_lock);

Could a single flip hold RTNL for several seconds over MDIO, and longer
over bit-banged SMI? The commit message and the comment above do note that
the scan reads every entry, but they don't mention how long RTNL is held.

port_vlan_add/del already see which VIDs are in use. Could the driver
track the active VIDs and rewrite only those, rather than reading every
entry?

> +		if (ret)
> +			return ret;
> +		if (!vlan4k.member || vlan4k.ivl_en == want_ivl)
> +			continue;
> +
> +		vlan4k.ivl_en = want_ivl;
> +		ret = fi->vlan_4k_write(priv, &vlan4k);
> +		if (ret)
> +			return ret;
> +	}

[Severity: Medium]
What happens to the entries already rewritten if fi->vlan_4k_read() or
fi->vlan_4k_write() fails partway through this loop? Possible causes are
a regmap/MDIO error or -ETIMEDOUT from rtl8365mb_table_poll_busy().

VIDs before the failing one keep the new IVL_EN, the remaining ones keep
the old value, and nothing records or restores which were changed. The
caller then unwinds like this:

rtl8365mb_port_vlan_filtering()
    ret = rtl8365mb_d_vlan_4k_refresh_ivl(ds, port, vlan_filtering);
    ...
    if (ret)
        goto undo_egress_mode;

The undo_egress_mode -> undo_set_framefilter chain restores the egress
mode, frame filter and transparent VLAN settings, but not the CVLAN
IVL_EN bits.

On error, dsa_port_vlan_filtering() does not commit dp->vlan_filtering. So
rtl8365mb_d_want_ivl(ds, -1, false) and later rtl8365mb_vlan_4k_port_set()
calls follow the old mode, while some existing VLANs learn in the other
mode.

For a VLAN-unaware bridge, would a VLAN left with IVL_EN set stop matching
the static FDB/MDB entries keyed as SVL/FID 0? That is the mismatch this
patch is meant to prevent. It would only clear on the next real
switch-wide flip.

Should the loop undo the entries it already rewrote when it fails, or
otherwise restore the table to the previous mode before returning?

> +
> +	return 0;
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cf3fd237-2290-4002-8de0-ea4100ef0f85%40yahoo.com

  parent reply	other threads:[~2026-11-19 22:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cf3fd237-2290-4002-8de0-ea4100ef0f85.ref@yahoo.com>
2026-11-17  7:34 ` [PATCH net-next v11 00/13] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-17  7:35   ` [PATCH net-next v11 01/13] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-17  7:36   ` [PATCH net-next v11 02/13] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-17  7:36   ` [PATCH net-next v11 03/13] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-17  7:37   ` [PATCH net-next v11 04/13] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-17  7:38   ` [PATCH net-next v11 05/13] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-17  7:38   ` [PATCH net-next v11 06/13] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-17  7:39   ` [PATCH net-next v11 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D Mieczyslaw Nalewaj
2026-11-17  8:23     ` Linus Walleij
2026-11-18  1:48       ` Gustavo Foletto Mora
2026-11-18  7:59         ` Mieczyslaw Nalewaj
2026-11-19  1:47           ` Gustavo Foletto Mora
2026-11-19 22:36     ` netdev-bot+sashiko [this message]
2026-11-17  7:39   ` [PATCH net-next v11 08/13] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-11-17  8:34     ` Linus Walleij
2026-11-17  8:53       ` Mieczyslaw Nalewaj
2026-11-18  1:55     ` Gustavo Foletto Mora
2026-11-17  7:40   ` [PATCH net-next v11 09/13] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-11-18  2:00     ` Gustavo Foletto Mora
2026-11-19 22:36     ` netdev-bot+sashiko
2026-11-17  7:41   ` [PATCH net-next v11 10/13] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-19 22:36     ` netdev-bot+sashiko
2026-11-17  7:41   ` [PATCH net-next v11 11/13] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-17  7:42   ` [PATCH net-next v11 12/13] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-19 22:36     ` netdev-bot+sashiko
2026-11-17  7:43   ` [PATCH net-next v11 13/13] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-19 22:36     ` 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=179512779012.3136.12590210308172981547@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=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