[2/2] net/mlx5: fix counter allocation from shared pool
Checks
Commit Message
mlx5_hws_cnt struct represents counter objects which are used
in flow rules. This struct contains a union which stores
the following information:
- If counter object is used:
- `share` is set to 1 if and only if counter object is used
in an indirect action.
- `age_idx` is set to the relevant AGE object index.
- Both of these fields are set at the time of allocatin
a counter object from the pool.
- If counter object is unused:
- `query_gen_when_free` is set to the current reset cycle
of the counter service at the time of freeing the counter object.
When ports were configured to share the flow engine resources,
counter object allocation logic in mlx5_hws_cnt_pool_get()
did not reset the `share` field.
This caused issues when previously released counter object
had the least significant bit of `query_gen_when_free` set to 1.
That counter object was treated as shared counter (indirect action),
even if it was allocated by using COUNT action directly in the flow
rule.
This patch fixes this issue by adding the explicit reset of `share`
field.
Fixes: 13ea6bdcc7ee ("net/mlx5: support counters in cross port shared mode")
Cc: viacheslavo@nvidia.com
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/mlx5_hws_cnt.h | 1 +
1 file changed, 1 insertion(+)
@@ -506,6 +506,7 @@ mlx5_hws_cnt_pool_get(struct mlx5_hws_cnt_pool *cpool, uint32_t *queue,
__hws_cnt_query_raw(cpool, *cnt_id,
&cpool->pool[iidx].reset.hits,
&cpool->pool[iidx].reset.bytes);
+ cpool->pool[iidx].share = 0;
MLX5_ASSERT(!cpool->pool[iidx].in_used);
cpool->pool[iidx].in_used = true;
cpool->pool[iidx].age_idx = age_idx;