Skip to content

Commit

Permalink
net/mlx5: DR, Warn on failure to destroy objects due to refcount
Browse files Browse the repository at this point in the history
Add WARN_ON_ONCE on refcount checks in SW steering object destructors

Signed-off-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
  • Loading branch information
Yevgeny Kliteynik authored and Saeed Mahameed committed Dec 31, 2021
1 parent e3a0f40 commit b541282
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_domain *dmn,

int mlx5dr_action_destroy(struct mlx5dr_action *action)
{
if (refcount_read(&action->refcount) > 1)
if (WARN_ON_ONCE(refcount_read(&action->refcount) > 1))
return -EBUSY;

switch (action->action_type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ int mlx5dr_domain_sync(struct mlx5dr_domain *dmn, u32 flags)

int mlx5dr_domain_destroy(struct mlx5dr_domain *dmn)
{
if (refcount_read(&dmn->refcount) > 1)
if (WARN_ON_ONCE(refcount_read(&dmn->refcount) > 1))
return -EBUSY;

/* make sure resources are not used by the hardware */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ int mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher)
{
struct mlx5dr_table *tbl = matcher->tbl;

if (refcount_read(&matcher->refcount) > 1)
if (WARN_ON_ONCE(refcount_read(&matcher->refcount) > 1))
return -EBUSY;

mlx5dr_domain_lock(tbl->dmn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ int mlx5dr_table_destroy(struct mlx5dr_table *tbl)
{
int ret;

if (refcount_read(&tbl->refcount) > 1)
if (WARN_ON_ONCE(refcount_read(&tbl->refcount) > 1))
return -EBUSY;

mlx5dr_dbg_tbl_del(tbl);
Expand Down

0 comments on commit b541282

Please sign in to comment.