aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2016-11-14 05:26:32 -0500
committerDavid S. Miller <davem@davemloft.net>2016-11-14 16:45:16 -0500
commitac571de999e14b87890cb960ad6f03fbdde6abc8 (patch)
tree85afb4689162f0be63b92611c418b2bccdd90d22
parentc51e424dc79e1428afc4d697cdb6a07f7af70cbf (diff)
mlxsw: spectrum_router: Flush FIB tables during fini
Since commit b45f64d16d45 ("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: b45f64d16d45 ("mlxsw: spectrum_router: Use FIB notifications instead of switchdev calls") 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>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index cbeeddd70c5a..e83072da6272 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -594,8 +594,11 @@ static int mlxsw_sp_vrs_init(struct mlxsw_sp *mlxsw_sp)
594 return 0; 594 return 0;
595} 595}
596 596
597static void mlxsw_sp_router_fib_flush(struct mlxsw_sp *mlxsw_sp);
598
597static void mlxsw_sp_vrs_fini(struct mlxsw_sp *mlxsw_sp) 599static void mlxsw_sp_vrs_fini(struct mlxsw_sp *mlxsw_sp)
598{ 600{
601 mlxsw_sp_router_fib_flush(mlxsw_sp);
599 kfree(mlxsw_sp->router.vrs); 602 kfree(mlxsw_sp->router.vrs);
600} 603}
601 604
@@ -1867,18 +1870,18 @@ static int mlxsw_sp_router_set_abort_trap(struct mlxsw_sp *mlxsw_sp)
1867 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl); 1870 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ralue), ralue_pl);
1868} 1871}
1869 1872
1870static void mlxsw_sp_router_fib4_abort(struct mlxsw_sp *mlxsw_sp) 1873static void mlxsw_sp_router_fib_flush(struct mlxsw_sp *mlxsw_sp)
1871{ 1874{
1872 struct mlxsw_resources *resources; 1875 struct mlxsw_resources *resources;
1873 struct mlxsw_sp_fib_entry *fib_entry; 1876 struct mlxsw_sp_fib_entry *fib_entry;
1874 struct mlxsw_sp_fib_entry *tmp; 1877 struct mlxsw_sp_fib_entry *tmp;
1875 struct mlxsw_sp_vr *vr; 1878 struct mlxsw_sp_vr *vr;
1876 int i; 1879 int i;
1877 int err;
1878 1880
1879 resources = mlxsw_core_resources_get(mlxsw_sp->core); 1881 resources = mlxsw_core_resources_get(mlxsw_sp->core);
1880 for (i = 0; i < resources->max_virtual_routers; i++) { 1882 for (i = 0; i < resources->max_virtual_routers; i++) {
1881 vr = &mlxsw_sp->router.vrs[i]; 1883 vr = &mlxsw_sp->router.vrs[i];
1884
1882 if (!vr->used) 1885 if (!vr->used)
1883 continue; 1886 continue;
1884 1887
@@ -1894,6 +1897,13 @@ static void mlxsw_sp_router_fib4_abort(struct mlxsw_sp *mlxsw_sp)
1894 break; 1897 break;
1895 } 1898 }
1896 } 1899 }
1900}
1901
1902static void mlxsw_sp_router_fib4_abort(struct mlxsw_sp *mlxsw_sp)
1903{
1904 int err;
1905
1906 mlxsw_sp_router_fib_flush(mlxsw_sp);
1897 mlxsw_sp->router.aborted = true; 1907 mlxsw_sp->router.aborted = true;
1898 err = mlxsw_sp_router_set_abort_trap(mlxsw_sp); 1908 err = mlxsw_sp_router_set_abort_trap(mlxsw_sp);
1899 if (err) 1909 if (err)