net/mlx5e: Get or put meter by the index of tc police action
authorJianbo Liu <jianbol@nvidia.com>
Mon, 7 Jun 2021 01:40:16 +0000 (01:40 +0000)
committerSaeed Mahameed <saeedm@nvidia.com>
Sat, 2 Jul 2022 18:58:28 +0000 (11:58 -0700)
commitb8acfd4f21e2d4f41964af0e0a2b24cbbc24440a
tree8d97af95113f56266bd48d4b7b6d0b8ba4a38a25
parent6ddac26cf7633766e4e59d513d81f6fd5afa6fcd
net/mlx5e: Get or put meter by the index of tc police action

Add functions to create and destroy flow meter aso object.
This object only supports the range allocation. 64 objects are
allocated at a time, and there are two meters in each object.
Usually only one meter is allocated for a flow, so bitmap is used
to manage these 128 meters.

TC police action is mapped to hardware meter. As the index is unique
for each police action, add APIs to allocate or free hardware meter by
the index. If the meter is already created, increment its refcnt,
otherwise create new one. If police action has different parameters,
update hardware meter accordingly.

Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.h