linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: e1000: prevent statistics from getting garbled during reset.
@ 2006-03-30 21:39 Linas Vepstas
  2006-03-31  0:02 ` Linas Vepstas
  0 siblings, 1 reply; 10+ messages in thread
From: Linas Vepstas @ 2006-03-30 21:39 UTC (permalink / raw)
  To: john.ronciak, jesse.brandeburg, jeffrey.t.kirsher
  Cc: netdev, linux-pci, Jeff Garzik, linux-kernel, linuxppc-dev


Please review, sign-off/ack, and forward upstream.
--linas

[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: Linas Vepstas <linas@austin.ibm.com>

----
 drivers/net/e1000/e1000_main.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Index: linux-2.6.16-git6/drivers/net/e1000/e1000_main.c
===================================================================
--- linux-2.6.16-git6.orig/drivers/net/e1000/e1000_main.c	2006-03-30 14:42:33.000000000 -0600
+++ linux-2.6.16-git6/drivers/net/e1000/e1000_main.c	2006-03-30 14:44:52.000000000 -0600
@@ -3069,13 +3069,17 @@ 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 */
-	if (adapter->link_speed == 0)
+	/* Prevent stats update while adapter is being reset, or if
+	 * the pci connection is down. */
+	if ((adapter->link_speed == 0) ||
+       ((pdev->error_state != 0) &&
+	    (pdev->error_state != pci_channel_io_normal)))
 		return;
 
 	spin_lock_irqsave(&adapter->stats_lock, flags);

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-03-31 18:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-30 21:39 [PATCH]: e1000: prevent statistics from getting garbled during reset Linas Vepstas
2006-03-31  0:02 ` Linas Vepstas
2006-03-31  1:05   ` Jeff V. Merkey
2006-03-31  0:35     ` Linas Vepstas
2006-03-31  4:14       ` Jeffrey V. Merkey
2006-03-31 17:03         ` Linas Vepstas
2006-03-31 17:36           ` Rick Jones
2006-03-31 18:40           ` Jeff V. Merkey
2006-03-31  5:46   ` Greg KH
2006-03-31 17:06     ` Linas Vepstas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).