Commit 4b400fea authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

mlxsw: spectrum_switchdev: remove transactional logic for VLAN objects

As of commit 457e20d6 ("mlxsw: spectrum_switchdev: Avoid returning
errors in commit phase"), the mlxsw driver performs the VLAN object
offloading during the prepare phase. So conversion just seems to be a
matter of removing the code that was running in the commit phase.

Ido Schimmel explains that the reason why mlxsw_sp_span_respin is called
unconditionally is because the bridge driver will ignore -EOPNOTSUPP and
actually add the VLAN on the bridge device - see commit 9c86ce2c
("net: bridge: Notify about bridge VLANs") and commit ea472175
("mlxsw: spectrum_switchdev: Ignore bridge VLAN events"). Since the VLAN
was successfully added on the bridge device, mlxsw_sp_span_respin_work()
should be able to resolve the egress port for a packet that is mirrored
to a gre tap and passes through the bridge device. Therefore keep the
logic as it is.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 417b99bf
...@@ -1196,7 +1196,6 @@ mlxsw_sp_br_ban_rif_pvid_change(struct mlxsw_sp *mlxsw_sp, ...@@ -1196,7 +1196,6 @@ mlxsw_sp_br_ban_rif_pvid_change(struct mlxsw_sp *mlxsw_sp,
static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
const struct switchdev_obj_port_vlan *vlan, const struct switchdev_obj_port_vlan *vlan,
struct switchdev_trans *trans,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
bool flag_untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; bool flag_untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
...@@ -1209,8 +1208,7 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -1209,8 +1208,7 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
int err = 0; int err = 0;
if ((vlan->flags & BRIDGE_VLAN_INFO_BRENTRY) && if ((vlan->flags & BRIDGE_VLAN_INFO_BRENTRY) &&
br_vlan_enabled(orig_dev) && br_vlan_enabled(orig_dev))
switchdev_trans_ph_prepare(trans))
err = mlxsw_sp_br_ban_rif_pvid_change(mlxsw_sp, err = mlxsw_sp_br_ban_rif_pvid_change(mlxsw_sp,
orig_dev, vlan); orig_dev, vlan);
if (!err) if (!err)
...@@ -1218,9 +1216,6 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -1218,9 +1216,6 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
return err; return err;
} }
if (switchdev_trans_ph_commit(trans))
return 0;
bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev);
if (WARN_ON(!bridge_port)) if (WARN_ON(!bridge_port))
return -EINVAL; return -EINVAL;
...@@ -1764,16 +1759,13 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev, ...@@ -1764,16 +1759,13 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev,
{ {
struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
const struct switchdev_obj_port_vlan *vlan; const struct switchdev_obj_port_vlan *vlan;
struct switchdev_trans trans;
int err = 0; int err = 0;
switch (obj->id) { switch (obj->id) {
case SWITCHDEV_OBJ_ID_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
vlan = SWITCHDEV_OBJ_PORT_VLAN(obj); vlan = SWITCHDEV_OBJ_PORT_VLAN(obj);
trans.ph_prepare = true; err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, extack);
err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, &trans,
extack);
/* The event is emitted before the changes are actually /* The event is emitted before the changes are actually
* applied to the bridge. Therefore schedule the respin * applied to the bridge. Therefore schedule the respin
...@@ -1781,13 +1773,6 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev, ...@@ -1781,13 +1773,6 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev,
* updated bridge state. * updated bridge state.
*/ */
mlxsw_sp_span_respin(mlxsw_sp_port->mlxsw_sp); mlxsw_sp_span_respin(mlxsw_sp_port->mlxsw_sp);
if (err)
break;
trans.ph_prepare = false;
err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, &trans,
extack);
break; break;
case SWITCHDEV_OBJ_ID_PORT_MDB: case SWITCHDEV_OBJ_ID_PORT_MDB:
err = mlxsw_sp_port_mdb_add(mlxsw_sp_port, err = mlxsw_sp_port_mdb_add(mlxsw_sp_port,
...@@ -3351,8 +3336,7 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp, ...@@ -3351,8 +3336,7 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp,
static int static int
mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev,
struct switchdev_notifier_port_obj_info * struct switchdev_notifier_port_obj_info *
port_obj_info, port_obj_info)
struct switchdev_trans *trans)
{ {
struct switchdev_obj_port_vlan *vlan = struct switchdev_obj_port_vlan *vlan =
SWITCHDEV_OBJ_PORT_VLAN(port_obj_info->obj); SWITCHDEV_OBJ_PORT_VLAN(port_obj_info->obj);
...@@ -3374,9 +3358,6 @@ mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, ...@@ -3374,9 +3358,6 @@ mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev,
port_obj_info->handled = true; port_obj_info->handled = true;
if (switchdev_trans_ph_commit(trans))
return 0;
bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev); bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev);
if (!bridge_device) if (!bridge_device)
return -EINVAL; return -EINVAL;
...@@ -3427,22 +3408,12 @@ mlxsw_sp_switchdev_handle_vxlan_obj_add(struct net_device *vxlan_dev, ...@@ -3427,22 +3408,12 @@ mlxsw_sp_switchdev_handle_vxlan_obj_add(struct net_device *vxlan_dev,
struct switchdev_notifier_port_obj_info * struct switchdev_notifier_port_obj_info *
port_obj_info) port_obj_info)
{ {
struct switchdev_trans trans;
int err = 0; int err = 0;
switch (port_obj_info->obj->id) { switch (port_obj_info->obj->id) {
case SWITCHDEV_OBJ_ID_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
trans.ph_prepare = true;
err = mlxsw_sp_switchdev_vxlan_vlans_add(vxlan_dev,
port_obj_info,
&trans);
if (err)
break;
trans.ph_prepare = false;
err = mlxsw_sp_switchdev_vxlan_vlans_add(vxlan_dev, err = mlxsw_sp_switchdev_vxlan_vlans_add(vxlan_dev,
port_obj_info, port_obj_info);
&trans);
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment