[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
[safe/jmp/linux-2.6] / drivers / net / seeq8005.c
index 4bce7c4..8ef9402 100644 (file)
@@ -67,7 +67,6 @@ static unsigned int net_debug = NET_DEBUG;
 
 /* Information that need to be kept for each board. */
 struct net_local {
-       struct net_device_stats stats;
        unsigned short receive_ptr;             /* What address in packet memory do we expect a recv_pkt_header? */
        long open_time;                         /* Useless example local info. */
 };
@@ -86,7 +85,6 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t seeq8005_interrupt(int irq, void *dev_id);
 static void seeq8005_rx(struct net_device *dev);
 static int seeq8005_close(struct net_device *dev);
-static struct net_device_stats *seeq8005_get_stats(struct net_device *dev);
 static void set_multicast_list(struct net_device *dev);
 
 /* Example routines you must write ;->. */
@@ -338,7 +336,6 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
        dev->hard_start_xmit    = seeq8005_send_packet;
        dev->tx_timeout         = seeq8005_timeout;
        dev->watchdog_timeo     = HZ/20;
-       dev->get_stats          = seeq8005_get_stats;
        dev->set_multicast_list = set_multicast_list;
        dev->flags &= ~IFF_MULTICAST;
 
@@ -391,7 +388,6 @@ static void seeq8005_timeout(struct net_device *dev)
 
 static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
 {
-       struct net_local *lp = netdev_priv(dev);
        short length = skb->len;
        unsigned char *buf;
 
@@ -407,7 +403,7 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
 
        hardware_send_packet(dev, buf, length);
        dev->trans_start = jiffies;
-       lp->stats.tx_bytes += length;
+       dev->stats.tx_bytes += length;
        dev_kfree_skb (skb);
        /* You might need to clean up and record Tx statistics here. */
 
@@ -463,7 +459,7 @@ static irqreturn_t seeq8005_interrupt(int irq, void *dev_id)
                if (status & SEEQSTAT_TX_INT) {
                        handled = 1;
                        outw( SEEQCMD_TX_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
-                       lp->stats.tx_packets++;
+                       dev->stats.tx_packets++;
                        netif_wake_queue(dev);  /* Inform upper layers. */
                }
                if (status & SEEQSTAT_RX_INT) {
@@ -531,11 +527,11 @@ static void seeq8005_rx(struct net_device *dev)
                }
 
                if (pkt_hdr & SEEQPKTS_ANY_ERROR) {                             /* There was an error. */
-                       lp->stats.rx_errors++;
-                       if (pkt_hdr & SEEQPKTS_SHORT) lp->stats.rx_frame_errors++;
-                       if (pkt_hdr & SEEQPKTS_DRIB) lp->stats.rx_frame_errors++;
-                       if (pkt_hdr & SEEQPKTS_OVERSIZE) lp->stats.rx_over_errors++;
-                       if (pkt_hdr & SEEQPKTS_CRC_ERR) lp->stats.rx_crc_errors++;
+                       dev->stats.rx_errors++;
+                       if (pkt_hdr & SEEQPKTS_SHORT) dev->stats.rx_frame_errors++;
+                       if (pkt_hdr & SEEQPKTS_DRIB) dev->stats.rx_frame_errors++;
+                       if (pkt_hdr & SEEQPKTS_OVERSIZE) dev->stats.rx_over_errors++;
+                       if (pkt_hdr & SEEQPKTS_CRC_ERR) dev->stats.rx_crc_errors++;
                        /* skip over this packet */
                        outw( SEEQCMD_FIFO_WRITE | SEEQCMD_DMA_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
                        outw( (lp->receive_ptr & 0xff00)>>8, SEEQ_REA);
@@ -547,7 +543,7 @@ static void seeq8005_rx(struct net_device *dev)
                        skb = dev_alloc_skb(pkt_len);
                        if (skb == NULL) {
                                printk("%s: Memory squeeze, dropping packet.\n", dev->name);
-                               lp->stats.rx_dropped++;
+                               dev->stats.rx_dropped++;
                                break;
                        }
                        skb_reserve(skb, 2);    /* align data on 16 byte */
@@ -567,8 +563,8 @@ static void seeq8005_rx(struct net_device *dev)
                        skb->protocol=eth_type_trans(skb,dev);
                        netif_rx(skb);
                        dev->last_rx = jiffies;
-                       lp->stats.rx_packets++;
-                       lp->stats.rx_bytes += pkt_len;
+                       dev->stats.rx_packets++;
+                       dev->stats.rx_bytes += pkt_len;
                }
        } while ((--boguscount) && (pkt_hdr & SEEQPKTH_CHAIN));
 
@@ -599,15 +595,6 @@ static int seeq8005_close(struct net_device *dev)
 
 }
 
-/* Get the current statistics. This may be called with the card open or
-   closed. */
-static struct net_device_stats *seeq8005_get_stats(struct net_device *dev)
-{
-       struct net_local *lp = netdev_priv(dev);
-
-       return &lp->stats;
-}
-
 /* Set or clear the multicast filter for this adaptor.
    num_addrs == -1     Promiscuous mode, receive all packets
    num_addrs == 0      Normal mode, clear multicast list