linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: [PATCH 54/77] netwave: convert to internal net_device_stats
Date: Fri, 20 Mar 2009 22:36:21 -0700	[thread overview]
Message-ID: <20090321053716.656878050@vyatta.com> (raw)
In-Reply-To: 20090321053527.316395697@vyatta.com

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


--- a/drivers/net/wireless/netwave_cs.c	2009-03-20 21:45:41.100964205 -0700
+++ b/drivers/net/wireless/netwave_cs.c	2009-03-20 22:14:37.954403178 -0700
@@ -210,10 +210,6 @@ static int netwave_rx( struct net_device
 static irqreturn_t netwave_interrupt(int irq, void *dev_id);
 static void netwave_watchdog(struct net_device *);
 
-/* Statistics */
-static void update_stats(struct net_device *dev);
-static struct net_device_stats *netwave_get_stats(struct net_device *dev);
-
 /* Wireless extensions */
 static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev);
 
@@ -275,14 +271,9 @@ typedef struct netwave_private {
     int        lastExec;
     struct timer_list      watchdog;	/* To avoid blocking state */
     struct site_survey     nss;
-    struct net_device_stats stats;
     struct iw_statistics   iw_stats;    /* Wireless stats */
 } netwave_private;
 
-#ifdef NETWAVE_STATS
-static struct net_device_stats *netwave_get_stats(struct net_device *dev);
-#endif
-
 /*
  * The Netwave card is little-endian, so won't work for big endian
  * systems.
@@ -413,7 +404,6 @@ static int netwave_probe(struct pcmcia_d
 
     /* Netwave specific entries in the device structure */
     dev->hard_start_xmit = &netwave_start_xmit;
-    dev->get_stats  = &netwave_get_stats;
     dev->set_multicast_list = &set_multicast_list;
     /* wireless extensions */
     dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def;
@@ -988,7 +978,7 @@ static int netwave_hw_xmit(unsigned char
 	return 1;
     }
 
-    priv->stats.tx_bytes += len;
+    dev->stats.tx_bytes += len;
 
     DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n",
 	  readb(ramBase + NETWAVE_EREG_SPCQ),
@@ -1107,11 +1097,11 @@ static irqreturn_t netwave_interrupt(int
 	    rser = readb(ramBase + NETWAVE_EREG_RSER);			
 	    
 	    if (rser & 0x04) {
-		++priv->stats.rx_dropped; 
-		++priv->stats.rx_crc_errors;
+		++dev->stats.rx_dropped;
+		++dev->stats.rx_crc_errors;
 	    }
 	    if (rser & 0x02)
-		++priv->stats.rx_frame_errors;
+		++dev->stats.rx_frame_errors;
 			
 	    /* Clear the RxErr bit in RSER. RSER+4 is the
 	     * write part. Also clear the RxCRC (0x04) and 
@@ -1125,8 +1115,8 @@ static irqreturn_t netwave_interrupt(int
 	    wait_WOC(iobase);
 	    writeb(0x40, ramBase + NETWAVE_EREG_ASCC);
 
-	    /* Remember to count up priv->stats on error packets */
-	    ++priv->stats.rx_errors;
+	    /* Remember to count up dev->stats on error packets */
+	    ++dev->stats.rx_errors;
 	}
 	/* TxDN */
 	if (status & 0x20) {
@@ -1140,17 +1130,17 @@ static irqreturn_t netwave_interrupt(int
 		/* Transmitting was okay, clear bits */
 		wait_WOC(iobase);
 		writeb(0x2f, ramBase + NETWAVE_EREG_TSER + 4);
-		++priv->stats.tx_packets;
+		++dev->stats.tx_packets;
 	    }
 			
 	    if (txStatus & 0xd0) {
 		if (txStatus & 0x80) {
-		    ++priv->stats.collisions; /* Because of /proc/net/dev*/
-		    /* ++priv->stats.tx_aborted_errors; */
+		    ++dev->stats.collisions; /* Because of /proc/net/dev*/
+		    /* ++dev->stats.tx_aborted_errors; */
 		    /* printk("Collision. %ld\n", jiffies - dev->trans_start); */
 		}
 		if (txStatus & 0x40) 
-		    ++priv->stats.tx_carrier_errors;
+		    ++dev->stats.tx_carrier_errors;
 		/* 0x80 TxGU Transmit giveup - nine times and no luck
 		 * 0x40 TxNOAP No access point. Discarded packet.
 		 * 0x10 TxErr Transmit error. Always set when 
@@ -1163,7 +1153,7 @@ static irqreturn_t netwave_interrupt(int
 		/* Clear out TxGU, TxNOAP, TxErr and TxTrys */
 		wait_WOC(iobase);
 		writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4);
-		++priv->stats.tx_errors;
+		++dev->stats.tx_errors;
 	    }
 	    DEBUG(3, "New status is TSER %x ASR %x\n",
 		  readb(ramBase + NETWAVE_EREG_TSER),
@@ -1197,40 +1187,6 @@ static void netwave_watchdog(struct net_
     netif_wake_queue(dev);
 } /* netwave_watchdog */
 
-static struct net_device_stats *netwave_get_stats(struct net_device *dev) {
-    netwave_private *priv = netdev_priv(dev);
-
-    update_stats(dev);
-
-    DEBUG(2, "netwave: SPCQ %x SPU %x LIF %x ISPLQ %x MHS %x rxtx %x"
-	  " %x tx %x %x %x %x\n", 
-	  readb(priv->ramBase + NETWAVE_EREG_SPCQ),
-	  readb(priv->ramBase + NETWAVE_EREG_SPU),
-	  readb(priv->ramBase + NETWAVE_EREG_LIF),
-	  readb(priv->ramBase + NETWAVE_EREG_ISPLQ),
-	  readb(priv->ramBase + NETWAVE_EREG_MHS),
-	  readb(priv->ramBase + NETWAVE_EREG_EC + 0xe),
-	  readb(priv->ramBase + NETWAVE_EREG_EC + 0xf),
-	  readb(priv->ramBase + NETWAVE_EREG_EC + 0x18),
-	  readb(priv->ramBase + NETWAVE_EREG_EC + 0x19),
-	  readb(priv->ramBase + NETWAVE_EREG_EC + 0x1a),
-	  readb(priv->ramBase + NETWAVE_EREG_EC + 0x1b));
-
-    return &priv->stats;
-}
-
-static void update_stats(struct net_device *dev) {
-    //unsigned long flags;
-/*     netwave_private *priv = netdev_priv(dev); */
-
-    //spin_lock_irqsave(&priv->spinlock, flags);
-
-/*    priv->stats.rx_packets = readb(priv->ramBase + 0x18e); 
-    priv->stats.tx_packets = readb(priv->ramBase + 0x18f); */
-
-    //spin_unlock_irqrestore(&priv->spinlock, flags);
-}
-
 static int netwave_rx(struct net_device *dev)
 {
     netwave_private *priv = netdev_priv(dev);
@@ -1274,7 +1230,7 @@ static int netwave_rx(struct net_device 
 	if (skb == NULL) {
 	    DEBUG(1, "netwave_rx: Could not allocate an sk_buff of "
 		  "length %d\n", rcvLen);
-	    ++priv->stats.rx_dropped; 
+	    ++dev->stats.rx_dropped;
 	    /* Tell the adapter to skip the packet */
 	    wait_WOC(iobase);
 	    writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0);
@@ -1307,8 +1263,8 @@ static int netwave_rx(struct net_device 
 	/* Queue packet for network layer */
 	netif_rx(skb);
 
-	priv->stats.rx_packets++;
-	priv->stats.rx_bytes += rcvLen;
+	dev->stats.rx_packets++;
+	dev->stats.rx_bytes += rcvLen;
 
 	/* Got the packet, tell the adapter to skip it */
 	wait_WOC(iobase);

-- 


       reply	other threads:[~2009-03-21  5:48 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090321053527.316395697@vyatta.com>
2009-03-21  5:36 ` Stephen Hemminger [this message]
2009-03-22  5:47   ` [PATCH 54/77] netwave: convert to internal net_device_stats David Miller
2009-03-21  5:36 ` [PATCH 55/77] netwave: convert to net_device_ops Stephen Hemminger
2009-03-22  5:48   ` David Miller
2009-03-21  5:36 ` [PATCH 56/77] strip: " Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-21  5:36 ` [PATCH 57/77] wavelan: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-21  5:36 ` [PATCH 58/77] wavelan: convert to net_device_ops Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-21  5:36 ` [PATCH 59/77] airo: " Stephen Hemminger
2009-03-22  5:48   ` David Miller
2009-03-21  5:36 ` [PATCH 60/77] atmel: " Stephen Hemminger
2009-03-22  5:48   ` David Miller
2009-03-21  5:36 ` [PATCH 61/77] raylan: " Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 64/77] zd1201: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 65/77] zd1201: convert to net_device_ops Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 66/77] mac80211_hwsim: convert to internal net_device_stats Stephen Hemminger
2009-03-21 11:08   ` Johannes Berg
2009-03-22  5:49     ` David Miller
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 67/77] prism54: convert to net_device_ops Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 68/77] prism54: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 69/77] libertas: " Stephen Hemminger
2009-03-22  5:54   ` David Miller
2009-03-21  5:36 ` [PATCH 70/77] libertas: convert to net_device_ops Stephen Hemminger
2009-03-22  5:54   ` David Miller
2009-03-21  5:36 ` [PATCH 71/77] ipw2x00: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:56   ` David Miller
2009-03-21  5:36 ` [PATCH 72/77] ipw2x00: convert infrastructure for use by net_device_ops Stephen Hemminger
2009-03-22  5:56   ` David Miller
2009-03-21  5:36 ` [PATCH 73/77] ipw2100: convert to net_device_ops Stephen Hemminger
2009-03-22  5:57   ` David Miller
2009-03-21  5:36 ` [PATCH 74/77] ipw2200: " Stephen Hemminger
2009-03-22  5:57   ` David Miller
2009-03-21  5:36 ` [PATCH 75/77] hostap: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:57   ` David Miller
2009-03-21  5:36 ` [PATCH 76/77] hostap: convert to net_device_ops Stephen Hemminger
2009-03-22  5:57   ` 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=20090321053716.656878050@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=linux-wireless@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 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).