diff options
author | Michael Chan <mchan@broadcom.com> | 2012-07-16 18:25:56 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-17 10:12:02 +0400 |
commit | efdfad3205403e1d1c5c0bdcbdb647ddd89bfaa3 (patch) | |
tree | 1b058c348ce528d344020542f9b7371a4a37f279 /drivers/net/ethernet/broadcom/bnx2.c | |
parent | aed93e0bf493535c25c27270001226bb1dd379b2 (diff) | |
download | linux-efdfad3205403e1d1c5c0bdcbdb647ddd89bfaa3.tar.xz |
bnx2: Try to recover from PCI block reset
If the PCI block has reset, the memory enable bit will be reset and
the device will not respond to MMIO access. bnx2_reset_task() currently
will not recover when this happens. Add code to detect this condition
and restore the PCI state. This scenario has been reported by some
users.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 0ced154129a9..79cebd8525ce 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -6388,6 +6388,7 @@ bnx2_reset_task(struct work_struct *work) { struct bnx2 *bp = container_of(work, struct bnx2, reset_task); int rc; + u16 pcicmd; rtnl_lock(); if (!netif_running(bp->dev)) { @@ -6397,6 +6398,12 @@ bnx2_reset_task(struct work_struct *work) bnx2_netif_stop(bp, true); + pci_read_config_word(bp->pdev, PCI_COMMAND, &pcicmd); + if (!(pcicmd & PCI_COMMAND_MEMORY)) { + /* in case PCI block has reset */ + pci_restore_state(bp->pdev); + pci_save_state(bp->pdev); + } rc = bnx2_init_nic(bp, 1); if (rc) { netdev_err(bp->dev, "failed to reset NIC, closing\n"); |