Skip to content

Commit 79fa521

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_router: Avoid allocating NH counters twice
mlxsw_sp_nexthop_counter_disable() decays to a nop when called on a disabled counter, but mlxsw_sp_nexthop_counter_enable() can't similarly be called on an enabled counter. This would be useful in the following patches. Add the missing condition. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Link: https://lore.kernel.org/r/0cc9050e196366c1387ab5ee47f1cee8ecde9c86.1709901020.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6fb88aa commit 79fa521

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,6 +3157,9 @@ int mlxsw_sp_nexthop_counter_enable(struct mlxsw_sp *mlxsw_sp,
31573157
struct devlink *devlink;
31583158
int err;
31593159

3160+
if (nh->counter_valid)
3161+
return 0;
3162+
31603163
devlink = priv_to_devlink(mlxsw_sp->core);
31613164
if (!devlink_dpipe_table_counter_enabled(devlink,
31623165
MLXSW_SP_DPIPE_TABLE_NAME_ADJ))

0 commit comments

Comments
 (0)