linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] net: dsa: rzn1-a5psw: disabled learning for standalone ports and fix STP support
@ 2023-05-11 17:01 alexis.lothore
  2023-05-11 17:02 ` [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port alexis.lothore
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: alexis.lothore @ 2023-05-11 17:01 UTC (permalink / raw)
  To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni
  Cc: linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard

From: Alexis Lothoré <alexis.lothore@bootlin.com>

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
professional 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 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

Clément Léger (3):
  net: dsa: rzn1-a5psw: enable management frames for CPU port
  net: dsa: rzn1-a5psw: fix STP states handling
  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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port
  2023-05-11 17:01 [PATCH net v2 0/3] net: dsa: rzn1-a5psw: disabled learning for standalone ports and fix STP support alexis.lothore
@ 2023-05-11 17:02 ` alexis.lothore
  2023-05-11 21:35   ` Vladimir Oltean
  2023-05-12  4:19   ` kernel test robot
  2023-05-11 17:02 ` [PATCH net v2 2/3] net: dsa: rzn1-a5psw: fix STP states handling alexis.lothore
  2023-05-11 17:02 ` [PATCH net v2 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports alexis.lothore
  2 siblings, 2 replies; 9+ messages in thread
From: alexis.lothore @ 2023-05-11 17:02 UTC (permalink / raw)
  To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni
  Cc: linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard

From: Clément Léger <clement.leger@bootlin.com>

Currently, management frame were discarded before reaching the CPU port due
to a misconfiguration of the MGMT_CONFIG register. Enable them by setting
the correct value in this register in order to correctly receive management
frame and handle STP.

Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 drivers/net/dsa/rzn1_a5psw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 919027cf2012..8a419e2ffe2a 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -673,7 +673,7 @@ static int a5psw_setup(struct dsa_switch *ds)
 	}
 
 	/* Configure management port */
-	reg = A5PSW_CPU_PORT | A5PSW_MGMT_CFG_DISCARD;
+	reg = A5PSW_CPU_PORT | A5PSW_MGMT_CFG_ENABLE;
 	a5psw_reg_writel(a5psw, A5PSW_MGMT_CFG, reg);
 
 	/* Set pattern 0 to forward all frame to mgmt port */
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v2 2/3] net: dsa: rzn1-a5psw: fix STP states handling
  2023-05-11 17:01 [PATCH net v2 0/3] net: dsa: rzn1-a5psw: disabled learning for standalone ports and fix STP support alexis.lothore
  2023-05-11 17:02 ` [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port alexis.lothore
@ 2023-05-11 17:02 ` alexis.lothore
  2023-05-11 21:37   ` Vladimir Oltean
  2023-05-11 17:02 ` [PATCH net v2 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports alexis.lothore
  2 siblings, 1 reply; 9+ messages in thread
From: alexis.lothore @ 2023-05-11 17:02 UTC (permalink / raw)
  To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni
  Cc: linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard

From: Clément Léger <clement.leger@bootlin.com>

stp_set_state() should actually allow receiving BPDU while in LEARNING
mode which is not the case. Additionally, the BLOCKEN bit does not
actually forbid sending forwarded frames from that port. To fix this, add
a5psw_port_tx_enable() function which allows to disable TX. However, while
its name suggest that TX is totally disabled, it is not and can still
allow to send BPDUs even if disabled. This can be done by using forced
forwarding with the switch tagging mechanism but keeping "filtering"
disabled (which is already the case in the rzn1-a5sw tag driver). With
these fixes, STP support is now functional.

Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 drivers/net/dsa/rzn1_a5psw.c | 57 ++++++++++++++++++++++++++++++------
 drivers/net/dsa/rzn1_a5psw.h |  3 +-
 2 files changed, 50 insertions(+), 10 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 8a419e2ffe2a..a3acac29ffa6 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -120,6 +120,22 @@ static void a5psw_port_mgmtfwd_set(struct a5psw *a5psw, int port, bool enable)
 	a5psw_port_pattern_set(a5psw, port, A5PSW_PATTERN_MGMTFWD, enable);
 }
 
+static void a5psw_port_tx_enable(struct a5psw *a5psw, int port, bool enable)
+{
+	u32 mask = A5PSW_PORT_ENA_TX(port);
+	u32 reg = enable ? mask : 0;
+
+	/* Even though the port TX is disabled through TXENA bit in the
+	 * PORT_ENA register, it can still send BPDUs. This depends on the tag
+	 * configuration added when sending packets from the CPU port to the
+	 * switch port. Indeed, when using forced forwarding without filtering,
+	 * even disabled ports will be able to send packets that are tagged.
+	 * This allows to implement STP support when ports are in a state where
+	 * forwarding traffic should be stopped but BPDUs should still be sent.
+	 */
+	a5psw_reg_rmw(a5psw, A5PSW_PORT_ENA, mask, reg);
+}
+
 static void a5psw_port_enable_set(struct a5psw *a5psw, int port, bool enable)
 {
 	u32 port_ena = 0;
@@ -292,6 +308,22 @@ static int a5psw_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
 	return 0;
 }
 
+static void a5psw_port_learning_set(struct a5psw *a5psw, int port, bool learn)
+{
+	u32 mask = A5PSW_INPUT_LEARN_DIS(port);
+	u32 reg = !learn ? mask : 0;
+
+	a5psw_reg_rmw(a5psw, A5PSW_INPUT_LEARN, mask, reg);
+}
+
+static void a5psw_port_rx_block_set(struct a5psw *a5psw, int port, bool block)
+{
+	u32 mask = A5PSW_INPUT_LEARN_BLOCK(port);
+	u32 reg = block ? mask : 0;
+
+	a5psw_reg_rmw(a5psw, A5PSW_INPUT_LEARN, mask, reg);
+}
+
 static void a5psw_flooding_set_resolution(struct a5psw *a5psw, int port,
 					  bool set)
 {
@@ -344,28 +376,35 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port,
 
 static void a5psw_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
 {
-	u32 mask = A5PSW_INPUT_LEARN_DIS(port) | A5PSW_INPUT_LEARN_BLOCK(port);
 	struct a5psw *a5psw = ds->priv;
-	u32 reg = 0;
+	bool learning_enabled, rx_enabled, tx_enabled;
 
 	switch (state) {
 	case BR_STATE_DISABLED:
 	case BR_STATE_BLOCKING:
-		reg |= A5PSW_INPUT_LEARN_DIS(port);
-		reg |= A5PSW_INPUT_LEARN_BLOCK(port);
-		break;
 	case BR_STATE_LISTENING:
-		reg |= A5PSW_INPUT_LEARN_DIS(port);
+		rx_enabled = false;
+		tx_enabled = false;
+		learning_enabled = false;
 		break;
 	case BR_STATE_LEARNING:
-		reg |= A5PSW_INPUT_LEARN_BLOCK(port);
+		rx_enabled = false;
+		tx_enabled = false;
+		learning_enabled = true;
 		break;
 	case BR_STATE_FORWARDING:
-	default:
+		rx_enabled = true;
+		tx_enabled = true;
+		learning_enabled = true;
 		break;
+	default:
+		dev_err(ds->dev, "invalid STP state: %d\n", state);
+		return;
 	}
 
-	a5psw_reg_rmw(a5psw, A5PSW_INPUT_LEARN, mask, reg);
+	a5psw_port_learning_set(a5psw, port, learning_enabled);
+	a5psw_port_rx_block_set(a5psw, port, !rx_enabled);
+	a5psw_port_tx_enable(a5psw, port, tx_enabled);
 }
 
 static void a5psw_port_fast_age(struct dsa_switch *ds, int port)
diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index c67abd49c013..b869192eef3f 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -19,6 +19,7 @@
 #define A5PSW_PORT_OFFSET(port)		(0x400 * (port))
 
 #define A5PSW_PORT_ENA			0x8
+#define A5PSW_PORT_ENA_TX(port)		BIT(port)
 #define A5PSW_PORT_ENA_RX_SHIFT		16
 #define A5PSW_PORT_ENA_TX_RX(port)	(BIT((port) + A5PSW_PORT_ENA_RX_SHIFT) | \
 					 BIT(port))
@@ -36,7 +37,7 @@
 #define A5PSW_INPUT_LEARN_BLOCK(p)	BIT(p)
 
 #define A5PSW_MGMT_CFG			0x20
-#define A5PSW_MGMT_CFG_DISCARD		BIT(7)
+#define A5PSW_MGMT_CFG_ENABLE		BIT(6)
 
 #define A5PSW_MODE_CFG			0x24
 #define A5PSW_MODE_STATS_RESET		BIT(31)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net v2 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports
  2023-05-11 17:01 [PATCH net v2 0/3] net: dsa: rzn1-a5psw: disabled learning for standalone ports and fix STP support alexis.lothore
  2023-05-11 17:02 ` [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port alexis.lothore
  2023-05-11 17:02 ` [PATCH net v2 2/3] net: dsa: rzn1-a5psw: fix STP states handling alexis.lothore
@ 2023-05-11 17:02 ` alexis.lothore
  2023-05-11 21:38   ` Vladimir Oltean
  2 siblings, 1 reply; 9+ messages in thread
From: alexis.lothore @ 2023-05-11 17:02 UTC (permalink / raw)
  To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni
  Cc: linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard

From: Clément Léger <clement.leger@bootlin.com>

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 <clement.leger@bootlin.com>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 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 a3acac29ffa6..02f83d19656a 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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port
  2023-05-11 17:02 ` [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port alexis.lothore
@ 2023-05-11 21:35   ` Vladimir Oltean
  2023-05-12  4:19   ` kernel test robot
  1 sibling, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2023-05-11 21:35 UTC (permalink / raw)
  To: alexis.lothore
  Cc: andrew, f.fainelli, davem, edumazet, kuba, pabeni,
	linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard, Clément Léger

On Thu, May 11, 2023 at 07:02:00PM +0200, alexis.lothore@bootlin.com wrote:
> From: Clément Léger <clement.leger@bootlin.com>
> 
> Currently, management frame were discarded before reaching the CPU port due
> to a misconfiguration of the MGMT_CONFIG register. Enable them by setting
> the correct value in this register in order to correctly receive management
> frame and handle STP.
> 
> Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 2/3] net: dsa: rzn1-a5psw: fix STP states handling
  2023-05-11 17:02 ` [PATCH net v2 2/3] net: dsa: rzn1-a5psw: fix STP states handling alexis.lothore
@ 2023-05-11 21:37   ` Vladimir Oltean
  2023-05-12  6:33     ` Alexis Lothoré
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Oltean @ 2023-05-11 21:37 UTC (permalink / raw)
  To: alexis.lothore
  Cc: andrew, f.fainelli, davem, edumazet, kuba, pabeni,
	linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard

On Thu, May 11, 2023 at 07:02:01PM +0200, alexis.lothore@bootlin.com wrote:
> From: Clément Léger <clement.leger@bootlin.com>
> 
> stp_set_state() should actually allow receiving BPDU while in LEARNING
> mode which is not the case. Additionally, the BLOCKEN bit does not
> actually forbid sending forwarded frames from that port. To fix this, add
> a5psw_port_tx_enable() function which allows to disable TX. However, while
> its name suggest that TX is totally disabled, it is not and can still
> allow to send BPDUs even if disabled. This can be done by using forced
> forwarding with the switch tagging mechanism but keeping "filtering"
> disabled (which is already the case in the rzn1-a5sw tag driver). With
> these fixes, STP support is now functional.
> 
> Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

> @@ -344,28 +376,35 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port,
>  
>  static void a5psw_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
>  {
> -	u32 mask = A5PSW_INPUT_LEARN_DIS(port) | A5PSW_INPUT_LEARN_BLOCK(port);
>  	struct a5psw *a5psw = ds->priv;
> -	u32 reg = 0;
> +	bool learning_enabled, rx_enabled, tx_enabled;

Absolutely minor comment: in the networking subsystem there is a coding
style preference to order lines with variable declarations longest to
shortest (reverse Christmas tree). Since I don't see another less
frivolous reason to resend the patch set, I thought I'd just mention
for next time.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports
  2023-05-11 17:02 ` [PATCH net v2 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports alexis.lothore
@ 2023-05-11 21:38   ` Vladimir Oltean
  0 siblings, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2023-05-11 21:38 UTC (permalink / raw)
  To: alexis.lothore
  Cc: andrew, f.fainelli, davem, edumazet, kuba, pabeni,
	linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard

On Thu, May 11, 2023 at 07:02:02PM +0200, alexis.lothore@bootlin.com wrote:
> From: Clément Léger <clement.leger@bootlin.com>
> 
> 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 <clement.leger@bootlin.com>
> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port
  2023-05-11 17:02 ` [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port alexis.lothore
  2023-05-11 21:35   ` Vladimir Oltean
@ 2023-05-12  4:19   ` kernel test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2023-05-12  4:19 UTC (permalink / raw)
  To: alexis.lothore, andrew, f.fainelli, olteanv, davem, edumazet,
	kuba, pabeni
  Cc: oe-kbuild-all, linux-renesas-soc, netdev, linux-kernel,
	thomas.petazzoni, herve.codina, miquel.raynal, milan.stevanovic,
	jimmy.lalande, pascal.eberhard

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]

url:    https://github.com/intel-lab-lkp/linux/commits/alexis-lothore-bootlin-com/net-dsa-rzn1-a5psw-enable-management-frames-for-CPU-port/20230512-010530
base:   net/main
patch link:    https://lore.kernel.org/r/20230511170202.742087-2-alexis.lothore%40bootlin.com
patch subject: [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20230512/202305121153.NMzdkguI-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/1a3acdd4d7ad50be9d4df989592327668610b13a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review alexis-lothore-bootlin-com/net-dsa-rzn1-a5psw-enable-management-frames-for-CPU-port/20230512-010530
        git checkout 1a3acdd4d7ad50be9d4df989592327668610b13a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305121153.NMzdkguI-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/dsa/rzn1_a5psw.c: In function 'a5psw_setup':
>> drivers/net/dsa/rzn1_a5psw.c:676:32: error: 'A5PSW_MGMT_CFG_ENABLE' undeclared (first use in this function); did you mean 'A5PSW_MGMT_TAG_CFG_ENABLE'?
     676 |         reg = A5PSW_CPU_PORT | A5PSW_MGMT_CFG_ENABLE;
         |                                ^~~~~~~~~~~~~~~~~~~~~
         |                                A5PSW_MGMT_TAG_CFG_ENABLE
   drivers/net/dsa/rzn1_a5psw.c:676:32: note: each undeclared identifier is reported only once for each function it appears in


vim +676 drivers/net/dsa/rzn1_a5psw.c

   659	
   660	static int a5psw_setup(struct dsa_switch *ds)
   661	{
   662		struct a5psw *a5psw = ds->priv;
   663		int port, vlan, ret;
   664		struct dsa_port *dp;
   665		u32 reg;
   666	
   667		/* Validate that there is only 1 CPU port with index A5PSW_CPU_PORT */
   668		dsa_switch_for_each_cpu_port(dp, ds) {
   669			if (dp->index != A5PSW_CPU_PORT) {
   670				dev_err(a5psw->dev, "Invalid CPU port\n");
   671				return -EINVAL;
   672			}
   673		}
   674	
   675		/* Configure management port */
 > 676		reg = A5PSW_CPU_PORT | A5PSW_MGMT_CFG_ENABLE;
   677		a5psw_reg_writel(a5psw, A5PSW_MGMT_CFG, reg);
   678	
   679		/* Set pattern 0 to forward all frame to mgmt port */
   680		a5psw_reg_writel(a5psw, A5PSW_PATTERN_CTRL(A5PSW_PATTERN_MGMTFWD),
   681				 A5PSW_PATTERN_CTRL_MGMTFWD);
   682	
   683		/* Enable port tagging */
   684		reg = FIELD_PREP(A5PSW_MGMT_TAG_CFG_TAGFIELD, ETH_P_DSA_A5PSW);
   685		reg |= A5PSW_MGMT_TAG_CFG_ENABLE | A5PSW_MGMT_TAG_CFG_ALL_FRAMES;
   686		a5psw_reg_writel(a5psw, A5PSW_MGMT_TAG_CFG, reg);
   687	
   688		/* Enable normal switch operation */
   689		reg = A5PSW_LK_ADDR_CTRL_BLOCKING | A5PSW_LK_ADDR_CTRL_LEARNING |
   690		      A5PSW_LK_ADDR_CTRL_AGEING | A5PSW_LK_ADDR_CTRL_ALLOW_MIGR |
   691		      A5PSW_LK_ADDR_CTRL_CLEAR_TABLE;
   692		a5psw_reg_writel(a5psw, A5PSW_LK_CTRL, reg);
   693	
   694		ret = readl_poll_timeout(a5psw->base + A5PSW_LK_CTRL, reg,
   695					 !(reg & A5PSW_LK_ADDR_CTRL_CLEAR_TABLE),
   696					 A5PSW_LK_BUSY_USEC_POLL, A5PSW_CTRL_TIMEOUT);
   697		if (ret) {
   698			dev_err(a5psw->dev, "Failed to clear lookup table\n");
   699			return ret;
   700		}
   701	
   702		/* Reset learn count to 0 */
   703		reg = A5PSW_LK_LEARNCOUNT_MODE_SET;
   704		a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
   705	
   706		/* Clear VLAN resource table */
   707		reg = A5PSW_VLAN_RES_WR_PORTMASK | A5PSW_VLAN_RES_WR_TAGMASK;
   708		for (vlan = 0; vlan < A5PSW_VLAN_COUNT; vlan++)
   709			a5psw_reg_writel(a5psw, A5PSW_VLAN_RES(vlan), reg);
   710	
   711		/* Reset all ports */
   712		dsa_switch_for_each_port(dp, ds) {
   713			port = dp->index;
   714	
   715			/* Reset the port */
   716			a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port),
   717					 A5PSW_CMD_CFG_SW_RESET);
   718	
   719			/* Enable only CPU port */
   720			a5psw_port_enable_set(a5psw, port, dsa_port_is_cpu(dp));
   721	
   722			if (dsa_port_is_unused(dp))
   723				continue;
   724	
   725			/* Enable egress flooding for CPU port */
   726			if (dsa_port_is_cpu(dp))
   727				a5psw_flooding_set_resolution(a5psw, port, true);
   728	
   729			/* Enable management forward only for user ports */
   730			if (dsa_port_is_user(dp))
   731				a5psw_port_mgmtfwd_set(a5psw, port, true);
   732		}
   733	
   734		return 0;
   735	}
   736	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net v2 2/3] net: dsa: rzn1-a5psw: fix STP states handling
  2023-05-11 21:37   ` Vladimir Oltean
@ 2023-05-12  6:33     ` Alexis Lothoré
  0 siblings, 0 replies; 9+ messages in thread
From: Alexis Lothoré @ 2023-05-12  6:33 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: andrew, f.fainelli, davem, edumazet, kuba, pabeni,
	linux-renesas-soc, netdev, linux-kernel, thomas.petazzoni,
	herve.codina, miquel.raynal, milan.stevanovic, jimmy.lalande,
	pascal.eberhard

Hello Vladimir,
thanks for the fast review !
On 5/11/23 23:37, Vladimir Oltean wrote:
> On Thu, May 11, 2023 at 07:02:01PM +0200, alexis.lothore@bootlin.com wrote:
>> From: Clément Léger <clement.leger@bootlin.com>
>>
>> stp_set_state() should actually allow receiving BPDU while in LEARNING
>> mode which is not the case. Additionally, the BLOCKEN bit does not
>> actually forbid sending forwarded frames from that port. To fix this, add
>> a5psw_port_tx_enable() function which allows to disable TX. However, while
>> its name suggest that TX is totally disabled, it is not and can still
>> allow to send BPDUs even if disabled. This can be done by using forced
>> forwarding with the switch tagging mechanism but keeping "filtering"
>> disabled (which is already the case in the rzn1-a5sw tag driver). With
>> these fixes, STP support is now functional.
>>
>> Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
>> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
>> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
>> ---
> 
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
> 
>> @@ -344,28 +376,35 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port,
>>  
>>  static void a5psw_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
>>  {
>> -	u32 mask = A5PSW_INPUT_LEARN_DIS(port) | A5PSW_INPUT_LEARN_BLOCK(port);
>>  	struct a5psw *a5psw = ds->priv;
>> -	u32 reg = 0;
>> +	bool learning_enabled, rx_enabled, tx_enabled;
> 
> Absolutely minor comment: in the networking subsystem there is a coding
> style preference to order lines with variable declarations longest to
> shortest (reverse Christmas tree). Since I don't see another less
> frivolous reason to resend the patch set, I thought I'd just mention
> for next time.

ACK. Since an error has been raised by CI bot on this series, I will send a V3
and fix this ordering too.

Regards,

-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-05-12  6:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 17:01 [PATCH net v2 0/3] net: dsa: rzn1-a5psw: disabled learning for standalone ports and fix STP support alexis.lothore
2023-05-11 17:02 ` [PATCH net v2 1/3] net: dsa: rzn1-a5psw: enable management frames for CPU port alexis.lothore
2023-05-11 21:35   ` Vladimir Oltean
2023-05-12  4:19   ` kernel test robot
2023-05-11 17:02 ` [PATCH net v2 2/3] net: dsa: rzn1-a5psw: fix STP states handling alexis.lothore
2023-05-11 21:37   ` Vladimir Oltean
2023-05-12  6:33     ` Alexis Lothoré
2023-05-11 17:02 ` [PATCH net v2 3/3] net: dsa: rzn1-a5psw: disable learning for standalone ports alexis.lothore
2023-05-11 21:38   ` Vladimir Oltean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).