public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Cammarata <jimi@sngx.net>
To: linux-kernel@vger.kernel.org
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: add ability to clear stats via ethtool - e1000/pcnet32
Date: Wed, 28 May 2008 21:08:05 -0500	[thread overview]
Message-ID: <483E1005.3080804@sngx.net> (raw)
In-Reply-To: <483E0AAE.2020107@sngx.net>

Missed an errant define in some copied code (from the get_stats function in e1000_main.c).

Signed-off-by: James Cammarata <jimi@sngx.net>
---

--- linux-2.6.25.4/drivers/net/e1000/e1000_main.c	2008-05-15 10:00:12.000000000 -0500
+++ linux-2.6.25.4-jcammara/drivers/net/e1000/e1000_main.c	2008-05-28 21:06:19.000000000 -0500
@@ -141,6 +141,7 @@ static void e1000_free_tx_resources(stru
 static void e1000_free_rx_resources(struct e1000_adapter *adapter,
                              struct e1000_rx_ring *rx_ring);
 void e1000_update_stats(struct e1000_adapter *adapter);
+void e1000_clear_stats(struct e1000_adapter *adapter);
 
 static int e1000_init_module(void);
 static void e1000_exit_module(void);
@@ -3819,6 +3820,29 @@ e1000_update_stats(struct e1000_adapter 
 	spin_unlock_irqrestore(&adapter->stats_lock, flags);
 }
 
+void
+e1000_clear_stats(struct e1000_adapter *adapter)
+{
+	struct pci_dev *pdev = adapter->pdev;
+	unsigned long flags;
+
+	/*
+	 * Prevent stats update while adapter is being reset, or if the pci
+	 * connection is down.
+	 */
+	if (adapter->link_speed == 0)
+		return;
+	if (pci_channel_offline(pdev))
+		return;
+
+	spin_lock_irqsave(&adapter->stats_lock, flags);
+
+	memset(&adapter->stats, 0, sizeof(struct e1000_hw_stats));
+	memset(&adapter->net_stats, 0, sizeof(struct net_device_stats));
+
+	spin_unlock_irqrestore(&adapter->stats_lock, flags);
+}
+
 /**
  * e1000_intr_msi - Interrupt Handler
  * @irq: interrupt number


  reply	other threads:[~2008-05-29  2:07 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16 15:18 [PATCH updated] net: add ability to clear per-interface network statistics via procfs James Cammarata
2008-05-16 16:20 ` Eric Dumazet
2008-05-16 20:03   ` David Miller
2008-05-17 14:54   ` James Cammarata
2008-05-17 21:41     ` Eric Dumazet
2008-05-17 22:49       ` James Cammarata
2008-05-18  0:31         ` Ben Hutchings
2008-05-18  1:43           ` Patrick McHardy
2008-05-18  5:09           ` James Cammarata
2008-05-18 11:27             ` Ben Hutchings
2008-05-29  1:45             ` [PATCH] net: add ability to clear stats via ethtool - e1000/pcnet32 James Cammarata
2008-05-29  2:08               ` James Cammarata [this message]
2008-05-29  5:11               ` Andrew Morton
2008-05-29 12:34                 ` James Cammarata
2008-05-29 14:45                   ` Alan Cox
2008-05-29 17:15                     ` James Cammarata
2008-05-29 20:50                       ` David Miller
2008-05-29 21:18                         ` James Cammarata
2008-05-30 19:12                     ` Bill Fink
2008-05-30 22:14                       ` Rick Jones
2008-05-31  1:09                         ` Bill Fink
2008-05-31  2:41                           ` Stephen Hemminger
2008-05-31  4:47                             ` Bill Fink
2008-05-31 12:11                       ` Alan Cox
2008-05-31 23:57                         ` Bill Fink
2008-06-01  1:46                           ` Ben Hutchings
2008-06-01 20:46                             ` Bill Fink
2008-06-01 22:29                               ` Ben Hutchings
2008-06-02  3:55                                 ` Bill Fink
2008-06-02  5:39                               ` David Miller
2008-06-02 15:41                                 ` Bill Fink
2008-06-02  4:50                           ` Glen Turner
2008-06-02 16:10                             ` Bill Fink
2008-06-03 12:28                               ` James Cammarata
2008-06-03 12:35                                 ` Ben Hutchings
2008-06-03 14:46                                 ` Alan Cox
2008-06-04  3:05                                   ` James Cammarata
2008-05-29 14:48                   ` Chris Friesen
2008-05-16 20:00 ` [PATCH updated] net: add ability to clear per-interface network statistics via procfs David Miller
2008-05-16 20:09   ` Rick Jones
2008-05-17 15:06     ` James Cammarata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=483E1005.3080804@sngx.net \
    --to=jimi@sngx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox