summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>2018-10-23 10:04:10 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-26 22:14:06 +0200
commitc4301b9caf3582b13a404bb828874065cfa34d04 (patch)
treea23eb4d896155f3c6e11b69f130a06c0e3bcafc3 /drivers
parent0dcdf32e642df5b2f3a82d3ebd639322b147c0ca (diff)
downloaddpdk-c4301b9caf3582b13a404bb828874065cfa34d04.zip
dpdk-c4301b9caf3582b13a404bb828874065cfa34d04.tar.gz
dpdk-c4301b9caf3582b13a404bb828874065cfa34d04.tar.xz
net/mlx5: fix flow counters creation
The Flow counter creation function contains two problems: - Flow counter object in Verbs is not freed in case of memory allocation error. The call of counter Verbs object deallocating function is added to fix. - The initial value of reference counter is set to one in order to provide the correct counter object freeing in the flow_verbs_counter_release() function. The reference counter field should be initialized to one. Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/mlx5/mlx5_flow_verbs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 4ae974b..6ddb13b 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -72,6 +72,7 @@ flow_verbs_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id)
}),
.hits = 0,
.bytes = 0,
+ .ref_cnt = 1,
};
if (!tmpl.cs) {
@@ -80,6 +81,7 @@ flow_verbs_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id)
}
cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
if (!cnt) {
+ claim_zero(mlx5_glue->destroy_counter_set(tmpl.cs));
rte_errno = ENOMEM;
return NULL;
}