From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from over.co.us.ibm.com (over.co.us.ibm.com [32.97.110.157]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "over.co.us.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTP id 0D7D7679F8 for ; Sat, 1 Apr 2006 05:40:17 +1100 (EST) Received: from e5.ny.us.ibm.com (e5.pok.ibm.com [9.56.232.145]) by bldfb.esmtp.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k2VH6i0h030981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 31 Mar 2006 12:06:45 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e5.ny.us.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k2VH6U3A031706 for ; Fri, 31 Mar 2006 12:06:30 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k2VH6MLt197324 for ; Fri, 31 Mar 2006 12:06:22 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11/8.13.3) with ESMTP id k2VH6L4J014215 for ; Fri, 31 Mar 2006 12:06:21 -0500 Date: Fri, 31 Mar 2006 11:06:20 -0600 To: Greg KH Subject: Re: [PATCH]: e1000: prevent statistics from getting garbled during reset. Message-ID: <20060331170620.GW2172@austin.ibm.com> References: <20060330213928.GQ2172@austin.ibm.com> <20060331000208.GS2172@austin.ibm.com> <20060331054654.GA6632@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20060331054654.GA6632@kroah.com> From: linas@austin.ibm.com (Linas Vepstas) Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jesse.brandeburg@intel.com, linuxppc-dev@ozlabs.org, john.ronciak@intel.com, jeffrey.t.kirsher@intel.com, linux-pci@atrey.karlin.mff.cuni.cz, Jeff Garzik List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, Mar 30, 2006 at 09:46:54PM -0800, Greg KH wrote: > > (hint, use a tab...) glurg. [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 ---- drivers/net/e1000/e1000_main.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) 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 17:51:37.924162779 -0600 +++ linux-2.6.16-git6/drivers/net/e1000/e1000_main.c 2006-03-30 17:54:07.659188391 -0600 @@ -3069,14 +3069,18 @@ 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);