[PATCH net-next v2 0/4] net: dsa: hellcreek: Fix handling of MGMT protocols

STALE1760d LANDED

Landed in mainline as 6cf7a1ac0fed on 2021-12-15.

10 messages, 4 authors, 2021-12-15 · open the first message on its own page

[PATCH net-next v2 0/4] net: dsa: hellcreek: Fix handling of MGMT protocols

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: 2021-12-14 13:45:40

Hi,

this series fixes some minor issues with regards to management protocols such as
PTP and STP in the hellcreek DSA driver. Configure static FDB for these
protocols. The end result is:

|root@tsn:~# mv88e6xxx_dump --atu
|Using device <platform/ff240000.switch>
|ATU:
|FID  MAC               0123 Age OBT Pass Static Reprio Prio
|   0 01:1b:19:00:00:00 1100   1               X       X    6
|   1 01:00:5e:00:01:81 1100   1               X       X    6
|   2 33:33:00:00:01:81 1100   1               X       X    6
|   3 01:80:c2:00:00:0e 1100   1        X      X       X    6
|   4 01:00:5e:00:00:6b 1100   1        X      X       X    6
|   5 33:33:00:00:00:6b 1100   1        X      X       X    6
|   6 01:80:c2:00:00:00 1100   1        X      X       X    6

Thanks,
Kurt

Previous version:

 * https://lore.kernel.org/r/20211213101810.121553-1-kurt@linutronix.de/

Changes since v1:

 * Target net-next, as this never worked correctly and is not critical
 * Add STP and PTP over UDP rules
 * Use pass_blocked for PDelay messages only (Richard Cochran)

Kurt Kanzenbach (4):
  net: dsa: hellcreek: Fix insertion of static FDB entries
  net: dsa: hellcreek: Add STP forwarding rule
  net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports
  net: dsa: hellcreek: Add missing PTP via UDP rules

 drivers/net/dsa/hirschmann/hellcreek.c | 87 +++++++++++++++++++++++---
 1 file changed, 80 insertions(+), 7 deletions(-)

-- 
2.30.2

[PATCH net-next v2 1/4] net: dsa: hellcreek: Fix insertion of static FDB entries

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: 2021-12-14 13:45:40

The insertion of static FDB entries ignores the pass_blocked bit. That bit is
evaluated with regards to STP. Add the missing functionality.

Fixes: e4b27ebc780f ("net: dsa: Add DSA driver for Hirschmann Hellcreek switches")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/dsa/hirschmann/hellcreek.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
index 9eecb7529573..c4f840b20adf 100644
--- a/drivers/net/dsa/hirschmann/hellcreek.c
+++ b/drivers/net/dsa/hirschmann/hellcreek.c
@@ -711,8 +711,9 @@ static int __hellcreek_fdb_add(struct hellcreek *hellcreek,
 	u16 meta = 0;
 
 	dev_dbg(hellcreek->dev, "Add static FDB entry: MAC=%pM, MASK=0x%02x, "
-		"OBT=%d, REPRIO_EN=%d, PRIO=%d\n", entry->mac, entry->portmask,
-		entry->is_obt, entry->reprio_en, entry->reprio_tc);
+		"OBT=%d, PASS_BLOCKED=%d, REPRIO_EN=%d, PRIO=%d\n", entry->mac,
+		entry->portmask, entry->is_obt, entry->pass_blocked,
+		entry->reprio_en, entry->reprio_tc);
 
 	/* Add mac address */
 	hellcreek_write(hellcreek, entry->mac[1] | (entry->mac[0] << 8), HR_FDBWDH);
@@ -723,6 +724,8 @@ static int __hellcreek_fdb_add(struct hellcreek *hellcreek,
 	meta |= entry->portmask << HR_FDBWRM0_PORTMASK_SHIFT;
 	if (entry->is_obt)
 		meta |= HR_FDBWRM0_OBT;
+	if (entry->pass_blocked)
+		meta |= HR_FDBWRM0_PASS_BLOCKED;
 	if (entry->reprio_en) {
 		meta |= HR_FDBWRM0_REPRIO_EN;
 		meta |= entry->reprio_tc << HR_FDBWRM0_REPRIO_TC_SHIFT;
-- 
2.30.2

[PATCH net-next v2 2/4] net: dsa: hellcreek: Add STP forwarding rule

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: 2021-12-14 13:45:41

Treat STP as management traffic. STP traffic is designated for the CPU port
only. In addition, STP traffic has to pass blocked ports.

Fixes: e4b27ebc780f ("net: dsa: Add DSA driver for Hirschmann Hellcreek switches")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/dsa/hirschmann/hellcreek.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
index c4f840b20adf..17d3a4a3582e 100644
--- a/drivers/net/dsa/hirschmann/hellcreek.c
+++ b/drivers/net/dsa/hirschmann/hellcreek.c
@@ -1075,6 +1075,17 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
 		.reprio_en    = 1,
 	};
+	static struct hellcreek_fdb_entry stp = {
+		/* MAC: 01-80-C2-00-00-00 */
+		.mac	      = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 },
+		.portmask     = 0x03,	/* Management ports */
+		.age	      = 0,
+		.is_obt	      = 0,
+		.pass_blocked = 1,
+		.is_static    = 1,
+		.reprio_tc    = 6,
+		.reprio_en    = 1,
+	};
 	int ret;
 
 	mutex_lock(&hellcreek->reg_lock);
@@ -1082,6 +1093,9 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 	if (ret)
 		goto out;
 	ret = __hellcreek_fdb_add(hellcreek, &p2p);
+	if (ret)
+		goto out;
+	ret = __hellcreek_fdb_add(hellcreek, &stp);
 out:
 	mutex_unlock(&hellcreek->reg_lock);
 
-- 
2.30.2

[PATCH net-next v2 3/4] net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: 2021-12-14 13:45:41

Allow PTP peer delay measurements on blocked ports by STP. In case of topology
changes the PTP stack can directly start with the correct delays.

Fixes: ddd56dfe52c9 ("net: dsa: hellcreek: Add PTP clock support")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/dsa/hirschmann/hellcreek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
index 17d3a4a3582e..cc0e4465bbbf 100644
--- a/drivers/net/dsa/hirschmann/hellcreek.c
+++ b/drivers/net/dsa/hirschmann/hellcreek.c
@@ -1070,7 +1070,7 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 		.portmask     = 0x03,	/* Management ports */
 		.age	      = 0,
 		.is_obt	      = 0,
-		.pass_blocked = 0,
+		.pass_blocked = 1,
 		.is_static    = 1,
 		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
 		.reprio_en    = 1,
-- 
2.30.2

[PATCH net-next v2 4/4] net: dsa: hellcreek: Add missing PTP via UDP rules

From: Kurt Kanzenbach <kurt@linutronix.de>
Date: 2021-12-14 13:45:41

The switch supports PTP for UDP transport too. Therefore, add the missing static
FDB entries to ensure correct forwarding of these packets.

Fixes: ddd56dfe52c9 ("net: dsa: hellcreek: Add PTP clock support")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/dsa/hirschmann/hellcreek.c | 64 ++++++++++++++++++++++++--
 1 file changed, 60 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
index cc0e4465bbbf..726f267cb228 100644
--- a/drivers/net/dsa/hirschmann/hellcreek.c
+++ b/drivers/net/dsa/hirschmann/hellcreek.c
@@ -1053,7 +1053,7 @@ static void hellcreek_setup_tc_identity_mapping(struct hellcreek *hellcreek)
 
 static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 {
-	static struct hellcreek_fdb_entry ptp = {
+	static struct hellcreek_fdb_entry l2_ptp = {
 		/* MAC: 01-1B-19-00-00-00 */
 		.mac	      = { 0x01, 0x1b, 0x19, 0x00, 0x00, 0x00 },
 		.portmask     = 0x03,	/* Management ports */
@@ -1064,7 +1064,29 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
 		.reprio_en    = 1,
 	};
-	static struct hellcreek_fdb_entry p2p = {
+	static struct hellcreek_fdb_entry udp4_ptp = {
+		/* MAC: 01-00-5E-00-01-81 */
+		.mac	      = { 0x01, 0x00, 0x5e, 0x00, 0x01, 0x81 },
+		.portmask     = 0x03,	/* Management ports */
+		.age	      = 0,
+		.is_obt	      = 0,
+		.pass_blocked = 0,
+		.is_static    = 1,
+		.reprio_tc    = 6,
+		.reprio_en    = 1,
+	};
+	static struct hellcreek_fdb_entry udp6_ptp = {
+		/* MAC: 33-33-00-00-01-81 */
+		.mac	      = { 0x33, 0x33, 0x00, 0x00, 0x01, 0x81 },
+		.portmask     = 0x03,	/* Management ports */
+		.age	      = 0,
+		.is_obt	      = 0,
+		.pass_blocked = 0,
+		.is_static    = 1,
+		.reprio_tc    = 6,
+		.reprio_en    = 1,
+	};
+	static struct hellcreek_fdb_entry l2_p2p = {
 		/* MAC: 01-80-C2-00-00-0E */
 		.mac	      = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e },
 		.portmask     = 0x03,	/* Management ports */
@@ -1075,6 +1097,28 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
 		.reprio_en    = 1,
 	};
+	static struct hellcreek_fdb_entry udp4_p2p = {
+		/* MAC: 01-00-5E-00-00-6B */
+		.mac	      = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x6b },
+		.portmask     = 0x03,	/* Management ports */
+		.age	      = 0,
+		.is_obt	      = 0,
+		.pass_blocked = 1,
+		.is_static    = 1,
+		.reprio_tc    = 6,
+		.reprio_en    = 1,
+	};
+	static struct hellcreek_fdb_entry udp6_p2p = {
+		/* MAC: 33-33-00-00-00-6B */
+		.mac	      = { 0x33, 0x33, 0x00, 0x00, 0x00, 0x6b },
+		.portmask     = 0x03,	/* Management ports */
+		.age	      = 0,
+		.is_obt	      = 0,
+		.pass_blocked = 1,
+		.is_static    = 1,
+		.reprio_tc    = 6,
+		.reprio_en    = 1,
+	};
 	static struct hellcreek_fdb_entry stp = {
 		/* MAC: 01-80-C2-00-00-00 */
 		.mac	      = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 },
@@ -1089,10 +1133,22 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 	int ret;
 
 	mutex_lock(&hellcreek->reg_lock);
-	ret = __hellcreek_fdb_add(hellcreek, &ptp);
+	ret = __hellcreek_fdb_add(hellcreek, &l2_ptp);
+	if (ret)
+		goto out;
+	ret = __hellcreek_fdb_add(hellcreek, &udp4_ptp);
+	if (ret)
+		goto out;
+	ret = __hellcreek_fdb_add(hellcreek, &udp6_ptp);
+	if (ret)
+		goto out;
+	ret = __hellcreek_fdb_add(hellcreek, &l2_p2p);
+	if (ret)
+		goto out;
+	ret = __hellcreek_fdb_add(hellcreek, &udp4_p2p);
 	if (ret)
 		goto out;
-	ret = __hellcreek_fdb_add(hellcreek, &p2p);
+	ret = __hellcreek_fdb_add(hellcreek, &udp6_p2p);
 	if (ret)
 		goto out;
 	ret = __hellcreek_fdb_add(hellcreek, &stp);
-- 
2.30.2

Re: [PATCH net-next v2 0/4] net: dsa: hellcreek: Fix handling of MGMT protocols

From: Richard Cochran <richardcochran@gmail.com>
Date: 2021-12-14 20:10:02

On Tue, Dec 14, 2021 at 02:45:04PM +0100, Kurt Kanzenbach wrote:
Kurt Kanzenbach (4):
  net: dsa: hellcreek: Fix insertion of static FDB entries
  net: dsa: hellcreek: Add STP forwarding rule
  net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports
  net: dsa: hellcreek: Add missing PTP via UDP rules

 drivers/net/dsa/hirschmann/hellcreek.c | 87 +++++++++++++++++++++++---
 1 file changed, 80 insertions(+), 7 deletions(-)
Acked-by: Richard Cochran <richardcochran@gmail.com>

Re: [PATCH net-next v2 1/4] net: dsa: hellcreek: Fix insertion of static FDB entries

From: Vladimir Oltean <olteanv@gmail.com>
Date: 2021-12-14 20:53:45

On Tue, Dec 14, 2021 at 02:45:05PM +0100, Kurt Kanzenbach wrote:
The insertion of static FDB entries ignores the pass_blocked bit. That bit is
evaluated with regards to STP. Add the missing functionality.

Fixes: e4b27ebc780f ("net: dsa: Add DSA driver for Hirschmann Hellcreek switches")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

Re: [PATCH net-next v2 3/4] net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports

From: Vladimir Oltean <olteanv@gmail.com>
Date: 2021-12-14 20:54:20

On Tue, Dec 14, 2021 at 02:45:07PM +0100, Kurt Kanzenbach wrote:
Allow PTP peer delay measurements on blocked ports by STP. In case of topology
changes the PTP stack can directly start with the correct delays.

Fixes: ddd56dfe52c9 ("net: dsa: hellcreek: Add PTP clock support")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

Re: [PATCH net-next v2 2/4] net: dsa: hellcreek: Add STP forwarding rule

From: Vladimir Oltean <olteanv@gmail.com>
Date: 2021-12-14 20:55:20

On Tue, Dec 14, 2021 at 02:45:06PM +0100, Kurt Kanzenbach wrote:
Treat STP as management traffic. STP traffic is designated for the CPU port
only. In addition, STP traffic has to pass blocked ports.

Fixes: e4b27ebc780f ("net: dsa: Add DSA driver for Hirschmann Hellcreek switches")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
Kinda "net" material?

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

Re: [PATCH net-next v2 0/4] net: dsa: hellcreek: Fix handling of MGMT protocols

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-12-15 03:00:15

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski [off-list ref]:

On Tue, 14 Dec 2021 14:45:04 +0100 you wrote:
Hi,

this series fixes some minor issues with regards to management protocols such as
PTP and STP in the hellcreek DSA driver. Configure static FDB for these
protocols. The end result is:

|root@tsn:~# mv88e6xxx_dump --atu
|Using device <platform/ff240000.switch>
|ATU:
|FID  MAC               0123 Age OBT Pass Static Reprio Prio
|   0 01:1b:19:00:00:00 1100   1               X       X    6
|   1 01:00:5e:00:01:81 1100   1               X       X    6
|   2 33:33:00:00:01:81 1100   1               X       X    6
|   3 01:80:c2:00:00:0e 1100   1        X      X       X    6
|   4 01:00:5e:00:00:6b 1100   1        X      X       X    6
|   5 33:33:00:00:00:6b 1100   1        X      X       X    6
|   6 01:80:c2:00:00:00 1100   1        X      X       X    6

[...]
Here is the summary with links:
  - [net-next,v2,1/4] net: dsa: hellcreek: Fix insertion of static FDB entries
    https://git.kernel.org/netdev/net-next/c/4db4c3ea5697
  - [net-next,v2,2/4] net: dsa: hellcreek: Add STP forwarding rule
    https://git.kernel.org/netdev/net-next/c/b7ade35eb53a
  - [net-next,v2,3/4] net: dsa: hellcreek: Allow PTP P2P measurements on blocked ports
    https://git.kernel.org/netdev/net-next/c/cad1798d2d08
  - [net-next,v2,4/4] net: dsa: hellcreek: Add missing PTP via UDP rules
    https://git.kernel.org/netdev/net-next/c/6cf01e451599

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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help