aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/de620.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/de620.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (diff)
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device, and the default ->get_stats() hook does the obvious thing for us. Run through drivers/net/* and remove the driver-local storage of statistics, and driver-local ->get_stats() hook where applicable. This was just the low-hanging fruit in drivers/net; plenty more drivers remain to be updated. [ Resolved conflicts with napi_struct changes and fix sunqe build regression... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/de620.c')
-rw-r--r--drivers/net/de620.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/net/de620.c b/drivers/net/de620.c
index a92c207b8839..4b93902906ba 100644
--- a/drivers/net/de620.c
+++ b/drivers/net/de620.c
@@ -216,7 +216,6 @@ MODULE_PARM_DESC(de620_debug, "DE-620 debug level (0-2)");
216/* Put in the device structure. */ 216/* Put in the device structure. */
217static int de620_open(struct net_device *); 217static int de620_open(struct net_device *);
218static int de620_close(struct net_device *); 218static int de620_close(struct net_device *);
219static struct net_device_stats *get_stats(struct net_device *);
220static void de620_set_multicast_list(struct net_device *); 219static void de620_set_multicast_list(struct net_device *);
221static int de620_start_xmit(struct sk_buff *, struct net_device *); 220static int de620_start_xmit(struct sk_buff *, struct net_device *);
222 221
@@ -480,16 +479,6 @@ static int de620_close(struct net_device *dev)
480 479
481/********************************************* 480/*********************************************
482 * 481 *
483 * Return current statistics
484 *
485 */
486static struct net_device_stats *get_stats(struct net_device *dev)
487{
488 return (struct net_device_stats *)(dev->priv);
489}
490
491/*********************************************
492 *
493 * Set or clear the multicast filter for this adaptor. 482 * Set or clear the multicast filter for this adaptor.
494 * (no real multicast implemented for the DE-620, but she can be promiscuous...) 483 * (no real multicast implemented for the DE-620, but she can be promiscuous...)
495 * 484 *
@@ -579,7 +568,7 @@ static int de620_start_xmit(struct sk_buff *skb, struct net_device *dev)
579 if(!(using_txbuf == (TXBF0 | TXBF1))) 568 if(!(using_txbuf == (TXBF0 | TXBF1)))
580 netif_wake_queue(dev); 569 netif_wake_queue(dev);
581 570
582 ((struct net_device_stats *)(dev->priv))->tx_packets++; 571 dev->stats.tx_packets++;
583 spin_unlock_irqrestore(&de620_lock, flags); 572 spin_unlock_irqrestore(&de620_lock, flags);
584 dev_kfree_skb (skb); 573 dev_kfree_skb (skb);
585 return 0; 574 return 0;
@@ -660,7 +649,7 @@ static int de620_rx_intr(struct net_device *dev)
660 /* You win some, you lose some. And sometimes plenty... */ 649 /* You win some, you lose some. And sometimes plenty... */
661 adapter_init(dev); 650 adapter_init(dev);
662 netif_wake_queue(dev); 651 netif_wake_queue(dev);
663 ((struct net_device_stats *)(dev->priv))->rx_over_errors++; 652 dev->stats.rx_over_errors++;
664 return 0; 653 return 0;
665 } 654 }
666 655
@@ -680,7 +669,7 @@ static int de620_rx_intr(struct net_device *dev)
680 next_rx_page = header_buf.Rx_NextPage; /* at least a try... */ 669 next_rx_page = header_buf.Rx_NextPage; /* at least a try... */
681 de620_send_command(dev, W_DUMMY); 670 de620_send_command(dev, W_DUMMY);
682 de620_set_register(dev, W_NPRF, next_rx_page); 671 de620_set_register(dev, W_NPRF, next_rx_page);
683 ((struct net_device_stats *)(dev->priv))->rx_over_errors++; 672 dev->stats.rx_over_errors++;
684 return 0; 673 return 0;
685 } 674 }
686 next_rx_page = pagelink; 675 next_rx_page = pagelink;
@@ -693,7 +682,7 @@ static int de620_rx_intr(struct net_device *dev)
693 skb = dev_alloc_skb(size+2); 682 skb = dev_alloc_skb(size+2);
694 if (skb == NULL) { /* Yeah, but no place to put it... */ 683 if (skb == NULL) { /* Yeah, but no place to put it... */
695 printk(KERN_WARNING "%s: Couldn't allocate a sk_buff of size %d.\n", dev->name, size); 684 printk(KERN_WARNING "%s: Couldn't allocate a sk_buff of size %d.\n", dev->name, size);
696 ((struct net_device_stats *)(dev->priv))->rx_dropped++; 685 dev->stats.rx_dropped++;
697 } 686 }
698 else { /* Yep! Go get it! */ 687 else { /* Yep! Go get it! */
699 skb_reserve(skb,2); /* Align */ 688 skb_reserve(skb,2); /* Align */
@@ -706,8 +695,8 @@ static int de620_rx_intr(struct net_device *dev)
706 netif_rx(skb); /* deliver it "upstairs" */ 695 netif_rx(skb); /* deliver it "upstairs" */
707 dev->last_rx = jiffies; 696 dev->last_rx = jiffies;
708 /* count all receives */ 697 /* count all receives */
709 ((struct net_device_stats *)(dev->priv))->rx_packets++; 698 dev->stats.rx_packets++;
710 ((struct net_device_stats *)(dev->priv))->rx_bytes += size; 699 dev->stats.rx_bytes += size;
711 } 700 }
712 } 701 }
713 702
@@ -819,7 +808,7 @@ struct net_device * __init de620_probe(int unit)
819 int err = -ENOMEM; 808 int err = -ENOMEM;
820 int i; 809 int i;
821 810
822 dev = alloc_etherdev(sizeof(struct net_device_stats)); 811 dev = alloc_etherdev(0);
823 if (!dev) 812 if (!dev)
824 goto out; 813 goto out;
825 814
@@ -879,7 +868,6 @@ struct net_device * __init de620_probe(int unit)
879 else 868 else
880 printk(" UTP)\n"); 869 printk(" UTP)\n");
881 870
882 dev->get_stats = get_stats;
883 dev->open = de620_open; 871 dev->open = de620_open;
884 dev->stop = de620_close; 872 dev->stop = de620_close;
885 dev->hard_start_xmit = de620_start_xmit; 873 dev->hard_start_xmit = de620_start_xmit;