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,
	o.rempel@pengutronix.de
Subject: Re: [PATCH net-next v14 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D
Date: Fri, 27 Nov 2026 03:00:25 +0000	[thread overview]
Message-ID: <179574842518.3135.934343295203099061@kernel.org> (raw)
In-Reply-To: <f431815c-e496-49b4-9231-c82694b12032@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, rtl8365mb_setup() sets ds->max_num_bridges = 1
  (drivers/net/dsa/realtek/rtl8365mb_main.c:3859) and treats it as a…

--

net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D

This patch teaches the rtl8365mb table and L2 code about the family D
(RTL8367S-VB) LUT layout. It also uses port-based FID to isolate an
offloaded VLAN-unaware bridge in FID 1 from standalone ports in FID 0.
On family D, fdb_isolation is no longer advertised and max_num_bridges is
set to 1.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index cf06bc94c6029..bf508edc1ad96 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c

[ ... ]

> @@ -3670,9 +3841,23 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
>  		goto out_teardown_irq;
>  
>  	ds->assisted_learning_on_cpu_port = true;
> -	ds->fdb_isolation = true;
> -	/* The EFID is 3 bits, but EFID 0 is reserved for standalone ports */
> -	ds->max_num_bridges = FIELD_MAX(RTL8365MB_EFID_MASK);
> +	if (!rtl8365mb_is_d(priv)) {
> +		ds->fdb_isolation = true;
> +		/* The EFID is 3 bits, but EFID 0 is reserved for standalone */
> +		ds->max_num_bridges = FIELD_MAX(RTL8365MB_EFID_MASK);
> +	} else {
> +		/* No EFID; FID 0 is used by standalone ports and FID 1 by the
> +		 * offloaded VLAN-unaware bridge via port-based FID, so allow
> +		 * at most one offloaded bridge. The bridge number it gets is
> +		 * what rtl8365mb_port_set_efid() takes as "offloaded" to
> +		 * enable port-based FID, so max_num_bridges must not be 0.
> +		 * Bridge numbers are allocated system-wide by DSA, so this
> +		 * does not stop a bridge that already has a number from
> +		 * another switch from being offloaded here as well; such
> +		 * bridges share FID 1 (known limitation).
> +		 */
> +		ds->max_num_bridges = 1;

[Severity: Medium]
Does max_num_bridges = 1 actually mean "at most one offloaded bridge" on
this switch?

DSA treats max_num_bridges as an upper bound on bridge numbers, and those
numbers come from a single system-wide bitmap:

net/dsa/dsa.c:dsa_bridge_num_get() {
    ...
	if (!bridge_num) {
		bridge_num = find_next_zero_bit(&dsa_fwd_offloading_bridges,
						DSA_MAX_NUM_OFFLOADING_BRIDGES,
						1);
		if (bridge_num > max)
			return 0;
    ...
}

If it returns 0, dsa_port_bridge_create() fails with "Range of offloadable
bridges exceeded" and -EOPNOTSUPP, and dsa_user_changeupper() falls back
to software bridging.

Here is one case. Another DSA switch in a different tree already offloads
a bridge holding bridge number 1. A new bridge built only from
RTL8367S-VB ports then gets number 2. Since 2 > 1, it is refused, and this
switch cannot offload any bridge at all, so all bridged traffic goes
through the CPU.

Whether offload works then depends on the order in which unrelated
switches allocated numbers. It can also change as bridges are deleted and
their numbers freed.

The comment above, and this part of the commit message, describe only the
opposite outcome of the same mismatch:

  DSA allocates bridge numbers system-wide, so this does not stop a
  bridge that already has a number from another switch from being
  offloaded here as well; such bridges share FID 1, a known limitation.

rtl83xx_port_bridge_join() passes any non-zero bridge.num to
port_set_efid(), which maps it to FID 1 on family D. It does not enforce
the one-bridge-per-switch limit itself.

Would it work better to keep max_num_bridges at a larger value? On family
D, port_bridge_join could then return -EOPNOTSUPP when another port of
this switch already offloads a different bridge, which would avoid both
outcomes.

At minimum, could the comment and the commit message say that on
multi-switch systems this switch may be unable to offload any bridge?

This code is unchanged at the end of the series, in "net: dsa: realtek:
rtl8365mb: add support for RTL8367S-VB".

> +	}
>  
>  	ds->configure_vlan_while_not_filtering = true;
>

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/874b29a3-f47f-4bf2-a0f6-2f9fea712f4c%40yahoo.com

  reply	other threads:[~2026-11-27  3:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <874b29a3-f47f-4bf2-a0f6-2f9fea712f4c.ref@yahoo.com>
2026-11-24 23:59 ` [PATCH net-next v14 00/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-25  0:00   ` [PATCH net-next v14 01/15] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-25  0:01   ` [PATCH net-next v14 02/15] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-27  3:00     ` netdev-bot+sashiko
2026-11-25  0:02   ` [PATCH net-next v14 03/15] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-25  0:03   ` [PATCH net-next v14 04/15] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-25  0:04   ` [PATCH net-next v14 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-25  0:05   ` [PATCH net-next v14 06/15] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-25  0:06   ` [PATCH net-next v14 07/15] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D Mieczyslaw Nalewaj
2026-11-27  3:00     ` netdev-bot+sashiko
2026-11-25  0:07   ` [PATCH net-next v14 08/15] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-11-25  0:08   ` [PATCH net-next v14 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-11-25  0:09   ` [PATCH net-next v14 10/15] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-27  3:00     ` netdev-bot+sashiko
2026-11-25  0:10   ` [PATCH net-next v14 11/15] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-25  0:11   ` [PATCH net-next v14 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-27  3:00     ` netdev-bot+sashiko [this message]
2026-11-25  0:12   ` [PATCH net-next v14 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling Mieczyslaw Nalewaj
2026-11-27  3:00     ` netdev-bot+sashiko
2026-11-25  0:13   ` [PATCH net-next v14 14/15] net: dsa: realtek: rtl8365mb: use PCP numbering on family D Mieczyslaw Nalewaj
2026-11-27  3:00     ` netdev-bot+sashiko
2026-11-25  0:14   ` [PATCH net-next v14 15/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-27  3:00     ` 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=179574842518.3135.934343295203099061@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=o.rempel@pengutronix.de \
    --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