Commit b2f81d304cee ("net: dsa: add CPU and DSA ports as VLAN members")
is littering a lot. After deleting a VLAN added on a DSA port, it still
remains installed in the hardware filter of the upstream port. Fix this.

Signed-off-by: Vladimir Oltean <olte...@gmail.com>
---
 net/dsa/switch.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index 09d9286b27cc..84ab2336131e 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -295,11 +295,20 @@ static int dsa_switch_vlan_del(struct dsa_switch *ds,
                               struct dsa_notifier_vlan_info *info)
 {
        const struct switchdev_obj_port_vlan *vlan = info->vlan;
+       int port;
 
        if (!ds->ops->port_vlan_del)
                return -EOPNOTSUPP;
 
+       /* Build a mask of VLAN members */
+       bitmap_zero(ds->bitmap, ds->num_ports);
        if (ds->index == info->sw_index)
+               set_bit(info->port, ds->bitmap);
+       for (port = 0; port < ds->num_ports; port++)
+               if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
+                       set_bit(port, ds->bitmap);
+
+       for_each_set_bit(port, ds->bitmap, ds->num_ports)
                return ds->ops->port_vlan_del(ds, info->port, vlan);
 
        return 0;
-- 
2.17.1

Reply via email to