Article View: linux.kernel.netdev
Article #26036Re: [PATCH net-next v18 07/15] net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D
From: netdev-bot+sashiko
Date: Wed, 02 Dec 2026 23:58
Date: Wed, 02 Dec 2026 23:58
148 lines
13629 bytes
13629 bytes
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
Technical Details
Message-ID:
<179625593322.3146.8283656347914128389@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376136-linux-kernel-netdev=dewy.ruReferences:
<72a97f84-770a-45a7-bed6-c0f148767730@yahoo.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376136-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179625593322.3146.8283656347914128389@kernel.org> References: <72a97f84-770a-45a7-bed6-c0f148767730@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2091912"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:2S1lhWYwW+k7DYOO0S9pqHXDgPU= sha256:3DItjhWGCae8Nx3QyuVsXTeeRY21jPVVq7XxeqXf8pw= sha1:41zQKUXkBW2s7KZfbyqm1erITvc= sha256:qR1j3zF8SYtckL2eVs427sxmlUVodxrTZ3hO72tRwg8= 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 A285E1177A5; Thu, 3 Dec 2026 02:59:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 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] 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 tbGtgYDspo-5; Thu, 3 Dec 2026 02:59:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376136-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id AD16F1177A0; Thu, 3 Dec 2026 02:59:00 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 973BD2A2BB; Wed, 2 Dec 2026 23:58:56 +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=1796255936; b=5gfqg27jtyZbWoNVw0E5ZDYU37E1O+jUX9iE1OdCu794MZXET0y6/K0gp8dKUMx28q5o Lvjz9SmElXRDxyYLYb29Vqrkv/GJfimFl9E+a9vyLHmQ/gTVDH4oe6K0wyYmLr3viIDCp CKVN5T6IIgPdQLeUPEOndslowXNLtfqNUQSf4IythBN5xPAkjWfCRJRTnMvBeegmRXzqa VO7TX/vdaxI0HaAhKvo4DzwpuwkrrlVerXKU3Xj5KWJQHdVZBku69bjg3xzCImNJfwnic 4yC58fhl3X9qyt1Jvysyql0KiKlAjTPMDXATRPU1jhXAe/ZMW+4E2vi3+x83N/Byrdw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796255936; 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=leuUrmO05l0SdC32ppY1st3huc/D9i7xa6jkorZOXFA=; b=jcf77hPsrKpAoR5zeY/HdMKl8gYxV9LiKQju23t2nyR7Y5ZHb/yIY2wci6gYAvlo8Zbe ZxdXfbt5Sb0d4TUuokM6Q0VsbfmLDE4QQiQR6IseNQ6tz3Nq+W/RsfWlomyOPcw5PTpA9 qWGnte1X6dX1Pvqf/oMeBc83bkRTC2pjIrAPDYxnWSkGMDfsSg6KpJEHhwG7Htk0jryea Aa5TNjI3Tp8F0gmqWfYFvyEAKIDp/d45waia4Gp6a7dKi+GHii92De0Hd2bPbeol7vyuy nLz3/UicnSIYOlw0qqgGNRrW8uEnljUaPluW1gSO3sEqfuJ5ptz8OtqycAO0P0cJ+DQ== 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=JVBn0cBH; 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 07B60606A33F; Wed, 2 Dec 2026 23:58:56 +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=JVBn0cBH 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=1796255935; b=mSLBn79n9DmKDIm7uTBUOykJedup478Y6PRNN0FdJWK5b5V0ZzM4nDXwJ/M9l9SEn5wv cergns76I0V3TCUydYVqjb3OnZeYoSpV6wE/TbpjJpDf3YB0LT4AiglBlaHXzZ69FEUgY JwLcJqFAC+gfMRaGuxjifxkI33oHJ1FRzTh9Bg1ueJzNtUd/sVyxQsGGwp99dTJeRqxRQ KBALFcyGIPOGvvGQ9XrDFdd0u5ESsS7WYcXMcRhSSSv5V20rkSjcZH20/dIkYhwAn+qkw RsT0769LnD+z1+V69WQoPUjVya2ynFsg/S9ndVQYBmC4+UjAF3skwpcfto4mdRWrvDw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796255935; 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=leuUrmO05l0SdC32ppY1st3huc/D9i7xa6jkorZOXFA=; b=SsehcaqcCUdcToPzg3Tt0ACg2xE6qrR2sNBoHICgpbFBkojvhI8pJyz1QJejRwdlp5Yr j4cQUWcLIK2uaX7iUi1ACuute+pSGUQLMASFGNY54Y3LLEy/K5yvLFzOUPvYxAk2cN9zs 4Euen46R+t1SIRwDRPNdQ8d4s9ndTy1Dq/mC8AGOjth1FC6pRXPAoVjE5cDfiKeaduW0u UvmQm/edj7l+N5mTD83mtuGXTPkQJHXk4yaXKf+vCIYQzbPYtsDPoVgHPk2z9Dk7uiAlq jj657yGUVIBmJwP4J3XLi/ztmB2ifSeexxTZS7g494rH3w7OsS98JtUB0oHT4JLwt+w== 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=JVBn0cBH; 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 2863E606A330; Wed, 2 Dec 2026 23:58:54 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D571F00893; Wed, 2 Dec 2026 23:58:53 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796255934; bh=leuUrmO05l0SdC32ppY1st3huc/D9i7xa6jkorZOXFA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JVBn0cBHkkb8h/vrPRvWYdoNv+a5W6sguLoDaaIXr5JNr4leD7caQxZyods2GPYAL O89ndUDZ9qVO+bmnDvItfh1COdhia64SpIGTOxMdN8TXJg51PE0wEmdg9cpXY061yx AO5+0HniAf1GbhIkULAhXfPGvwSQy8NRMOKjPZ+YNkn1/eGGa4Wymxl/R5U9koUmRv 58w4PY0KPqhEXKWrIS3m7QFSJPy0CppPaIpiTDPW7f0Raid/oa1uKU350ScDcrIr6y vTQP6hEPNyDzjZdAxWaC6OdIMX7bwO98kO2PS/kcCHubTdETQZ/VQc2suYSOIhWtb3 CkYgNOf/Ftijg== 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, o.rempel@pengutronix.de X-In-Reply-To: <72a97f84-770a-45a7-bed6-c0f148767730@yahoo.com> X-sashiko-severity: Low 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