Skip to content

Commit

Permalink
mlxsw: spectrum_switchdev: Remove VXLAN checks during FID membership
Browse files Browse the repository at this point in the history
As explained in previous patch, VXLAN devices now take a reference on
the FID and not only local ports. Therefore, there is no need for local
ports to check if they need to set a VNI on the FID when they join the
FID.

Remove these unnecessary checks.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ido Schimmel authored and David S. Miller committed Feb 17, 2020
1 parent 71afb45 commit 578e551
Showing 1 changed file with 2 additions and 58 deletions.
60 changes: 2 additions & 58 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2108,38 +2108,8 @@ mlxsw_sp_bridge_8021q_fid_get(struct mlxsw_sp_bridge_device *bridge_device,
u16 vid, struct netlink_ext_ack *extack)
{
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
struct net_device *vxlan_dev;
struct mlxsw_sp_fid *fid;
int err;

fid = mlxsw_sp_fid_8021q_get(mlxsw_sp, vid);
if (IS_ERR(fid))
return fid;

if (mlxsw_sp_fid_vni_is_set(fid))
return fid;

/* Find the VxLAN device that has the specified VLAN configured as
* PVID and egress untagged. There can be at most one such device
*/
vxlan_dev = mlxsw_sp_bridge_8021q_vxlan_dev_find(bridge_device->dev,
vid);
if (!vxlan_dev)
return fid;

if (!netif_running(vxlan_dev))
return fid;

err = mlxsw_sp_bridge_8021q_vxlan_join(bridge_device, vxlan_dev, vid,
extack);
if (err)
goto err_vxlan_join;

return fid;

err_vxlan_join:
mlxsw_sp_fid_put(fid);
return ERR_PTR(err);
return mlxsw_sp_fid_8021q_get(mlxsw_sp, vid);
}

static struct mlxsw_sp_fid *
Expand Down Expand Up @@ -2273,34 +2243,8 @@ mlxsw_sp_bridge_8021d_fid_get(struct mlxsw_sp_bridge_device *bridge_device,
u16 vid, struct netlink_ext_ack *extack)
{
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
struct net_device *vxlan_dev;
struct mlxsw_sp_fid *fid;
int err;

fid = mlxsw_sp_fid_8021d_get(mlxsw_sp, bridge_device->dev->ifindex);
if (IS_ERR(fid))
return fid;

if (mlxsw_sp_fid_vni_is_set(fid))
return fid;

vxlan_dev = mlxsw_sp_bridge_vxlan_dev_find(bridge_device->dev);
if (!vxlan_dev)
return fid;

if (!netif_running(vxlan_dev))
return fid;

err = mlxsw_sp_bridge_8021d_vxlan_join(bridge_device, vxlan_dev, 0,
extack);
if (err)
goto err_vxlan_join;

return fid;

err_vxlan_join:
mlxsw_sp_fid_put(fid);
return ERR_PTR(err);
return mlxsw_sp_fid_8021d_get(mlxsw_sp, bridge_device->dev->ifindex);
}

static struct mlxsw_sp_fid *
Expand Down

0 comments on commit 578e551

Please sign in to comment.