On Thu, Dec 17, 2020 at 03:58:19AM +0200, Vladimir Oltean wrote: > It should be the driver's business to logically separate its VLAN > offloading into a preparation and a commit phase, and some drivers don't > need / can't do this. > > So remove the transactional shim from DSA and let drivers to propagate > errors directly from the .port_vlan_add callback. > > Signed-off-by: Vladimir Oltean <vladimir.olt...@nxp.com> > --- [...] > diff --git a/net/dsa/switch.c b/net/dsa/switch.c > index 65124bc3ddfb..bd00ef6296f9 100644 > --- a/net/dsa/switch.c > +++ b/net/dsa/switch.c > @@ -217,35 +217,13 @@ static bool dsa_switch_vlan_match(struct dsa_switch > *ds, int port, > return false; > } > > -static int dsa_switch_vlan_prepare(struct dsa_switch *ds, > - struct dsa_notifier_vlan_info *info) > -{ > - int port, err; > - > - if (!ds->ops->port_vlan_prepare || !ds->ops->port_vlan_add) > - return -EOPNOTSUPP; > - > - for (port = 0; port < ds->num_ports; port++) { > - if (dsa_switch_vlan_match(ds, port, info)) { > - err = ds->ops->port_vlan_prepare(ds, port, info->vlan); > - if (err) > - return err; > - } > - } > - > - return 0; > -} > - > static int dsa_switch_vlan_add(struct dsa_switch *ds, > struct dsa_notifier_vlan_info *info) > { > int port; > > - if (switchdev_trans_ph_prepare(info->trans)) > - return dsa_switch_vlan_prepare(ds, info); > - > if (!ds->ops->port_vlan_add) > - return 0; > + return -EOPNOTSUPP; > > for (port = 0; port < ds->num_ports; port++) > if (dsa_switch_vlan_match(ds, port, info)) > -- > 2.25.1 >
For anybody who wants to test, please paste this instead of the existing dsa_switch_vlan_add, to propagate the errors: static int dsa_switch_vlan_add(struct dsa_switch *ds, struct dsa_notifier_vlan_info *info) { int err = 0; int port; if (!ds->ops->port_vlan_add) return -EOPNOTSUPP; for (port = 0; port < ds->num_ports; port++) { if (dsa_switch_vlan_match(ds, port, info)) { err = ds->ops->port_vlan_add(ds, port, info->vlan); if (err) break; } } return err; }