[dpdk-dev] net/mlx5: fix counter set destroy order

Message ID 1509367614-1626-1-git-send-email-orika@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ori Kam Oct. 30, 2017, 12:46 p.m. UTC
  The counter set should be destroyed only after the flow was destroyed.

Fixes: 9a761de ("net/mlx5: flow counter support")
Cc: orika@mellanox.com

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Yongseok Koh Nov. 1, 2017, 5:12 p.m. UTC | #1
> On Oct 30, 2017, at 5:46 AM, Ori Kam <orika@mellanox.com> wrote:
> 
> The counter set should be destroyed only after the flow was destroyed.
> 
> Fixes: 9a761de ("net/mlx5: flow counter support")
> Cc: orika@mellanox.com
> 
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>
 
Thanks
  
Ferruh Yigit Nov. 1, 2017, 8:26 p.m. UTC | #2
On 11/1/2017 10:12 AM, Yongseok Koh wrote:
> 
>> On Oct 30, 2017, at 5:46 AM, Ori Kam <orika@mellanox.com> wrote:
>>
>> The counter set should be destroyed only after the flow was destroyed.
>>
>> Fixes: 9a761de ("net/mlx5: flow counter support")
>> Cc: orika@mellanox.com
>>
>> Signed-off-by: Ori Kam <orika@mellanox.com>

> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 3999b84..e810a3a 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2001,10 +2001,6 @@  struct rte_flow *
 {
 	unsigned int i;
 
-	if (flow->cs) {
-		claim_zero(ibv_destroy_counter_set(flow->cs));
-		flow->cs = NULL;
-	}
 	if (flow->drop || !flow->mark)
 		goto free;
 	for (i = 0; i != flow->queues_n; ++i) {
@@ -2053,6 +2049,10 @@  struct rte_flow *
 				rte_free(frxq->ibv_attr);
 		}
 	}
+	if (flow->cs) {
+		claim_zero(ibv_destroy_counter_set(flow->cs));
+		flow->cs = NULL;
+	}
 	TAILQ_REMOVE(list, flow, next);
 	DEBUG("Flow destroyed %p", (void *)flow);
 	rte_free(flow);