Skip to content

Commit 8fc3e29

Browse files
mark-blochSaeed Mahameed
authored andcommitted
net/mlx5: Fix crash upon suspend/resume
Currently a Linux system with the mlx5 NIC always crashes upon hibernation - suspend/resume. Add basic callbacks so the NIC could be suspended and resumed. Fixes: 9603b61 ("mlx5: Move pci device handling from mlx5_ib to mlx5_core") Tested-by: Dexuan Cui <[email protected]> Signed-off-by: Mark Bloch <[email protected]> Reviewed-by: Moshe Shemesh <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 7c6d2ec commit 8fc3e29

File tree

1 file changed

+18
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,22 @@ static void shutdown(struct pci_dev *pdev)
15491549
mlx5_pci_disable_device(dev);
15501550
}
15511551

1552+
static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state)
1553+
{
1554+
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
1555+
1556+
mlx5_unload_one(dev, false);
1557+
1558+
return 0;
1559+
}
1560+
1561+
static int mlx5_resume(struct pci_dev *pdev)
1562+
{
1563+
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
1564+
1565+
return mlx5_load_one(dev, false);
1566+
}
1567+
15521568
static const struct pci_device_id mlx5_core_pci_table[] = {
15531569
{ PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) },
15541570
{ PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */
@@ -1592,6 +1608,8 @@ static struct pci_driver mlx5_core_driver = {
15921608
.id_table = mlx5_core_pci_table,
15931609
.probe = init_one,
15941610
.remove = remove_one,
1611+
.suspend = mlx5_suspend,
1612+
.resume = mlx5_resume,
15951613
.shutdown = shutdown,
15961614
.err_handler = &mlx5_err_handler,
15971615
.sriov_configure = mlx5_core_sriov_configure,

0 commit comments

Comments
 (0)