Commit 921c0f5b authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

IB/mlx5: Honor cnt_set_id_valid flag instead of set_id

It is incorrect to depend on set_id value to know if counters were
allocated or not. set_id_valid field is set to true when counters
were allocated. Therefore, use set_id_valid while deciding to
free counters.

Cc: <stable@vger.kernel.org> # 4.15
Fixes: aac4492e ("IB/mlx5: Update counter implementation for dual port RoCE")
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent e3f1ed1f
...@@ -4699,7 +4699,7 @@ static void mlx5_ib_dealloc_counters(struct mlx5_ib_dev *dev) ...@@ -4699,7 +4699,7 @@ static void mlx5_ib_dealloc_counters(struct mlx5_ib_dev *dev)
int i; int i;
for (i = 0; i < dev->num_ports; i++) { for (i = 0; i < dev->num_ports; i++) {
if (dev->port[i].cnts.set_id) if (dev->port[i].cnts.set_id_valid)
mlx5_core_dealloc_q_counter(dev->mdev, mlx5_core_dealloc_q_counter(dev->mdev,
dev->port[i].cnts.set_id); dev->port[i].cnts.set_id);
kfree(dev->port[i].cnts.names); kfree(dev->port[i].cnts.names);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment