Skip to content

Commit 304f515

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Dump LAG FDB records only once
LAG FDB records can only point to LAG devices or VLAN devices configured on top of them. Therefore, when dumping the FDB we shouldn't associate these records with the underlying physical ports. Fixes: 8a1ab5d ("mlxsw: spectrum: Implement FDB add/remove/dump for LAG") Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e43aca2 commit 304f515

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,8 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp,
10481048

10491049
static int mlxsw_sp_port_fdb_dump(struct mlxsw_sp_port *mlxsw_sp_port,
10501050
struct switchdev_obj_port_fdb *fdb,
1051-
switchdev_obj_dump_cb_t *cb)
1051+
switchdev_obj_dump_cb_t *cb,
1052+
struct net_device *orig_dev)
10521053
{
10531054
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
10541055
u16 vport_fid = 0;
@@ -1114,6 +1115,12 @@ static int mlxsw_sp_port_fdb_dump(struct mlxsw_sp_port *mlxsw_sp_port,
11141115
mac, &fid, &lag_id);
11151116
if (mlxsw_sp_port ==
11161117
mlxsw_sp_lag_rep_port(mlxsw_sp, lag_id)) {
1118+
/* LAG records can only point to LAG
1119+
* devices or VLAN devices on top.
1120+
*/
1121+
if (!netif_is_lag_master(orig_dev) &&
1122+
!is_vlan_dev(orig_dev))
1123+
continue;
11171124
if (vport_fid && vport_fid == fid)
11181125
fdb->vid = 0;
11191126
else if (!vport_fid &&
@@ -1185,7 +1192,8 @@ static int mlxsw_sp_port_obj_dump(struct net_device *dev,
11851192
break;
11861193
case SWITCHDEV_OBJ_ID_PORT_FDB:
11871194
err = mlxsw_sp_port_fdb_dump(mlxsw_sp_port,
1188-
SWITCHDEV_OBJ_PORT_FDB(obj), cb);
1195+
SWITCHDEV_OBJ_PORT_FDB(obj), cb,
1196+
obj->orig_dev);
11891197
break;
11901198
default:
11911199
err = -EOPNOTSUPP;

0 commit comments

Comments
 (0)