aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dm9000.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/dm9000.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/dm9000.c')
-rw-r--r--drivers/net/dm9000.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 857eb366bb11..f691ef61b2d3 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -148,7 +148,6 @@ typedef struct board_info {
148 struct resource *irq_res; 148 struct resource *irq_res;
149 149
150 struct timer_list timer; 150 struct timer_list timer;
151 struct net_device_stats stats;
152 unsigned char srom[128]; 151 unsigned char srom[128];
153 spinlock_t lock; 152 spinlock_t lock;
154 153
@@ -166,8 +165,6 @@ static int dm9000_stop(struct net_device *);
166static void dm9000_timer(unsigned long); 165static void dm9000_timer(unsigned long);
167static void dm9000_init_dm9000(struct net_device *); 166static void dm9000_init_dm9000(struct net_device *);
168 167
169static struct net_device_stats *dm9000_get_stats(struct net_device *);
170
171static irqreturn_t dm9000_interrupt(int, void *); 168static irqreturn_t dm9000_interrupt(int, void *);
172 169
173static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg); 170static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg);
@@ -558,7 +555,6 @@ dm9000_probe(struct platform_device *pdev)
558 ndev->tx_timeout = &dm9000_timeout; 555 ndev->tx_timeout = &dm9000_timeout;
559 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); 556 ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
560 ndev->stop = &dm9000_stop; 557 ndev->stop = &dm9000_stop;
561 ndev->get_stats = &dm9000_get_stats;
562 ndev->set_multicast_list = &dm9000_hash_table; 558 ndev->set_multicast_list = &dm9000_hash_table;
563#ifdef CONFIG_NET_POLL_CONTROLLER 559#ifdef CONFIG_NET_POLL_CONTROLLER
564 ndev->poll_controller = &dm9000_poll_controller; 560 ndev->poll_controller = &dm9000_poll_controller;
@@ -713,7 +709,7 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev)
713 writeb(DM9000_MWCMD, db->io_addr); 709 writeb(DM9000_MWCMD, db->io_addr);
714 710
715 (db->outblk)(db->io_data, skb->data, skb->len); 711 (db->outblk)(db->io_data, skb->data, skb->len);
716 db->stats.tx_bytes += skb->len; 712 dev->stats.tx_bytes += skb->len;
717 713
718 db->tx_pkt_cnt++; 714 db->tx_pkt_cnt++;
719 /* TX control: First packet immediately send, second packet queue */ 715 /* TX control: First packet immediately send, second packet queue */
@@ -790,7 +786,7 @@ dm9000_tx_done(struct net_device *dev, board_info_t * db)
790 if (tx_status & (NSR_TX2END | NSR_TX1END)) { 786 if (tx_status & (NSR_TX2END | NSR_TX1END)) {
791 /* One packet sent complete */ 787 /* One packet sent complete */
792 db->tx_pkt_cnt--; 788 db->tx_pkt_cnt--;
793 db->stats.tx_packets++; 789 dev->stats.tx_packets++;
794 790
795 /* Queue packet check & send */ 791 /* Queue packet check & send */
796 if (db->tx_pkt_cnt > 0) { 792 if (db->tx_pkt_cnt > 0) {
@@ -852,17 +848,6 @@ dm9000_interrupt(int irq, void *dev_id)
852} 848}
853 849
854/* 850/*
855 * Get statistics from driver.
856 */
857static struct net_device_stats *
858dm9000_get_stats(struct net_device *dev)
859{
860 board_info_t *db = (board_info_t *) dev->priv;
861 return &db->stats;
862}
863
864
865/*
866 * A periodic timer routine 851 * A periodic timer routine
867 * Dynamic media sense, allocated Rx buffer... 852 * Dynamic media sense, allocated Rx buffer...
868 */ 853 */
@@ -939,15 +924,15 @@ dm9000_rx(struct net_device *dev)
939 GoodPacket = false; 924 GoodPacket = false;
940 if (rxhdr.RxStatus & 0x100) { 925 if (rxhdr.RxStatus & 0x100) {
941 PRINTK1("fifo error\n"); 926 PRINTK1("fifo error\n");
942 db->stats.rx_fifo_errors++; 927 dev->stats.rx_fifo_errors++;
943 } 928 }
944 if (rxhdr.RxStatus & 0x200) { 929 if (rxhdr.RxStatus & 0x200) {
945 PRINTK1("crc error\n"); 930 PRINTK1("crc error\n");
946 db->stats.rx_crc_errors++; 931 dev->stats.rx_crc_errors++;
947 } 932 }
948 if (rxhdr.RxStatus & 0x8000) { 933 if (rxhdr.RxStatus & 0x8000) {
949 PRINTK1("length error\n"); 934 PRINTK1("length error\n");
950 db->stats.rx_length_errors++; 935 dev->stats.rx_length_errors++;
951 } 936 }
952 } 937 }
953 938
@@ -960,12 +945,12 @@ dm9000_rx(struct net_device *dev)
960 /* Read received packet from RX SRAM */ 945 /* Read received packet from RX SRAM */
961 946
962 (db->inblk)(db->io_data, rdptr, RxLen); 947 (db->inblk)(db->io_data, rdptr, RxLen);
963 db->stats.rx_bytes += RxLen; 948 dev->stats.rx_bytes += RxLen;
964 949
965 /* Pass to upper layer */ 950 /* Pass to upper layer */
966 skb->protocol = eth_type_trans(skb, dev); 951 skb->protocol = eth_type_trans(skb, dev);
967 netif_rx(skb); 952 netif_rx(skb);
968 db->stats.rx_packets++; 953 dev->stats.rx_packets++;
969 954
970 } else { 955 } else {
971 /* need to dump the packet's data */ 956 /* need to dump the packet's data */