Skip to content

Commit f089652

Browse files
KanjiMonsterkuba-moo
authored andcommitted
net: dsa: b53: do not program vlans when vlan filtering is off
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>
1 parent 45e9d59 commit f089652

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
@@ -1547,6 +1547,9 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
15471547
if (vlan->vid == 0)
15481548
return 0;
15491549

1550+
if (!ds->vlan_filtering)
1551+
return 0;
1552+
15501553
b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &old_pvid);
15511554
if (pvid)
15521555
new_pvid = vlan->vid;
@@ -1592,6 +1595,9 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
15921595
if (vlan->vid == 0)
15931596
return 0;
15941597

1598+
if (!ds->vlan_filtering)
1599+
return 0;
1600+
15951601
b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid);
15961602

15971603
vl = &dev->vlans[vlan->vid];
@@ -1952,18 +1958,20 @@ int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
19521958
pvid = b53_default_pvid(dev);
19531959
vl = &dev->vlans[pvid];
19541960

1955-
/* Make this port leave the all VLANs join since we will have proper
1956-
* VLAN entries from now on
1957-
*/
1958-
if (is58xx(dev)) {
1959-
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, &reg);
1960-
reg &= ~BIT(port);
1961-
if ((reg & BIT(cpu_port)) == BIT(cpu_port))
1962-
reg &= ~BIT(cpu_port);
1963-
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
1964-
}
1965-
19661961
if (ds->vlan_filtering) {
1962+
/* Make this port leave the all VLANs join since we will have
1963+
* proper VLAN entries from now on
1964+
*/
1965+
if (is58xx(dev)) {
1966+
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN,
1967+
&reg);
1968+
reg &= ~BIT(port);
1969+
if ((reg & BIT(cpu_port)) == BIT(cpu_port))
1970+
reg &= ~BIT(cpu_port);
1971+
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN,
1972+
reg);
1973+
}
1974+
19671975
b53_get_vlan_entry(dev, pvid, vl);
19681976
vl->members &= ~BIT(port);
19691977
if (vl->members == BIT(cpu_port))
@@ -2030,16 +2038,16 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge)
20302038
pvid = b53_default_pvid(dev);
20312039
vl = &dev->vlans[pvid];
20322040

2033-
/* Make this port join all VLANs without VLAN entries */
2034-
if (is58xx(dev)) {
2035-
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, &reg);
2036-
reg |= BIT(port);
2037-
if (!(reg & BIT(cpu_port)))
2038-
reg |= BIT(cpu_port);
2039-
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
2040-
}
2041-
20422041
if (ds->vlan_filtering) {
2042+
/* Make this port join all VLANs without VLAN entries */
2043+
if (is58xx(dev)) {
2044+
b53_read16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, &reg);
2045+
reg |= BIT(port);
2046+
if (!(reg & BIT(cpu_port)))
2047+
reg |= BIT(cpu_port);
2048+
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
2049+
}
2050+
20432051
b53_get_vlan_entry(dev, pvid, vl);
20442052
vl->members |= BIT(port) | BIT(cpu_port);
20452053
vl->untag |= BIT(port) | BIT(cpu_port);

0 commit comments

Comments
 (0)