From: Wojciech Drewek <wojciech.drewek@intel.com>
To: "Matthias Schiffer" <mschiffer@universe-factory.net>,
"Arınç ÜNAL" <arinc.unal@arinc9.com>,
"Daniel Golle" <daniel@makrotopia.org>,
"DENG Qingfang" <dqfext@gmail.com>,
"Sean Wang" <sean.wang@mediatek.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH net-next v3 2/2] net: dsa: mt7530: add support for bridge port isolation
Date: Tue, 18 Jun 2024 15:18:38 +0200 [thread overview]
Message-ID: <a86c1fcd-6d00-4c31-9d15-5a801fd6c7f4@intel.com> (raw)
In-Reply-To: <499be699382f8b674d19516b6a365b2265de2151.1718694181.git.mschiffer@universe-factory.net>
On 18.06.2024 09:17, Matthias Schiffer wrote:
> Remove a pair of ports from the port matrix when both ports have the
> isolated flag set.
>
> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> ---
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
>
> v2: removed unintended formatting change
> v3: no changes
>
> drivers/net/dsa/mt7530.c | 18 ++++++++++++++++--
> drivers/net/dsa/mt7530.h | 1 +
> 2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 9ce27ce07d77..ec18e68bf3a8 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -1311,6 +1311,7 @@ static void mt7530_update_port_member(struct mt7530_priv *priv, int port,
> struct dsa_port *cpu_dp = dp->cpu_dp;
> u32 port_bitmap = BIT(cpu_dp->index);
> int other_port;
> + bool isolated;
>
> dsa_switch_for_each_user_port(other_dp, priv->ds) {
> other_port = other_dp->index;
> @@ -1327,7 +1328,9 @@ static void mt7530_update_port_member(struct mt7530_priv *priv, int port,
> if (!dsa_port_offloads_bridge_dev(other_dp, bridge_dev))
> continue;
>
> - if (join) {
> + isolated = p->isolated && other_p->isolated;
> +
> + if (join && !isolated) {
> other_p->pm |= PCR_MATRIX(BIT(port));
> port_bitmap |= BIT(other_port);
> } else {
> @@ -1354,7 +1357,7 @@ mt7530_port_pre_bridge_flags(struct dsa_switch *ds, int port,
> struct netlink_ext_ack *extack)
> {
> if (flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD |
> - BR_BCAST_FLOOD))
> + BR_BCAST_FLOOD | BR_ISOLATED))
> return -EINVAL;
>
> return 0;
> @@ -1383,6 +1386,17 @@ mt7530_port_bridge_flags(struct dsa_switch *ds, int port,
> mt7530_rmw(priv, MT753X_MFC, BC_FFP(BIT(port)),
> flags.val & BR_BCAST_FLOOD ? BC_FFP(BIT(port)) : 0);
>
> + if (flags.mask & BR_ISOLATED) {
> + struct dsa_port *dp = dsa_to_port(ds, port);
> + struct net_device *bridge_dev = dsa_port_bridge_dev_get(dp);
> +
> + priv->ports[port].isolated = !!(flags.val & BR_ISOLATED);
> +
> + mutex_lock(&priv->reg_mutex);
> + mt7530_update_port_member(priv, port, bridge_dev, true);
> + mutex_unlock(&priv->reg_mutex);
> + }
> +
> return 0;
> }
>
> diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
> index 2ea4e24628c6..28592123070b 100644
> --- a/drivers/net/dsa/mt7530.h
> +++ b/drivers/net/dsa/mt7530.h
> @@ -721,6 +721,7 @@ struct mt7530_fdb {
> */
> struct mt7530_port {
> bool enable;
> + bool isolated;
> u32 pm;
> u16 pvid;
> struct phylink_pcs *sgmii_pcs;
next prev parent reply other threads:[~2024-06-18 13:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 7:17 [PATCH net-next v3 1/2] net: dsa: mt7530: factor out bridge join/leave logic Matthias Schiffer
2024-06-18 7:17 ` [PATCH net-next v3 2/2] net: dsa: mt7530: add support for bridge port isolation Matthias Schiffer
2024-06-18 13:18 ` Wojciech Drewek [this message]
2024-06-18 19:46 ` Arınç ÜNAL
2024-06-18 13:16 ` [PATCH net-next v3 1/2] net: dsa: mt7530: factor out bridge join/leave logic Wojciech Drewek
2024-06-18 19:45 ` Arınç ÜNAL
2024-06-19 12:20 ` patchwork-bot+netdevbpf
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=a86c1fcd-6d00-4c31-9d15-5a801fd6c7f4@intel.com \
--to=wojciech.drewek@intel.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arinc.unal@arinc9.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mschiffer@universe-factory.net \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=sean.wang@mediatek.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®