Skip to content

Commit edc64c0

Browse files
mrgolingregkh
authored andcommitted
RDMA/efa: Reset device on probe failure
[ 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 <firasj@amazon.com> Reviewed-by: Yonatan Nachum <ynachum@amazon.com> Signed-off-by: Michael Margolin <mrgolin@amazon.com> Link: https://patch.msgid.link/20241225131548.15155-1-mrgolin@amazon.com Reviewed-by: Gal Pressman <gal.pressman@linux.dev> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 627218d commit edc64c0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

drivers/infiniband/hw/efa/efa_main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ static void efa_ib_device_remove(struct efa_dev *dev)
452452
ibdev_info(&dev->ibdev, "Unregister ib device\n");
453453
ib_unregister_device(&dev->ibdev);
454454
efa_destroy_eqs(dev);
455-
efa_com_dev_reset(&dev->edev, EFA_REGS_RESET_NORMAL);
456455
efa_release_doorbell_bar(dev);
457456
}
458457

@@ -623,12 +622,14 @@ static struct efa_dev *efa_probe_device(struct pci_dev *pdev)
623622
return ERR_PTR(err);
624623
}
625624

626-
static void efa_remove_device(struct pci_dev *pdev)
625+
static void efa_remove_device(struct pci_dev *pdev,
626+
enum efa_regs_reset_reason_types reset_reason)
627627
{
628628
struct efa_dev *dev = pci_get_drvdata(pdev);
629629
struct efa_com_dev *edev;
630630

631631
edev = &dev->edev;
632+
efa_com_dev_reset(edev, reset_reason);
632633
efa_com_admin_destroy(edev);
633634
efa_free_irq(dev, &dev->admin_irq);
634635
efa_disable_msix(dev);
@@ -656,7 +657,7 @@ static int efa_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
656657
return 0;
657658

658659
err_remove_device:
659-
efa_remove_device(pdev);
660+
efa_remove_device(pdev, EFA_REGS_RESET_INIT_ERR);
660661
return err;
661662
}
662663

@@ -665,7 +666,7 @@ static void efa_remove(struct pci_dev *pdev)
665666
struct efa_dev *dev = pci_get_drvdata(pdev);
666667

667668
efa_ib_device_remove(dev);
668-
efa_remove_device(pdev);
669+
efa_remove_device(pdev, EFA_REGS_RESET_NORMAL);
669670
}
670671

671672
static struct pci_driver efa_pci_driver = {

0 commit comments

Comments
 (0)