Skip to content

Commit 489e172

Browse files
mrgolinmehmetb0
authored andcommitted
RDMA/efa: Reset device on probe failure
BugLink: https://bugs.launchpad.net/bugs/2104873 [ Upstream commit 123c13f ] Make sure the device is being reset on driver exit whatever the reason is, to keep the device aligned and allow it to close shared resources (e.g. admin queue). Reviewed-by: Firas Jahjah <[email protected]> Reviewed-by: Yonatan Nachum <[email protected]> Signed-off-by: Michael Margolin <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Gal Pressman <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent 94d0a95 commit 489e172

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/infiniband/hw/efa/efa_main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ static void efa_ib_device_remove(struct efa_dev *dev)
469469
ibdev_info(&dev->ibdev, "Unregister ib device\n");
470470
ib_unregister_device(&dev->ibdev);
471471
efa_destroy_eqs(dev);
472-
efa_com_dev_reset(&dev->edev, EFA_REGS_RESET_NORMAL);
473472
efa_release_doorbell_bar(dev);
474473
}
475474

@@ -642,12 +641,14 @@ static struct efa_dev *efa_probe_device(struct pci_dev *pdev)
642641
return ERR_PTR(err);
643642
}
644643

645-
static void efa_remove_device(struct pci_dev *pdev)
644+
static void efa_remove_device(struct pci_dev *pdev,
645+
enum efa_regs_reset_reason_types reset_reason)
646646
{
647647
struct efa_dev *dev = pci_get_drvdata(pdev);
648648
struct efa_com_dev *edev;
649649

650650
edev = &dev->edev;
651+
efa_com_dev_reset(edev, reset_reason);
651652
efa_com_admin_destroy(edev);
652653
efa_free_irq(dev, &dev->admin_irq);
653654
efa_disable_msix(dev);
@@ -675,7 +676,7 @@ static int efa_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
675676
return 0;
676677

677678
err_remove_device:
678-
efa_remove_device(pdev);
679+
efa_remove_device(pdev, EFA_REGS_RESET_INIT_ERR);
679680
return err;
680681
}
681682

@@ -684,7 +685,7 @@ static void efa_remove(struct pci_dev *pdev)
684685
struct efa_dev *dev = pci_get_drvdata(pdev);
685686

686687
efa_ib_device_remove(dev);
687-
efa_remove_device(pdev);
688+
efa_remove_device(pdev, EFA_REGS_RESET_NORMAL);
688689
}
689690

690691
static void efa_shutdown(struct pci_dev *pdev)

0 commit comments

Comments
 (0)