Skip to content

Commit 794cd62

Browse files
mosheshemesh2Sasha Levin
authored andcommitted
net/mlx5: Stop waiting for PCI if pci channel is offline
[ Upstream commit 33afbfc ] 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 <[email protected]> Reviewed-by: Shay Drori <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 556f288 commit 794cd62

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
@@ -379,6 +379,10 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev)
379379
do {
380380
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
381381
break;
382+
if (pci_channel_offline(dev->pdev)) {
383+
mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n");
384+
return -EACCES;
385+
}
382386

383387
cond_resched();
384388
} 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
@@ -260,6 +260,10 @@ void mlx5_error_sw_reset(struct mlx5_core_dev *dev)
260260
do {
261261
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
262262
break;
263+
if (pci_channel_offline(dev->pdev)) {
264+
mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n");
265+
goto unlock;
266+
}
263267

264268
msleep(20);
265269
} while (!time_after(jiffies, end));
@@ -329,6 +333,10 @@ int mlx5_health_wait_pci_up(struct mlx5_core_dev *dev)
329333
mlx5_core_warn(dev, "device is being removed, stop waiting for PCI\n");
330334
return -ENODEV;
331335
}
336+
if (pci_channel_offline(dev->pdev)) {
337+
mlx5_core_err(dev, "PCI channel offline, stop waiting for PCI\n");
338+
return -EACCES;
339+
}
332340
msleep(100);
333341
}
334342
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)