Skip to contentSkip to conversation

net: dsa: b53: Remove unconditional CPU VLAN tagging

PATCH In review Florian Fainelli 2 participants 6 messages Jun 7, 2021

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

cover net: dsa: b53: Remove unconditional CPU VLAN tagging

This patch series removes the unconditional egress tagging of VLANs added to a b53 switch's CPU port. This had led to adding the untag_bridge_pvid attribute in the DSA framework and is causing problems with stacking of switches such as the configuration being used by Matthew.

Since we use Broadcom tags for all of the supported switches nowadays the original situation that led to doing this unconditional egress tagging is no longer warranted.

Florian Fainelli (2):
net: dsa: b53: Do not force tagging on CPU port VLANs
net: dsa: Remove bridge PVID untagging

 drivers/net/dsa/b53/b53_common.c |  5 ++-
 include/net/dsa.h                |  8 -----
 net/dsa/dsa.c                    |  9 -----
 net/dsa/dsa_priv.h               | 59 --------------------------------
 4 files changed, 2 insertions(+), 79 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 net: dsa: b53: Do not force tagging on CPU port VLANs

Commit ca8931948344 ("net: dsa: b53: Keep CPU port as tagged in all VLANs") forced the CPU port to be always tagged in any VLAN membership. This was necessary back then because we did not support Broadcom tags for all configurations so the only way to differentiate tagged and untagged traffic while DSA_TAG_PROTO_NONE was used was to force the CPU port into being always tagged.

This is not necessary anymore since 8fab459e69ab ("net: dsa: b53: Enable Broadcom tags for 531x5/539x families") and we can simply program what we are being told now, regardless of the port being CPU or user-facing.

---
 drivers/net/dsa/b53/b53_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/b53/b53_common.c +2 -2
index 3ca6b394dd5f..56e3b42ec28c 100644
@@ -1477,7 +1477,7 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
 		untagged = true;
 
 	vl->members |= BIT(port);
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag |= BIT(port);
 	else
 		vl->untag &= ~BIT(port);
@@ -1514,7 +1514,7 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
 	if (pvid == vlan->vid)
 		pvid = b53_default_pvid(dev);
 
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag &= ~(BIT(port));
 
 	b53_set_vlan_entry(dev, vlan->vid, vl);
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH net-next 1/2] net: dsa: b53: Do not force tagging on CPU port VLANs

Quoted 42 lines · Florian Fainelli

Commit ca8931948344 ("net: dsa: b53: Keep CPU port as tagged in all VLANs") forced the CPU port to be always tagged in any VLAN membership. This was necessary back then because we did not support Broadcom tags for all configurations so the only way to differentiate tagged and untagged traffic while DSA_TAG_PROTO_NONE was used was to force the CPU port into being always tagged.

This is not necessary anymore since 8fab459e69ab ("net: dsa: b53: Enable Broadcom tags for 531x5/539x families") and we can simply program what we are being told now, regardless of the port being CPU or user-facing.

---
 drivers/net/dsa/b53/b53_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/b53/b53_common.c +2 -2
index 3ca6b394dd5f..56e3b42ec28c 100644
@@ -1477,7 +1477,7 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
 		untagged = true;
 
 	vl->members |= BIT(port);
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag |= BIT(port);
 	else
 		vl->untag &= ~BIT(port);
@@ -1514,7 +1514,7 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
 	if (pvid == vlan->vid)
 		pvid = b53_default_pvid(dev);
 
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag &= ~(BIT(port));
 
 	b53_set_vlan_entry(dev, vlan->vid, vl);
Signature · 1 line
2.25.1

Don't you want to keep this functionality for BCM5325 / BCM5365 and such, which still use DSA_TAG_PROTO_NONE?

#3 lore raw

Re: [PATCH net-next 1/2] net: dsa: b53: Do not force tagging on CPU port VLANs

Quoted 39 lines · Vladimir Oltean
Quoted 38 lines · Florian Fainelli

Commit ca8931948344 ("net: dsa: b53: Keep CPU port as tagged in all VLANs") forced the CPU port to be always tagged in any VLAN membership. This was necessary back then because we did not support Broadcom tags for all configurations so the only way to differentiate tagged and untagged traffic while DSA_TAG_PROTO_NONE was used was to force the CPU port into being always tagged.

This is not necessary anymore since 8fab459e69ab ("net: dsa: b53: Enable Broadcom tags for 531x5/539x families") and we can simply program what we are being told now, regardless of the port being CPU or user-facing.

---
 drivers/net/dsa/b53/b53_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/b53/b53_common.c +2 -2
index 3ca6b394dd5f..56e3b42ec28c 100644
@@ -1477,7 +1477,7 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
 		untagged = true;
 
 	vl->members |= BIT(port);
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag |= BIT(port);
 	else
 		vl->untag &= ~BIT(port);
@@ -1514,7 +1514,7 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
 	if (pvid == vlan->vid)
 		pvid = b53_default_pvid(dev);
 
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag &= ~(BIT(port));
 
Quoted 7 lines
Quoted 4 lines
drivers/net/dsa/b53/b53_common.c +0 -0
 	b53_set_vlan_entry(dev, vlan->vid, vl);
Signature · 1 line
2.25.1

Don't you want to keep this functionality for BCM5325 / BCM5365 and such, which still use DSA_TAG_PROTO_NONE?

Humm, in premise yes, however I am debating removing support for 5325/5365 entirely, nobody that I know of has even been trying to get those devices to work with that driver.

Signature · 1 line
Florian
#4 lore raw

Re: [PATCH net-next 1/2] net: dsa: b53: Do not force tagging on CPU port VLANs

Quoted 50 lines · Florian Fainelli
Quoted 39 lines · Vladimir Oltean
Quoted 38 lines · Florian Fainelli

Commit ca8931948344 ("net: dsa: b53: Keep CPU port as tagged in all VLANs") forced the CPU port to be always tagged in any VLAN membership. This was necessary back then because we did not support Broadcom tags for all configurations so the only way to differentiate tagged and untagged traffic while DSA_TAG_PROTO_NONE was used was to force the CPU port into being always tagged.

This is not necessary anymore since 8fab459e69ab ("net: dsa: b53: Enable Broadcom tags for 531x5/539x families") and we can simply program what we are being told now, regardless of the port being CPU or user-facing.

---
 drivers/net/dsa/b53/b53_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/b53/b53_common.c +2 -2
index 3ca6b394dd5f..56e3b42ec28c 100644
@@ -1477,7 +1477,7 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
 		untagged = true;
 
 	vl->members |= BIT(port);
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag |= BIT(port);
 	else
 		vl->untag &= ~BIT(port);
@@ -1514,7 +1514,7 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
 	if (pvid == vlan->vid)
 		pvid = b53_default_pvid(dev);
 
-	if (untagged && !dsa_is_cpu_port(ds, port))
+	if (untagged)
 		vl->untag &= ~(BIT(port));
 
Quoted 7 lines
Quoted 4 lines
drivers/net/dsa/b53/b53_common.c +0 -0
 	b53_set_vlan_entry(dev, vlan->vid, vl);
Signature · 1 line
2.25.1

Don't you want to keep this functionality for BCM5325 / BCM5365 and such, which still use DSA_TAG_PROTO_NONE?

Quoted 3 lines

Humm, in premise yes, however I am debating removing support for 5325/5365 entirely, nobody that I know of has even been trying to get those devices to work with that driver.

On second thought, we just need to have those devices return DSA_TAG_PROTO_BRCM_LEGACY which is what they use, there does appear to be a couple of users, including myself, I had not realized that the device I was using used a 5325 (thought it was a 53125). V2 coming.

Signature · 1 line
Florian
#5 lore raw

PATCH 2/2 net: dsa: Remove bridge PVID untagging

In reply to Florian Fainelli

Now that the only user of the bridge PVID untagging code is no longer forcing the PVID untagged VLAN configuration to be PVID egress tagged for the CPU, we no longer need this support code to pop the VLAN tag automatically.

---
 drivers/net/dsa/b53/b53_common.c |  1 -
 include/net/dsa.h                |  8 -----
 net/dsa/dsa.c                    |  9 -----
 net/dsa/dsa_priv.h               | 59 --------------------------------
 4 files changed, 77 deletions(-)
drivers/net/dsa/b53/b53_common.c +0 -1
index 56e3b42ec28c..dc43dadd6d31 100644
@@ -2660,7 +2660,6 @@ struct b53_device *b53_switch_alloc(struct device *base,
 	dev->priv = priv;
 	dev->ops = ops;
 	ds->ops = &b53_switch_ops;
-	ds->untag_bridge_pvid = true;
 	dev->vlan_enabled = true;
 	/* Let DSA handle the case were multiple bridges span the same switch
 	 * device and different VLAN awareness settings are requested, which
include/net/dsa.h +0 -8
index e1a2610a0e06..216443820a7e 100644
@@ -355,14 +355,6 @@ struct dsa_switch {
 	 */
 	bool			configure_vlan_while_not_filtering;
 
-	/* If the switch driver always programs the CPU port as egress tagged
-	 * despite the VLAN configuration indicating otherwise, then setting
-	 * @untag_bridge_pvid will force the DSA receive path to pop the bridge's
-	 * default_pvid VLAN tagged frames to offer a consistent behavior
-	 * between a vlan_filtering=0 and vlan_filtering=1 bridge device.
-	 */
-	bool			untag_bridge_pvid;
-
 	/* Let DSA manage the FDB entries towards the CPU, based on the
 	 * software bridge database.
 	 */
net/dsa/dsa.c +0 -9
index 84cad1be9ce4..daac329b6e93 100644
@@ -260,15 +260,6 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
 
 	p = netdev_priv(skb->dev);
 
-	if (unlikely(cpu_dp->ds->untag_bridge_pvid)) {
-		nskb = dsa_untag_bridge_pvid(skb);
-		if (!nskb) {
-			kfree_skb(skb);
-			return 0;
-		}
-		skb = nskb;
-	}
-
 	dev_sw_netstats_rx_add(skb->dev, skb->len);
 
 	if (dsa_skb_defer_rx_timestamp(p, skb))
net/dsa/dsa_priv.h +0 -59

65 lines not on this page · raw message

Signature · 1 line
2.25.1