mlxsw: spectrum: Make VLAN deletion function symmetric
authorIdo Schimmel <idosch@mellanox.com>
Wed, 24 Aug 2016 10:00:24 +0000 (12:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Aug 2016 16:41:12 +0000 (09:41 -0700)
Commit 05978481e77e ("mlxsw: spectrum: Create PVID vPort before
registering netdevice") removed __mlxsw_sp_port_vlans_del() from the
init sequence of the driver, which forced it to be non-symmetric with
regards to __mlxsw_sp_port_vlans_add().

Make both functions symmetric as the constraint no longer exists.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c

index 02de24080e792bd1baf4309e907b8e110ee9455f..2f3831058bfec5d7dd03eb24bea5138ca565194a 100644 (file)
@@ -1008,14 +1008,6 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
        if (!mlxsw_sp_port->bridged)
                return -EINVAL;
 
-       err = __mlxsw_sp_port_vlans_set(mlxsw_sp_port, vid_begin, vid_end,
-                                       false, false);
-       if (err) {
-               netdev_err(dev, "Unable to del VIDs %d-%d\n", vid_begin,
-                          vid_end);
-               return err;
-       }
-
        pvid = mlxsw_sp_port->pvid;
        if (pvid >= vid_begin && pvid <= vid_end) {
                err = mlxsw_sp_port_pvid_set(mlxsw_sp_port, 0);
@@ -1025,6 +1017,14 @@ static int __mlxsw_sp_port_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port,
                }
        }
 
+       err = __mlxsw_sp_port_vlans_set(mlxsw_sp_port, vid_begin, vid_end,
+                                       false, false);
+       if (err) {
+               netdev_err(dev, "Unable to del VIDs %d-%d\n", vid_begin,
+                          vid_end);
+               return err;
+       }
+
        mlxsw_sp_port_fid_leave(mlxsw_sp_port, vid_begin, vid_end);
 
        /* Changing activity bits only if HW operation succeded */