All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jeff Garzik <jgarzik@pobox.com>, Samuel Chessman <chessman@tux.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH 2/7] tlan: use netdevice stats
Date: Fri, 30 May 2008 09:49:53 -0700	[thread overview]
Message-ID: <20080530165033.520199120@vyatta.com> (raw)
In-Reply-To: 20080530164951.033143725@vyatta.com

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

Use new netdevice common stats area.

Compile tested only.

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


--- a/drivers/net/tlan.c	2008-05-30 08:47:37.000000000 -0700
+++ b/drivers/net/tlan.c	2008-05-30 08:49:51.000000000 -0700
@@ -1276,7 +1276,7 @@ static struct net_device_stats *TLan_Get
 			TLan_PrintList( priv->txList + i, "TX", i );
 	}
 
-	return ( &( (TLanPrivateInfo *) netdev_priv(dev) )->stats );
+	return &dev->stats;
 
 } /* TLan_GetStats */
 
@@ -1434,7 +1434,7 @@ static u32 TLan_HandleTxEOF( struct net_
 		if ( tmpCStat & TLAN_CSTAT_EOC )
 			eoc = 1;
 
-		priv->stats.tx_bytes += head_list->frameSize;
+		dev->stats.tx_bytes += head_list->frameSize;
 
 		head_list->cStat = TLAN_CSTAT_UNUSED;
 		netif_start_queue(dev);
@@ -1564,7 +1564,7 @@ static u32 TLan_HandleRxEOF( struct net_
 				skb_reserve(skb, 2);
 				t = (void *) skb_put(skb, frameSize);
 
-				priv->stats.rx_bytes += head_list->frameSize;
+				dev->stats.rx_bytes += head_list->frameSize;
 
 				memcpy( t, head_buffer, frameSize );
 				skb->protocol = eth_type_trans( skb, dev );
@@ -1586,7 +1586,7 @@ static u32 TLan_HandleRxEOF( struct net_
 				pci_unmap_single(priv->pciDev, head_list->buffer[0].address, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE);
 				skb_trim( skb, frameSize );
 
-				priv->stats.rx_bytes += frameSize;
+				dev->stats.rx_bytes += frameSize;
 
 				skb->protocol = eth_type_trans( skb, dev );
 				netif_rx( skb );
@@ -2142,7 +2142,6 @@ static void TLan_PrintList( TLanList *li
 
 static void TLan_ReadAndClearStats( struct net_device *dev, int record )
 {
-	TLanPrivateInfo	*priv = netdev_priv(dev);
 	u32		tx_good, tx_under;
 	u32		rx_good, rx_over;
 	u32		def_tx, crc, code;
@@ -2179,18 +2178,18 @@ static void TLan_ReadAndClearStats( stru
 	loss       = inb( dev->base_addr + TLAN_DIO_DATA + 2 );
 
 	if ( record ) {
-		priv->stats.rx_packets += rx_good;
-		priv->stats.rx_errors  += rx_over + crc + code;
-		priv->stats.tx_packets += tx_good;
-		priv->stats.tx_errors  += tx_under + loss;
-		priv->stats.collisions += multi_col + single_col + excess_col + late_col;
-
-		priv->stats.rx_over_errors    += rx_over;
-		priv->stats.rx_crc_errors     += crc;
-		priv->stats.rx_frame_errors   += code;
+		dev->stats.rx_packets += rx_good;
+		dev->stats.rx_errors  += rx_over + crc + code;
+		dev->stats.tx_packets += tx_good;
+		dev->stats.tx_errors  += tx_under + loss;
+		dev->stats.collisions += multi_col + single_col + excess_col + late_col;
+
+		dev->stats.rx_over_errors    += rx_over;
+		dev->stats.rx_crc_errors     += crc;
+		dev->stats.rx_frame_errors   += code;
 
-		priv->stats.tx_aborted_errors += tx_under;
-		priv->stats.tx_carrier_errors += loss;
+		dev->stats.tx_aborted_errors += tx_under;
+		dev->stats.tx_carrier_errors += loss;
 	}
 
 } /* TLan_ReadAndClearStats */
--- a/drivers/net/tlan.h	2008-05-30 08:46:59.000000000 -0700
+++ b/drivers/net/tlan.h	2008-05-30 08:47:09.000000000 -0700
@@ -194,7 +194,6 @@ typedef struct tlan_private_tag {
 	u32			timerSetAt;
 	u32			timerType;
 	struct timer_list	timer;
-	struct net_device_stats	stats;
 	struct board		*adapter;
 	u32			adapterRev;
 	u32			aui;

-- 


  parent reply	other threads:[~2008-05-30 16:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 16:49 [PATCH 0/7] TLAN driver cleanups Stephen Hemminger
2008-05-30 16:49 ` [PATCH 1/7] tlan: get rid of padding buffer Stephen Hemminger
2008-05-31  2:19   ` Jeff Garzik
2008-05-30 16:49 ` Stephen Hemminger [this message]
2008-05-30 16:49 ` [PATCH 3/7] tlan: remove unused devName field Stephen Hemminger
2008-05-30 16:49 ` [PATCH 4/7] tlan: 64bit conversion Stephen Hemminger
2008-05-30 16:49 ` [PATCH 5/7] tlan: manage rx allocation failure better Stephen Hemminger
2008-05-30 16:49 ` [PATCH 6/7] tlan: proper shared IRQ support Stephen Hemminger
2008-05-30 16:49 ` [PATCH 7/7] tlan: wrap source lines 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=20080530165033.520199120@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=chessman@tux.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 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.