Commit e6060027 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum: Use FID instead of vFID to setup flooding

Use a FID index instead of vFID and ease the transition towards a
generic FID struct.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9c4d4423
...@@ -793,9 +793,9 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto, ...@@ -793,9 +793,9 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto,
goto err_port_vport_create; goto err_port_vport_create;
} }
fid = mlxsw_sp_vfid_to_fid(vfid->vfid);
if (!vfid->nr_vports) { if (!vfid->nr_vports) {
err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, fid, true);
true);
if (err) { if (err) {
netdev_err(dev, "Failed to setup flooding for vFID=%d\n", netdev_err(dev, "Failed to setup flooding for vFID=%d\n",
vfid->vfid); vfid->vfid);
...@@ -815,7 +815,6 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto, ...@@ -815,7 +815,6 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto,
} }
} }
fid = mlxsw_sp_vfid_to_fid(vfid->vfid);
err = mlxsw_sp_vport_fid_map(mlxsw_sp_vport, fid, true); err = mlxsw_sp_vport_fid_map(mlxsw_sp_vport, fid, true);
if (err) { if (err) {
netdev_err(dev, "Failed to map {Port, VID=%d} to vFID=%d\n", netdev_err(dev, "Failed to map {Port, VID=%d} to vFID=%d\n",
...@@ -858,7 +857,7 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto, ...@@ -858,7 +857,7 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto,
mlxsw_sp_port_vlan_mode_trans(mlxsw_sp_port); mlxsw_sp_port_vlan_mode_trans(mlxsw_sp_port);
err_port_vp_mode_trans: err_port_vp_mode_trans:
if (!vfid->nr_vports) if (!vfid->nr_vports)
mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, false); mlxsw_sp_vport_flood_set(mlxsw_sp_vport, fid, false);
err_vport_flood_set: err_vport_flood_set:
mlxsw_sp_port_vport_destroy(mlxsw_sp_vport); mlxsw_sp_port_vport_destroy(mlxsw_sp_vport);
err_port_vport_create: err_port_vport_create:
...@@ -3260,7 +3259,7 @@ static void mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport, ...@@ -3260,7 +3259,7 @@ static void mlxsw_sp_vport_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_vport,
goto err_port_vid_learning_set; goto err_port_vid_learning_set;
} }
err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, false); err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, fid, false);
if (err) { if (err) {
netdev_err(dev, "Failed clear to clear flooding\n"); netdev_err(dev, "Failed clear to clear flooding\n");
goto err_vport_flood_set; goto err_vport_flood_set;
...@@ -3320,7 +3319,8 @@ static int mlxsw_sp_vport_bridge_join(struct mlxsw_sp_port *mlxsw_sp_vport, ...@@ -3320,7 +3319,8 @@ static int mlxsw_sp_vport_bridge_join(struct mlxsw_sp_port *mlxsw_sp_vport,
} }
} }
err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, true); fid = mlxsw_sp_vfid_to_fid(vfid->vfid);
err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, fid, true);
if (err) { if (err) {
netdev_err(dev, "Failed to setup flooding for vFID=%d\n", netdev_err(dev, "Failed to setup flooding for vFID=%d\n",
vfid->vfid); vfid->vfid);
...@@ -3344,7 +3344,6 @@ static int mlxsw_sp_vport_bridge_join(struct mlxsw_sp_port *mlxsw_sp_vport, ...@@ -3344,7 +3344,6 @@ static int mlxsw_sp_vport_bridge_join(struct mlxsw_sp_port *mlxsw_sp_vport,
goto err_vport_fid_unmap; goto err_vport_fid_unmap;
} }
fid = mlxsw_sp_vfid_to_fid(vfid->vfid);
err = mlxsw_sp_vport_fid_map(mlxsw_sp_vport, fid, true); err = mlxsw_sp_vport_fid_map(mlxsw_sp_vport, fid, true);
if (err) { if (err) {
netdev_err(dev, "Failed to map {Port, VID} to vFID=%d\n", netdev_err(dev, "Failed to map {Port, VID} to vFID=%d\n",
...@@ -3371,7 +3370,7 @@ static int mlxsw_sp_vport_bridge_join(struct mlxsw_sp_port *mlxsw_sp_vport, ...@@ -3371,7 +3370,7 @@ static int mlxsw_sp_vport_bridge_join(struct mlxsw_sp_port *mlxsw_sp_vport,
err_vport_fid_unmap: err_vport_fid_unmap:
mlxsw_sp_port_vid_learning_set(mlxsw_sp_vport, vid, false); mlxsw_sp_port_vid_learning_set(mlxsw_sp_vport, vid, false);
err_port_vid_learning_set: err_port_vid_learning_set:
mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, false); mlxsw_sp_vport_flood_set(mlxsw_sp_vport, fid, false);
err_port_flood_set: err_port_flood_set:
if (!vfid->nr_vports) if (!vfid->nr_vports)
mlxsw_sp_br_vfid_destroy(mlxsw_sp, vfid); mlxsw_sp_br_vfid_destroy(mlxsw_sp, vfid);
......
...@@ -366,7 +366,7 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto, ...@@ -366,7 +366,7 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto,
u16 vid); u16 vid);
int mlxsw_sp_port_kill_vid(struct net_device *dev, int mlxsw_sp_port_kill_vid(struct net_device *dev,
__be16 __always_unused proto, u16 vid); __be16 __always_unused proto, u16 vid);
int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 vfid, int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid,
bool set); bool set);
void mlxsw_sp_port_active_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port); void mlxsw_sp_port_active_vlans_del(struct mlxsw_sp_port *mlxsw_sp_port);
int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
......
...@@ -260,12 +260,15 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -260,12 +260,15 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
return err; return err;
} }
int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 vfid, int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid,
bool set) bool set)
{ {
u16 vfid;
/* In case of vFIDs, index into the flooding table is relative to /* In case of vFIDs, index into the flooding table is relative to
* the start of the vFIDs range. * the start of the vFIDs range.
*/ */
vfid = mlxsw_sp_fid_to_vfid(fid);
return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set,
false); false);
} }
......
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