Skip to contentSkip to conversation

bnx2: Try to recover from PCI block reset

PATCH Applied Michael Chan 2 participants 2 messages Jul 17, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/ethernet/broadcom/bnx2.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/ethernet/broadcom/bnx2.c +7 -0
index 0ced154..79cebd8 100644
@@ -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");
Signature · 1 line
1.7.1
maintainer Applied
#1 lore raw

From: "Michael Chan" <[email protected]>
Date: Mon, 16 Jul 2012 17:25:56 -0700

Quoted 7 lines

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.

Applied, thanks Michael.