Commit 038eddd9acf34e8202b31af3ee9eb48179114323
Committed by
Linus Torvalds
1 parent
f30828a674
Exists in
master
and in
7 other branches
ariadne: 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: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 22 additions and 25 deletions Side-by-side Diff
drivers/net/ariadne.c
... | ... | @@ -98,7 +98,6 @@ |
98 | 98 | volatile u_short *rx_buff[RX_RING_SIZE]; |
99 | 99 | int cur_tx, cur_rx; /* The next free ring entry */ |
100 | 100 | int dirty_tx; /* The ring entries to be free()ed. */ |
101 | - struct net_device_stats stats; | |
102 | 101 | char tx_full; |
103 | 102 | }; |
104 | 103 | |
105 | 104 | |
106 | 105 | |
... | ... | @@ -378,20 +377,19 @@ |
378 | 377 | |
379 | 378 | static int ariadne_close(struct net_device *dev) |
380 | 379 | { |
381 | - struct ariadne_private *priv = netdev_priv(dev); | |
382 | 380 | volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr; |
383 | 381 | |
384 | 382 | netif_stop_queue(dev); |
385 | 383 | |
386 | 384 | lance->RAP = CSR112; /* Missed Frame Count */ |
387 | - priv->stats.rx_missed_errors = swapw(lance->RDP); | |
385 | + dev->stats.rx_missed_errors = swapw(lance->RDP); | |
388 | 386 | lance->RAP = CSR0; /* PCnet-ISA Controller Status */ |
389 | 387 | |
390 | 388 | if (ariadne_debug > 1) { |
391 | 389 | printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n", |
392 | 390 | dev->name, lance->RDP); |
393 | 391 | printk(KERN_DEBUG "%s: %lu packets missed\n", dev->name, |
394 | - priv->stats.rx_missed_errors); | |
392 | + dev->stats.rx_missed_errors); | |
395 | 393 | } |
396 | 394 | |
397 | 395 | /* We stop the LANCE here -- it occasionally polls memory if we don't. */ |
398 | 396 | |
399 | 397 | |
400 | 398 | |
401 | 399 | |
... | ... | @@ -502,16 +500,16 @@ |
502 | 500 | if (status & TF_ERR) { |
503 | 501 | /* There was an major error, log it. */ |
504 | 502 | int err_status = priv->tx_ring[entry]->TMD3; |
505 | - priv->stats.tx_errors++; | |
503 | + dev->stats.tx_errors++; | |
506 | 504 | if (err_status & EF_RTRY) |
507 | - priv->stats.tx_aborted_errors++; | |
505 | + dev->stats.tx_aborted_errors++; | |
508 | 506 | if (err_status & EF_LCAR) |
509 | - priv->stats.tx_carrier_errors++; | |
507 | + dev->stats.tx_carrier_errors++; | |
510 | 508 | if (err_status & EF_LCOL) |
511 | - priv->stats.tx_window_errors++; | |
509 | + dev->stats.tx_window_errors++; | |
512 | 510 | if (err_status & EF_UFLO) { |
513 | 511 | /* Ackk! On FIFO errors the Tx unit is turned off! */ |
514 | - priv->stats.tx_fifo_errors++; | |
512 | + dev->stats.tx_fifo_errors++; | |
515 | 513 | /* Remove this verbosity later! */ |
516 | 514 | printk(KERN_ERR "%s: Tx FIFO error! Status %4.4x.\n", |
517 | 515 | dev->name, csr0); |
... | ... | @@ -520,8 +518,8 @@ |
520 | 518 | } |
521 | 519 | } else { |
522 | 520 | if (status & (TF_MORE|TF_ONE)) |
523 | - priv->stats.collisions++; | |
524 | - priv->stats.tx_packets++; | |
521 | + dev->stats.collisions++; | |
522 | + dev->stats.tx_packets++; | |
525 | 523 | } |
526 | 524 | dirty_tx++; |
527 | 525 | } |
528 | 526 | |
... | ... | @@ -547,11 +545,11 @@ |
547 | 545 | /* Log misc errors. */ |
548 | 546 | if (csr0 & BABL) { |
549 | 547 | handled = 1; |
550 | - priv->stats.tx_errors++; /* Tx babble. */ | |
548 | + dev->stats.tx_errors++; /* Tx babble. */ | |
551 | 549 | } |
552 | 550 | if (csr0 & MISS) { |
553 | 551 | handled = 1; |
554 | - priv->stats.rx_errors++; /* Missed a Rx frame. */ | |
552 | + dev->stats.rx_errors++; /* Missed a Rx frame. */ | |
555 | 553 | } |
556 | 554 | if (csr0 & MERR) { |
557 | 555 | handled = 1; |
... | ... | @@ -672,7 +670,7 @@ |
672 | 670 | priv->cur_tx -= TX_RING_SIZE; |
673 | 671 | priv->dirty_tx -= TX_RING_SIZE; |
674 | 672 | } |
675 | - priv->stats.tx_bytes += len; | |
673 | + dev->stats.tx_bytes += len; | |
676 | 674 | |
677 | 675 | /* Trigger an immediate send poll. */ |
678 | 676 | lance->RAP = CSR0; /* PCnet-ISA Controller Status */ |
679 | 677 | |
680 | 678 | |
681 | 679 | |
682 | 680 | |
... | ... | @@ -707,15 +705,15 @@ |
707 | 705 | buffers, with only the last correctly noting the error. */ |
708 | 706 | if (status & RF_ENP) |
709 | 707 | /* Only count a general error at the end of a packet.*/ |
710 | - priv->stats.rx_errors++; | |
708 | + dev->stats.rx_errors++; | |
711 | 709 | if (status & RF_FRAM) |
712 | - priv->stats.rx_frame_errors++; | |
710 | + dev->stats.rx_frame_errors++; | |
713 | 711 | if (status & RF_OFLO) |
714 | - priv->stats.rx_over_errors++; | |
712 | + dev->stats.rx_over_errors++; | |
715 | 713 | if (status & RF_CRC) |
716 | - priv->stats.rx_crc_errors++; | |
714 | + dev->stats.rx_crc_errors++; | |
717 | 715 | if (status & RF_BUFF) |
718 | - priv->stats.rx_fifo_errors++; | |
716 | + dev->stats.rx_fifo_errors++; | |
719 | 717 | priv->rx_ring[entry]->RMD1 &= 0xff00|RF_STP|RF_ENP; |
720 | 718 | } else { |
721 | 719 | /* Malloc up new buffer, compatible with net-3. */ |
... | ... | @@ -731,7 +729,7 @@ |
731 | 729 | break; |
732 | 730 | |
733 | 731 | if (i > RX_RING_SIZE-2) { |
734 | - priv->stats.rx_dropped++; | |
732 | + dev->stats.rx_dropped++; | |
735 | 733 | priv->rx_ring[entry]->RMD1 |= RF_OWN; |
736 | 734 | priv->cur_rx++; |
737 | 735 | } |
... | ... | @@ -764,8 +762,8 @@ |
764 | 762 | |
765 | 763 | netif_rx(skb); |
766 | 764 | dev->last_rx = jiffies; |
767 | - priv->stats.rx_packets++; | |
768 | - priv->stats.rx_bytes += pkt_len; | |
765 | + dev->stats.rx_packets++; | |
766 | + dev->stats.rx_bytes += pkt_len; | |
769 | 767 | } |
770 | 768 | |
771 | 769 | priv->rx_ring[entry]->RMD1 |= RF_OWN; |
... | ... | @@ -783,7 +781,6 @@ |
783 | 781 | |
784 | 782 | static struct net_device_stats *ariadne_get_stats(struct net_device *dev) |
785 | 783 | { |
786 | - struct ariadne_private *priv = netdev_priv(dev); | |
787 | 784 | volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr; |
788 | 785 | short saved_addr; |
789 | 786 | unsigned long flags; |
790 | 787 | |
... | ... | @@ -791,11 +788,11 @@ |
791 | 788 | local_irq_save(flags); |
792 | 789 | saved_addr = lance->RAP; |
793 | 790 | lance->RAP = CSR112; /* Missed Frame Count */ |
794 | - priv->stats.rx_missed_errors = swapw(lance->RDP); | |
791 | + dev->stats.rx_missed_errors = swapw(lance->RDP); | |
795 | 792 | lance->RAP = saved_addr; |
796 | 793 | local_irq_restore(flags); |
797 | 794 | |
798 | - return &priv->stats; | |
795 | + return &dev->stats; | |
799 | 796 | } |
800 | 797 | |
801 | 798 |