netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shemminger@linux-foundation.org
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 4/5] sky2: software rx/tx stats
Date: Fri, 26 Jan 2007 11:38:39 -0800	[thread overview]
Message-ID: <20070126194004.281546000@linux-foundation.org> (raw)
In-Reply-To: 20070126193835.658962000@linux-foundation.org

[-- Attachment #1: sky2-stats.patch --]
[-- Type: text/plain, Size: 1827 bytes --]

Maintain packet statistics in software rather than hardware.
This is slightly slower, but allows easier debugging of problems
where packets are still being received by PHY but not being handled
by hardware.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


---
 drivers/net/sky2.c |   21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

--- sky2-2.6.orig/drivers/net/sky2.c	2007-01-26 11:27:40.000000000 -0800
+++ sky2-2.6/drivers/net/sky2.c	2007-01-26 11:27:42.000000000 -0800
@@ -1510,6 +1510,9 @@
 			if (unlikely(netif_msg_tx_done(sky2)))
 				printk(KERN_DEBUG "%s: tx done %u\n",
 				       dev->name, idx);
+			sky2->net_stats.tx_packets++;
+			sky2->net_stats.tx_bytes += re->skb->len;
+
 			dev_kfree_skb_any(re->skb);
 		}
 
@@ -2132,6 +2135,8 @@
 				goto force_update;
 
 			skb->protocol = eth_type_trans(skb, dev);
+			sky2->net_stats.rx_packets++;
+			sky2->net_stats.rx_bytes += skb->len;
 			dev->last_rx = jiffies;
 
 #ifdef SKY2_VLAN_TAG_USED
@@ -2893,25 +2898,9 @@
 	}
 }
 
-/* Use hardware MIB variables for critical path statistics and
- * transmit feedback not reported at interrupt.
- * Other errors are accounted for in interrupt handler.
- */
 static struct net_device_stats *sky2_get_stats(struct net_device *dev)
 {
 	struct sky2_port *sky2 = netdev_priv(dev);
-	u64 data[13];
-
-	sky2_phy_stats(sky2, data, ARRAY_SIZE(data));
-
-	sky2->net_stats.tx_bytes = data[0];
-	sky2->net_stats.rx_bytes = data[1];
-	sky2->net_stats.tx_packets = data[2] + data[4] + data[6];
-	sky2->net_stats.rx_packets = data[3] + data[5] + data[7];
-	sky2->net_stats.multicast = data[3] + data[5];
-	sky2->net_stats.collisions = data[10];
-	sky2->net_stats.tx_aborted_errors = data[12];
-
 	return &sky2->net_stats;
 }
 

--
Stephen Hemminger <shemminger@linux-foundation.org>


  parent reply	other threads:[~2007-01-26 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-26 19:38 [PATCH 0/5] sky2 v1.11.1 patches shemminger
2007-01-26 19:38 ` [PATCH 1/5] sky2: handle network device allocation failure shemminger
2007-01-31 10:03   ` Jeff Garzik
2007-01-26 19:38 ` [PATCH 2/5] sky2: add Wake On Lan support shemminger
2007-01-31 10:03   ` Jeff Garzik
2007-01-26 19:38 ` [PATCH 3/5] sky2: use dev_err for error reports shemminger
2007-01-31 10:03   ` Jeff Garzik
2007-01-26 19:38 ` shemminger [this message]
2007-01-31 10:04   ` [PATCH 4/5] sky2: software rx/tx stats Jeff Garzik
2007-01-26 19:38 ` [PATCH 5/5] sky2: version 1.11.1 shemminger
2007-01-31 10:04   ` Jeff Garzik

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=20070126194004.281546000@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=jgarzik@pobox.com \
    --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;
as well as URLs for NNTP newsgroup(s).