Skip to content

Commit a299a7c

Browse files
KanjiMonstersmb49
authored andcommitted
net: dsa: b53: do not program vlans when vlan filtering is off
BugLink: https://bugs.launchpad.net/bugs/2130277 [ Upstream commit f089652 ] Documentation/networking/switchdev.rst says: - with VLAN filtering turned off: the bridge is strictly VLAN unaware and its data path will process all Ethernet frames as if they are VLAN-untagged. The bridge VLAN database can still be modified, but the modifications should have no effect while VLAN filtering is turned off. This breaks if we immediately apply the VLAN configuration, so skip writing it when vlan_filtering is off. Fixes: 0ee2af4 ("net: dsa: set configure_vlan_while_not_filtering to true by default") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://patch.msgid.link/20250429201710.330937-9-jonas.gorski@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent a7c69d5 commit a299a7c

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,9 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
15311531
if (vlan->vid == 0)
15321532
return 0;
15331533

1534+
if (!ds->vlan_filtering)
1535+
return 0;
1536+
15341537
b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &old_pvid);
15351538
if (pvid)
15361539
new_pvid = vlan->vid;
@@ -1576,6 +1579,9 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
15761579
if (vlan->vid == 0)
15771580
return 0;
15781581

1582+
if (!ds->vlan_filtering)
1583+
return 0;
1584+
15791585
b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid);
15801586

15811587
vl = &dev->vlans[vlan->vid];
@@ -1936,18 +1942,20 @@ int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
19361942
pvid = b53_default_pvid(dev);
19371943
vl = &dev->vlans[pvid];
19381944

1939-
/* Make this port leave the all VLANs join since we will have proper
1940-
* VLAN entries from now on
1941-
*/
1942-
if (is58xx(dev)) {
1943-
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, &reg);
1944-
reg &= ~BIT(port);
1945-
if ((reg & BIT(cpu_port)) == BIT(cpu_port))
1946-
reg &= ~BIT(cpu_port);
1947-
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
1948-
}
1949-
19501945
if (ds->vlan_filtering) {
1946+
/* Make this port leave the all VLANs join since we will have
1947+
* proper VLAN entries from now on
1948+
*/
1949+
if (is58xx(dev)) {
1950+
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN,
1951+
&reg);
1952+
reg &= ~BIT(port);
1953+
if ((reg & BIT(cpu_port)) == BIT(cpu_port))
1954+
reg &= ~BIT(cpu_port);
1955+
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN,
1956+
reg);
1957+
}
1958+
19511959
b53_get_vlan_entry(dev, pvid, vl);
19521960
vl->members &= ~BIT(port);
19531961
if (vl->members == BIT(cpu_port))
@@ -2014,16 +2022,16 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge)
20142022
pvid = b53_default_pvid(dev);
20152023
vl = &dev->vlans[pvid];
20162024

2017-
/* Make this port join all VLANs without VLAN entries */
2018-
if (is58xx(dev)) {
2019-
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, &reg);
2020-
reg |= BIT(port);
2021-
if (!(reg & BIT(cpu_port)))
2022-
reg |= BIT(cpu_port);
2023-
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
2024-
}
2025-
20262025
if (ds->vlan_filtering) {
2026+
/* Make this port join all VLANs without VLAN entries */
2027+
if (is58xx(dev)) {
2028+
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, &reg);
2029+
reg |= BIT(port);
2030+
if (!(reg & BIT(cpu_port)))
2031+
reg |= BIT(cpu_port);
2032+
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
2033+
}
2034+
20272035
b53_get_vlan_entry(dev, pvid, vl);
20282036
vl->members |= BIT(port) | BIT(cpu_port);
20292037
vl->untag |= BIT(port) | BIT(cpu_port);

0 commit comments

Comments
 (0)