Skip to content

Commit 0adb214

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_router: Pass argument explicitly
Instead of relying on the LPM tree to be assigned to the virtual router before binding the two, lets pass it explicitly. This will later allow us to return upon binding error instead of having to perform a rollback of the assignment. 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>
1 parent cc70267 commit 0adb214

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,13 +659,13 @@ static struct mlxsw_sp_vr *mlxsw_sp_vr_find_unused(struct mlxsw_sp *mlxsw_sp)
659659
}
660660

661661
static int mlxsw_sp_vr_lpm_tree_bind(struct mlxsw_sp *mlxsw_sp,
662-
const struct mlxsw_sp_fib *fib)
662+
const struct mlxsw_sp_fib *fib, u8 tree_id)
663663
{
664664
char raltb_pl[MLXSW_REG_RALTB_LEN];
665665

666666
mlxsw_reg_raltb_pack(raltb_pl, fib->vr->id,
667667
(enum mlxsw_reg_ralxx_protocol) fib->proto,
668-
fib->lpm_tree->id);
668+
tree_id);
669669
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(raltb), raltb_pl);
670670
}
671671

@@ -777,7 +777,7 @@ mlxsw_sp_vr_lpm_tree_check(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fib *fib,
777777

778778
/* Prevent packet loss by overwriting existing binding */
779779
fib->lpm_tree = new_tree;
780-
err = mlxsw_sp_vr_lpm_tree_bind(mlxsw_sp, fib);
780+
err = mlxsw_sp_vr_lpm_tree_bind(mlxsw_sp, fib, new_tree->id);
781781
if (err)
782782
goto err_tree_bind;
783783
mlxsw_sp_lpm_tree_put(mlxsw_sp, lpm_tree);
@@ -2631,7 +2631,7 @@ static int mlxsw_sp_fib_node_init(struct mlxsw_sp *mlxsw_sp,
26312631
if (IS_ERR(lpm_tree))
26322632
return PTR_ERR(lpm_tree);
26332633
fib->lpm_tree = lpm_tree;
2634-
err = mlxsw_sp_vr_lpm_tree_bind(mlxsw_sp, fib);
2634+
err = mlxsw_sp_vr_lpm_tree_bind(mlxsw_sp, fib, lpm_tree->id);
26352635
if (err)
26362636
goto err_tree_bind;
26372637
}

0 commit comments

Comments
 (0)