Skip to content

Commit a1acdc2

Browse files
vikasbrcmdavem330
authored andcommitted
bnxt_en: Fix the PCI-AER routines
We do not support two simultaneous recoveries so check for reset flag, BNXT_STATE_IN_FW_RESET, and do not proceed with AER further. When the pci channel state is pci_channel_io_frozen, the PCIe link can not be trusted so we disable the traffic immediately and stop BAR access by calling bnxt_fw_fatal_close(). BAR access after AER fatal error can cause an NMI. Fixes: f75d9a0 ("bnxt_en: Re-write PCI BARs after PCI fatal error.") Signed-off-by: Vikas Gupta <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7474b1c commit a1acdc2

File tree

1 file changed

+16
-3
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+16
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15378,6 +15378,7 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
1537815378
{
1537915379
struct net_device *netdev = pci_get_drvdata(pdev);
1538015380
struct bnxt *bp = netdev_priv(netdev);
15381+
bool abort = false;
1538115382

1538215383
netdev_info(netdev, "PCI I/O error detected\n");
1538315384

@@ -15386,16 +15387,27 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
1538615387

1538715388
bnxt_ulp_stop(bp);
1538815389

15389-
if (state == pci_channel_io_perm_failure) {
15390+
if (test_and_set_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
15391+
netdev_err(bp->dev, "Firmware reset already in progress\n");
15392+
abort = true;
15393+
}
15394+
15395+
if (abort || state == pci_channel_io_perm_failure) {
1539015396
rtnl_unlock();
1539115397
return PCI_ERS_RESULT_DISCONNECT;
1539215398
}
1539315399

15394-
if (state == pci_channel_io_frozen)
15400+
/* Link is not reliable anymore if state is pci_channel_io_frozen
15401+
* so we disable bus master to prevent any potential bad DMAs before
15402+
* freeing kernel memory.
15403+
*/
15404+
if (state == pci_channel_io_frozen) {
1539515405
set_bit(BNXT_STATE_PCI_CHANNEL_IO_FROZEN, &bp->state);
15406+
bnxt_fw_fatal_close(bp);
15407+
}
1539615408

1539715409
if (netif_running(netdev))
15398-
bnxt_close(netdev);
15410+
__bnxt_close_nic(bp, true, true);
1539915411

1540015412
if (pci_is_enabled(pdev))
1540115413
pci_disable_device(pdev);
@@ -15479,6 +15491,7 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
1547915491
}
1548015492

1548115493
reset_exit:
15494+
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1548215495
bnxt_clear_reservations(bp, true);
1548315496
rtnl_unlock();
1548415497

0 commit comments

Comments
 (0)