Skip to content

Commit 3aad95d

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_router: Pass FIB node to LPM tree unlink function
Next patch will try to optimize the LPM tree and make sure only used prefix lengths are present, to avoid unnecessary look-ups. Pass the currently removed FIB node to the unlinking function as its associated prefix length is a potential candidate for removal from the tree. Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4fd0031 commit 3aad95d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4193,10 +4193,10 @@ mlxsw_sp_fib_node_entry_is_first(const struct mlxsw_sp_fib_node *fib_node,
41934193
}
41944194

41954195
static int mlxsw_sp_fib_lpm_tree_link(struct mlxsw_sp *mlxsw_sp,
4196-
struct mlxsw_sp_fib *fib,
41974196
struct mlxsw_sp_fib_node *fib_node)
41984197
{
41994198
struct mlxsw_sp_prefix_usage req_prefix_usage = {{ 0 } };
4199+
struct mlxsw_sp_fib *fib = fib_node->fib;
42004200
struct mlxsw_sp_lpm_tree *lpm_tree;
42014201
int err;
42024202

@@ -4230,8 +4230,10 @@ static int mlxsw_sp_fib_lpm_tree_link(struct mlxsw_sp *mlxsw_sp,
42304230
}
42314231

42324232
static void mlxsw_sp_fib_lpm_tree_unlink(struct mlxsw_sp *mlxsw_sp,
4233-
struct mlxsw_sp_fib *fib)
4233+
struct mlxsw_sp_fib_node *fib_node)
42344234
{
4235+
struct mlxsw_sp_fib *fib = fib_node->fib;
4236+
42354237
if (!list_is_singular(&fib->node_list))
42364238
return;
42374239
/* Last node is being unlinked from the FIB. Unbind the
@@ -4271,7 +4273,7 @@ static int mlxsw_sp_fib_node_init(struct mlxsw_sp *mlxsw_sp,
42714273
return err;
42724274
fib_node->fib = fib;
42734275

4274-
err = mlxsw_sp_fib_lpm_tree_link(mlxsw_sp, fib, fib_node);
4276+
err = mlxsw_sp_fib_lpm_tree_link(mlxsw_sp, fib_node);
42754277
if (err)
42764278
goto err_fib_lpm_tree_link;
42774279

@@ -4291,7 +4293,7 @@ static void mlxsw_sp_fib_node_fini(struct mlxsw_sp *mlxsw_sp,
42914293
struct mlxsw_sp_fib *fib = fib_node->fib;
42924294

42934295
mlxsw_sp_fib_node_prefix_dec(fib_node);
4294-
mlxsw_sp_fib_lpm_tree_unlink(mlxsw_sp, fib);
4296+
mlxsw_sp_fib_lpm_tree_unlink(mlxsw_sp, fib_node);
42954297
fib_node->fib = NULL;
42964298
mlxsw_sp_fib_node_remove(fib, fib_node);
42974299
}

0 commit comments

Comments
 (0)