Skip to content

Commit 33afbfc

Browse files
mosheshemesh2davem330
authored andcommitted
net/mlx5: Stop waiting for PCI if pci channel is offline
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: b3bd076 ("net/mlx5: Report devlink health on FW fatal issues") Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Shay Drori <shayd@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c57e558 commit 33afbfc

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/fw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev)
373373
do {
374374
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
375375
break;
376+
if (pci_channel_offline(dev->pdev)) {
377+
mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n");
378+
return -EACCES;
379+
}
376380

377381
cond_resched();
378382
} while (!time_after(jiffies, end));

drivers/net/ethernet/mellanox/mlx5/core/health.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ void mlx5_error_sw_reset(struct mlx5_core_dev *dev)
248248
do {
249249
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
250250
break;
251+
if (pci_channel_offline(dev->pdev)) {
252+
mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n");
253+
goto unlock;
254+
}
251255

252256
msleep(20);
253257
} while (!time_after(jiffies, end));
@@ -317,6 +321,10 @@ int mlx5_health_wait_pci_up(struct mlx5_core_dev *dev)
317321
mlx5_core_warn(dev, "device is being removed, stop waiting for PCI\n");
318322
return -ENODEV;
319323
}
324+
if (pci_channel_offline(dev->pdev)) {
325+
mlx5_core_err(dev, "PCI channel offline, stop waiting for PCI\n");
326+
return -EACCES;
327+
}
320328
msleep(100);
321329
}
322330
return 0;

drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ int mlx5_vsc_gw_lock(struct mlx5_core_dev *dev)
7474
ret = -EBUSY;
7575
goto pci_unlock;
7676
}
77+
if (pci_channel_offline(dev->pdev)) {
78+
ret = -EACCES;
79+
goto pci_unlock;
80+
}
7781

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

0 commit comments

Comments
 (0)