Skip to content

Commit

Permalink
net/mlx5: Fix cmd error logging for manage pages cmd
Browse files Browse the repository at this point in the history
When the driver unloads, give/reclaim_pages may fail as PF driver in
teardown flow, current code will lead to the following kernel log print
'failed reclaiming pages: err 0'.

Fix it to get same behavior as before the cited commits,
by calling mlx5_cmd_check before handling error state.
mlx5_cmd_check will verify if the returned error is an actual error
needed to be handled by the driver or not and will return an
appropriate value.

Fixes: 8d56429 ("net/mlx5: Remove redundant error on reclaim pages")
Fixes: 4dac2f1 ("net/mlx5: Remove redundant notify fail on give pages")
Signed-off-by: Roy Novich <royno@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
royno-nvidia authored and Saeed Mahameed committed Aug 22, 2022
1 parent 8e93f29 commit 090f3e4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
goto out_dropped;
}
}
err = mlx5_cmd_check(dev, err, in, out);
if (err) {
err = mlx5_cmd_check(dev, err, in, out);
mlx5_core_warn(dev, "func_id 0x%x, npages %d, err %d\n",
func_id, npages, err);
goto out_dropped;
Expand Down Expand Up @@ -524,10 +524,13 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
dev->priv.reclaim_pages_discard += npages;
}
/* if triggered by FW event and failed by FW then ignore */
if (event && err == -EREMOTEIO)
if (event && err == -EREMOTEIO) {
err = 0;
goto out_free;
}

err = mlx5_cmd_check(dev, err, in, out);
if (err) {
err = mlx5_cmd_check(dev, err, in, out);
mlx5_core_err(dev, "failed reclaiming pages: err %d\n", err);
goto out_free;
}
Expand Down

0 comments on commit 090f3e4

Please sign in to comment.