Skip to content

Commit 692eb9f

Browse files
KanjiMonsterkuba-moo
authored andcommitted
net: dsa: b53: fix untagged traffic sent via cpu tagged with VID 0
When Linux sends out untagged traffic from a port, it will enter the CPU port without any VLAN tag, even if the port is a member of a vlan filtering bridge with a PVID egress untagged VLAN. This makes the CPU port's PVID take effect, and the PVID's VLAN table entry controls if the packet will be tagged on egress. Since commit 45e9d59 ("net: dsa: b53: do not allow to configure VLAN 0") we remove bridged ports from VLAN 0 when joining or leaving a VLAN aware bridge. But we also clear the untagged bit, causing untagged traffic from the controller to become tagged with VID 0 (and priority 0). Fix this by not touching the untagged map of VLAN 0. Additionally, always keep the CPU port as a member, as the untag map is only effective as long as there is at least one member, and we would remove it when bridging all ports and leaving no standalone ports. Since Linux (and the switch) treats VLAN 0 tagged traffic like untagged, the actual impact of this is rather low, but this also prevented earlier detection of the issue. Fixes: 45e9d59 ("net: dsa: b53: do not allow to configure VLAN 0") Signed-off-by: Jonas Gorski <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2c7e4a2 commit 692eb9f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,9 +2034,6 @@ int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
20342034

20352035
b53_get_vlan_entry(dev, pvid, vl);
20362036
vl->members &= ~BIT(port);
2037-
if (vl->members == BIT(cpu_port))
2038-
vl->members &= ~BIT(cpu_port);
2039-
vl->untag = vl->members;
20402037
b53_set_vlan_entry(dev, pvid, vl);
20412038
}
20422039

@@ -2115,8 +2112,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge)
21152112
}
21162113

21172114
b53_get_vlan_entry(dev, pvid, vl);
2118-
vl->members |= BIT(port) | BIT(cpu_port);
2119-
vl->untag |= BIT(port) | BIT(cpu_port);
2115+
vl->members |= BIT(port);
21202116
b53_set_vlan_entry(dev, pvid, vl);
21212117
}
21222118
}

0 commit comments

Comments
 (0)