🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19426

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

#19426
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 22:36
127 lines
12525 bytes
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
Technical Details
Message-ID: <179512779012.3136.12590210308172981547@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367385-linux-kernel-netdev=dewy.ru
References: <7edbdf93-91e1-4dd1-9ecf-35863cecc277@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367385-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179512779012.3136.12590210308172981547@kernel.org>
References: <7edbdf93-91e1-4dd1-9ecf-35863cecc277@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2999216"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:n1aco74Rp3xCnl8PUSOLAJu8E7M= sha256:tcjS6ZpQY2bZVWHl/fjfjHs3zHkBYn273n2mfdwHvn8=
	sha1:J16qLvuqCCjZxqDt2mFifgj2W+Y= sha256:WX7uZNu2VTFF3t9VP2a4TufTlcNACq7DJgyi2oVCLr4=
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 104E01157D3; Fri, 20 Nov 2026 01:36:50 +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 RORwIEbssFv2;
	Fri, 20 Nov 2026 01:36:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367385-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 B4EB91157BD; Fri, 20 Nov 2026 01:36:35 +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 14997888E5; Thu, 19 Nov 2026 22:36:33 +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=1795127792;
	b=OJUst0wGuMkEwp9gD/BtQ/pBMwMQUaA7JYMQ5GXjuAZlI/wuQT4GLPjFxf8ToFQsgivs
	 J8PO7vwHK2fIZJxRp9Mda041Rwb/tIUTL41LsFRtgajJpL7maPaEkhIDBtuX9qCIwsH1s
	 /jYvPWfplqJS74ISjShCNtdIHzRCGfTF8tlIjIGNWbbInBYJmL8XQz3FEqusYi/6vgKWm
	 7jDWqMDjW5WR1RBXi+LO4SjbjqKfvDnWu57AYrfsaq209fo3g2wNVEcvIP8DWM7dOSA/r
	 6tQVcHdtC1BTvN9mZ6AsZL6WIpuO/xHAdG02M+1TnqK53pW3U0Jv7+oogS04Z3GM4DA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795127792;
	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=Tgu+WP2m0uodmDr9Nd0f7m6qiFgWHDogdH3e+s7AJJI=;
	b=fdRuz1tIalBg8sxmxne202VESeWM/y8f7IaaFPOWH+ydc9ftrpZZ674f21COeh8kUdwk
	 5EwijhuXEu3f6EpQT64Je/nezgs2L4cy6NAXPE2mSbBWLFDJT2NwO0lRpft+Uw08ZX77L
	 nRrKEmkne1RPCCW3HTXPHpF88oRFPrnBYM0IoWN/rFrOi0Wyvlc/fMnieYmgYiv6AFK1B
	 fHohHSxldBTTRO1ourl8C1yPNjkOCm7JUsyRshfWiojNxEyb5Djbp0CbgzSYdpSfKx4Vh
	 nR/v7D4fn+cuA16Rr+scZXqe0PSoaGtI52psD839+NhjIfqwLlbx3AcQSVXFwWQFQpw==
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=YNExrvjz;
	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 C8E60606A320;
	Thu, 19 Nov 2026 22:36:32 +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=YNExrvjz
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=1795127792;
	b=nIUNdYqGt/dR9Y4P8x0C4IX0gx5UAeUFjjIqPinhB1gZKnxwr9dq7SSpgxziaR+/2hBZ
	 Rc1LjEEoVDlntXre/sxqfYg+yAtrFe/mh2s86woxEWwyWNCfsBH7uk52t0KH/o/WANBmc
	 QPDrcgwE5+olUrN0TuAX0g1PJIhfgRVs6mZ2iIkPG8R2WSh9DsvBTTJFBGSdQeuHMFldl
	 Nu/Np6LKpruGviDmTIVwP+RLuFS+XfXvaLNH9yp/AU9islsE1q0izKiBJgrxi2s6Zl7uZ
	 Hri255OY1IMRMZMe0mRdIh4jX+1Khblb9iOBvRrlQrIrBtMlc4J08MYXC2m5WciokCA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795127792;
	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=Tgu+WP2m0uodmDr9Nd0f7m6qiFgWHDogdH3e+s7AJJI=;
	b=QqleRpotmEJGYarEzah3or5xQCotWWImO6laAooWKbde5pk6bXPVXN0vA7zmXHrBx7H1
	 ZNpqbYm2d7fDJDg5eJawDoWoqK8MouX1eFbJDc80A38pGwBgcF7E6OcOQDWCok9NCIWYu
	 03LrzPVLw2cbp9NlYPZzGRRVHjSwtaYYfdbRuiGgAJl+ZVLnI4Hhhh7U/0SzU0hZ8Ixh4
	 yk2jETVwOSnEznydkhbqh7Yf+wP3dd1U9Kl3inMM15jmip/SKCHhbQGdwx/J3e7LHmc2U
	 02LG3HteL2oMKPO2HWUmoqeuTpf6JIJlnd3Zfq+J4LiWGEBvzpDaAE+Y3v41ZZIQ+QA==
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=YNExrvjz;
	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 E705D606A326;
	Thu, 19 Nov 2026 22:36:31 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EF121F000C0;
	Thu, 19 Nov 2026 22:36:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795127791;
	bh=Tgu+WP2m0uodmDr9Nd0f7m6qiFgWHDogdH3e+s7AJJI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=YNExrvjzBol1ezFy1HpYWmoqW4KSC95f21PTKTi5J+ErrVBa3DZseGOOxnDb4oZup
	 W3kEn4Ocx4luYGM1faP+cv/56M4WNd0fmsH0rYikksRh9T9g7JWSwVPB4+Zvr+K7Hm
	 ibaSw4E20vssNQ24g8Omci2kIqITji2n6who65RFGHAh9MFkPR0YppMyte7CysbiQy
	 nkavc2z82KoAV/8zk7Fu9WT4QqhC+yQ8jeQ6ztgFhXEDK9Wg3BmbT4ItQV7AB+hUim
	 Wnhn6G+ViaXSON0lVvycrdh2eIYQLhvpx6snwfhaJ1RbhwhJnoE0tFtDQwcDOQpRR6
	 ChrUcxG3rCklQ==
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: <7edbdf93-91e1-4dd1-9ecf-35863cecc277@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