Skip to content

Commit 6e6325d

Browse files
vladimirolteangregkh
authored andcommitted
net: mscc: ocelot: delete PVID VLAN when readding it as non-PVID
[ Upstream commit 5ec6d7d ] The following set of commands: ip link add br0 type bridge vlan_filtering 1 # vlan_default_pvid 1 is implicit ip link set swp0 master br0 bridge vlan add dev swp0 vid 1 should result in the dropping of untagged and 802.1p-tagged traffic, but we see that it continues to be accepted. Whereas, had we deleted VID 1 instead, the aforementioned dropping would have worked This is because the ANA_PORT_DROP_CFG update logic doesn't run, because ocelot_vlan_add() only calls ocelot_port_set_pvid() if the new VLAN has the BRIDGE_VLAN_INFO_PVID flag. Similar to other drivers like mt7530_port_vlan_add() which handle this case correctly, we need to test whether the VLAN we're changing used to have the BRIDGE_VLAN_INFO_PVID flag, but lost it now. That amounts to a PVID deletion and should be treated as such. Regarding blame attribution: this never worked properly since the introduction of bridge VLAN filtering in commit 7142529 ("net: mscc: ocelot: add VLAN filtering"). However, there was a significant paradigm shift which aligned the ANA_PORT_DROP_CFG register with the PVID concept rather than with the native VLAN concept, and that change wasn't targeted for 'stable'. Realistically, that is as far as this fix needs to be propagated to. Fixes: be0576f ("net: mscc: ocelot: move the logic to drop 802.1p traffic to the pvid deletion") Signed-off-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 432572d commit 6e6325d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ EXPORT_SYMBOL(ocelot_vlan_prepare);
830830
int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
831831
bool untagged)
832832
{
833+
struct ocelot_port *ocelot_port = ocelot->ports[port];
833834
int err;
834835

835836
/* Ignore VID 0 added to our RX filter by the 8021q module, since
@@ -849,6 +850,11 @@ int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
849850
ocelot_bridge_vlan_find(ocelot, vid));
850851
if (err)
851852
return err;
853+
} else if (ocelot_port->pvid_vlan &&
854+
ocelot_bridge_vlan_find(ocelot, vid) == ocelot_port->pvid_vlan) {
855+
err = ocelot_port_set_pvid(ocelot, port, NULL);
856+
if (err)
857+
return err;
852858
}
853859

854860
/* Untagged egress vlan clasification */

0 commit comments

Comments
 (0)