From: Jakub Kicinski <kuba@kernel.org>
To: luizluca@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
linusw@kernel.org, alsi@bang-olufsen.dk, yury.norov@gmail.com,
linux@rasmusvillemoes.dk, linux@armlinux.org.uk,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH v3 6/8] net: dsa: realtek: rtl8365mb: add port_bridge_{join,leave}
Date: Sun, 10 May 2026 10:35:14 -0700 [thread overview]
Message-ID: <20260510173514.3920074-1-kuba@kernel.org> (raw)
In-Reply-To: <20260506-realtek_forward-v3-6-1d87c5f85a3b@gmail.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: dsa: realtek: rtl8365mb: add port_bridge_{join,leave}
This commit implements hardware offloading of bridge functionality for the
rtl8365mb switch by configuring per-port isolation registers and Extended
Filtering IDs (EFIDs) for Independent VLAN Learning (IVL).
> diff --git a/drivers/net/dsa/realtek/rtl83xx.c b/drivers/net/dsa/realtek/rtl83xx.c
> index 2b9bd4462714b..3ab91cd82743a 100644
> --- a/drivers/net/dsa/realtek/rtl83xx.c
> +++ b/drivers/net/dsa/realtek/rtl83xx.c
[ ... ]
> @@ -325,6 +325,120 @@ void rtl83xx_reset_deassert(struct realtek_priv *priv)
> gpiod_set_value(priv->reset, false);
> }
>
> +/**
> + * rtl83xx_port_bridge_join() - join a port to a bridge
[ ... ]
> +int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port,
> + struct dsa_bridge bridge,
> + bool *tx_forward_offload,
> + struct netlink_ext_ack *extack)
> +{
> + struct realtek_priv *priv = ds->priv;
> + struct dsa_port *dp;
> + u32 mask = 0;
> + int ret;
> +
> + if (!priv->ops->port_add_isolation)
> + return -EOPNOTSUPP;
> +
> + dev_dbg(priv->dev, "bridge %d join port %d\n", bridge.num, port);
> +
> + /* Add this port to the isolation group of every other port
> + * offloading this bridge.
> + */
> + dsa_switch_for_each_user_port(dp, ds) {
> + /* Handle this port after */
> + if (dp->index == port)
> + continue;
> +
> + /* Skip ports that are not in this bridge */
> + if (!dsa_port_offloads_bridge(dp, &bridge))
> + continue;
> +
> + ret = priv->ops->port_add_isolation(priv, dp->index, BIT(port));
> + if (ret)
> + return ret;
What happens if this port_add_isolation() fails midway through the loop,
or if any subsequent operations fail?
It looks like the function returns immediately without rolling back the
isolation masks of the ports that were already successfully modified.
This would leave the hardware partially configured, allowing the modified
bridge ports to forward traffic to the standalone port in hardware, while
the DSA core aborted the join in software, leading to a network isolation
regression.
Should there be an error unwinding path here that reverts the isolation
masks for the previously configured ports using port_remove_isolation()?
> +
> + mask |= BIT(dp->index);
> + }
> +
> + /* Add those ports to the isolation group of this port */
> + ret = priv->ops->port_add_isolation(priv, port, mask);
> + if (ret)
> + return ret;
> +
> + /* Use the bridge number as the EFID for this port */
> + if (priv->ops->port_set_efid) {
> + ret = priv->ops->port_set_efid(priv, port, bridge.num);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
next prev parent reply other threads:[~2026-05-10 17:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 2:58 [net-next PATCH v3 0/8] net: dsa: realtek: rtl8365mb: bridge offloading and VLAN support Luiz Angelo Daros de Luca
2026-05-07 2:58 ` [net-next PATCH v3 1/8] net: dsa: realtek: rtl8365mb: use ERR_PTR Luiz Angelo Daros de Luca
2026-05-10 15:23 ` Mieczyslaw Nalewaj
2026-05-07 2:58 ` [net-next PATCH v3 2/8] net: dsa: realtek: rtl8365mb: use dsa helpers for port iteration Luiz Angelo Daros de Luca
2026-05-10 15:23 ` Mieczyslaw Nalewaj
2026-05-10 17:34 ` Jakub Kicinski
2026-05-10 17:35 ` Jakub Kicinski
2026-05-07 2:58 ` [net-next PATCH v3 3/8] net: dsa: realtek: rtl8365mb: prepare for multiple source files Luiz Angelo Daros de Luca
2026-05-10 15:23 ` Mieczyslaw Nalewaj
2026-05-07 2:58 ` [net-next PATCH v3 4/8] net: dsa: realtek: rtl8365mb: add table lookup interface Luiz Angelo Daros de Luca
2026-05-10 15:24 ` Mieczyslaw Nalewaj
2026-05-10 17:34 ` Jakub Kicinski
2026-05-07 2:58 ` [net-next PATCH v3 5/8] net: dsa: realtek: rtl8365mb: add VLAN support Luiz Angelo Daros de Luca
2026-05-10 15:24 ` Mieczyslaw Nalewaj
2026-05-10 17:34 ` Jakub Kicinski
2026-05-10 17:35 ` Jakub Kicinski
2026-05-07 2:58 ` [net-next PATCH v3 6/8] net: dsa: realtek: rtl8365mb: add port_bridge_{join,leave} Luiz Angelo Daros de Luca
2026-05-10 15:25 ` Mieczyslaw Nalewaj
2026-05-10 17:34 ` Jakub Kicinski
2026-05-10 17:35 ` Jakub Kicinski [this message]
2026-05-07 2:58 ` [net-next PATCH v3 7/8] net: dsa: realtek: rtl8365mb: add FDB support Luiz Angelo Daros de Luca
2026-05-10 15:25 ` Mieczyslaw Nalewaj
2026-05-10 17:34 ` Jakub Kicinski
2026-05-10 17:35 ` Jakub Kicinski
2026-05-11 15:00 ` Mieczyslaw Nalewaj
2026-05-07 2:58 ` [net-next PATCH v3 8/8] net: dsa: realtek: rtl8365mb: add bridge port flags Luiz Angelo Daros de Luca
2026-05-10 15:26 ` Mieczyslaw Nalewaj
2026-05-10 17:34 ` Jakub Kicinski
2026-05-10 17:34 ` [net-next PATCH v3 0/8] net: dsa: realtek: rtl8365mb: bridge offloading and VLAN support Jakub Kicinski
2026-05-11 4:58 ` Luiz Angelo Daros de Luca
2026-05-11 9:31 ` Linus Walleij
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=20260510173514.3920074-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@rasmusvillemoes.dk \
--cc=luizluca@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=yury.norov@gmail.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