Skip to contentSkip to conversation

e1000: prevent statistics from getting garbled during reset

PATCH In review [email protected] 2 participants 2 messages Jun 9, 2006

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

PATCH 4/8 e1000: prevent statistics from getting garbled during reset

From: Linas Vepstas <[email protected]>

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.

Cc John Ronciak <[email protected]>
Cc Jesse Brandeburg <[email protected]>
Cc Jeff Kirsher <[email protected]>
Cc Jeff Garzik <[email protected]>

---

 drivers/net/e1000/e1000_main.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/e1000/e1000_main.c renamed from drivers/net/e1000/e1000_main.c~e1000-prevent-statistics-from-getting-garbled-during-reset +7 -1
diff -puN drivers/net/e1000/e1000_main.c~e1000-prevent-statistics-from-getting-garbled-during-reset drivers/net/e1000/e1000_main.c
@@ -3082,14 +3082,20 @@ void
 e1000_update_stats(struct e1000_adapter *adapter)
 {
 	struct e1000_hw *hw = &adapter->hw;
+	struct pci_dev *pdev = adapter->pdev;
 	unsigned long flags;
 	uint16_t phy_tmp;
 
 #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)
 		return;
+	if (pdev->error_state && pdev->error_state != pci_channel_io_normal)
+		return;
 
 	spin_lock_irqsave(&adapter->stats_lock, flags);
 

_

Acked-by Acked-by on v1 4/8
#1 lore raw

Ack,

Jeff, please pull this patch from:

git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream

which is against netdev-2.6#upstream cac925a4aab1b7233d3beb591f53498816058a08

Cheers,

Auke

---

---
 e1000_main.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)
Quoted 6 lines · [email protected] wrote:

From: Linas Vepstas <[email protected]>

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.

[snip]

e1000: prevent statistics from garbling during bus resets

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.

drivers/net/e1000/e1000_main.c +7 -1
index 56c7492..a373ccb 100644
@@ -3045,14 +3045,20 @@ void
 e1000_update_stats(struct e1000_adapter *adapter)
 {
 	struct e1000_hw *hw = &adapter->hw;
+	struct pci_dev *pdev = adapter->pdev;
 	unsigned long flags;
 	uint16_t phy_tmp;
 
 #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)
 		return;
+	if (pdev->error_state && pdev->error_state != pci_channel_io_normal)
+		return;
 
 	spin_lock_irqsave(&adapter->stats_lock, flags);