]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bnxt_en: Fix AER recovery.
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Sun, 27 Dec 2020 19:18:17 +0000 (14:18 -0500)
committerJakub Kicinski <kuba@kernel.org>
Mon, 28 Dec 2020 22:10:52 +0000 (14:10 -0800)
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: b340dc680ed4 ("bnxt_en: Avoid sending firmware messages when AER error is detected.")
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 4edd6f8e017e468f6b9555447cf13c40bddec2a1..b8351e24395deaaf7aa7ced89dab7cf1a40aba0c 100644 (file)
@@ -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,22 +12919,8 @@ 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();
 
-       netif_device_attach(netdev);
+       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();
 }