Commit fb1e6e56 authored by Vasundhara Volam's avatar Vasundhara Volam Committed by Jakub Kicinski
Browse files

bnxt_en: Fix AER recovery.



A recent change skips sending firmware messages to the firmware when
pci_channel_offline() is true during fatal AER error.  To make this
complete, we need to move the re-initialization sequence to
bnxt_io_resume(), otherwise the firmware messages to re-initialize
will all be skipped.  In any case, it is more correct to re-initialize
in bnxt_io_resume().

Also, fix the reverse x-mas tree format when defining variables
in bnxt_io_slot_reset().

Fixes: b340dc68 ("bnxt_en: Avoid sending firmware messages when AER error is detected.")
Reviewed-by: default avatarEdwin Peer <edwin.peer@broadcom.com>
Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 74f88c16
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -12887,10 +12887,10 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
 */
static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
{
	pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
	struct net_device *netdev = pci_get_drvdata(pdev);
	struct bnxt *bp = netdev_priv(netdev);
	int err = 0, off;
	pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;

	netdev_info(bp->dev, "PCI Slot Reset\n");

@@ -12919,23 +12919,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
		pci_save_state(pdev);

		err = bnxt_hwrm_func_reset(bp);
		if (!err) {
			err = bnxt_hwrm_func_qcaps(bp);
			if (!err && netif_running(netdev))
				err = bnxt_open(netdev);
		}
		bnxt_ulp_start(bp, err);
		if (!err) {
			bnxt_reenable_sriov(bp);
		if (!err)
			result = PCI_ERS_RESULT_RECOVERED;
	}
	}

	if (result != PCI_ERS_RESULT_RECOVERED) {
		if (netif_running(netdev))
			dev_close(netdev);
		pci_disable_device(pdev);
	}

	rtnl_unlock();

@@ -12952,10 +12938,21 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
static void bnxt_io_resume(struct pci_dev *pdev)
{
	struct net_device *netdev = pci_get_drvdata(pdev);
	struct bnxt *bp = netdev_priv(netdev);
	int err;

	netdev_info(bp->dev, "PCI Slot Resume\n");
	rtnl_lock();

	err = bnxt_hwrm_func_qcaps(bp);
	if (!err && netif_running(netdev))
		err = bnxt_open(netdev);

	bnxt_ulp_start(bp, err);
	if (!err) {
		bnxt_reenable_sriov(bp);
		netif_device_attach(netdev);
	}

	rtnl_unlock();
}