Skip to content

Commit 577fa14

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Do not process learned records with a dummy FID
The switch periodically sends notifications about learned FDB entries. Among other things, the notification includes the FID (Filtering Identifier) and the port on which the MAC was learned. In case the driver does not have the FID defined on the relevant port, the following error will be periodically generated: mlxsw_spectrum2 0000:06:00.0 swp32: Failed to find a matching {Port, VID} following FDB notification This is not supposed to happen under normal conditions, but can happen if an ingress tc filter with a redirect action is installed on a bridged port. The redirect action will cause the packet's FID to be changed to the dummy FID and a learning notification will be emitted with this FID - which is not defined on the bridged port. Fix this by having the driver ignore learning notifications generated with the dummy FID and delete them from the device. Another option is to chain an ignore action after the redirect action which will cause the device to disable learning, but this means that we need to consume another action whenever a redirect action is used. In addition, the scenario described above is merely a corner case. Fixes: cedbb8b ("mlxsw: spectrum_flower: Set dummy FID before forward action") Signed-off-by: Ido Schimmel <[email protected]> Reported-by: Alex Kushnarov <[email protected]> Acked-by: Jiri Pirko <[email protected]> Tested-by: Alex Kushnarov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dedfde2 commit 577fa14

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ int mlxsw_sp_setup_tc_prio(struct mlxsw_sp_port *mlxsw_sp_port,
830830
struct tc_prio_qopt_offload *p);
831831

832832
/* spectrum_fid.c */
833+
bool mlxsw_sp_fid_is_dummy(struct mlxsw_sp *mlxsw_sp, u16 fid_index);
833834
bool mlxsw_sp_fid_lag_vid_valid(const struct mlxsw_sp_fid *fid);
834835
struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp,
835836
u16 fid_index);

drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ static const int *mlxsw_sp_packet_type_sfgc_types[] = {
126126
[MLXSW_SP_FLOOD_TYPE_MC] = mlxsw_sp_sfgc_mc_packet_types,
127127
};
128128

129+
bool mlxsw_sp_fid_is_dummy(struct mlxsw_sp *mlxsw_sp, u16 fid_index)
130+
{
131+
enum mlxsw_sp_fid_type fid_type = MLXSW_SP_FID_TYPE_DUMMY;
132+
struct mlxsw_sp_fid_family *fid_family;
133+
134+
fid_family = mlxsw_sp->fid_core->fid_family_arr[fid_type];
135+
136+
return fid_family->start_index == fid_index;
137+
}
138+
129139
bool mlxsw_sp_fid_lag_vid_valid(const struct mlxsw_sp_fid *fid)
130140
{
131141
return fid->fid_family->lag_vid_valid;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,6 +2468,9 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
24682468
goto just_remove;
24692469
}
24702470

2471+
if (mlxsw_sp_fid_is_dummy(mlxsw_sp, fid))
2472+
goto just_remove;
2473+
24712474
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_fid(mlxsw_sp_port, fid);
24722475
if (!mlxsw_sp_port_vlan) {
24732476
netdev_err(mlxsw_sp_port->dev, "Failed to find a matching {Port, VID} following FDB notification\n");
@@ -2527,6 +2530,9 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp,
25272530
goto just_remove;
25282531
}
25292532

2533+
if (mlxsw_sp_fid_is_dummy(mlxsw_sp, fid))
2534+
goto just_remove;
2535+
25302536
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_fid(mlxsw_sp_port, fid);
25312537
if (!mlxsw_sp_port_vlan) {
25322538
netdev_err(mlxsw_sp_port->dev, "Failed to find a matching {Port, VID} following FDB notification\n");

0 commit comments

Comments
 (0)