mirror of https://lore.kernel.org/lkml/
 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 v10 07/12] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
Date: Mon, 16 Nov 2026 18:55:54 +0000	[thread overview]
Message-ID: <179485535493.3136.1068069637622995619@kernel.org> (raw)
In-Reply-To: <915a9103-82e6-4504-8d6e-3d12c4e7af1a@yahoo.com>

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] On family D, the per-VID IVL_EN bit (CVLAN word 1, bit 3) is
  set only inside rtl8365mb_vlan_4k_port_set()…

--

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

This adds two-word pack/unpack helpers for the family D CVLAN (4K VLAN)
table entry, rtl8365mb_d_vlan_4k_read() and rtl8365mb_d_vlan_4k_write().
It also changes rtl8365mb_vlan_4k_port_set() so that on family D, IVL_EN
is set only while some user port has VLAN filtering enabled. Family C
keeps IVL always on.

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

[ ... ]

> @@ -314,7 +391,21 @@ rtl8365mb_vlan_4k_port_set(struct dsa_switch *ds, int port,
>  		vlan4k.untag |= BIT(port);
>  	else
>  		vlan4k.untag &= ~BIT(port);
> -	vlan4k.ivl_en = true; /* always use Independent VLAN Learning */
> +
> +	/* Family C always uses IVL. On family D, IVL is on while any user
> +	 * port has VLAN filtering enabled, so that static entries match
> +	 * learned ones in a VLAN-unaware bridge (SVL).
> +	 */
> +	if (!rtl8365mb_is_d(priv)) {
> +		vlan4k.ivl_en = true;
> +	} else {
> +		struct dsa_port *dp;
> +
> +		vlan4k.ivl_en = false;
> +		dsa_switch_for_each_user_port(dp, ds)
> +			if (dsa_port_is_vlan_filtering(dp))
> +				vlan4k.ivl_en = true;
> +	}

[Severity: Medium]
Can the per-VID IVL_EN bit go stale here when vlan_filtering changes?

The bit is only computed when a VLAN is added or deleted.
rtl8365mb_port_vlan_filtering() in rtl8365mb_main.c changes ingress
filtering, the transparent masks, the frame filter and the egress mode.
It never rewrites the 4K table entries:

rtl8365mb_port_vlan_filtering() {
    ...
	ret = rtl8365mb_port_set_ingress_filtering(priv, port, vlan_filtering);
    ...
		ret = rtl8365mb_port_set_transparent(priv, port, dp->index,
						     !vlan_filtering);
    ...
}

rtl8365mb_setup() sets ds->configure_vlan_while_not_filtering = true, so
VLANs are programmed while the bridge is still VLAN-unaware. Take a
common sequence:

  ip link add br0 type bridge
  ip link set lanX master br0
  ip link set br0 type bridge vlan_filtering 1

VID 1 is written with IVL_EN=0 and keeps it after filtering is turned
on. VIDs added after that get IVL_EN=1, so the table ends up with a mix
of IVL and SVL VLANs inside one VLAN-aware bridge.

The reverse also happens. If filtering is turned off, the VLANs stay in
IVL mode. Later in the series, rtl8365mb_d_l2_uc_to_data() and
rtl8365mb_d_l2_mc_to_data() key vid 0 static entries with SVL (FID 0):

	bool ivl = uc->key.ivl && uc->key.vid;
	u16 id = ivl ? uc->key.vid : uc->key.fid;

In both cases, would static FDB/MDB entries and learned entries end up
with different keys? The commit message says this logic exists to
prevent that.

The bridge join ordering seems to add a further case. In
dsa_port_bridge_join(), switchdev_bridge_port_offload() replays the
bridge VLANs through br_switchdev_vlan_replay() before
dsa_port_switchdev_sync_attrs() sets dp->vlan_filtering. When the first
port joins a bridge that already filters, are the replayed VLANs written
with IVL_EN=0?

The policy is also switch-wide. With one VLAN-aware bridge and one
VLAN-unaware bridge on the same switch, the unaware bridge's VIDs would
be forced to IVL.

The commit message says:

  The stored IVL_EN is refreshed on the next port_vlan_add/del for the
  VID, not on a vlan_filtering change.

Nothing in the driver triggers that refresh, so the final hardware state
depends on the order of configuration steps. Should
rtl8365mb_port_vlan_filtering(), or the family D join path, walk the
existing 4K entries and rewrite IVL_EN?

This is still present at the end of the series, where the family D info
is wired up in "net: dsa: realtek: rtl8365mb: add support for
RTL8367S-VB".

>  
>  	ret = fi->vlan_4k_write(priv, &vlan4k);
>  	if (ret) {

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/d9da17af-f49e-4878-a8dd-59a8919e6930%40yahoo.com

  parent reply	other threads:[~2026-11-16 18:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d9da17af-f49e-4878-a8dd-59a8919e6930.ref@yahoo.com>
2026-11-12 17:31 ` [PATCH net-next v10 00/12] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-12 17:32   ` [PATCH net-next v10 01/12] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-12 17:33   ` [PATCH net-next v10 02/12] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-12 17:33   ` [PATCH net-next v10 03/12] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-12 20:23     ` Linus Walleij
2026-11-12 17:34   ` [PATCH net-next v10 04/12] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-12 17:35   ` [PATCH net-next v10 05/12] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-12 17:36   ` [PATCH net-next v10 06/12] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-12 20:24     ` Linus Walleij
2026-11-12 17:37   ` [PATCH net-next v10 07/12] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D Mieczyslaw Nalewaj
2026-11-12 20:25     ` Linus Walleij
2026-11-16 18:55     ` netdev-bot+sashiko [this message]
2026-11-12 17:38   ` [PATCH net-next v10 08/12] net: dsa: realtek: rtl8365mb: use raw VID for PVID on " Mieczyslaw Nalewaj
2026-11-16 18:55     ` netdev-bot+sashiko
2026-11-12 17:39   ` [PATCH net-next v10 09/12] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-16 18:55     ` netdev-bot+sashiko
2026-11-12 17:40   ` [PATCH net-next v10 10/12] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-12 20:26     ` Linus Walleij
2026-11-12 17:41   ` [PATCH net-next v10 11/12] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-16 18:55     ` netdev-bot+sashiko
2026-11-12 17:42   ` [PATCH net-next v10 12/12] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-16 18:56     ` 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=179485535493.3136.1068069637622995619@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

all inboxes | Powered by JetHome®