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;
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 &
if (err)
return err;
}
- break;
- default:
- return -EOPNOTSUPP;
}
return 0;
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;
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: