diff mbox series

net/mlx5: fix flow counters deletion in Verbs

Message ID 1540637629-9233-1-git-send-email-viacheslavo@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Shahaf Shuler
Headers show
Series net/mlx5: fix flow counters deletion in Verbs | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK

Commit Message

Slava Ovsiienko Oct. 27, 2018, 10:54 a.m. UTC
The Flow counters created with Verbs are erroneously destroyed
in Flow remove function (flow_verbs_remove()). Counter Verbs
handles stored in the translated rule buffer become invalid.
If rule is reapplied with these invalid counter handles the
driver hangs.

The counter should be destroyed with Verbs in the Flow destroy
function. The Flow remove function should keep counters intact.

Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_verbs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Shahaf Shuler Oct. 28, 2018, 12:53 p.m. UTC | #1
Saturday, October 27, 2018 1:54 PM¸ Slava Ovsiienko:
> Subject: [PATCH] net/mlx5: fix flow counters deletion in Verbs
> 
> The Flow counters created with Verbs are erroneously destroyed in Flow
> remove function (flow_verbs_remove()). Counter Verbs handles stored in
> the translated rule buffer become invalid.
> If rule is reapplied with these invalid counter handles the driver hangs.
> 
> The counter should be destroyed with Verbs in the Flow destroy function.
> The Flow remove function should keep counters intact.
> 
> Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
> Cc: stable@dpdk.org
> 

Very nice commit log.

> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

Acked-by: Shahaf Shuler <shahafs@mellanox.com>

Applied to next-net-mlx, thanks. 

> ---
>  drivers/net/mlx5/mlx5_flow_verbs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 81bc39f..2e506b9 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -1669,10 +1669,6 @@
>  			verbs->hrxq = NULL;
>  		}
>  	}
> -	if (flow->counter) {
> -		flow_verbs_counter_release(flow->counter);
> -		flow->counter = NULL;
> -	}
>  }
> 
>  /**
> @@ -1696,6 +1692,10 @@
>  		LIST_REMOVE(dev_flow, next);
>  		rte_free(dev_flow);
>  	}
> +	if (flow->counter) {
> +		flow_verbs_counter_release(flow->counter);
> +		flow->counter = NULL;
> +	}
>  }
> 
>  /**
> --
> 1.8.3.1
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 81bc39f..2e506b9 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1669,10 +1669,6 @@ 
 			verbs->hrxq = NULL;
 		}
 	}
-	if (flow->counter) {
-		flow_verbs_counter_release(flow->counter);
-		flow->counter = NULL;
-	}
 }
 
 /**
@@ -1696,6 +1692,10 @@ 
 		LIST_REMOVE(dev_flow, next);
 		rte_free(dev_flow);
 	}
+	if (flow->counter) {
+		flow_verbs_counter_release(flow->counter);
+		flow->counter = NULL;
+	}
 }
 
 /**