[v3,10/13] net/mlx5: fix e-switch Flow counter deletion

Message ID 1541074741-41368-11-git-send-email-viacheslavo@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Shahaf Shuler
Headers
Series net/mlx5: e-switch VXLAN encap/decap hardware offload |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK

Commit Message

Slava Ovsiienko Nov. 1, 2018, 12:19 p.m. UTC
  The counters for E-Switch rules were erroneously deleted in
flow_tcf_remove() routine. The counters deletion is moved to
flow_tcf_destroy() routine.

Fixes: e1114ff6a5ab ("net/mlx5: support e-switch flow count action")
Cc: Moti Haimovsky <motih@mellanox.com>

Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_tcf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Comments

Yongseok Koh Nov. 1, 2018, 10 p.m. UTC | #1
On Thu, Nov 01, 2018 at 05:19:32AM -0700, Slava Ovsiienko wrote:
> The counters for E-Switch rules were erroneously deleted in
> flow_tcf_remove() routine. The counters deletion is moved to
> flow_tcf_destroy() routine.
> 
> Fixes: e1114ff6a5ab ("net/mlx5: support e-switch flow count action")
> Cc: Moti Haimovsky <motih@mellanox.com>
> 
> Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>

Thanks

>  drivers/net/mlx5/mlx5_flow_tcf.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c
> index 67a6ff3..02b64d6 100644
> --- a/drivers/net/mlx5/mlx5_flow_tcf.c
> +++ b/drivers/net/mlx5/mlx5_flow_tcf.c
> @@ -3803,12 +3803,6 @@ struct pedit_parser {
>  
>  	if (!flow)
>  		return;
> -	if (flow->counter) {
> -		if (--flow->counter->ref_cnt == 0) {
> -			rte_free(flow->counter);
> -			flow->counter = NULL;
> -		}
> -	}
>  	dev_flow = LIST_FIRST(&flow->dev_flows);
>  	if (!dev_flow)
>  		return;
> @@ -3836,6 +3830,12 @@ struct pedit_parser {
>  	if (!flow)
>  		return;
>  	flow_tcf_remove(dev, flow);
> +	if (flow->counter) {
> +		if (--flow->counter->ref_cnt == 0) {
> +			rte_free(flow->counter);
> +			flow->counter = NULL;
> +		}
> +	}
>  	dev_flow = LIST_FIRST(&flow->dev_flows);
>  	if (!dev_flow)
>  		return;
> -- 
> 1.8.3.1
>
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c
index 67a6ff3..02b64d6 100644
--- a/drivers/net/mlx5/mlx5_flow_tcf.c
+++ b/drivers/net/mlx5/mlx5_flow_tcf.c
@@ -3803,12 +3803,6 @@  struct pedit_parser {
 
 	if (!flow)
 		return;
-	if (flow->counter) {
-		if (--flow->counter->ref_cnt == 0) {
-			rte_free(flow->counter);
-			flow->counter = NULL;
-		}
-	}
 	dev_flow = LIST_FIRST(&flow->dev_flows);
 	if (!dev_flow)
 		return;
@@ -3836,6 +3830,12 @@  struct pedit_parser {
 	if (!flow)
 		return;
 	flow_tcf_remove(dev, flow);
+	if (flow->counter) {
+		if (--flow->counter->ref_cnt == 0) {
+			rte_free(flow->counter);
+			flow->counter = NULL;
+		}
+	}
 	dev_flow = LIST_FIRST(&flow->dev_flows);
 	if (!dev_flow)
 		return;