netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: "David S. Miller" <davem@davemloft.net>, Jon Mason <jdmason@kudzu.us>
Cc: netdev@vger.kernel.org
Subject: [PATCH 9/9] s2io: implement 64 bit stats
Date: Wed, 08 Jun 2011 17:54:05 -0700	[thread overview]
Message-ID: <20110609005417.817071451@vyatta.com> (raw)
In-Reply-To: 20110609005356.160260858@vyatta.com

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

Convert s2io driver to 64 bit statistics interface.
This driver keeps it private set of counters so change those
to the 64 bit netlink type.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/s2io.c	2011-06-07 17:35:37.372117743 -0700
+++ b/drivers/net/s2io.c	2011-06-07 17:44:14.102680070 -0700
@@ -4897,7 +4897,8 @@ static void s2io_updt_stats(struct s2io_
  *  Return value:
  *  pointer to the updated net_device_stats structure.
  */
-static struct net_device_stats *s2io_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *s2io_get_stats(struct net_device *dev,
+						struct rtnl_link_stats64 *net_stats)
 {
 	struct s2io_nic *sp = netdev_priv(dev);
 	struct mac_info *mac_control = &sp->mac_control;
@@ -4916,40 +4917,32 @@ static struct net_device_stats *s2io_get
 	 */
 	delta = ((u64) le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 |
 		le32_to_cpu(stats->rmac_vld_frms)) - sp->stats.rx_packets;
-	sp->stats.rx_packets += delta;
-	dev->stats.rx_packets += delta;
+	sp->stats.tx_packets += delta;
 
 	delta = ((u64) le32_to_cpu(stats->tmac_frms_oflow) << 32 |
 		le32_to_cpu(stats->tmac_frms)) - sp->stats.tx_packets;
 	sp->stats.tx_packets += delta;
-	dev->stats.tx_packets += delta;
 
 	delta = ((u64) le32_to_cpu(stats->rmac_data_octets_oflow) << 32 |
 		le32_to_cpu(stats->rmac_data_octets)) - sp->stats.rx_bytes;
 	sp->stats.rx_bytes += delta;
-	dev->stats.rx_bytes += delta;
 
 	delta = ((u64) le32_to_cpu(stats->tmac_data_octets_oflow) << 32 |
 		le32_to_cpu(stats->tmac_data_octets)) - sp->stats.tx_bytes;
 	sp->stats.tx_bytes += delta;
-	dev->stats.tx_bytes += delta;
 
 	delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_errors;
 	sp->stats.rx_errors += delta;
-	dev->stats.rx_errors += delta;
 
 	delta = ((u64) le32_to_cpu(stats->tmac_any_err_frms_oflow) << 32 |
 		le32_to_cpu(stats->tmac_any_err_frms)) - sp->stats.tx_errors;
 	sp->stats.tx_errors += delta;
-	dev->stats.tx_errors += delta;
 
 	delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_dropped;
 	sp->stats.rx_dropped += delta;
-	dev->stats.rx_dropped += delta;
 
 	delta = le64_to_cpu(stats->tmac_drop_frms) - sp->stats.tx_dropped;
 	sp->stats.tx_dropped += delta;
-	dev->stats.tx_dropped += delta;
 
 	/* The adapter MAC interprets pause frames as multicast packets, but
 	 * does not pass them up.  This erroneously increases the multicast
@@ -4961,19 +4954,16 @@ static struct net_device_stats *s2io_get
 	delta -= le64_to_cpu(stats->rmac_pause_ctrl_frms);
 	delta -= sp->stats.multicast;
 	sp->stats.multicast += delta;
-	dev->stats.multicast += delta;
 
 	delta = ((u64) le32_to_cpu(stats->rmac_usized_frms_oflow) << 32 |
 		le32_to_cpu(stats->rmac_usized_frms)) +
 		le64_to_cpu(stats->rmac_long_frms) - sp->stats.rx_length_errors;
 	sp->stats.rx_length_errors += delta;
-	dev->stats.rx_length_errors += delta;
 
 	delta = le64_to_cpu(stats->rmac_fcs_err_frms) - sp->stats.rx_crc_errors;
 	sp->stats.rx_crc_errors += delta;
-	dev->stats.rx_crc_errors += delta;
 
-	return &dev->stats;
+	return &sp->stats;
 }
 
 /**
@@ -7447,7 +7437,7 @@ static int rx_osm_handler(struct ring_in
 		if (err_mask != 0x5) {
 			DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
 				  dev->name, err_mask);
-			dev->stats.rx_crc_errors++;
+			sp->stats.rx_crc_errors++;
 			swstats->mem_freed
 				+= skb->truesize;
 			dev_kfree_skb(skb);
@@ -7731,7 +7721,7 @@ static int rts_ds_steer(struct s2io_nic
 static const struct net_device_ops s2io_netdev_ops = {
 	.ndo_open	        = s2io_open,
 	.ndo_stop	        = s2io_close,
-	.ndo_get_stats	        = s2io_get_stats,
+	.ndo_get_stats64        = s2io_get_stats,
 	.ndo_start_xmit    	= s2io_xmit,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_multicast_list = s2io_set_multicast,
--- a/drivers/net/s2io.h	2011-06-07 17:38:50.921077503 -0700
+++ b/drivers/net/s2io.h	2011-06-07 17:43:59.478607560 -0700
@@ -871,7 +871,7 @@ struct s2io_nic {
 
 	struct mac_addr def_mac_addr[256];
 
-	struct net_device_stats stats;
+	struct rtnl_link_stats64 stats;
 	int high_dma_flag;
 	int device_enabled_once;
 



  parent reply	other threads:[~2011-06-09  1:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
2011-06-09  0:53 ` [PATCH 1/9] vmxnet3: convert to 64 bit stats interface Stephen Hemminger
2011-06-09  5:17   ` [Pv-drivers] " Scott Goldman
2011-06-09  0:53 ` [PATCH 2/9] xen: " Stephen Hemminger
2011-06-09  1:56   ` Ben Hutchings
2011-06-14 21:07     ` Konrad Rzeszutek Wilk
2011-06-15  8:38       ` [Xen-devel] " Ian Campbell
2011-06-09  0:53 ` [PATCH 3/9] veth: convert to 64 bit statistics Stephen Hemminger
2011-06-09  2:00   ` Ben Hutchings
2011-06-09  3:22     ` Stephen Hemminger
2011-06-10 16:34       ` Ben Hutchings
2011-06-09  6:26   ` David Miller
2011-06-09  0:54 ` [PATCH 4/9] ifb: convert to 64 bit stats Stephen Hemminger
2011-06-09  3:29   ` Eric Dumazet
2011-06-09  3:32     ` Stephen Hemminger
2011-06-09  3:37       ` Eric Dumazet
2011-06-09  0:54 ` [PATCH 5/9] netxen: convert to 64 bit statistics Stephen Hemminger
2011-06-09  6:13   ` Amit Salecha
2011-06-09  6:27   ` David Miller
2011-06-09  0:54 ` [PATCH 6/9] enic: update to support 64 bit stats Stephen Hemminger
2011-06-09  6:27   ` David Miller
2011-06-09 17:43   ` roprabhu
2011-06-09  0:54 ` [PATCH 7/9] myricom: update to " Stephen Hemminger
2011-06-09  6:27   ` David Miller
2011-06-09  0:54 ` [PATCH 8/9] niu: support 64 bit stats interface Stephen Hemminger
2011-06-09  6:27   ` David Miller
2011-06-09  0:54 ` Stephen Hemminger [this message]
2011-06-09  1:52   ` [PATCH 9/9] s2io: implement 64 bit stats Ben Hutchings

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=20110609005417.817071451@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=jdmason@kudzu.us \
    --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).