linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-net@vger.kernel.org,
	Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Subject: [patch 02/29] ariadne: use netstats in net_device structure
Date: Thu, 17 Jul 2008 21:16:09 +0200	[thread overview]
Message-ID: <20080717191749.977933994@mail.of.borg> (raw)
In-Reply-To: 20080717191607.955742542@mail.of.borg

[-- Attachment #1: m68k-ariadne-use-netstats-in-net_device-structure.diff --]
[-- Type: text/plain, Size: 5746 bytes --]

From: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>

Use net_device_stats from net_device structure instead of local.

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/net/ariadne.c |   47 ++++++++++++++++++++++-------------------------
 1 file changed, 22 insertions(+), 25 deletions(-)

--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -98,7 +98,6 @@ struct ariadne_private {
     volatile u_short *rx_buff[RX_RING_SIZE];
     int cur_tx, cur_rx;			/* The next free ring entry */
     int dirty_tx;			/* The ring entries to be free()ed. */
-    struct net_device_stats stats;
     char tx_full;
 };
 
@@ -378,20 +377,19 @@ static void ariadne_init_ring(struct net
 
 static int ariadne_close(struct net_device *dev)
 {
-    struct ariadne_private *priv = netdev_priv(dev);
     volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
 
     netif_stop_queue(dev);
 
     lance->RAP = CSR112;	/* Missed Frame Count */
-    priv->stats.rx_missed_errors = swapw(lance->RDP);
+    dev->stats.rx_missed_errors = swapw(lance->RDP);
     lance->RAP = CSR0;		/* PCnet-ISA Controller Status */
 
     if (ariadne_debug > 1) {
 	printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n",
 	       dev->name, lance->RDP);
 	printk(KERN_DEBUG "%s: %lu packets missed\n", dev->name,
-	       priv->stats.rx_missed_errors);
+	       dev->stats.rx_missed_errors);
     }
 
     /* We stop the LANCE here -- it occasionally polls memory if we don't. */
@@ -502,16 +500,16 @@ static irqreturn_t ariadne_interrupt(int
 		if (status & TF_ERR) {
 		    /* There was an major error, log it. */
 		    int err_status = priv->tx_ring[entry]->TMD3;
-		    priv->stats.tx_errors++;
+		    dev->stats.tx_errors++;
 		    if (err_status & EF_RTRY)
-			priv->stats.tx_aborted_errors++;
+			dev->stats.tx_aborted_errors++;
 		    if (err_status & EF_LCAR)
-			priv->stats.tx_carrier_errors++;
+			dev->stats.tx_carrier_errors++;
 		    if (err_status & EF_LCOL)
-			priv->stats.tx_window_errors++;
+			dev->stats.tx_window_errors++;
 		    if (err_status & EF_UFLO) {
 			/* Ackk!  On FIFO errors the Tx unit is turned off! */
-			priv->stats.tx_fifo_errors++;
+			dev->stats.tx_fifo_errors++;
 			/* Remove this verbosity later! */
 			printk(KERN_ERR "%s: Tx FIFO error! Status %4.4x.\n",
 			       dev->name, csr0);
@@ -520,8 +518,8 @@ static irqreturn_t ariadne_interrupt(int
 		    }
 		} else {
 		    if (status & (TF_MORE|TF_ONE))
-			priv->stats.collisions++;
-		    priv->stats.tx_packets++;
+			dev->stats.collisions++;
+		    dev->stats.tx_packets++;
 		}
 		dirty_tx++;
 	    }
@@ -547,11 +545,11 @@ static irqreturn_t ariadne_interrupt(int
 	/* Log misc errors. */
 	if (csr0 & BABL) {
 	    handled = 1;
-	    priv->stats.tx_errors++;	/* Tx babble. */
+	    dev->stats.tx_errors++;	/* Tx babble. */
 	}
 	if (csr0 & MISS) {
 	    handled = 1;
-	    priv->stats.rx_errors++;	/* Missed a Rx frame. */
+	    dev->stats.rx_errors++;	/* Missed a Rx frame. */
 	}
 	if (csr0 & MERR) {
 	    handled = 1;
@@ -672,7 +670,7 @@ static int ariadne_start_xmit(struct sk_
 	priv->cur_tx -= TX_RING_SIZE;
 	priv->dirty_tx -= TX_RING_SIZE;
     }
-    priv->stats.tx_bytes += len;
+    dev->stats.tx_bytes += len;
 
     /* Trigger an immediate send poll. */
     lance->RAP = CSR0;		/* PCnet-ISA Controller Status */
@@ -707,15 +705,15 @@ static int ariadne_rx(struct net_device 
 		buffers, with only the last correctly noting the error. */
 	    if (status & RF_ENP)
 		/* Only count a general error at the end of a packet.*/
-		priv->stats.rx_errors++;
+		dev->stats.rx_errors++;
 	    if (status & RF_FRAM)
-		priv->stats.rx_frame_errors++;
+		dev->stats.rx_frame_errors++;
 	    if (status & RF_OFLO)
-		priv->stats.rx_over_errors++;
+		dev->stats.rx_over_errors++;
 	    if (status & RF_CRC)
-		priv->stats.rx_crc_errors++;
+		dev->stats.rx_crc_errors++;
 	    if (status & RF_BUFF)
-		priv->stats.rx_fifo_errors++;
+		dev->stats.rx_fifo_errors++;
 	    priv->rx_ring[entry]->RMD1 &= 0xff00|RF_STP|RF_ENP;
 	} else {
 	    /* Malloc up new buffer, compatible with net-3. */
@@ -731,7 +729,7 @@ static int ariadne_rx(struct net_device 
 			break;
 
 		if (i > RX_RING_SIZE-2) {
-		    priv->stats.rx_dropped++;
+		    dev->stats.rx_dropped++;
 		    priv->rx_ring[entry]->RMD1 |= RF_OWN;
 		    priv->cur_rx++;
 		}
@@ -764,8 +762,8 @@ static int ariadne_rx(struct net_device 
 
 	    netif_rx(skb);
 	    dev->last_rx = jiffies;
-	    priv->stats.rx_packets++;
-	    priv->stats.rx_bytes += pkt_len;
+	    dev->stats.rx_packets++;
+	    dev->stats.rx_bytes += pkt_len;
 	}
 
 	priv->rx_ring[entry]->RMD1 |= RF_OWN;
@@ -783,7 +781,6 @@ static int ariadne_rx(struct net_device 
 
 static struct net_device_stats *ariadne_get_stats(struct net_device *dev)
 {
-    struct ariadne_private *priv = netdev_priv(dev);
     volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
     short saved_addr;
     unsigned long flags;
@@ -791,11 +788,11 @@ static struct net_device_stats *ariadne_
     local_irq_save(flags);
     saved_addr = lance->RAP;
     lance->RAP = CSR112;		/* Missed Frame Count */
-    priv->stats.rx_missed_errors = swapw(lance->RDP);
+    dev->stats.rx_missed_errors = swapw(lance->RDP);
     lance->RAP = saved_addr;
     local_irq_restore(flags);
 
-    return &priv->stats;
+    return &dev->stats;
 }
 
 

-- 
Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


  parent reply	other threads:[~2008-07-17 19:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-17 19:16 [patch 00/29] m68k patches for 2.6.27 Geert Uytterhoeven
2008-07-17 19:16 ` [patch 01/29] m68k: remove CVS keywords Geert Uytterhoeven
2008-07-17 19:16 ` Geert Uytterhoeven [this message]
2008-07-17 19:45   ` [patch 02/29] ariadne: use netstats in net_device structure Jeff Garzik
2008-07-17 19:16 ` [patch 03/29] m68k: Return -ENODEV if no device is found Geert Uytterhoeven
2008-07-17 19:16 ` [patch 04/29] m68k: vmlinux-std/sun3.lds.S cleanup - use PAGE_SIZE macro Geert Uytterhoeven
2008-07-17 19:16 ` [patch 05/29] m68k: Allow no CPU/platform type for allnoconfig Geert Uytterhoeven
2008-07-17 19:16 ` [patch 06/29] m68k: remove -traditional Geert Uytterhoeven
2008-07-17 19:16 ` [patch 07/29] m68k: make multi_defconfig the default defconfig Geert Uytterhoeven
2008-07-17 19:16 ` [patch 08/29] m68k: remove AP1000 code Geert Uytterhoeven
2008-07-17 19:16 ` [patch 09/29] ZORRO: Replace deprecated __initcall with equivalent device_initcall Geert Uytterhoeven
2008-07-17 19:16 ` [patch 10/29] zorro: use memory_read_from_buffer Geert Uytterhoeven
2008-07-17 19:16 ` [patch 11/29] amifb: Register Amiga-specific video modes with sysfs Geert Uytterhoeven
2008-07-17 19:16 ` [patch 12/29] atafb: Register Atari-specific " Geert Uytterhoeven
2008-07-17 19:16 ` [patch 13/29] drivers/video/c2p.c: add MODULE_LICENSE Geert Uytterhoeven
2008-07-17 19:16 ` [patch 14/29] export amiga_vblank Geert Uytterhoeven
2008-07-17 19:16 ` [patch 15/29] export c2p Geert Uytterhoeven
2008-07-17 19:16 ` [patch 16/29] m68k/amiga/: possible cleanups Geert Uytterhoeven
2008-07-17 19:16 ` [patch 17/29] m68k/atari/debug.c: " Geert Uytterhoeven
2008-07-20 20:06   ` Michael Schmitz
2008-07-21  0:11     ` Geert Uytterhoeven
2008-07-17 19:16 ` [patch 18/29] m68k/mac/: " Geert Uytterhoeven
2008-07-17 19:16 ` [patch 19/29] m68k/q40/config.c: make functions static Geert Uytterhoeven
2008-07-17 19:16 ` [patch 20/29] m68k/sun3/: possible cleanups Geert Uytterhoeven
2008-07-17 19:16 ` [patch 21/29] m68k: remove stale ARCH_SUN4 #define Geert Uytterhoeven
2008-07-17 19:16 ` [patch 22/29] m68k/apollo: Add missing call to apollo_parse_bootinfo() Geert Uytterhoeven
2008-07-17 19:16 ` [patch 23/29] m68k/Mac: remove the unused ADB_KEYBOARD option Geert Uytterhoeven
2008-07-17 19:16 ` [patch 24/29] m68k/Atari: remove the dead ATARI_SCC{,_DMA} options Geert Uytterhoeven
2008-07-17 19:16 ` [patch 25/29] m68k/Apollo: remove the unused APOLLO_ELPLUS option Geert Uytterhoeven
2008-07-17 19:16 ` [patch 26/29] arch/m68k/mm/motorola.c: Eliminate NULL test and memset after alloc_bootmem Geert Uytterhoeven
2008-07-17 19:16 ` [patch 27/29] arch/m68k/mm/sun3mmu.c: " Geert Uytterhoeven
2008-07-17 19:16 ` [patch 28/29] dio: use dio_match_device() in dio_bus_match() Geert Uytterhoeven
2008-07-17 19:16 ` [patch 29/29] initrd: Fix virtual/physical mix-up in overwrite test Geert Uytterhoeven
2008-07-24 15:35   ` Atsushi Nemoto
2008-07-24 18:49     ` Geert Uytterhoeven
2008-07-25 16:27       ` Atsushi Nemoto
2008-07-25 19:22         ` Geert Uytterhoeven
2008-07-26 14:46           ` Atsushi Nemoto

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=20080717191749.977933994@mail.of.borg \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    --cc=paulius.zaleckas@teltonika.lt \
    --cc=torvalds@linux-foundation.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).