diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-05-06 19:20:40 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-13 01:35:23 -0400 |
commit | 244d74ff209b635c10aac2a8fa5249a2a2c8d9d9 (patch) | |
tree | ea59e7d2b94cd3b19a788a45a49def3bd25706bb /drivers/net/lib8390.c | |
parent | 8e2691658f4cd2e24beacb6dcba3c33b2ff10593 (diff) |
lib8390: use netstats in net_device structure
Use net_device_stats from net_device structure instead of local.
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/lib8390.c')
-rw-r--r-- | drivers/net/lib8390.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c index 0c5447dac03b..72ffbeb829cc 100644 --- a/drivers/net/lib8390.c +++ b/drivers/net/lib8390.c | |||
@@ -265,7 +265,7 @@ static void ei_tx_timeout(struct net_device *dev) | |||
265 | int txsr, isr, tickssofar = jiffies - dev->trans_start; | 265 | int txsr, isr, tickssofar = jiffies - dev->trans_start; |
266 | unsigned long flags; | 266 | unsigned long flags; |
267 | 267 | ||
268 | ei_local->stat.tx_errors++; | 268 | dev->stats.tx_errors++; |
269 | 269 | ||
270 | spin_lock_irqsave(&ei_local->page_lock, flags); | 270 | spin_lock_irqsave(&ei_local->page_lock, flags); |
271 | txsr = ei_inb(e8390_base+EN0_TSR); | 271 | txsr = ei_inb(e8390_base+EN0_TSR); |
@@ -276,7 +276,7 @@ static void ei_tx_timeout(struct net_device *dev) | |||
276 | dev->name, (txsr & ENTSR_ABT) ? "excess collisions." : | 276 | dev->name, (txsr & ENTSR_ABT) ? "excess collisions." : |
277 | (isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar); | 277 | (isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar); |
278 | 278 | ||
279 | if (!isr && !ei_local->stat.tx_packets) | 279 | if (!isr && !dev->stats.tx_packets) |
280 | { | 280 | { |
281 | /* The 8390 probably hasn't gotten on the cable yet. */ | 281 | /* The 8390 probably hasn't gotten on the cable yet. */ |
282 | ei_local->interface_num ^= 1; /* Try a different xcvr. */ | 282 | ei_local->interface_num ^= 1; /* Try a different xcvr. */ |
@@ -374,7 +374,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
374 | ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR); | 374 | ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR); |
375 | spin_unlock(&ei_local->page_lock); | 375 | spin_unlock(&ei_local->page_lock); |
376 | enable_irq_lockdep_irqrestore(dev->irq, &flags); | 376 | enable_irq_lockdep_irqrestore(dev->irq, &flags); |
377 | ei_local->stat.tx_errors++; | 377 | dev->stats.tx_errors++; |
378 | return 1; | 378 | return 1; |
379 | } | 379 | } |
380 | 380 | ||
@@ -417,7 +417,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
417 | enable_irq_lockdep_irqrestore(dev->irq, &flags); | 417 | enable_irq_lockdep_irqrestore(dev->irq, &flags); |
418 | 418 | ||
419 | dev_kfree_skb (skb); | 419 | dev_kfree_skb (skb); |
420 | ei_local->stat.tx_bytes += send_length; | 420 | dev->stats.tx_bytes += send_length; |
421 | 421 | ||
422 | return 0; | 422 | return 0; |
423 | } | 423 | } |
@@ -493,9 +493,9 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id) | |||
493 | 493 | ||
494 | if (interrupts & ENISR_COUNTERS) | 494 | if (interrupts & ENISR_COUNTERS) |
495 | { | 495 | { |
496 | ei_local->stat.rx_frame_errors += ei_inb_p(e8390_base + EN0_COUNTER0); | 496 | dev->stats.rx_frame_errors += ei_inb_p(e8390_base + EN0_COUNTER0); |
497 | ei_local->stat.rx_crc_errors += ei_inb_p(e8390_base + EN0_COUNTER1); | 497 | dev->stats.rx_crc_errors += ei_inb_p(e8390_base + EN0_COUNTER1); |
498 | ei_local->stat.rx_missed_errors+= ei_inb_p(e8390_base + EN0_COUNTER2); | 498 | dev->stats.rx_missed_errors+= ei_inb_p(e8390_base + EN0_COUNTER2); |
499 | ei_outb_p(ENISR_COUNTERS, e8390_base + EN0_ISR); /* Ack intr. */ | 499 | ei_outb_p(ENISR_COUNTERS, e8390_base + EN0_ISR); /* Ack intr. */ |
500 | } | 500 | } |
501 | 501 | ||
@@ -578,10 +578,10 @@ static void ei_tx_err(struct net_device *dev) | |||
578 | ei_tx_intr(dev); | 578 | ei_tx_intr(dev); |
579 | else | 579 | else |
580 | { | 580 | { |
581 | ei_local->stat.tx_errors++; | 581 | dev->stats.tx_errors++; |
582 | if (txsr & ENTSR_CRS) ei_local->stat.tx_carrier_errors++; | 582 | if (txsr & ENTSR_CRS) dev->stats.tx_carrier_errors++; |
583 | if (txsr & ENTSR_CDH) ei_local->stat.tx_heartbeat_errors++; | 583 | if (txsr & ENTSR_CDH) dev->stats.tx_heartbeat_errors++; |
584 | if (txsr & ENTSR_OWC) ei_local->stat.tx_window_errors++; | 584 | if (txsr & ENTSR_OWC) dev->stats.tx_window_errors++; |
585 | } | 585 | } |
586 | } | 586 | } |
587 | 587 | ||
@@ -645,25 +645,25 @@ static void ei_tx_intr(struct net_device *dev) | |||
645 | 645 | ||
646 | /* Minimize Tx latency: update the statistics after we restart TXing. */ | 646 | /* Minimize Tx latency: update the statistics after we restart TXing. */ |
647 | if (status & ENTSR_COL) | 647 | if (status & ENTSR_COL) |
648 | ei_local->stat.collisions++; | 648 | dev->stats.collisions++; |
649 | if (status & ENTSR_PTX) | 649 | if (status & ENTSR_PTX) |
650 | ei_local->stat.tx_packets++; | 650 | dev->stats.tx_packets++; |
651 | else | 651 | else |
652 | { | 652 | { |
653 | ei_local->stat.tx_errors++; | 653 | dev->stats.tx_errors++; |
654 | if (status & ENTSR_ABT) | 654 | if (status & ENTSR_ABT) |
655 | { | 655 | { |
656 | ei_local->stat.tx_aborted_errors++; | 656 | dev->stats.tx_aborted_errors++; |
657 | ei_local->stat.collisions += 16; | 657 | dev->stats.collisions += 16; |
658 | } | 658 | } |
659 | if (status & ENTSR_CRS) | 659 | if (status & ENTSR_CRS) |
660 | ei_local->stat.tx_carrier_errors++; | 660 | dev->stats.tx_carrier_errors++; |
661 | if (status & ENTSR_FU) | 661 | if (status & ENTSR_FU) |
662 | ei_local->stat.tx_fifo_errors++; | 662 | dev->stats.tx_fifo_errors++; |
663 | if (status & ENTSR_CDH) | 663 | if (status & ENTSR_CDH) |
664 | ei_local->stat.tx_heartbeat_errors++; | 664 | dev->stats.tx_heartbeat_errors++; |
665 | if (status & ENTSR_OWC) | 665 | if (status & ENTSR_OWC) |
666 | ei_local->stat.tx_window_errors++; | 666 | dev->stats.tx_window_errors++; |
667 | } | 667 | } |
668 | netif_wake_queue(dev); | 668 | netif_wake_queue(dev); |
669 | } | 669 | } |
@@ -730,7 +730,7 @@ static void ei_receive(struct net_device *dev) | |||
730 | && rx_frame.next != next_frame + 1 - num_rx_pages) { | 730 | && rx_frame.next != next_frame + 1 - num_rx_pages) { |
731 | ei_local->current_page = rxing_page; | 731 | ei_local->current_page = rxing_page; |
732 | ei_outb(ei_local->current_page-1, e8390_base+EN0_BOUNDARY); | 732 | ei_outb(ei_local->current_page-1, e8390_base+EN0_BOUNDARY); |
733 | ei_local->stat.rx_errors++; | 733 | dev->stats.rx_errors++; |
734 | continue; | 734 | continue; |
735 | } | 735 | } |
736 | 736 | ||
@@ -740,8 +740,8 @@ static void ei_receive(struct net_device *dev) | |||
740 | printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n", | 740 | printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n", |
741 | dev->name, rx_frame.count, rx_frame.status, | 741 | dev->name, rx_frame.count, rx_frame.status, |
742 | rx_frame.next); | 742 | rx_frame.next); |
743 | ei_local->stat.rx_errors++; | 743 | dev->stats.rx_errors++; |
744 | ei_local->stat.rx_length_errors++; | 744 | dev->stats.rx_length_errors++; |
745 | } | 745 | } |
746 | else if ((pkt_stat & 0x0F) == ENRSR_RXOK) | 746 | else if ((pkt_stat & 0x0F) == ENRSR_RXOK) |
747 | { | 747 | { |
@@ -753,7 +753,7 @@ static void ei_receive(struct net_device *dev) | |||
753 | if (ei_debug > 1) | 753 | if (ei_debug > 1) |
754 | printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n", | 754 | printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n", |
755 | dev->name, pkt_len); | 755 | dev->name, pkt_len); |
756 | ei_local->stat.rx_dropped++; | 756 | dev->stats.rx_dropped++; |
757 | break; | 757 | break; |
758 | } | 758 | } |
759 | else | 759 | else |
@@ -764,10 +764,10 @@ static void ei_receive(struct net_device *dev) | |||
764 | skb->protocol=eth_type_trans(skb,dev); | 764 | skb->protocol=eth_type_trans(skb,dev); |
765 | netif_rx(skb); | 765 | netif_rx(skb); |
766 | dev->last_rx = jiffies; | 766 | dev->last_rx = jiffies; |
767 | ei_local->stat.rx_packets++; | 767 | dev->stats.rx_packets++; |
768 | ei_local->stat.rx_bytes += pkt_len; | 768 | dev->stats.rx_bytes += pkt_len; |
769 | if (pkt_stat & ENRSR_PHY) | 769 | if (pkt_stat & ENRSR_PHY) |
770 | ei_local->stat.multicast++; | 770 | dev->stats.multicast++; |
771 | } | 771 | } |
772 | } | 772 | } |
773 | else | 773 | else |
@@ -776,10 +776,10 @@ static void ei_receive(struct net_device *dev) | |||
776 | printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n", | 776 | printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n", |
777 | dev->name, rx_frame.status, rx_frame.next, | 777 | dev->name, rx_frame.status, rx_frame.next, |
778 | rx_frame.count); | 778 | rx_frame.count); |
779 | ei_local->stat.rx_errors++; | 779 | dev->stats.rx_errors++; |
780 | /* NB: The NIC counts CRC, frame and missed errors. */ | 780 | /* NB: The NIC counts CRC, frame and missed errors. */ |
781 | if (pkt_stat & ENRSR_FO) | 781 | if (pkt_stat & ENRSR_FO) |
782 | ei_local->stat.rx_fifo_errors++; | 782 | dev->stats.rx_fifo_errors++; |
783 | } | 783 | } |
784 | next_frame = rx_frame.next; | 784 | next_frame = rx_frame.next; |
785 | 785 | ||
@@ -827,7 +827,7 @@ static void ei_rx_overrun(struct net_device *dev) | |||
827 | 827 | ||
828 | if (ei_debug > 1) | 828 | if (ei_debug > 1) |
829 | printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name); | 829 | printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name); |
830 | ei_local->stat.rx_over_errors++; | 830 | dev->stats.rx_over_errors++; |
831 | 831 | ||
832 | /* | 832 | /* |
833 | * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total. | 833 | * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total. |
@@ -889,16 +889,16 @@ static struct net_device_stats *get_stats(struct net_device *dev) | |||
889 | 889 | ||
890 | /* If the card is stopped, just return the present stats. */ | 890 | /* If the card is stopped, just return the present stats. */ |
891 | if (!netif_running(dev)) | 891 | if (!netif_running(dev)) |
892 | return &ei_local->stat; | 892 | return &dev->stats; |
893 | 893 | ||
894 | spin_lock_irqsave(&ei_local->page_lock,flags); | 894 | spin_lock_irqsave(&ei_local->page_lock,flags); |
895 | /* Read the counter registers, assuming we are in page 0. */ | 895 | /* Read the counter registers, assuming we are in page 0. */ |
896 | ei_local->stat.rx_frame_errors += ei_inb_p(ioaddr + EN0_COUNTER0); | 896 | dev->stats.rx_frame_errors += ei_inb_p(ioaddr + EN0_COUNTER0); |
897 | ei_local->stat.rx_crc_errors += ei_inb_p(ioaddr + EN0_COUNTER1); | 897 | dev->stats.rx_crc_errors += ei_inb_p(ioaddr + EN0_COUNTER1); |
898 | ei_local->stat.rx_missed_errors+= ei_inb_p(ioaddr + EN0_COUNTER2); | 898 | dev->stats.rx_missed_errors+= ei_inb_p(ioaddr + EN0_COUNTER2); |
899 | spin_unlock_irqrestore(&ei_local->page_lock, flags); | 899 | spin_unlock_irqrestore(&ei_local->page_lock, flags); |
900 | 900 | ||
901 | return &ei_local->stat; | 901 | return &dev->stats; |
902 | } | 902 | } |
903 | 903 | ||
904 | /* | 904 | /* |