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