mlxsw: spectrum_router: Add an indication if a nexthop group can be destroyed
Currently, a nexthop group is destroyed when the last FIB entry is detached from it. When nexthop objects are supported, this can no longer be the case, as the group is a separate object whose lifetime is managed by user space. Add an indication if a nexthop group can be destroyed and always set it to true for the existing IPv4 and IPv6 nexthop groups. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a9a711a3f7
commit
2efca2bfba
@ -2897,6 +2897,7 @@ struct mlxsw_sp_nexthop_group {
|
||||
};
|
||||
struct mlxsw_sp_nexthop_group_info *nhgi;
|
||||
enum mlxsw_sp_nexthop_group_type type;
|
||||
bool can_destroy;
|
||||
};
|
||||
|
||||
void mlxsw_sp_nexthop_counter_alloc(struct mlxsw_sp *mlxsw_sp,
|
||||
@ -4173,6 +4174,8 @@ mlxsw_sp_nexthop4_group_create(struct mlxsw_sp *mlxsw_sp, struct fib_info *fi)
|
||||
if (err)
|
||||
goto err_nexthop_group_insert;
|
||||
|
||||
nh_grp->can_destroy = true;
|
||||
|
||||
return nh_grp;
|
||||
|
||||
err_nexthop_group_insert:
|
||||
@ -4187,6 +4190,8 @@ static void
|
||||
mlxsw_sp_nexthop4_group_destroy(struct mlxsw_sp *mlxsw_sp,
|
||||
struct mlxsw_sp_nexthop_group *nh_grp)
|
||||
{
|
||||
if (!nh_grp->can_destroy)
|
||||
return;
|
||||
mlxsw_sp_nexthop_group_remove(mlxsw_sp, nh_grp);
|
||||
mlxsw_sp_nexthop4_group_info_fini(mlxsw_sp, nh_grp);
|
||||
fib_info_put(nh_grp->ipv4.fi);
|
||||
@ -5479,6 +5484,8 @@ mlxsw_sp_nexthop6_group_create(struct mlxsw_sp *mlxsw_sp,
|
||||
if (err)
|
||||
goto err_nexthop_group_insert;
|
||||
|
||||
nh_grp->can_destroy = true;
|
||||
|
||||
return nh_grp;
|
||||
|
||||
err_nexthop_group_insert:
|
||||
@ -5492,6 +5499,8 @@ static void
|
||||
mlxsw_sp_nexthop6_group_destroy(struct mlxsw_sp *mlxsw_sp,
|
||||
struct mlxsw_sp_nexthop_group *nh_grp)
|
||||
{
|
||||
if (!nh_grp->can_destroy)
|
||||
return;
|
||||
mlxsw_sp_nexthop_group_remove(mlxsw_sp, nh_grp);
|
||||
mlxsw_sp_nexthop6_group_info_fini(mlxsw_sp, nh_grp);
|
||||
kfree(nh_grp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user