🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17399

Re: [PATCH net-next v10 07/12] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D

#17399
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 18:55
124 lines
12613 bytes
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
Technical Details
Message-ID: <179485535493.3136.1068069637622995619@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364640-linux-kernel-netdev=dewy.ru
References: <915a9103-82e6-4504-8d6e-3d12c4e7af1a@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364640-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179485535493.3136.1068069637622995619@kernel.org>
References: <915a9103-82e6-4504-8d6e-3d12c4e7af1a@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2141928"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FRre2vUwTZmTLxMoH5MEIgZ4IgU= sha256:QN4dkKvRk1ZhUCkNMTjzS8l7Pa3EyPeUBpE4q0BvWOg=
	sha1:h3npzp5rzRjzd9k6oZsi4Z0C+bQ= sha256:5aZDjNc0bTMbvVLITbR8oOvdKfT2JlE0nQtBqHGPrhg=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id C9393114D34; Mon, 16 Nov 2026 21:56:14 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id EVknQ1-1oHY2;
	Mon, 16 Nov 2026 21:56:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364640-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 15A20114D09; Mon, 16 Nov 2026 21:56:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CC0D9295D9; Mon, 16 Nov 2026 18:56:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794855357;
	b=RknmNw7ys1PPw2T/YMcGegYaQTqwwFKiNGRy3g0d+1VbyWBE09uk1VknW7tsmWwVqS90
	 38b0AUS+JoLPDl7Sx3TnWRZpBQpPG48N1maAuFVluSl1akP+RqcdhJFLhTBqgggqkZjDA
	 N3dQdKdmHA8AfKOj+wp3zSPnDKPEjQCIXhCs1SMGV1tbJf8suv76W75sLILLmBOyUTHNh
	 U8H/ogKu7OzD9sUAE3hZX18Ija0N5bJkbncz2aZxrwaB5/GtkUefSwe2X3bkIz3YlPUpH
	 0JInXlse3DmWA046HHhe8Y/Suo52Npi9Da/sPtvNgTA4EDNpjTNNWjXnAUo0aREjmtQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794855357;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=3MwGTia29hoI59AYQaU2Ez4dH29GW4k/UQmwogH8ApU=;
	b=0ZrZrDVryvA5BU2FluyBqxmKwmx2BMxjBKCkLDNEguK5ITNkG1LPIzKGBGnQ5umNaFLD
	 5Gs99qO8M3VyFo//XgI45AWPrjV565uqQDru7D2k5laYORVzaCf6ULl6j+mGH04Wd5HHm
	 VHWFr1Ya+pRJSy3iDkwslVjdEgjO7SVC10uke4FgOkNbtK7TyP0G3RaUJ1t0N50SfoJIn
	 pgpSPh3/s5C41t58tFoLteHkt0jxlnBingpUOc1WkNAhFHEtJdj2K4JXlw9q4o1Hajn9Y
	 KnHx5nAxDqLE8xFVh4+/FKUtOB0IeEVB9Ab41U43UNVu7XG+VVR+ToyUrFj3pAyxYdQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RI5Ywpeq;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id BEE5E606A334;
	Mon, 16 Nov 2026 18:55:57 +0000 (UTC)
X-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=RI5Ywpeq
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794855356;
	b=aHy0nQLpceulJ0hzKN8k9vBy5LxXVq+2vZ5Uiw9kqHCbPjw7fEbalRNj30LWm/fxHbcH
	 nZ7yWSea6LwMxgcGj8qiPDqC+Gzshxo7t1lllnMJFFPIWJAJKvwWEKMPKzSty+5K6VQuC
	 l9CTTfD8i1g65w0PDUjmihSyCIrW3nG9HxjBuN5UMcsCko35pcWTqlFrgXFJKEypRa2OK
	 t7dDdgA4NarOpOipcm7lCZTlbxjrA2tz5n6hl/MdW13BQIwA6xj//s1Qm5WjyPR79qR30
	 iBJ9VT/7x+hLyIQq4OkJlwNIVOAK585Qsz2JlJxWiZrZJPR4irfz22EL6zFsNmCPdoQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794855356;
	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=3MwGTia29hoI59AYQaU2Ez4dH29GW4k/UQmwogH8ApU=;
	b=gK7IjyXl7UhdxMlBSqo0LoXYlv3kbV9PSuV8LYtITauKkVdy55DZb6XborOH668S8TI8
	 bEsBRxes0yCkT6XdpSnYBwXy34RMFAP/B01gpjgUBoboefmdvLcgyahWL86eb3n2nLuGp
	 JDxfQzVn46nS3LR2pAlGEm1Nk1A7mlMu87+Hlsw9uay5f4ocSpGo2y9zHFLQKCckEa8Y9
	 N6HgXe6HtGz5oVmIQ4/qqPU7U9+Acq1c9lFnnV40wBremMmwImUGvwSeqe1CITKjGhWeF
	 4ZAm8Ope5EIXilb42kfT1IkT110Nmhgl+PeMU8YPKorqCbtYN8O4xxondI4HrbhXoiA==
X-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=RI5Ywpeq;
	arc=none smtp.remote-ip=100.103.45.18
X-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 DA0A4606A322;
	Mon, 16 Nov 2026 18:55:56 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA571F000C4;
	Mon, 16 Nov 2026 18:55:55 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794855356;
	bh=3MwGTia29hoI59AYQaU2Ez4dH29GW4k/UQmwogH8ApU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=RI5YwpeqRU57kQQWAFDUJRI5bEo4fI8+rmCJLhGn9A3llbMJsF4YoKFvGsBkr0yBL
	 cqrd2c0RNIirTEO6PINH2Lo4/35mrVpFmhWBLxVXikHrWvlaS7bLaV1U/GOwQdtigv
	 s750fDUw1UdKNtLAQ3CIyFUB+2Fs6GrsRDG2EgehBvuANEdrQVgEJ+wByoa5Y+cHfm
	 AbePJMoj4FrMX3Vfybceg/YA5m+iitTxs8t5Y5kmscYEXzMivISIhqepF1/20FhRQB
	 Vu5KGLxdA7G++XQeEghBbwopbceLVJjE2SPzu3KI43PH7SDBhmdkM6Pa+mt+N0nUNM
	 NkU/wGwqOyZ1Q==
X-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
X-In-Reply-To: <915a9103-82e6-4504-8d6e-3d12c4e7af1a@yahoo.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list