Commit 090f3e4f authored by Roy Novich's avatar Roy Novich Committed by Saeed Mahameed
Browse files

net/mlx5: Fix cmd error logging for manage pages cmd



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: 8d564292 ("net/mlx5: Remove redundant error on reclaim pages")
Fixes: 4dac2f10 ("net/mlx5: Remove redundant notify fail on give pages")
Signed-off-by: default avatarRoy Novich <royno@nvidia.com>
Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 8e93f294
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -376,8 +376,8 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
			goto out_dropped;
		}
	}
	if (err) {
	err = mlx5_cmd_check(dev, err, in, out);
	if (err) {
		mlx5_core_warn(dev, "func_id 0x%x, npages %d, err %d\n",
			       func_id, npages, err);
		goto out_dropped;
@@ -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;
	if (err) {
		goto out_free;
	}

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