net/mlx5: fix flow counters deletion in Verbs
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>
Sat, 27 Oct 2018 10:54:21 +0000 (10:54 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 5 Nov 2018 14:01:25 +0000 (15:01 +0100)
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>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
drivers/net/mlx5/mlx5_flow_verbs.c

index 81bc39f..2e506b9 100644 (file)
@@ -1669,10 +1669,6 @@ flow_verbs_remove(struct rte_eth_dev *dev, struct rte_flow *flow)
                        verbs->hrxq = NULL;
                }
        }
-       if (flow->counter) {
-               flow_verbs_counter_release(flow->counter);
-               flow->counter = NULL;
-       }
 }
 
 /**
@@ -1696,6 +1692,10 @@ flow_verbs_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)
                LIST_REMOVE(dev_flow, next);
                rte_free(dev_flow);
        }
+       if (flow->counter) {
+               flow_verbs_counter_release(flow->counter);
+               flow->counter = NULL;
+       }
 }
 
 /**