]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/sgiseeq.c
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
[karo-tx-linux.git] / drivers / net / sgiseeq.c
index eb67b024e4138de64565fd75f190ebfbd7031bce..5189ef066884073f678d3c9e39cb621d48213c0e 100644 (file)
@@ -93,8 +93,6 @@ struct sgiseeq_private {
        unsigned char control;
        unsigned char mode;
 
-       struct net_device_stats stats;
-
        spinlock_t tx_lock;
 };
 
@@ -267,18 +265,17 @@ static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp,
        return 0;
 }
 
-static inline void record_rx_errors(struct sgiseeq_private *sp,
-                                   unsigned char status)
+static void record_rx_errors(struct net_device *dev, unsigned char status)
 {
        if (status & SEEQ_RSTAT_OVERF ||
            status & SEEQ_RSTAT_SFRAME)
-               sp->stats.rx_over_errors++;
+               dev->stats.rx_over_errors++;
        if (status & SEEQ_RSTAT_CERROR)
-               sp->stats.rx_crc_errors++;
+               dev->stats.rx_crc_errors++;
        if (status & SEEQ_RSTAT_DERROR)
-               sp->stats.rx_frame_errors++;
+               dev->stats.rx_frame_errors++;
        if (status & SEEQ_RSTAT_REOF)
-               sp->stats.rx_errors++;
+               dev->stats.rx_errors++;
 }
 
 static inline void rx_maybe_restart(struct sgiseeq_private *sp,
@@ -328,8 +325,8 @@ static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp
                                if (memcmp(eth_hdr(skb)->h_source, dev->dev_addr, ETH_ALEN)) {
                                        netif_rx(skb);
                                        dev->last_rx = jiffies;
-                                       sp->stats.rx_packets++;
-                                       sp->stats.rx_bytes += len;
+                                       dev->stats.rx_packets++;
+                                       dev->stats.rx_bytes += len;
                                } else {
                                        /* Silently drop my own packets */
                                        dev_kfree_skb_irq(skb);
@@ -337,10 +334,10 @@ static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp
                        } else {
                                printk (KERN_NOTICE "%s: Memory squeeze, deferring packet.\n",
                                        dev->name);
-                               sp->stats.rx_dropped++;
+                               dev->stats.rx_dropped++;
                        }
                } else {
-                       record_rx_errors(sp, pkt_status);
+                       record_rx_errors(dev, pkt_status);
                }
 
                /* Return the entry to the ring pool. */
@@ -392,11 +389,11 @@ static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp
        if (!(status & (HPC3_ETXCTRL_ACTIVE | SEEQ_TSTAT_PTRANS))) {
                /* Oops, HPC detected some sort of error. */
                if (status & SEEQ_TSTAT_R16)
-                       sp->stats.tx_aborted_errors++;
+                       dev->stats.tx_aborted_errors++;
                if (status & SEEQ_TSTAT_UFLOW)
-                       sp->stats.tx_fifo_errors++;
+                       dev->stats.tx_fifo_errors++;
                if (status & SEEQ_TSTAT_LCLS)
-                       sp->stats.collisions++;
+                       dev->stats.collisions++;
        }
 
        /* Ack 'em... */
@@ -412,7 +409,7 @@ static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp
                        }
                        break;
                }
-               sp->stats.tx_packets++;
+               dev->stats.tx_packets++;
                sp->tx_old = NEXT_TX(sp->tx_old);
                td->tdma.cntinfo &= ~(HPCDMA_XIU | HPCDMA_XIE);
                td->tdma.cntinfo |= HPCDMA_EOX;
@@ -516,7 +513,7 @@ static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
        /* Setup... */
        skblen = skb->len;
        len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen;
-       sp->stats.tx_bytes += len;
+       dev->stats.tx_bytes += len;
        entry = sp->tx_new;
        td = &sp->tx_desc[entry];
 
@@ -569,13 +566,6 @@ static void timeout(struct net_device *dev)
        netif_wake_queue(dev);
 }
 
-static struct net_device_stats *sgiseeq_get_stats(struct net_device *dev)
-{
-       struct sgiseeq_private *sp = netdev_priv(dev);
-
-       return &sp->stats;
-}
-
 static void sgiseeq_set_multicast(struct net_device *dev)
 {
        struct sgiseeq_private *sp = (struct sgiseeq_private *) dev->priv;
@@ -694,7 +684,6 @@ static int __init sgiseeq_probe(struct platform_device *pdev)
        dev->hard_start_xmit    = sgiseeq_start_xmit;
        dev->tx_timeout         = timeout;
        dev->watchdog_timeo     = (200 * HZ) / 1000;
-       dev->get_stats          = sgiseeq_get_stats;
        dev->set_multicast_list = sgiseeq_set_multicast;
        dev->set_mac_address    = sgiseeq_set_mac_address;
        dev->irq                = irq;