[dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic

Slava Ovsiienko viacheslavo at mellanox.com
Sat Dec 29 21:12:42 CET 2018


Moti, don't you forget to update flow_verbs_counter_release() ?
Only shared counters should be removed from the list.

WBR,
Slava

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Mordechay Haimovsky
> Sent: Friday, December 28, 2018 0:20
> To: dev at dpdk.org
> Cc: Mordechay Haimovsky <motih at mellanox.com>; stable at dpdk.org
> Subject: [dpdk-dev] [PATCH v2 1/3] 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: 84c406e74524 ("net/mlx5: add flow translate function")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Moti Haimovsky <motih at mellanox.com>
> ---
> v2:
> * Modified commit header
> ---
>  drivers/net/mlx5/mlx5_flow_verbs.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 81ec59d..409e1cd 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -121,13 +121,13 @@
>  	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) {
> --
> 1.8.3.1



More information about the dev mailing list