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

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

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

--- a/drivers/net/hamradio/mkiss.c	2009-01-09 10:16:50.000000000 -0800
+++ b/drivers/net/hamradio/mkiss.c	2009-01-09 12:57:32.000000000 -0800
@@ -59,8 +59,6 @@ struct mkiss {
 	unsigned char		*xhead;	/* pointer to next byte to XMIT */
 	int			xleft;	/* bytes left in XMIT queue     */
 
-	struct net_device_stats	stats;
-
 	/* Detailed SLIP statistics. */
 	int		mtu;		/* Our mtu (to spot changes!)   */
 	int		buffsize;	/* Max buffers sizes            */
@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax)
 	if (ax->rbuff[0] > 0x0f) {
 		if (ax->rbuff[0] & 0x80) {
 			if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
-				ax->stats.rx_errors++;
+				ax->dev->stats.rx_errors++;
 				spin_unlock_bh(&ax->buflock);
 
 				return;
@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax)
 			*ax->rbuff &= ~0x80;
 		} else if (ax->rbuff[0] & 0x20)  {
 			if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
-				ax->stats.rx_errors++;
+				ax->dev->stats.rx_errors++;
 				spin_unlock_bh(&ax->buflock);
 				return;
 			}
@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax)
 	if ((skb = dev_alloc_skb(count)) == NULL) {
 		printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
 		       ax->dev->name);
-		ax->stats.rx_dropped++;
+		ax->dev->stats.rx_dropped++;
 		spin_unlock_bh(&ax->buflock);
 		return;
 	}
@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax)
 	memcpy(skb_put(skb,count), ax->rbuff, count);
 	skb->protocol = ax25_type_trans(skb, ax->dev);
 	netif_rx(skb);
-	ax->stats.rx_packets++;
-	ax->stats.rx_bytes += count;
+	ax->dev->stats.rx_packets++;
+	ax->dev->stats.rx_bytes += count;
 	spin_unlock_bh(&ax->buflock);
 }
 
@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax,
 			return;
 		}
 
-		ax->stats.rx_over_errors++;
+		ax->dev->stats.rx_over_errors++;
 		set_bit(AXF_ERROR, &ax->flags);
 	}
 	spin_unlock_bh(&ax->buflock);
@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *
 			memcpy(ax->xbuff, ax->xhead, ax->xleft);
 		} else  {
 			ax->xleft = 0;
-			ax->stats.tx_dropped++;
+			dev->stats.tx_dropped++;
 		}
 	}
 
@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *
 			memcpy(ax->rbuff, orbuff, ax->rcount);
 		} else  {
 			ax->rcount = 0;
-			ax->stats.rx_over_errors++;
+			dev->stats.rx_over_errors++;
 			set_bit(AXF_ERROR, &ax->flags);
 		}
 	}
@@ -444,7 +442,7 @@ static void ax_encaps(struct net_device 
 	if (len > ax->mtu) {		/* Sigh, shouldn't occur BUT ... */
 		len = ax->mtu;
 		printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name);
-		ax->stats.tx_dropped++;
+		dev->stats.tx_dropped++;
 		netif_start_queue(dev);
 		return;
 	}
@@ -518,8 +516,8 @@ static void ax_encaps(struct net_device 
 
 	set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
 	actual = ax->tty->ops->write(ax->tty, ax->xbuff, count);
-	ax->stats.tx_packets++;
-	ax->stats.tx_bytes += actual;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += actual;
 
 	ax->dev->trans_start = jiffies;
 	ax->xleft = count - actual;
@@ -664,13 +662,6 @@ static int ax_close(struct net_device *d
 	return 0;
 }
 
-static struct net_device_stats *ax_get_stats(struct net_device *dev)
-{
-	struct mkiss *ax = netdev_priv(dev);
-
-	return &ax->stats;
-}
-
 static const struct header_ops ax_header_ops = {
 	.create    = ax_header,
 	.rebuild   = ax_rebuild_header,
@@ -683,7 +674,6 @@ static void ax_setup(struct net_device *
 	dev->hard_start_xmit = ax_xmit;
 	dev->open            = ax_open_dev;
 	dev->stop            = ax_close;
-	dev->get_stats	     = ax_get_stats;
 	dev->set_mac_address = ax_set_mac_address;
 	dev->hard_header_len = 0;
 	dev->addr_len        = 0;
@@ -929,7 +919,7 @@ static void mkiss_receive_buf(struct tty
 	while (count--) {
 		if (fp != NULL && *fp++) {
 			if (!test_and_set_bit(AXF_ERROR, &ax->flags))
-				ax->stats.rx_errors++;
+				ax->dev->stats.rx_errors++;
 			cp++;
 			continue;
 		}



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

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090109230057.575650817@linux-foundation.org>
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 31/45] 6pack: convert to net_device_ops 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 ` Stephen Hemminger [this message]
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

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=20090109230139.928206029@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-hams@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.