Skip to content

Commit ce45bde

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_router: Align with new route replace logic
Commit f34436a ("net/ipv6: Simplify route replace and appending into multipath route") changed the IPv6 route replace logic so that the first matching route (i.e., same metric) is replaced. Have mlxsw replace the first matching route as well. Fixes: f34436a ("net/ipv6: Simplify route replace and appending into multipath route") Signed-off-by: Ido Schimmel <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 53b562d commit ce45bde

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4756,12 +4756,6 @@ static void mlxsw_sp_rt6_destroy(struct mlxsw_sp_rt6 *mlxsw_sp_rt6)
47564756
kfree(mlxsw_sp_rt6);
47574757
}
47584758

4759-
static bool mlxsw_sp_fib6_rt_can_mp(const struct fib6_info *rt)
4760-
{
4761-
/* RTF_CACHE routes are ignored */
4762-
return (rt->fib6_flags & (RTF_GATEWAY | RTF_ADDRCONF)) == RTF_GATEWAY;
4763-
}
4764-
47654759
static struct fib6_info *
47664760
mlxsw_sp_fib6_entry_rt(const struct mlxsw_sp_fib6_entry *fib6_entry)
47674761
{
@@ -5169,7 +5163,7 @@ static struct mlxsw_sp_fib6_entry *
51695163
mlxsw_sp_fib6_node_entry_find(const struct mlxsw_sp_fib_node *fib_node,
51705164
const struct fib6_info *nrt, bool replace)
51715165
{
5172-
struct mlxsw_sp_fib6_entry *fib6_entry, *fallback = NULL;
5166+
struct mlxsw_sp_fib6_entry *fib6_entry;
51735167

51745168
list_for_each_entry(fib6_entry, &fib_node->entry_list, common.list) {
51755169
struct fib6_info *rt = mlxsw_sp_fib6_entry_rt(fib6_entry);
@@ -5178,18 +5172,13 @@ mlxsw_sp_fib6_node_entry_find(const struct mlxsw_sp_fib_node *fib_node,
51785172
continue;
51795173
if (rt->fib6_table->tb6_id != nrt->fib6_table->tb6_id)
51805174
break;
5181-
if (replace && rt->fib6_metric == nrt->fib6_metric) {
5182-
if (mlxsw_sp_fib6_rt_can_mp(rt) ==
5183-
mlxsw_sp_fib6_rt_can_mp(nrt))
5184-
return fib6_entry;
5185-
if (mlxsw_sp_fib6_rt_can_mp(nrt))
5186-
fallback = fallback ?: fib6_entry;
5187-
}
5175+
if (replace && rt->fib6_metric == nrt->fib6_metric)
5176+
return fib6_entry;
51885177
if (rt->fib6_metric > nrt->fib6_metric)
5189-
return fallback ?: fib6_entry;
5178+
return fib6_entry;
51905179
}
51915180

5192-
return fallback;
5181+
return NULL;
51935182
}
51945183

51955184
static int

0 commit comments

Comments
 (0)