Commit 71ff3f62 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jason Gunthorpe

RDMA: Make counters destroy symmetrical

Change counters to return failure like any other verbs destroy, however
this flow shouldn't return error at all.

Link: https://lore.kernel.org/r/20200907120921.476363-10-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent add53535
...@@ -46,7 +46,9 @@ static int uverbs_free_counters(struct ib_uobject *uobject, ...@@ -46,7 +46,9 @@ static int uverbs_free_counters(struct ib_uobject *uobject,
if (ret) if (ret)
return ret; return ret;
counters->device->ops.destroy_counters(counters); ret = counters->device->ops.destroy_counters(counters);
if (ret)
return ret;
kfree(counters); kfree(counters);
return 0; return 0;
} }
......
...@@ -117,7 +117,7 @@ static int mlx5_ib_read_counters(struct ib_counters *counters, ...@@ -117,7 +117,7 @@ static int mlx5_ib_read_counters(struct ib_counters *counters,
return ret; return ret;
} }
static void mlx5_ib_destroy_counters(struct ib_counters *counters) static int mlx5_ib_destroy_counters(struct ib_counters *counters)
{ {
struct mlx5_ib_mcounters *mcounters = to_mcounters(counters); struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
...@@ -125,6 +125,7 @@ static void mlx5_ib_destroy_counters(struct ib_counters *counters) ...@@ -125,6 +125,7 @@ static void mlx5_ib_destroy_counters(struct ib_counters *counters)
if (mcounters->hw_cntrs_hndl) if (mcounters->hw_cntrs_hndl)
mlx5_fc_destroy(to_mdev(counters->device)->mdev, mlx5_fc_destroy(to_mdev(counters->device)->mdev,
mcounters->hw_cntrs_hndl); mcounters->hw_cntrs_hndl);
return 0;
} }
static int mlx5_ib_create_counters(struct ib_counters *counters, static int mlx5_ib_create_counters(struct ib_counters *counters,
......
...@@ -2498,7 +2498,7 @@ struct ib_device_ops { ...@@ -2498,7 +2498,7 @@ struct ib_device_ops {
struct uverbs_attr_bundle *attrs); struct uverbs_attr_bundle *attrs);
int (*create_counters)(struct ib_counters *counters, int (*create_counters)(struct ib_counters *counters,
struct uverbs_attr_bundle *attrs); struct uverbs_attr_bundle *attrs);
void (*destroy_counters)(struct ib_counters *counters); int (*destroy_counters)(struct ib_counters *counters);
int (*read_counters)(struct ib_counters *counters, int (*read_counters)(struct ib_counters *counters,
struct ib_counters_read_attr *counters_read_attr, struct ib_counters_read_attr *counters_read_attr,
struct uverbs_attr_bundle *attrs); struct uverbs_attr_bundle *attrs);
......
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