Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0a0a84d authored by Moshe Shemesh's avatar Moshe Shemesh Committed by Greg Kroah-Hartman
Browse files

net/mlx5: Stop waiting for PCI if pci channel is offline



[ Upstream commit 33afbfcc105a572159750f2ebee834a8a70fdd96 ]

In case pci channel becomes offline the driver should not wait for PCI
reads during health dump and recovery flow. The driver has timeout for
each of these loops trying to read PCI, so it would fail anyway.
However, in case of recovery waiting till timeout may cause the pci
error_detected() callback fail to meet pci_dpc_recovered() wait timeout.

Fixes: b3bd076f ("net/mlx5: Report devlink health on FW fatal issues")
Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Reviewed-by: default avatarShay Drori <shayd@nvidia.com>
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b2ca635b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -337,6 +337,10 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev)
	do {
		if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
			break;
		if (pci_channel_offline(dev->pdev)) {
			mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n");
			return -EACCES;
		}

		cond_resched();
	} while (!time_after(jiffies, end));
+8 −0
Original line number Diff line number Diff line
@@ -250,6 +250,10 @@ void mlx5_error_sw_reset(struct mlx5_core_dev *dev)
	do {
		if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
			break;
		if (pci_channel_offline(dev->pdev)) {
			mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n");
			goto unlock;
		}

		msleep(20);
	} while (!time_after(jiffies, end));
@@ -322,6 +326,10 @@ static int mlx5_health_try_recover(struct mlx5_core_dev *dev)
				      "health recovery flow aborted, PCI reads still not working\n");
			return -EIO;
		}
		if (pci_channel_offline(dev->pdev)) {
			mlx5_core_err(dev, "PCI channel offline, stop waiting for PCI\n");
			return -EACCES;
		}
		msleep(100);
	}

+4 −0
Original line number Diff line number Diff line
@@ -74,6 +74,10 @@ int mlx5_vsc_gw_lock(struct mlx5_core_dev *dev)
			ret = -EBUSY;
			goto pci_unlock;
		}
		if (pci_channel_offline(dev->pdev)) {
			ret = -EACCES;
			goto pci_unlock;
		}

		/* Check if semaphore is already locked */
		ret = vsc_read(dev, VSC_SEMAPHORE_OFFSET, &lock_val);