diff options
author | Jiri Pirko <jiri@mellanox.com> | 2015-09-24 08:02:48 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-09-25 05:59:22 (GMT) |
commit | 79a62eb22a5fa4ee5e1f21af5e1f19f493dac5e0 (patch) | |
tree | ea046def57317217e97d7ed1a28c71e86a38e077 | |
parent | 9f6467cf229a0e8a7580401b07de2a76e4c8618d (diff) | |
download | linux-79a62eb22a5fa4ee5e1f21af5e1f19f493dac5e0.tar.xz |
dsa: use prepare/commit switchdev transaction helpers
The enum is going to disappear, use the helpers instead.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/dsa/slave.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 748cc63..71a1155 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -251,8 +251,7 @@ static int dsa_slave_port_vlan_add(struct net_device *dev, u16 vid; int err; - switch (trans->ph) { - case SWITCHDEV_TRANS_PREPARE: + if (switchdev_trans_ph_prepare(trans)) { if (!ds->drv->port_vlan_add || !ds->drv->port_pvid_set) return -EOPNOTSUPP; @@ -264,8 +263,7 @@ static int dsa_slave_port_vlan_add(struct net_device *dev, vlan->vid_end); if (err) return err; - break; - case SWITCHDEV_TRANS_COMMIT: + } else { for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { err = ds->drv->port_vlan_add(ds, p->port, vid, vlan->flags & @@ -275,9 +273,6 @@ static int dsa_slave_port_vlan_add(struct net_device *dev, if (err) return err; } - break; - default: - return -EOPNOTSUPP; } return 0; @@ -356,9 +351,9 @@ static int dsa_slave_port_fdb_add(struct net_device *dev, struct dsa_switch *ds = p->parent; int ret = -EOPNOTSUPP; - if (trans->ph == SWITCHDEV_TRANS_PREPARE) + if (switchdev_trans_ph_prepare(trans)) ret = ds->drv->port_fdb_add ? 0 : -EOPNOTSUPP; - else if (trans->ph == SWITCHDEV_TRANS_COMMIT) + else ret = ds->drv->port_fdb_add(ds, p->port, fdb->addr, fdb->vid); return ret; @@ -465,7 +460,7 @@ static int dsa_slave_port_attr_set(struct net_device *dev, switch (attr->id) { case SWITCHDEV_ATTR_PORT_STP_STATE: - if (trans->ph == SWITCHDEV_TRANS_COMMIT) + if (switchdev_trans_ph_commit(trans)) ret = dsa_slave_stp_update(dev, attr->u.stp_state); break; default: |