Commit 282f33c9 authored by Linas Vepstas's avatar Linas Vepstas Committed by Jeff Garzik

[PATCH] e1000: prevent statistics from getting garbled during reset

If a PCI bus error/fault triggers a PCI bus reset, attempts to get the
ethernet packet count statistics from the hardware will fail, returning
garbage data upstream.  This patch skips statistics data collection if the
PCI device is not on the bus.

This patch presumes that an earlier patch,
[PATCH] PCI Error Recovery: e1000 network device driver
has already been applied.
Signed-off-by: default avatarLinas Vepstas <linas@austin.ibm.com>
Cc: John Ronciak <john.ronciak@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent b89fa8b6
...@@ -3045,14 +3045,20 @@ void ...@@ -3045,14 +3045,20 @@ void
e1000_update_stats(struct e1000_adapter *adapter) e1000_update_stats(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct pci_dev *pdev = adapter->pdev;
unsigned long flags; unsigned long flags;
uint16_t phy_tmp; uint16_t phy_tmp;
#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
/* Prevent stats update while adapter is being reset */ /*
* Prevent stats update while adapter is being reset, or if the pci
* connection is down.
*/
if (adapter->link_speed == 0) if (adapter->link_speed == 0)
return; return;
if (pdev->error_state && pdev->error_state != pci_channel_io_normal)
return;
spin_lock_irqsave(&adapter->stats_lock, flags); spin_lock_irqsave(&adapter->stats_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment