Skip to contentSkip to conversation

net: dsa: mt7530: disable learning on standalone ports

PATCH In review DENG Qingfang 3 participants 8 messages Aug 24, 2021 – Sep 7, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: mt7530: disable learning on standalone ports

This is a partial backport of commit 5a30833b9a16f8d1aa15de06636f9317ca51f9df ("net: dsa: mt7530: support MDB and bridge flag operations") upstream.

Make sure that the standalone ports start up with learning disabled.

---
 drivers/net/dsa/mt7530.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/dsa/mt7530.c +10 -2
index 6335c4ea0957..67dfab774618 100644
@@ -803,6 +803,8 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port,
 			   PCR_MATRIX_MASK, PCR_MATRIX(port_bitmap));
 	priv->ports[port].pm |= PCR_MATRIX(port_bitmap);
 
+	mt7530_clear(priv, MT7530_PSC_P(port), SA_DIS);
+
 	mutex_unlock(&priv->reg_mutex);
 
 	return 0;
@@ -907,6 +909,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
 
 	mt7530_port_set_vlan_unaware(ds, port);
 
+	mt7530_set(priv, MT7530_PSC_P(port), SA_DIS);
+
 	mutex_unlock(&priv->reg_mutex);
 }
 
@@ -1287,11 +1291,15 @@ mt7530_setup(struct dsa_switch *ds)
 		mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
 			   PCR_MATRIX_CLR);
 
-		if (dsa_is_cpu_port(ds, i))
+		if (dsa_is_cpu_port(ds, i)) {
 			mt7530_cpu_port_enable(priv, i);
-		else
+		} else {
 			mt7530_port_disable(ds, i, NULL);
 
+			/* Disable learning by default on all user ports */
+			mt7530_set(priv, MT7530_PSC_P(i), SA_DIS);
+		}
+
 		/* Enable consistent egress tag */
 		mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK,
 			   PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 4 lines · DENG Qingfang

This is a partial backport of commit 5a30833b9a16f8d1aa15de06636f9317ca51f9df ("net: dsa: mt7530: support MDB and bridge flag operations") upstream.

Make sure that the standalone ports start up with learning disabled.

What's the reasoning behind:

1. Backporting this patch?
2. A partial backport of this patch?

Signature · 2 lines
Thanks,
Sasha
#2 lore raw

Hi Sasha,

Quoted 3 lines · Sasha Levin

What's the reasoning behind:

1. Backporting this patch?

Standalone ports should have address learning disabled, according to the documentation:
https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags function so it has to be done differently.

I've identified an issue related to this.

Quoted 1 line

2. A partial backport of this patch?

The other part does not actually fix anything.

Quoted 4 lines

--
Thanks,
Sasha

maintainer
#3 lore raw
Quoted 7 lines · DENG Qingfang

Hi Sasha,

Quoted 3 lines · Sasha Levin

What's the reasoning behind:

1. Backporting this patch?

Quoted 7 lines

Standalone ports should have address learning disabled, according to the documentation:
https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags function so it has to be done differently.

I've identified an issue related to this.

What issue is that? Where was it reported?

Quoted 3 lines
Quoted 1 line

2. A partial backport of this patch?

The other part does not actually fix anything.

Then why is it not ok to just take the whole thing?

When backporting not-identical-patches, something almost always goes wrong, so we prefer to take the original commit when ever possible.

thanks,

greg k-h

#4 lore raw
Quoted 10 lines · Greg KH
Quoted 7 lines · DENG Qingfang

Standalone ports should have address learning disabled, according to the documentation:
https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags function so it has to be done differently.

I've identified an issue related to this.

What issue is that? Where was it reported?

See Florian's message here
https://lore.kernel.org/stable/[email protected]/

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

2. A partial backport of this patch?

The other part does not actually fix anything.

Then why is it not ok to just take the whole thing?

When backporting not-identical-patches, something almost always goes wrong, so we prefer to take the original commit when ever possible.

Okay. MDB and tag ops can be backported as is, and broadcast/multicast flooding can be implemented in .port_egress_floods.

Quoted 4 lines

thanks,

greg k-h

maintainer
#5 lore raw
Quoted 8 lines · DENG Qingfang
Quoted 7 lines · Greg KH
Quoted 6 lines · DENG Qingfang

Standalone ports should have address learning disabled, according to the documentation:
https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags function so it has to be done differently.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I've identified an issue related to this.

What issue is that? Where was it reported?

See Florian's message here
https://lore.kernel.org/stable/[email protected]/

THat is just the patch changelog text, or is it unique to this stable-only patch? It is not obvious at all.

Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

2. A partial backport of this patch?

The other part does not actually fix anything.

Then why is it not ok to just take the whole thing?

When backporting not-identical-patches, something almost always goes wrong, so we prefer to take the original commit when ever possible.

Okay. MDB and tag ops can be backported as is, and broadcast/multicast flooding can be implemented in .port_egress_floods.

So what are we supposed to do here?

totally confused,

greg k-h

#6 lore raw
Quoted 11 lines · Greg KH
Quoted 10 lines · DENG Qingfang
Quoted 9 lines · Greg KH
Quoted 7 lines · DENG Qingfang

Standalone ports should have address learning disabled, according to the documentation:
https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags function so it has to be done differently.

I've identified an issue related to this.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

What issue is that? Where was it reported?

See Florian's message here
https://lore.kernel.org/stable/[email protected]/

THat is just the patch changelog text, or is it unique to this stable-only patch? It is not obvious at all.

The issue is with all DSA drivers that do not disable address learning on standalone ports.

"With learning enabled we would end up with the switch having incorrectly learned the address of the CPU port which typically results in a complete break down of network connectivity until the address learned ages out and gets re-learned, from the correct port this time."

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

2. A partial backport of this patch?

The other part does not actually fix anything.

Then why is it not ok to just take the whole thing?

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

When backporting not-identical-patches, something almost always goes wrong, so we prefer to take the original commit when ever possible.

Okay. MDB and tag ops can be backported as is, and broadcast/multicast flooding can be implemented in .port_egress_floods.

So what are we supposed to do here?

Function port_egress_floods is refactored to port_bridge_flags in commit a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags"). I can backport the mt7530_port_bridge_flags function as port_egress_floods.

Quoted 4 lines

totally confused,

greg k-h

maintainer
#7 lore raw
Quoted 38 lines · DENG Qingfang
Quoted 11 lines · Greg KH
Quoted 10 lines · DENG Qingfang
Quoted 9 lines · Greg KH
Quoted 7 lines · DENG Qingfang

Standalone ports should have address learning disabled, according to the documentation:
https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags function so it has to be done differently.

I've identified an issue related to this.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

What issue is that? Where was it reported?

See Florian's message here
https://lore.kernel.org/stable/[email protected]/

THat is just the patch changelog text, or is it unique to this stable-only patch? It is not obvious at all.

The issue is with all DSA drivers that do not disable address learning on standalone ports.

"With learning enabled we would end up with the switch having incorrectly learned the address of the CPU port which typically results in a complete break down of network connectivity until the address learned ages out and gets re-learned, from the correct port this time."

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

2. A partial backport of this patch?

The other part does not actually fix anything.

Then why is it not ok to just take the whole thing?

When backporting not-identical-patches, something almost always goes wrong, so we prefer to take the original commit when ever possible.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Okay. MDB and tag ops can be backported as is, and broadcast/multicast flooding can be implemented in .port_egress_floods.

So what are we supposed to do here?

Function port_egress_floods is refactored to port_bridge_flags in commit a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags"). I can backport the mt7530_port_bridge_flags function as port_egress_floods.

I am sorry, I still do not understand what to do here.

Ideally we want to take the original patches as get merged into Linus's tree. If that is not possible for some reason, we need to have it documented very well why that is so, and to get everyone to agree with the different patch that is submitted.

thanks,

greg k-h