aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c589_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/3c589_cs.c')
-rw-r--r--drivers/net/pcmcia/3c589_cs.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 1b1abb19c911..549a64558420 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -107,7 +107,6 @@ enum RxFilter {
107struct el3_private { 107struct el3_private {
108 struct pcmcia_device *p_dev; 108 struct pcmcia_device *p_dev;
109 dev_node_t node; 109 dev_node_t node;
110 struct net_device_stats stats;
111 /* For transceiver monitoring */ 110 /* For transceiver monitoring */
112 struct timer_list media; 111 struct timer_list media;
113 u16 media_status; 112 u16 media_status;
@@ -566,12 +565,11 @@ static int el3_open(struct net_device *dev)
566 565
567static void el3_tx_timeout(struct net_device *dev) 566static void el3_tx_timeout(struct net_device *dev)
568{ 567{
569 struct el3_private *lp = netdev_priv(dev);
570 unsigned int ioaddr = dev->base_addr; 568 unsigned int ioaddr = dev->base_addr;
571 569
572 printk(KERN_WARNING "%s: Transmit timed out!\n", dev->name); 570 printk(KERN_WARNING "%s: Transmit timed out!\n", dev->name);
573 dump_status(dev); 571 dump_status(dev);
574 lp->stats.tx_errors++; 572 dev->stats.tx_errors++;
575 dev->trans_start = jiffies; 573 dev->trans_start = jiffies;
576 /* Issue TX_RESET and TX_START commands. */ 574 /* Issue TX_RESET and TX_START commands. */
577 tc589_wait_for_completion(dev, TxReset); 575 tc589_wait_for_completion(dev, TxReset);
@@ -581,7 +579,6 @@ static void el3_tx_timeout(struct net_device *dev)
581 579
582static void pop_tx_status(struct net_device *dev) 580static void pop_tx_status(struct net_device *dev)
583{ 581{
584 struct el3_private *lp = netdev_priv(dev);
585 unsigned int ioaddr = dev->base_addr; 582 unsigned int ioaddr = dev->base_addr;
586 int i; 583 int i;
587 584
@@ -596,7 +593,7 @@ static void pop_tx_status(struct net_device *dev)
596 DEBUG(1, "%s: transmit error: status 0x%02x\n", 593 DEBUG(1, "%s: transmit error: status 0x%02x\n",
597 dev->name, tx_status); 594 dev->name, tx_status);
598 outw(TxEnable, ioaddr + EL3_CMD); 595 outw(TxEnable, ioaddr + EL3_CMD);
599 lp->stats.tx_aborted_errors++; 596 dev->stats.tx_aborted_errors++;
600 } 597 }
601 outb(0x00, ioaddr + TX_STATUS); /* Pop the status stack. */ 598 outb(0x00, ioaddr + TX_STATUS); /* Pop the status stack. */
602 } 599 }
@@ -614,7 +611,7 @@ static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
614 611
615 spin_lock_irqsave(&priv->lock, flags); 612 spin_lock_irqsave(&priv->lock, flags);
616 613
617 priv->stats.tx_bytes += skb->len; 614 dev->stats.tx_bytes += skb->len;
618 615
619 /* Put out the doubleword header... */ 616 /* Put out the doubleword header... */
620 outw(skb->len, ioaddr + TX_FIFO); 617 outw(skb->len, ioaddr + TX_FIFO);
@@ -764,7 +761,7 @@ static void media_check(unsigned long arg)
764 outw(StatsDisable, ioaddr + EL3_CMD); 761 outw(StatsDisable, ioaddr + EL3_CMD);
765 errs = inb(ioaddr + 0); 762 errs = inb(ioaddr + 0);
766 outw(StatsEnable, ioaddr + EL3_CMD); 763 outw(StatsEnable, ioaddr + EL3_CMD);
767 lp->stats.tx_carrier_errors += errs; 764 dev->stats.tx_carrier_errors += errs;
768 if (errs || (lp->media_status & 0x0010)) media |= 0x0010; 765 if (errs || (lp->media_status & 0x0010)) media |= 0x0010;
769 } 766 }
770 767
@@ -814,7 +811,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
814 update_stats(dev); 811 update_stats(dev);
815 spin_unlock_irqrestore(&lp->lock, flags); 812 spin_unlock_irqrestore(&lp->lock, flags);
816 } 813 }
817 return &lp->stats; 814 return &dev->stats;
818} 815}
819 816
820/* 817/*
@@ -827,7 +824,6 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
827*/ 824*/
828static void update_stats(struct net_device *dev) 825static void update_stats(struct net_device *dev)
829{ 826{
830 struct el3_private *lp = netdev_priv(dev);
831 unsigned int ioaddr = dev->base_addr; 827 unsigned int ioaddr = dev->base_addr;
832 828
833 DEBUG(2, "%s: updating the statistics.\n", dev->name); 829 DEBUG(2, "%s: updating the statistics.\n", dev->name);
@@ -835,13 +831,13 @@ static void update_stats(struct net_device *dev)
835 outw(StatsDisable, ioaddr + EL3_CMD); 831 outw(StatsDisable, ioaddr + EL3_CMD);
836 /* Switch to the stats window, and read everything. */ 832 /* Switch to the stats window, and read everything. */
837 EL3WINDOW(6); 833 EL3WINDOW(6);
838 lp->stats.tx_carrier_errors += inb(ioaddr + 0); 834 dev->stats.tx_carrier_errors += inb(ioaddr + 0);
839 lp->stats.tx_heartbeat_errors += inb(ioaddr + 1); 835 dev->stats.tx_heartbeat_errors += inb(ioaddr + 1);
840 /* Multiple collisions. */ inb(ioaddr + 2); 836 /* Multiple collisions. */ inb(ioaddr + 2);
841 lp->stats.collisions += inb(ioaddr + 3); 837 dev->stats.collisions += inb(ioaddr + 3);
842 lp->stats.tx_window_errors += inb(ioaddr + 4); 838 dev->stats.tx_window_errors += inb(ioaddr + 4);
843 lp->stats.rx_fifo_errors += inb(ioaddr + 5); 839 dev->stats.rx_fifo_errors += inb(ioaddr + 5);
844 lp->stats.tx_packets += inb(ioaddr + 6); 840 dev->stats.tx_packets += inb(ioaddr + 6);
845 /* Rx packets */ inb(ioaddr + 7); 841 /* Rx packets */ inb(ioaddr + 7);
846 /* Tx deferrals */ inb(ioaddr + 8); 842 /* Tx deferrals */ inb(ioaddr + 8);
847 /* Rx octets */ inw(ioaddr + 10); 843 /* Rx octets */ inw(ioaddr + 10);
@@ -854,7 +850,6 @@ static void update_stats(struct net_device *dev)
854 850
855static int el3_rx(struct net_device *dev) 851static int el3_rx(struct net_device *dev)
856{ 852{
857 struct el3_private *lp = netdev_priv(dev);
858 unsigned int ioaddr = dev->base_addr; 853 unsigned int ioaddr = dev->base_addr;
859 int worklimit = 32; 854 int worklimit = 32;
860 short rx_status; 855 short rx_status;
@@ -865,14 +860,14 @@ static int el3_rx(struct net_device *dev)
865 (--worklimit >= 0)) { 860 (--worklimit >= 0)) {
866 if (rx_status & 0x4000) { /* Error, update stats. */ 861 if (rx_status & 0x4000) { /* Error, update stats. */
867 short error = rx_status & 0x3800; 862 short error = rx_status & 0x3800;
868 lp->stats.rx_errors++; 863 dev->stats.rx_errors++;
869 switch (error) { 864 switch (error) {
870 case 0x0000: lp->stats.rx_over_errors++; break; 865 case 0x0000: dev->stats.rx_over_errors++; break;
871 case 0x0800: lp->stats.rx_length_errors++; break; 866 case 0x0800: dev->stats.rx_length_errors++; break;
872 case 0x1000: lp->stats.rx_frame_errors++; break; 867 case 0x1000: dev->stats.rx_frame_errors++; break;
873 case 0x1800: lp->stats.rx_length_errors++; break; 868 case 0x1800: dev->stats.rx_length_errors++; break;
874 case 0x2000: lp->stats.rx_frame_errors++; break; 869 case 0x2000: dev->stats.rx_frame_errors++; break;
875 case 0x2800: lp->stats.rx_crc_errors++; break; 870 case 0x2800: dev->stats.rx_crc_errors++; break;
876 } 871 }
877 } else { 872 } else {
878 short pkt_len = rx_status & 0x7ff; 873 short pkt_len = rx_status & 0x7ff;
@@ -889,12 +884,12 @@ static int el3_rx(struct net_device *dev)
889 skb->protocol = eth_type_trans(skb, dev); 884 skb->protocol = eth_type_trans(skb, dev);
890 netif_rx(skb); 885 netif_rx(skb);
891 dev->last_rx = jiffies; 886 dev->last_rx = jiffies;
892 lp->stats.rx_packets++; 887 dev->stats.rx_packets++;
893 lp->stats.rx_bytes += pkt_len; 888 dev->stats.rx_bytes += pkt_len;
894 } else { 889 } else {
895 DEBUG(1, "%s: couldn't allocate a sk_buff of" 890 DEBUG(1, "%s: couldn't allocate a sk_buff of"
896 " size %d.\n", dev->name, pkt_len); 891 " size %d.\n", dev->name, pkt_len);
897 lp->stats.rx_dropped++; 892 dev->stats.rx_dropped++;
898 } 893 }
899 } 894 }
900 /* Pop the top of the Rx FIFO */ 895 /* Pop the top of the Rx FIFO */
@@ -929,7 +924,7 @@ static int el3_close(struct net_device *dev)
929 DEBUG(1, "%s: shutting down ethercard.\n", dev->name); 924 DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
930 925
931 if (pcmcia_dev_present(link)) { 926 if (pcmcia_dev_present(link)) {
932 /* Turn off statistics ASAP. We update lp->stats below. */ 927 /* Turn off statistics ASAP. We update dev->stats below. */
933 outw(StatsDisable, ioaddr + EL3_CMD); 928 outw(StatsDisable, ioaddr + EL3_CMD);
934 929
935 /* Disable the receiver and transmitter. */ 930 /* Disable the receiver and transmitter. */