netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [patch 24/45] lanstreamer: convert to internal network stats
Date: Fri, 09 Jan 2009 15:01:21 -0800	[thread overview]
Message-ID: <20090109230138.483767420@linux-foundation.org> (raw)
In-Reply-To: 20090109230057.575650817@linux-foundation.org

[-- Attachment #1: tr-lanstream-stats.patch --]
[-- Type: text/plain, Size: 3732 bytes --]

Use internal network_device_stats to keep track of statistics.

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


---
 drivers/net/tokenring/lanstreamer.c |   17 +++++------------
 drivers/net/tokenring/lanstreamer.h |    1 -
 2 files changed, 5 insertions(+), 13 deletions(-)

--- a/drivers/net/tokenring/lanstreamer.c	2009-01-09 10:03:58.000000000 -0800
+++ b/drivers/net/tokenring/lanstreamer.c	2009-01-09 10:06:09.000000000 -0800
@@ -207,7 +207,6 @@ static int streamer_xmit(struct sk_buff 
 static int streamer_close(struct net_device *dev);
 static void streamer_set_rx_mode(struct net_device *dev);
 static irqreturn_t streamer_interrupt(int irq, void *dev_id);
-static struct net_device_stats *streamer_get_stats(struct net_device *dev);
 static int streamer_set_mac_address(struct net_device *dev, void *addr);
 static void streamer_arb_cmd(struct net_device *dev);
 static int streamer_change_mtu(struct net_device *dev, int mtu);
@@ -331,7 +330,6 @@ static int __devinit streamer_init_one(s
 	dev->do_ioctl = NULL;
 #endif
 	dev->set_multicast_list = &streamer_set_rx_mode;
-	dev->get_stats = &streamer_get_stats;
 	dev->set_mac_address = &streamer_set_mac_address;
 	dev->irq = pdev->irq;
 	dev->base_addr=pio_start;
@@ -937,7 +935,7 @@ static void streamer_rx(struct net_devic
 			if (skb == NULL) 
 			{
 				printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n",	dev->name);
-				streamer_priv->streamer_stats.rx_dropped++;
+				dev->stats.rx_dropped++;
 			} else {	/* we allocated an skb OK */
 				if (buffer_cnt == 1) {
 					/* release the DMA mapping */
@@ -1009,8 +1007,8 @@ static void streamer_rx(struct net_devic
 					/* send up to the protocol */
 					netif_rx(skb);
 				}
-				streamer_priv->streamer_stats.rx_packets++;
-				streamer_priv->streamer_stats.rx_bytes += length;
+				dev->stats.rx_packets++;
+				dev->stats.rx_bytes += length;
 			}	/* if skb == null */
 		}		/* end received without errors */
 
@@ -1053,8 +1051,8 @@ static irqreturn_t streamer_interrupt(in
 				while(streamer_priv->streamer_tx_ring[(streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1)].status) {
 				streamer_priv->tx_ring_last_status = (streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1);
 				streamer_priv->free_tx_ring_entries++;
-				streamer_priv->streamer_stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
-				streamer_priv->streamer_stats.tx_packets++;
+				dev->stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
+				dev->stats.tx_packets++;
 				dev_kfree_skb_irq(streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]);
 				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer = 0xdeadbeef;
 				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].status = 0;
@@ -1484,13 +1482,6 @@ static void streamer_srb_bh(struct net_d
 	}			/* switch srb[0] */
 }
 
-static struct net_device_stats *streamer_get_stats(struct net_device *dev)
-{
-	struct streamer_private *streamer_priv;
-	streamer_priv = netdev_priv(dev);
-	return (struct net_device_stats *) &streamer_priv->streamer_stats;
-}
-
 static int streamer_set_mac_address(struct net_device *dev, void *addr)
 {
 	struct sockaddr *saddr = addr;
--- a/drivers/net/tokenring/lanstreamer.h	2009-01-09 10:03:58.000000000 -0800
+++ b/drivers/net/tokenring/lanstreamer.h	2009-01-09 10:04:58.000000000 -0800
@@ -299,7 +299,6 @@ struct streamer_private {
 	int tx_ring_free, tx_ring_last_status, rx_ring_last_received,
 	    free_tx_ring_entries;
 
-	struct net_device_stats streamer_stats;
 	__u16 streamer_lan_status;
 	__u8 streamer_ring_speed;
 	__u16 pkt_buf_sz;



  parent reply	other threads:[~2009-01-09 23:17 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
2009-01-09 23:00 ` [patch 01/45] atm: br2684 internal stats Stephen Hemminger
2009-01-09 23:00 ` [patch 02/45] br2684: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 03/45] clip: convert to internal network_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 04/45] lec: " Stephen Hemminger
2009-01-09 23:01 ` [patch 05/45] lec: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 06/45] netrom: convert to internal net_device_stats Stephen Hemminger
2009-01-10 12:54   ` Ralf Baechle DL5RB
2009-01-11  8:15     ` David Miller
2009-01-09 23:01 ` [patch 07/45] netrom: convert to net_device_ops Stephen Hemminger
2009-01-10 12:55   ` Ralf Baechle DL5RB
2009-01-09 23:01 ` [patch 08/45] rose: convert to internal net_device_stats Stephen Hemminger
2009-01-10 12:55   ` Ralf Baechle DL5RB
2009-01-09 23:01 ` [patch 09/45] rose: convert to network_device_ops Stephen Hemminger
2009-01-10 12:55   ` Ralf Baechle DL5RB
2009-01-09 23:01 ` [patch 10/45] appletalk: remove unneeded stubs Stephen Hemminger
2009-01-09 23:01 ` [patch 11/45] arcnet: convert to internal stats Stephen Hemminger
2009-01-09 23:01 ` [patch 12/45] arcnet: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 13/45] com20020: convert to net_devic_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 14/45] 3c501: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 15/45] 3c505: " Stephen Hemminger
2009-01-09 23:01 ` [patch 16/45] 3c507: " Stephen Hemminger
2009-01-09 23:01 ` [patch 17/45] 3c509: " Stephen Hemminger
2009-01-09 23:01 ` [patch 18/45] 3c515: " Stephen Hemminger
2009-01-09 23:01 ` [patch 19/45] 3c523: " Stephen Hemminger
2009-01-09 23:01 ` [patch 20/45] 3c527: " Stephen Hemminger
2009-01-09 23:01 ` [patch 21/45] 3c59x: " Stephen Hemminger
2009-01-09 23:01 ` [patch 22/45] ibmtr: convert to internal network_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 23/45] ibmtr: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` Stephen Hemminger [this message]
2009-01-09 23:01 ` [patch 25/45] lanstreamer: " Stephen Hemminger
2009-01-09 23:01 ` [patch 26/45] olympic: convert to internal network device stats Stephen Hemminger
2009-01-09 23:01 ` [patch 27/45] olympic: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 28/45] tms380tr: " Stephen Hemminger
2009-01-09 23:01 ` [patch 29/45] 3c559: " Stephen Hemminger
2009-01-09 23:01 ` [patch 30/45] znet: " Stephen Hemminger
2009-01-09 23:01 ` [patch 31/45] 6pack: " Stephen Hemminger
2009-01-09 23:01 ` [patch 32/45] baycom: convert to internal net_device_stats Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 33/45] baycom: convert to net_device_ops Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 34/45] bpqether: convert to internal net_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 35/45] bpqether: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 36/45] dmascc: convert to internal network device stats Stephen Hemminger
2009-01-09 23:01 ` [patch 37/45] dmascc: convert to network_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 38/45] hdlcdrv: convert to internal net_device_stats Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 39/45] hdlcdrv: convert to net_device_ops Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 40/45] yam: convert to internal net_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 41/45] yam: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 42/45] scc: convert to internal net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 43/45] mkiss: convert to internal network device stats Stephen Hemminger
2009-01-09 23:01 ` [patch 44/45] dmascc: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 45/45] dmascc: convert to internal net_device_ops Stephen Hemminger
2009-01-10  1:32 ` [patch 00/45] Another batch of network device conversions David Miller

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=20090109230138.483767420@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=davem@davemloft.net \
    --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).