e100: Fix napi_enable BUG_ON when recovering from EEH error
authorAndre Detsch <adetsch@br.ibm.com>
Mon, 8 Jun 2009 07:42:30 +0000 (00:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Jun 2009 07:42:30 +0000 (00:42 -0700)
BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)) was being hit
during e100 EEH recovery. The problem source was a napi_enable
call being made during e100_io_error_detected. Napi should remain
disabled after e100_down, and only be reenabled when the interface
is recovered.

This patch also updates e100_io_error_detected in order to make
it similar to the current versions of the error_detected callback
in drivers such as e1000e and ixgbe.

Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/e100.c

index 0f9ee1348552b6d634e14b632476d8b29e6b9502..0c37dd97fa096e43168b55b28f10987dd99a6a51 100644 (file)
@@ -2822,12 +2822,13 @@ static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct nic *nic = netdev_priv(netdev);
 
-       /* Similar to calling e100_down(), but avoids adapter I/O. */
-       e100_close(netdev);
-
-       /* Detach; put netif into a state similar to hotplug unplug. */
-       napi_enable(&nic->napi);
        netif_device_detach(netdev);
+
+       if (state == pci_channel_io_perm_failure)
+               return PCI_ERS_RESULT_DISCONNECT;
+
+       if (netif_running(netdev))
+               e100_down(nic);
        pci_disable_device(pdev);
 
        /* Request a slot reset. */