aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/3c501.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/3c501.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/3c501.c')
-rw-r--r--drivers/net/3c501.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index 98e0bc4628a2..be71868d1513 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -315,7 +315,6 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
315 dev->tx_timeout = &el_timeout; 315 dev->tx_timeout = &el_timeout;
316 dev->watchdog_timeo = HZ; 316 dev->watchdog_timeo = HZ;
317 dev->stop = &el1_close; 317 dev->stop = &el1_close;
318 dev->get_stats = &el1_get_stats;
319 dev->set_multicast_list = &set_multicast_list; 318 dev->set_multicast_list = &set_multicast_list;
320 dev->ethtool_ops = &netdev_ethtool_ops; 319 dev->ethtool_ops = &netdev_ethtool_ops;
321 return 0; 320 return 0;
@@ -374,7 +373,7 @@ static void el_timeout(struct net_device *dev)
374 if (el_debug) 373 if (el_debug)
375 printk (KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n", 374 printk (KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n",
376 dev->name, inb(TX_STATUS), inb(AX_STATUS), inb(RX_STATUS)); 375 dev->name, inb(TX_STATUS), inb(AX_STATUS), inb(RX_STATUS));
377 lp->stats.tx_errors++; 376 dev->stats.tx_errors++;
378 outb(TX_NORM, TX_CMD); 377 outb(TX_NORM, TX_CMD);
379 outb(RX_NORM, RX_CMD); 378 outb(RX_NORM, RX_CMD);
380 outb(AX_OFF, AX_CMD); /* Just trigger a false interrupt. */ 379 outb(AX_OFF, AX_CMD); /* Just trigger a false interrupt. */
@@ -441,7 +440,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev)
441 lp->tx_pkt_start = gp_start; 440 lp->tx_pkt_start = gp_start;
442 lp->collisions = 0; 441 lp->collisions = 0;
443 442
444 lp->stats.tx_bytes += skb->len; 443 dev->stats.tx_bytes += skb->len;
445 444
446 /* 445 /*
447 * Command mode with status cleared should [in theory] 446 * Command mode with status cleared should [in theory]
@@ -588,7 +587,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
588 printk (KERN_DEBUG "%s: Transmit failed 16 times, Ethernet jammed?\n",dev->name); 587 printk (KERN_DEBUG "%s: Transmit failed 16 times, Ethernet jammed?\n",dev->name);
589 outb(AX_SYS, AX_CMD); 588 outb(AX_SYS, AX_CMD);
590 lp->txing = 0; 589 lp->txing = 0;
591 lp->stats.tx_aborted_errors++; 590 dev->stats.tx_aborted_errors++;
592 netif_wake_queue(dev); 591 netif_wake_queue(dev);
593 } 592 }
594 else if (txsr & TX_COLLISION) 593 else if (txsr & TX_COLLISION)
@@ -606,7 +605,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
606 outb(AX_SYS, AX_CMD); 605 outb(AX_SYS, AX_CMD);
607 outw(lp->tx_pkt_start, GP_LOW); 606 outw(lp->tx_pkt_start, GP_LOW);
608 outb(AX_XMIT, AX_CMD); 607 outb(AX_XMIT, AX_CMD);
609 lp->stats.collisions++; 608 dev->stats.collisions++;
610 spin_unlock(&lp->lock); 609 spin_unlock(&lp->lock);
611 goto out; 610 goto out;
612 } 611 }
@@ -615,7 +614,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
615 /* 614 /*
616 * It worked.. we will now fall through and receive 615 * It worked.. we will now fall through and receive
617 */ 616 */
618 lp->stats.tx_packets++; 617 dev->stats.tx_packets++;
619 if (el_debug > 6) 618 if (el_debug > 6)
620 printk(KERN_DEBUG " Tx succeeded %s\n", 619 printk(KERN_DEBUG " Tx succeeded %s\n",
621 (txsr & TX_RDY) ? "." : "but tx is busy!"); 620 (txsr & TX_RDY) ? "." : "but tx is busy!");
@@ -640,10 +639,10 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
640 * Just reading rx_status fixes most errors. 639 * Just reading rx_status fixes most errors.
641 */ 640 */
642 if (rxsr & RX_MISSED) 641 if (rxsr & RX_MISSED)
643 lp->stats.rx_missed_errors++; 642 dev->stats.rx_missed_errors++;
644 else if (rxsr & RX_RUNT) 643 else if (rxsr & RX_RUNT)
645 { /* Handled to avoid board lock-up. */ 644 { /* Handled to avoid board lock-up. */
646 lp->stats.rx_length_errors++; 645 dev->stats.rx_length_errors++;
647 if (el_debug > 5) 646 if (el_debug > 5)
648 printk(KERN_DEBUG " runt.\n"); 647 printk(KERN_DEBUG " runt.\n");
649 } 648 }
@@ -694,7 +693,6 @@ out:
694 693
695static void el_receive(struct net_device *dev) 694static void el_receive(struct net_device *dev)
696{ 695{
697 struct net_local *lp = netdev_priv(dev);
698 int ioaddr = dev->base_addr; 696 int ioaddr = dev->base_addr;
699 int pkt_len; 697 int pkt_len;
700 struct sk_buff *skb; 698 struct sk_buff *skb;
@@ -708,7 +706,7 @@ static void el_receive(struct net_device *dev)
708 { 706 {
709 if (el_debug) 707 if (el_debug)
710 printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); 708 printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len);
711 lp->stats.rx_over_errors++; 709 dev->stats.rx_over_errors++;
712 return; 710 return;
713 } 711 }
714 712
@@ -727,7 +725,7 @@ static void el_receive(struct net_device *dev)
727 if (skb == NULL) 725 if (skb == NULL)
728 { 726 {
729 printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); 727 printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name);
730 lp->stats.rx_dropped++; 728 dev->stats.rx_dropped++;
731 return; 729 return;
732 } 730 }
733 else 731 else
@@ -742,8 +740,8 @@ static void el_receive(struct net_device *dev)
742 skb->protocol=eth_type_trans(skb,dev); 740 skb->protocol=eth_type_trans(skb,dev);
743 netif_rx(skb); 741 netif_rx(skb);
744 dev->last_rx = jiffies; 742 dev->last_rx = jiffies;
745 lp->stats.rx_packets++; 743 dev->stats.rx_packets++;
746 lp->stats.rx_bytes+=pkt_len; 744 dev->stats.rx_bytes+=pkt_len;
747 } 745 }
748 return; 746 return;
749} 747}
@@ -811,23 +809,6 @@ static int el1_close(struct net_device *dev)
811} 809}
812 810
813/** 811/**
814 * el1_get_stats:
815 * @dev: The card to get the statistics for
816 *
817 * In smarter devices this function is needed to pull statistics off the
818 * board itself. The 3c501 has no hardware statistics. We maintain them all
819 * so they are by definition always up to date.
820 *
821 * Returns the statistics for the card from the card private data
822 */
823
824static struct net_device_stats *el1_get_stats(struct net_device *dev)
825{
826 struct net_local *lp = netdev_priv(dev);
827 return &lp->stats;
828}
829
830/**
831 * set_multicast_list: 812 * set_multicast_list:
832 * @dev: The device to adjust 813 * @dev: The device to adjust
833 * 814 *