net/mlx5: fix shared counter allocation logic

This commit fixes the logic for searching and allocating a shared
counter in mlx5_flow_verbs.
Now only the shared counters in the counters list are checked for
a match and not all the counters as before.

Fixes: 84c406e745 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
This commit is contained in:
Moti Haimovsky 2019-01-03 15:06:36 +00:00 committed by Ferruh Yigit
parent dc205cc57c
commit 5f09e80cf8

View File

@ -121,13 +121,13 @@ flow_verbs_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id)
struct mlx5_flow_counter *cnt;
int ret;
LIST_FOREACH(cnt, &priv->flow_counters, next) {
if (!cnt->shared || cnt->shared != shared)
continue;
if (cnt->id != id)
continue;
cnt->ref_cnt++;
return cnt;
if (shared) {
LIST_FOREACH(cnt, &priv->flow_counters, next) {
if (cnt->shared && cnt->id == id) {
cnt->ref_cnt++;
return cnt;
}
}
}
cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
if (!cnt) {