Skip to content

Commit ac571de

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_router: Flush FIB tables during fini
Since commit b45f64d ("mlxsw: spectrum_router: Use FIB notifications instead of switchdev calls") we reflect to the device the entire FIB table and not only FIBs that point to netdevs created by the driver. During module removal, FIBs of the second type are removed following NETDEV_UNREGISTER events sent. The other FIBs are still present in both the driver's cache and the device's table. Fix this by iterating over all the FIB tables in the device and flush them. There's no need to take locks, as we're the only writer. Fixes: b45f64d ("mlxsw: spectrum_router: Use FIB notifications instead of switchdev calls") Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c51e424 commit ac571de

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,11 @@ static int mlxsw_sp_vrs_init(struct mlxsw_sp *mlxsw_sp)
594594
return 0;
595595
}
596596

597+
static void mlxsw_sp_router_fib_flush(struct mlxsw_sp *mlxsw_sp);
598+
597599
static void mlxsw_sp_vrs_fini(struct mlxsw_sp *mlxsw_sp)
598600
{
601+
mlxsw_sp_router_fib_flush(mlxsw_sp);
599602
kfree(mlxsw_sp->router.vrs);
600603
}
601604

@@ -1867,18 +1870,18 @@ static int mlxsw_sp_router_set_abort_trap(struct mlxsw_sp *mlxsw_sp)
18671870
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
18681871
}
18691872

1870-
static void mlxsw_sp_router_fib4_abort(struct mlxsw_sp *mlxsw_sp)
1873+
static void mlxsw_sp_router_fib_flush(struct mlxsw_sp *mlxsw_sp)
18711874
{
18721875
struct mlxsw_resources *resources;
18731876
struct mlxsw_sp_fib_entry *fib_entry;
18741877
struct mlxsw_sp_fib_entry *tmp;
18751878
struct mlxsw_sp_vr *vr;
18761879
int i;
1877-
int err;
18781880

18791881
resources = mlxsw_core_resources_get(mlxsw_sp->core);
18801882
for (i = 0; i < resources->max_virtual_routers; i++) {
18811883
vr = &mlxsw_sp->router.vrs[i];
1884+
18821885
if (!vr->used)
18831886
continue;
18841887

@@ -1894,6 +1897,13 @@ static void mlxsw_sp_router_fib4_abort(struct mlxsw_sp *mlxsw_sp)
18941897
break;
18951898
}
18961899
}
1900+
}
1901+
1902+
static void mlxsw_sp_router_fib4_abort(struct mlxsw_sp *mlxsw_sp)
1903+
{
1904+
int err;
1905+
1906+
mlxsw_sp_router_fib_flush(mlxsw_sp);
18971907
mlxsw_sp->router.aborted = true;
18981908
err = mlxsw_sp_router_set_abort_trap(mlxsw_sp);
18991909
if (err)

0 commit comments

Comments
 (0)