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,
	o.rempel@pengutronix.de
Subject: Re: [PATCH net-next v16 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D
Date: Mon, 30 Nov 2026 15:12:48 +0000	[thread overview]
Message-ID: <179605156893.3146.2928663403676847633@kernel.org> (raw)
In-Reply-To: <3a5154a4-2b98-4658-916e-92817e04f352@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 (RTL8367S-VB), rtl8365mb_port_set_efid()
  (drivers/net/dsa/realtek/rtl8365mb_main.c) treats any non-zero bridge…

--

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

This commit teaches the rtl8365mb table and L2 code about the family D
(RTL8367S-VB) LUT layout and table access interface. It also uses
port-based FID 1 for offloaded VLAN-unaware bridge ports, enables the
lookup-hit isolation fallback and sets max_num_bridges to 1 on family D.

Closes: https://github.com/openwrt/openwrt/pull/19644#issuecomment-6708118180

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 45c1f0d90eae9..fc38bd12b62b7 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c

[ ... ]

> @@ -2736,6 +2818,46 @@ static int rtl8365mb_port_pre_bridge_flags(struct dsa_switch *ds, int port,
>  static int rtl8365mb_port_set_efid(struct realtek_priv *priv, int port,
>  				   u32 efid)
>  {
> +	/* Family D has no EFID (0x0A32 is RTL8365MB_D_LUT_CFG2_REG). Instead,
> +	 * assign port-based FID 1 to offloaded VLAN-unaware bridge ports
> +	 * (efid != 0 and !vlan_filtering) so their SVL entries do not collide
> +	 * with standalone ports in FID 0.
> +	 */
> +	if (rtl8365mb_is_d(priv)) {
> +		struct dsa_port *dp = dsa_to_port(&priv->ds, port);
> +		bool enable = efid && !dsa_port_is_vlan_filtering(dp);
> +		u8 fid = enable ? RTL8365MB_D_UNAWARE_BRIDGE_FID : 0;

[Severity: Medium]
Can two different offloaded bridges end up sharing FID 1 here? Every
non-zero efid is mapped to RTL8365MB_D_UNAWARE_BRIDGE_FID. The family D L2
key built by rtl8365mb_d_l2_uc_to_data() and rtl8365mb_d_l2_mc_to_data()
also has no per-bridge part.

Setting max_num_bridges = 1 does not seem to stop a second bridge from
being offloaded. dsa_bridge_num_get() returns an existing system-wide
number without comparing it to max:

net/dsa/dsa.c:dsa_bridge_num_get() {
	unsigned int bridge_num = dsa_bridge_num_find(bridge_dev);
	...
	if (!bridge_num) {
		...
		if (bridge_num > max)
			return 0;
		...
	}

	return bridge_num;
}

dsa_port_bridge_create() only rejects a zero result. Suppose a bridge
already got number 2 from a switch in another DSA tree. It is accepted
here, and this call gives the port PBFID 1:

rtl83xx_port_bridge_join()->rtl8365mb_port_set_efid(priv, port, 2)

The local bridge with number 1 uses that same FID.

In that setup, a host on bridge B can send frames with the source MAC of a
host M on bridge A. Would that move M's learned entry in FID 1 to B's port?
Static entries for the same MAC in both bridges would also overwrite each
other.

rtl8365mb_d_lut_init() sets RTL8365MB_D_LUT_LOOKUP_HIT_ISO_ACT. Traffic
from A's ports to M would then hit a port outside A's isolation mask. It
would be flooded to A's whole isolation mask, including the CPU, instead of
going to a single port.

The commit message and the comment in rtl8365mb_setup() call this a known
limitation. Could the driver refuse the offload instead, for example by
returning -EOPNOTSUPP from the bridge join path when another bridge on this
switch already uses PBFID 1? Another option is distinct PBFIDs, since
RTL8365MB_D_PORT_PBFID_MASK is 2 bits wide. Either way, software forwarding
would keep the bridges isolated.

> +		int ret;
> +
> +		/* PBFID is ignored while PBFIDEN is clear, so write them in
> +		 * the order that leaves the port usable if the second write
> +		 * fails: PBFID first when enabling, PBFIDEN first when
> +		 * disabling.
> +		 */

[ ... ]

> @@ -3705,9 +3874,25 @@ 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). If bridge number 1
> +		 * is already used elsewhere, a new local bridge remains
> +		 * software-forwarded.
> +		 */
> +		ds->max_num_bridges = 1;
> +	}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/aebcc7f6-d5f8-4157-b63a-e2e707d9859b%40yahoo.com

  reply	other threads:[~2026-11-30 15:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aebcc7f6-d5f8-4157-b63a-e2e707d9859b.ref@yahoo.com>
2026-11-29 15:02 ` [PATCH net-next v16 00/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-29 15:06   ` [PATCH net-next v16 01/15] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-29 15:06   ` [PATCH net-next v16 02/15] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-29 15:06   ` [PATCH net-next v16 03/15] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-29 15:07   ` [PATCH net-next v16 04/15] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-29 15:07   ` [PATCH net-next v16 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-29 22:47     ` Linus Walleij
2026-11-30 15:12     ` netdev-bot+sashiko
2026-11-29 15:07   ` [PATCH net-next v16 06/15] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-29 15:07   ` [PATCH net-next v16 07/15] net: dsa: realtek: rtl8365mb: set and get VLAN 4k for family D Mieczyslaw Nalewaj
2026-11-29 22:48     ` Linus Walleij
2026-11-30 15:12     ` netdev-bot+sashiko
2026-11-30 19:26       ` Mieczyslaw Nalewaj
2026-11-29 15:07   ` [PATCH net-next v16 08/15] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-11-29 15:11   ` [PATCH net-next v16 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-11-29 15:11   ` [PATCH net-next v16 10/15] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-30 15:12     ` netdev-bot+sashiko
2026-11-30 19:27       ` Mieczyslaw Nalewaj
2026-11-29 15:11   ` [PATCH net-next v16 11/15] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-29 15:11   ` [PATCH net-next v16 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-30 15:12     ` netdev-bot+sashiko [this message]
2026-11-29 15:12   ` [PATCH net-next v16 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling Mieczyslaw Nalewaj
2026-11-29 22:51     ` Linus Walleij
2026-11-29 15:12   ` [PATCH net-next v16 14/15] net: dsa: realtek: rtl8365mb: use PCP numbering on family D Mieczyslaw Nalewaj
2026-11-29 22:52     ` Linus Walleij
2026-11-30 15:12     ` netdev-bot+sashiko
2026-11-29 15:12   ` [PATCH net-next v16 15/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj

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=179605156893.3146.2928663403676847633@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

all inboxes | Powered by JetHome®