2023-05-12 07:53:51

by Alexis Lothoré

[permalink] [raw]
Subject: [PATCH net v3 0/3] net: dsa: rzn1-a5psw: fix STP states handling

From: Alexis Lothoré <[email protected]>

This small series fixes STP support and while adding a new function to
enable/disable learning, use that to disable learning on standalone ports
at switch setup as reported by Vladimir Oltean.

This series was initially submitted on net-next by Clement Leger, but some
career evolutions has made him hand me over those topics.
Also, this new revision is submitted on net instead of net-next for V1
based on Vladimir Oltean's suggestion

Changes since v2:
- fix commit split by moving A5PSW_MGMT_CFG_ENABLE in relevant commit
- fix reverse christmas tree ordering in a5psw_port_stp_state_set

Changes since v1:
- fix typos in commit messages and doc
- re-split STP states handling commit
- add Fixes: tag and new Signed-off-by
- submit series as fix on net instead of net-next
- split learning and blocking setting functions
- remove unused define A5PSW_PORT_ENA_TX_SHIFT
- add boolean for tx/rx enabled for clarity

Alexis Lothoré (1):
net: dsa: rzn1-a5psw: fix STP states handling

Clément Léger (2):
net: dsa: rzn1-a5psw: enable management frames for CPU port
net: dsa: rzn1-a5psw: disable learning for standalone ports

drivers/net/dsa/rzn1_a5psw.c | 83 ++++++++++++++++++++++++++++--------
drivers/net/dsa/rzn1_a5psw.h | 3 +-
2 files changed, 67 insertions(+), 19 deletions(-)

--
2.40.1



2023-05-12 07:54:46

by Alexis Lothoré

[permalink] [raw]
Subject: [PATCH net v3 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports

From: Clément Léger <[email protected]>

When ports are in standalone mode, they should have learning disabled to
avoid adding new entries in the MAC lookup table which might be used by
other bridge ports to forward packets. While adding that, also make sure
learning is enabled for CPU port.

Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Signed-off-by: Clément Léger <[email protected]>
Signed-off-by: Alexis Lothoré <[email protected]>
---
drivers/net/dsa/rzn1_a5psw.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index e2549cb31d00..c37d2e537230 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -340,6 +340,14 @@ static void a5psw_flooding_set_resolution(struct a5psw *a5psw, int port,
a5psw_reg_writel(a5psw, offsets[i], a5psw->bridged_ports);
}

+static void a5psw_port_set_standalone(struct a5psw *a5psw, int port,
+ bool standalone)
+{
+ a5psw_port_learning_set(a5psw, port, !standalone);
+ a5psw_flooding_set_resolution(a5psw, port, !standalone);
+ a5psw_port_mgmtfwd_set(a5psw, port, standalone);
+}
+
static int a5psw_port_bridge_join(struct dsa_switch *ds, int port,
struct dsa_bridge bridge,
bool *tx_fwd_offload,
@@ -355,8 +363,7 @@ static int a5psw_port_bridge_join(struct dsa_switch *ds, int port,
}

a5psw->br_dev = bridge.dev;
- a5psw_flooding_set_resolution(a5psw, port, true);
- a5psw_port_mgmtfwd_set(a5psw, port, false);
+ a5psw_port_set_standalone(a5psw, port, false);

return 0;
}
@@ -366,8 +373,7 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port,
{
struct a5psw *a5psw = ds->priv;

- a5psw_flooding_set_resolution(a5psw, port, false);
- a5psw_port_mgmtfwd_set(a5psw, port, true);
+ a5psw_port_set_standalone(a5psw, port, true);

/* No more ports bridged */
if (a5psw->bridged_ports == BIT(A5PSW_CPU_PORT))
@@ -761,13 +767,15 @@ static int a5psw_setup(struct dsa_switch *ds)
if (dsa_port_is_unused(dp))
continue;

- /* Enable egress flooding for CPU port */
- if (dsa_port_is_cpu(dp))
+ /* Enable egress flooding and learning for CPU port */
+ if (dsa_port_is_cpu(dp)) {
a5psw_flooding_set_resolution(a5psw, port, true);
+ a5psw_port_learning_set(a5psw, port, true);
+ }

- /* Enable management forward only for user ports */
+ /* Enable standalone mode for user ports */
if (dsa_port_is_user(dp))
- a5psw_port_mgmtfwd_set(a5psw, port, true);
+ a5psw_port_set_standalone(a5psw, port, true);
}

return 0;
--
2.40.1


2023-05-12 16:38:14

by Piotr Raczynski

[permalink] [raw]
Subject: Re: [PATCH net v3 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports

On Fri, May 12, 2023 at 09:27:12AM +0200, [email protected] wrote:
> From: Cl?ment L?ger <[email protected]>
>
> When ports are in standalone mode, they should have learning disabled to
> avoid adding new entries in the MAC lookup table which might be used by
> other bridge ports to forward packets. While adding that, also make sure
> learning is enabled for CPU port.
>
> Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
> Signed-off-by: Cl?ment L?ger <[email protected]>
> Signed-off-by: Alexis Lothor? <[email protected]>
Reviewed-by: Piotr Raczynski <[email protected]>

2023-05-13 16:57:46

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net v3 0/3] net: dsa: rzn1-a5psw: fix STP states handling

Hello:

This series was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

On Fri, 12 May 2023 09:27:09 +0200 you wrote:
> From: Alexis Lothoré <[email protected]>
>
> This small series fixes STP support and while adding a new function to
> enable/disable learning, use that to disable learning on standalone ports
> at switch setup as reported by Vladimir Oltean.
>
> This series was initially submitted on net-next by Clement Leger, but some
> career evolutions has made him hand me over those topics.
> Also, this new revision is submitted on net instead of net-next for V1
> based on Vladimir Oltean's suggestion
>
> [...]

Here is the summary with links:
- [net,v3,1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port
https://git.kernel.org/netdev/net/c/9e4b45f20c5a
- [net,v3,2/3] net: dsa: rzn1-a5psw: fix STP states handling
https://git.kernel.org/netdev/net/c/ebe9bc509527
- [net,v3,3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports
https://git.kernel.org/netdev/net/c/ec52b69c046a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html