diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2015-11-01 12:33:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-01 15:56:11 -0500 |
commit | 76e398a6271285c1f361d66445a55cdcee5c1b4b (patch) | |
tree | dbda581bc4be2cc8906b3866815de574cb58ad63 /net/dsa | |
parent | ea3803c193df18d8353d6c8d77034066a08c19f5 (diff) |
net: dsa: use switchdev obj for VLAN add/del ops
Simplify DSA by pushing the switchdev objects for VLAN add and delete
operations down to its drivers. Currently only mv88e6xxx is affected.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 481754ee062a..7bc787b095c8 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -247,11 +247,10 @@ static int dsa_slave_port_vlan_add(struct net_device *dev, { struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = p->parent; - u16 vid; int err; if (switchdev_trans_ph_prepare(trans)) { - if (!ds->drv->port_vlan_add || !ds->drv->port_pvid_set) + if (!ds->drv->port_vlan_prepare || !ds->drv->port_vlan_add) return -EOPNOTSUPP; /* If the requested port doesn't belong to the same bridge as @@ -262,16 +261,14 @@ static int dsa_slave_port_vlan_add(struct net_device *dev, vlan->vid_end); if (err) return err; + + err = ds->drv->port_vlan_prepare(ds, p->port, vlan, trans); + if (err) + return err; } else { - for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { - err = ds->drv->port_vlan_add(ds, p->port, vid, - vlan->flags & - BRIDGE_VLAN_INFO_UNTAGGED); - if (!err && vlan->flags & BRIDGE_VLAN_INFO_PVID) - err = ds->drv->port_pvid_set(ds, p->port, vid); - if (err) - return err; - } + err = ds->drv->port_vlan_add(ds, p->port, vlan, trans); + if (err) + return err; } return 0; @@ -282,19 +279,11 @@ static int dsa_slave_port_vlan_del(struct net_device *dev, { struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = p->parent; - u16 vid; - int err; if (!ds->drv->port_vlan_del) return -EOPNOTSUPP; - for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { - err = ds->drv->port_vlan_del(ds, p->port, vid); - if (err) - return err; - } - - return 0; + return ds->drv->port_vlan_del(ds, p->port, vlan); } static int dsa_slave_port_vlan_dump(struct net_device *dev, |