aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/at1700.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/at1700.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/at1700.c')
-rw-r--r--drivers/net/at1700.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index d20148e69fa1..a124fdb2bce6 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -109,7 +109,6 @@ typedef unsigned char uchar;
109 109
110/* Information that need to be kept for each board. */ 110/* Information that need to be kept for each board. */
111struct net_local { 111struct net_local {
112 struct net_device_stats stats;
113 spinlock_t lock; 112 spinlock_t lock;
114 unsigned char mc_filter[8]; 113 unsigned char mc_filter[8];
115 uint jumpered:1; /* Set iff the board has jumper config. */ 114 uint jumpered:1; /* Set iff the board has jumper config. */
@@ -164,7 +163,6 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev);
164static irqreturn_t net_interrupt(int irq, void *dev_id); 163static irqreturn_t net_interrupt(int irq, void *dev_id);
165static void net_rx(struct net_device *dev); 164static void net_rx(struct net_device *dev);
166static int net_close(struct net_device *dev); 165static int net_close(struct net_device *dev);
167static struct net_device_stats *net_get_stats(struct net_device *dev);
168static void set_rx_mode(struct net_device *dev); 166static void set_rx_mode(struct net_device *dev);
169static void net_tx_timeout (struct net_device *dev); 167static void net_tx_timeout (struct net_device *dev);
170 168
@@ -456,7 +454,6 @@ found:
456 dev->open = net_open; 454 dev->open = net_open;
457 dev->stop = net_close; 455 dev->stop = net_close;
458 dev->hard_start_xmit = net_send_packet; 456 dev->hard_start_xmit = net_send_packet;
459 dev->get_stats = net_get_stats;
460 dev->set_multicast_list = &set_rx_mode; 457 dev->set_multicast_list = &set_rx_mode;
461 dev->tx_timeout = net_tx_timeout; 458 dev->tx_timeout = net_tx_timeout;
462 dev->watchdog_timeo = TX_TIMEOUT; 459 dev->watchdog_timeo = TX_TIMEOUT;
@@ -571,7 +568,7 @@ static void net_tx_timeout (struct net_device *dev)
571 dev->name, inw(ioaddr + TX_STATUS), inw(ioaddr + TX_INTR), inw(ioaddr + TX_MODE), 568 dev->name, inw(ioaddr + TX_STATUS), inw(ioaddr + TX_INTR), inw(ioaddr + TX_MODE),
572 inw(ioaddr + CONFIG_0), inw(ioaddr + DATAPORT), inw(ioaddr + TX_START), 569 inw(ioaddr + CONFIG_0), inw(ioaddr + DATAPORT), inw(ioaddr + TX_START),
573 inw(ioaddr + MODE13 - 1), inw(ioaddr + RX_CTRL)); 570 inw(ioaddr + MODE13 - 1), inw(ioaddr + RX_CTRL));
574 lp->stats.tx_errors++; 571 dev->stats.tx_errors++;
575 /* ToDo: We should try to restart the adaptor... */ 572 /* ToDo: We should try to restart the adaptor... */
576 outw(0xffff, ioaddr + MODE24); 573 outw(0xffff, ioaddr + MODE24);
577 outw (0xffff, ioaddr + TX_STATUS); 574 outw (0xffff, ioaddr + TX_STATUS);
@@ -691,10 +688,10 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
691 printk("%s: 16 Collision occur during Txing.\n", dev->name); 688 printk("%s: 16 Collision occur during Txing.\n", dev->name);
692 /* Cancel sending a packet. */ 689 /* Cancel sending a packet. */
693 outb(0x03, ioaddr + COL16CNTL); 690 outb(0x03, ioaddr + COL16CNTL);
694 lp->stats.collisions++; 691 dev->stats.collisions++;
695 } 692 }
696 if (status & 0x82) { 693 if (status & 0x82) {
697 lp->stats.tx_packets++; 694 dev->stats.tx_packets++;
698 /* The Tx queue has any packets and is not being 695 /* The Tx queue has any packets and is not being
699 transferred a packet from the host, start 696 transferred a packet from the host, start
700 transmitting. */ 697 transmitting. */
@@ -719,7 +716,6 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
719static void 716static void
720net_rx(struct net_device *dev) 717net_rx(struct net_device *dev)
721{ 718{
722 struct net_local *lp = netdev_priv(dev);
723 int ioaddr = dev->base_addr; 719 int ioaddr = dev->base_addr;
724 int boguscount = 5; 720 int boguscount = 5;
725 721
@@ -738,11 +734,11 @@ net_rx(struct net_device *dev)
738#endif 734#endif
739 735
740 if ((status & 0xF0) != 0x20) { /* There was an error. */ 736 if ((status & 0xF0) != 0x20) { /* There was an error. */
741 lp->stats.rx_errors++; 737 dev->stats.rx_errors++;
742 if (status & 0x08) lp->stats.rx_length_errors++; 738 if (status & 0x08) dev->stats.rx_length_errors++;
743 if (status & 0x04) lp->stats.rx_frame_errors++; 739 if (status & 0x04) dev->stats.rx_frame_errors++;
744 if (status & 0x02) lp->stats.rx_crc_errors++; 740 if (status & 0x02) dev->stats.rx_crc_errors++;
745 if (status & 0x01) lp->stats.rx_over_errors++; 741 if (status & 0x01) dev->stats.rx_over_errors++;
746 } else { 742 } else {
747 /* Malloc up new buffer. */ 743 /* Malloc up new buffer. */
748 struct sk_buff *skb; 744 struct sk_buff *skb;
@@ -753,7 +749,7 @@ net_rx(struct net_device *dev)
753 /* Prime the FIFO and then flush the packet. */ 749 /* Prime the FIFO and then flush the packet. */
754 inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT); 750 inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT);
755 outb(0x05, ioaddr + RX_CTRL); 751 outb(0x05, ioaddr + RX_CTRL);
756 lp->stats.rx_errors++; 752 dev->stats.rx_errors++;
757 break; 753 break;
758 } 754 }
759 skb = dev_alloc_skb(pkt_len+3); 755 skb = dev_alloc_skb(pkt_len+3);
@@ -763,7 +759,7 @@ net_rx(struct net_device *dev)
763 /* Prime the FIFO and then flush the packet. */ 759 /* Prime the FIFO and then flush the packet. */
764 inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT); 760 inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT);
765 outb(0x05, ioaddr + RX_CTRL); 761 outb(0x05, ioaddr + RX_CTRL);
766 lp->stats.rx_dropped++; 762 dev->stats.rx_dropped++;
767 break; 763 break;
768 } 764 }
769 skb_reserve(skb,2); 765 skb_reserve(skb,2);
@@ -772,8 +768,8 @@ net_rx(struct net_device *dev)
772 skb->protocol=eth_type_trans(skb, dev); 768 skb->protocol=eth_type_trans(skb, dev);
773 netif_rx(skb); 769 netif_rx(skb);
774 dev->last_rx = jiffies; 770 dev->last_rx = jiffies;
775 lp->stats.rx_packets++; 771 dev->stats.rx_packets++;
776 lp->stats.rx_bytes += pkt_len; 772 dev->stats.rx_bytes += pkt_len;
777 } 773 }
778 if (--boguscount <= 0) 774 if (--boguscount <= 0)
779 break; 775 break;
@@ -822,17 +818,6 @@ static int net_close(struct net_device *dev)
822 return 0; 818 return 0;
823} 819}
824 820
825/* Get the current statistics.
826 This may be called with the card open or closed.
827 There are no on-chip counters, so this function is trivial.
828*/
829static struct net_device_stats *
830net_get_stats(struct net_device *dev)
831{
832 struct net_local *lp = netdev_priv(dev);
833 return &lp->stats;
834}
835
836/* 821/*
837 Set the multicast/promiscuous mode for this adaptor. 822 Set the multicast/promiscuous mode for this adaptor.
838*/ 823*/