aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/lp486e.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/lp486e.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/lp486e.c')
-rw-r--r--drivers/net/lp486e.c56
1 files changed, 23 insertions, 33 deletions
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index 408ae6eb6a8b..c5095ecd8b11 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -350,7 +350,6 @@ struct i596_private { /* aligned to a 16-byte boundary */
350 struct i596_cmd *cmd_head; 350 struct i596_cmd *cmd_head;
351 int cmd_backlog; 351 int cmd_backlog;
352 unsigned long last_cmd; 352 unsigned long last_cmd;
353 struct net_device_stats stats;
354 spinlock_t cmd_lock; 353 spinlock_t cmd_lock;
355}; 354};
356 355
@@ -381,7 +380,6 @@ static int i596_open(struct net_device *dev);
381static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); 380static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
382static irqreturn_t i596_interrupt(int irq, void *dev_id); 381static irqreturn_t i596_interrupt(int irq, void *dev_id);
383static int i596_close(struct net_device *dev); 382static int i596_close(struct net_device *dev);
384static struct net_device_stats *i596_get_stats(struct net_device *dev);
385static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd); 383static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd);
386static void print_eth(char *); 384static void print_eth(char *);
387static void set_multicast_list(struct net_device *dev); 385static void set_multicast_list(struct net_device *dev);
@@ -670,7 +668,7 @@ i596_rx_one(struct net_device *dev, struct i596_private *lp,
670 if (skb == NULL) { 668 if (skb == NULL) {
671 printk ("%s: i596_rx Memory squeeze, " 669 printk ("%s: i596_rx Memory squeeze, "
672 "dropping packet.\n", dev->name); 670 "dropping packet.\n", dev->name);
673 lp->stats.rx_dropped++; 671 dev->stats.rx_dropped++;
674 return 1; 672 return 1;
675 } 673 }
676 674
@@ -679,27 +677,27 @@ i596_rx_one(struct net_device *dev, struct i596_private *lp,
679 skb->protocol = eth_type_trans(skb,dev); 677 skb->protocol = eth_type_trans(skb,dev);
680 netif_rx(skb); 678 netif_rx(skb);
681 dev->last_rx = jiffies; 679 dev->last_rx = jiffies;
682 lp->stats.rx_packets++; 680 dev->stats.rx_packets++;
683 } else { 681 } else {
684#if 0 682#if 0
685 printk("Frame reception error status %04x\n", 683 printk("Frame reception error status %04x\n",
686 rfd->stat); 684 rfd->stat);
687#endif 685#endif
688 lp->stats.rx_errors++; 686 dev->stats.rx_errors++;
689 if (rfd->stat & RFD_COLLISION) 687 if (rfd->stat & RFD_COLLISION)
690 lp->stats.collisions++; 688 dev->stats.collisions++;
691 if (rfd->stat & RFD_SHORT_FRAME_ERR) 689 if (rfd->stat & RFD_SHORT_FRAME_ERR)
692 lp->stats.rx_length_errors++; 690 dev->stats.rx_length_errors++;
693 if (rfd->stat & RFD_DMA_ERR) 691 if (rfd->stat & RFD_DMA_ERR)
694 lp->stats.rx_over_errors++; 692 dev->stats.rx_over_errors++;
695 if (rfd->stat & RFD_NOBUFS_ERR) 693 if (rfd->stat & RFD_NOBUFS_ERR)
696 lp->stats.rx_fifo_errors++; 694 dev->stats.rx_fifo_errors++;
697 if (rfd->stat & RFD_ALIGN_ERR) 695 if (rfd->stat & RFD_ALIGN_ERR)
698 lp->stats.rx_frame_errors++; 696 dev->stats.rx_frame_errors++;
699 if (rfd->stat & RFD_CRC_ERR) 697 if (rfd->stat & RFD_CRC_ERR)
700 lp->stats.rx_crc_errors++; 698 dev->stats.rx_crc_errors++;
701 if (rfd->stat & RFD_LENGTH_ERR) 699 if (rfd->stat & RFD_LENGTH_ERR)
702 lp->stats.rx_length_errors++; 700 dev->stats.rx_length_errors++;
703 } 701 }
704 rfd->stat = rfd->count = 0; 702 rfd->stat = rfd->count = 0;
705 return 0; 703 return 0;
@@ -755,8 +753,8 @@ i596_cleanup_cmd(struct net_device *dev) {
755 753
756 dev_kfree_skb_any(tx_cmd_tbd->skb); 754 dev_kfree_skb_any(tx_cmd_tbd->skb);
757 755
758 lp->stats.tx_errors++; 756 dev->stats.tx_errors++;
759 lp->stats.tx_aborted_errors++; 757 dev->stats.tx_aborted_errors++;
760 758
761 cmd->pa_next = I596_NULL; 759 cmd->pa_next = I596_NULL;
762 kfree((unsigned char *)tx_cmd); 760 kfree((unsigned char *)tx_cmd);
@@ -867,7 +865,6 @@ static int i596_open(struct net_device *dev)
867} 865}
868 866
869static int i596_start_xmit (struct sk_buff *skb, struct net_device *dev) { 867static int i596_start_xmit (struct sk_buff *skb, struct net_device *dev) {
870 struct i596_private *lp = dev->priv;
871 struct tx_cmd *tx_cmd; 868 struct tx_cmd *tx_cmd;
872 short length; 869 short length;
873 870
@@ -884,7 +881,7 @@ static int i596_start_xmit (struct sk_buff *skb, struct net_device *dev) {
884 tx_cmd = kmalloc((sizeof (struct tx_cmd) + sizeof (struct i596_tbd)), GFP_ATOMIC); 881 tx_cmd = kmalloc((sizeof (struct tx_cmd) + sizeof (struct i596_tbd)), GFP_ATOMIC);
885 if (tx_cmd == NULL) { 882 if (tx_cmd == NULL) {
886 printk(KERN_WARNING "%s: i596_xmit Memory squeeze, dropping packet.\n", dev->name); 883 printk(KERN_WARNING "%s: i596_xmit Memory squeeze, dropping packet.\n", dev->name);
887 lp->stats.tx_dropped++; 884 dev->stats.tx_dropped++;
888 dev_kfree_skb (skb); 885 dev_kfree_skb (skb);
889 } else { 886 } else {
890 struct i596_tbd *tx_cmd_tbd; 887 struct i596_tbd *tx_cmd_tbd;
@@ -907,7 +904,7 @@ static int i596_start_xmit (struct sk_buff *skb, struct net_device *dev) {
907 904
908 i596_add_cmd (dev, (struct i596_cmd *) tx_cmd); 905 i596_add_cmd (dev, (struct i596_cmd *) tx_cmd);
909 906
910 lp->stats.tx_packets++; 907 dev->stats.tx_packets++;
911 } 908 }
912 909
913 return 0; 910 return 0;
@@ -920,10 +917,10 @@ i596_tx_timeout (struct net_device *dev) {
920 917
921 /* Transmitter timeout, serious problems. */ 918 /* Transmitter timeout, serious problems. */
922 printk(KERN_WARNING "%s: transmit timed out, status resetting.\n", dev->name); 919 printk(KERN_WARNING "%s: transmit timed out, status resetting.\n", dev->name);
923 lp->stats.tx_errors++; 920 dev->stats.tx_errors++;
924 921
925 /* Try to restart the adaptor */ 922 /* Try to restart the adaptor */
926 if (lp->last_restart == lp->stats.tx_packets) { 923 if (lp->last_restart == dev->stats.tx_packets) {
927 printk ("Resetting board.\n"); 924 printk ("Resetting board.\n");
928 925
929 /* Shutdown and restart */ 926 /* Shutdown and restart */
@@ -933,7 +930,7 @@ i596_tx_timeout (struct net_device *dev) {
933 printk ("Kicking board.\n"); 930 printk ("Kicking board.\n");
934 lp->scb.command = (CUC_START | RX_START); 931 lp->scb.command = (CUC_START | RX_START);
935 CA(); 932 CA();
936 lp->last_restart = lp->stats.tx_packets; 933 lp->last_restart = dev->stats.tx_packets;
937 } 934 }
938 netif_wake_queue(dev); 935 netif_wake_queue(dev);
939} 936}
@@ -1021,7 +1018,6 @@ static int __init lp486e_probe(struct net_device *dev) {
1021 dev->open = &i596_open; 1018 dev->open = &i596_open;
1022 dev->stop = &i596_close; 1019 dev->stop = &i596_close;
1023 dev->hard_start_xmit = &i596_start_xmit; 1020 dev->hard_start_xmit = &i596_start_xmit;
1024 dev->get_stats = &i596_get_stats;
1025 dev->set_multicast_list = &set_multicast_list; 1021 dev->set_multicast_list = &set_multicast_list;
1026 dev->watchdog_timeo = 5*HZ; 1022 dev->watchdog_timeo = 5*HZ;
1027 dev->tx_timeout = i596_tx_timeout; 1023 dev->tx_timeout = i596_tx_timeout;
@@ -1078,20 +1074,20 @@ i596_handle_CU_completion(struct net_device *dev,
1078 if (i596_debug) 1074 if (i596_debug)
1079 print_eth(pa_to_va(tx_cmd_tbd->pa_data)); 1075 print_eth(pa_to_va(tx_cmd_tbd->pa_data));
1080 } else { 1076 } else {
1081 lp->stats.tx_errors++; 1077 dev->stats.tx_errors++;
1082 if (i596_debug) 1078 if (i596_debug)
1083 printk("transmission failure:%04x\n", 1079 printk("transmission failure:%04x\n",
1084 cmd->status); 1080 cmd->status);
1085 if (cmd->status & 0x0020) 1081 if (cmd->status & 0x0020)
1086 lp->stats.collisions++; 1082 dev->stats.collisions++;
1087 if (!(cmd->status & 0x0040)) 1083 if (!(cmd->status & 0x0040))
1088 lp->stats.tx_heartbeat_errors++; 1084 dev->stats.tx_heartbeat_errors++;
1089 if (cmd->status & 0x0400) 1085 if (cmd->status & 0x0400)
1090 lp->stats.tx_carrier_errors++; 1086 dev->stats.tx_carrier_errors++;
1091 if (cmd->status & 0x0800) 1087 if (cmd->status & 0x0800)
1092 lp->stats.collisions++; 1088 dev->stats.collisions++;
1093 if (cmd->status & 0x1000) 1089 if (cmd->status & 0x1000)
1094 lp->stats.tx_aborted_errors++; 1090 dev->stats.tx_aborted_errors++;
1095 } 1091 }
1096 dev_kfree_skb_irq(tx_cmd_tbd->skb); 1092 dev_kfree_skb_irq(tx_cmd_tbd->skb);
1097 1093
@@ -1242,12 +1238,6 @@ static int i596_close(struct net_device *dev) {
1242 return 0; 1238 return 0;
1243} 1239}
1244 1240
1245static struct net_device_stats * i596_get_stats(struct net_device *dev) {
1246 struct i596_private *lp = dev->priv;
1247
1248 return &lp->stats;
1249}
1250
1251/* 1241/*
1252* Set or clear the multicast filter for this adaptor. 1242* Set or clear the multicast filter for this adaptor.
1253*/ 1243*/