Skip to content

Commit 4fd0031

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_router: Use the nodes list as indication for empty FIB
Currently, each FIB (IPv4 / IPv6) in a virtual router holds a prefix usage that is used to choose a matching LPM tree, but also to check if the FIB is empty, so that the LPM tree could be unbound. Next patches will remove the reliance on the per-FIB prefix usage for LPM tree matching. Keeping it only to check if the FIB is empty is a waste, since we can use the nodes ({Prefix, Length}) list instead. Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9d6474e commit 4fd0031

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,6 @@ mlxsw_sp_prefix_usage_eq(struct mlxsw_sp_prefix_usage *prefix_usage1,
349349
return !memcmp(prefix_usage1, prefix_usage2, sizeof(*prefix_usage1));
350350
}
351351

352-
static bool
353-
mlxsw_sp_prefix_usage_none(struct mlxsw_sp_prefix_usage *prefix_usage)
354-
{
355-
struct mlxsw_sp_prefix_usage prefix_usage_none = {{ 0 } };
356-
357-
return mlxsw_sp_prefix_usage_eq(prefix_usage, &prefix_usage_none);
358-
}
359-
360352
static void
361353
mlxsw_sp_prefix_usage_cpy(struct mlxsw_sp_prefix_usage *prefix_usage1,
362354
struct mlxsw_sp_prefix_usage *prefix_usage2)
@@ -4240,8 +4232,11 @@ static int mlxsw_sp_fib_lpm_tree_link(struct mlxsw_sp *mlxsw_sp,
42404232
static void mlxsw_sp_fib_lpm_tree_unlink(struct mlxsw_sp *mlxsw_sp,
42414233
struct mlxsw_sp_fib *fib)
42424234
{
4243-
if (!mlxsw_sp_prefix_usage_none(&fib->prefix_usage))
4235+
if (!list_is_singular(&fib->node_list))
42444236
return;
4237+
/* Last node is being unlinked from the FIB. Unbind the
4238+
* tree and drop the reference.
4239+
*/
42454240
mlxsw_sp_vr_lpm_tree_unbind(mlxsw_sp, fib);
42464241
mlxsw_sp_lpm_tree_put(mlxsw_sp, fib->lpm_tree);
42474242
fib->lpm_tree = NULL;

0 commit comments

Comments
 (0)