diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-04-29 18:08:26 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-13 01:35:24 -0400 |
commit | 2e8d31d574e26ded7688fb1f5c6a2349c9d427d1 (patch) | |
tree | 80a99ced17558d43bf7d64c2bd70411218afd980 /drivers/net/pcmcia/3c574_cs.c | |
parent | e1eac92e4cea32b5254d0b835de16d11e589502c (diff) |
3c574_cs: 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/pcmcia/3c574_cs.c')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 3b78a3819bb3..7112fd5e0e1b 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -208,7 +208,6 @@ enum Window4 { /* Window 4: Xcvr/media bits. */ | |||
208 | struct el3_private { | 208 | struct el3_private { |
209 | struct pcmcia_device *p_dev; | 209 | struct pcmcia_device *p_dev; |
210 | dev_node_t node; | 210 | dev_node_t node; |
211 | struct net_device_stats stats; | ||
212 | u16 advertising, partner; /* NWay media advertisement */ | 211 | u16 advertising, partner; /* NWay media advertisement */ |
213 | unsigned char phys; /* MII device address */ | 212 | unsigned char phys; /* MII device address */ |
214 | unsigned int autoselect:1, default_media:3; /* Read from the EEPROM/Wn3_Config. */ | 213 | unsigned int autoselect:1, default_media:3; /* Read from the EEPROM/Wn3_Config. */ |
@@ -741,12 +740,11 @@ static int el3_open(struct net_device *dev) | |||
741 | 740 | ||
742 | static void el3_tx_timeout(struct net_device *dev) | 741 | static void el3_tx_timeout(struct net_device *dev) |
743 | { | 742 | { |
744 | struct el3_private *lp = netdev_priv(dev); | ||
745 | unsigned int ioaddr = dev->base_addr; | 743 | unsigned int ioaddr = dev->base_addr; |
746 | 744 | ||
747 | printk(KERN_NOTICE "%s: Transmit timed out!\n", dev->name); | 745 | printk(KERN_NOTICE "%s: Transmit timed out!\n", dev->name); |
748 | dump_status(dev); | 746 | dump_status(dev); |
749 | lp->stats.tx_errors++; | 747 | dev->stats.tx_errors++; |
750 | dev->trans_start = jiffies; | 748 | dev->trans_start = jiffies; |
751 | /* Issue TX_RESET and TX_START commands. */ | 749 | /* Issue TX_RESET and TX_START commands. */ |
752 | tc574_wait_for_completion(dev, TxReset); | 750 | tc574_wait_for_completion(dev, TxReset); |
@@ -756,7 +754,6 @@ static void el3_tx_timeout(struct net_device *dev) | |||
756 | 754 | ||
757 | static void pop_tx_status(struct net_device *dev) | 755 | static void pop_tx_status(struct net_device *dev) |
758 | { | 756 | { |
759 | struct el3_private *lp = netdev_priv(dev); | ||
760 | unsigned int ioaddr = dev->base_addr; | 757 | unsigned int ioaddr = dev->base_addr; |
761 | int i; | 758 | int i; |
762 | 759 | ||
@@ -772,7 +769,7 @@ static void pop_tx_status(struct net_device *dev) | |||
772 | DEBUG(1, "%s: transmit error: status 0x%02x\n", | 769 | DEBUG(1, "%s: transmit error: status 0x%02x\n", |
773 | dev->name, tx_status); | 770 | dev->name, tx_status); |
774 | outw(TxEnable, ioaddr + EL3_CMD); | 771 | outw(TxEnable, ioaddr + EL3_CMD); |
775 | lp->stats.tx_aborted_errors++; | 772 | dev->stats.tx_aborted_errors++; |
776 | } | 773 | } |
777 | outb(0x00, ioaddr + TxStatus); /* Pop the status stack. */ | 774 | outb(0x00, ioaddr + TxStatus); /* Pop the status stack. */ |
778 | } | 775 | } |
@@ -987,7 +984,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev) | |||
987 | update_stats(dev); | 984 | update_stats(dev); |
988 | spin_unlock_irqrestore(&lp->window_lock, flags); | 985 | spin_unlock_irqrestore(&lp->window_lock, flags); |
989 | } | 986 | } |
990 | return &lp->stats; | 987 | return &dev->stats; |
991 | } | 988 | } |
992 | 989 | ||
993 | /* Update statistics. | 990 | /* Update statistics. |
@@ -996,7 +993,6 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev) | |||
996 | */ | 993 | */ |
997 | static void update_stats(struct net_device *dev) | 994 | static void update_stats(struct net_device *dev) |
998 | { | 995 | { |
999 | struct el3_private *lp = netdev_priv(dev); | ||
1000 | unsigned int ioaddr = dev->base_addr; | 996 | unsigned int ioaddr = dev->base_addr; |
1001 | u8 rx, tx, up; | 997 | u8 rx, tx, up; |
1002 | 998 | ||
@@ -1008,15 +1004,15 @@ static void update_stats(struct net_device *dev) | |||
1008 | /* Unlike the 3c509 we need not turn off stats updates while reading. */ | 1004 | /* Unlike the 3c509 we need not turn off stats updates while reading. */ |
1009 | /* Switch to the stats window, and read everything. */ | 1005 | /* Switch to the stats window, and read everything. */ |
1010 | EL3WINDOW(6); | 1006 | EL3WINDOW(6); |
1011 | lp->stats.tx_carrier_errors += inb(ioaddr + 0); | 1007 | dev->stats.tx_carrier_errors += inb(ioaddr + 0); |
1012 | lp->stats.tx_heartbeat_errors += inb(ioaddr + 1); | 1008 | dev->stats.tx_heartbeat_errors += inb(ioaddr + 1); |
1013 | /* Multiple collisions. */ inb(ioaddr + 2); | 1009 | /* Multiple collisions. */ inb(ioaddr + 2); |
1014 | lp->stats.collisions += inb(ioaddr + 3); | 1010 | dev->stats.collisions += inb(ioaddr + 3); |
1015 | lp->stats.tx_window_errors += inb(ioaddr + 4); | 1011 | dev->stats.tx_window_errors += inb(ioaddr + 4); |
1016 | lp->stats.rx_fifo_errors += inb(ioaddr + 5); | 1012 | dev->stats.rx_fifo_errors += inb(ioaddr + 5); |
1017 | lp->stats.tx_packets += inb(ioaddr + 6); | 1013 | dev->stats.tx_packets += inb(ioaddr + 6); |
1018 | up = inb(ioaddr + 9); | 1014 | up = inb(ioaddr + 9); |
1019 | lp->stats.tx_packets += (up&0x30) << 4; | 1015 | dev->stats.tx_packets += (up&0x30) << 4; |
1020 | /* Rx packets */ inb(ioaddr + 7); | 1016 | /* Rx packets */ inb(ioaddr + 7); |
1021 | /* Tx deferrals */ inb(ioaddr + 8); | 1017 | /* Tx deferrals */ inb(ioaddr + 8); |
1022 | rx = inw(ioaddr + 10); | 1018 | rx = inw(ioaddr + 10); |
@@ -1026,14 +1022,13 @@ static void update_stats(struct net_device *dev) | |||
1026 | /* BadSSD */ inb(ioaddr + 12); | 1022 | /* BadSSD */ inb(ioaddr + 12); |
1027 | up = inb(ioaddr + 13); | 1023 | up = inb(ioaddr + 13); |
1028 | 1024 | ||
1029 | lp->stats.tx_bytes += tx + ((up & 0xf0) << 12); | 1025 | dev->stats.tx_bytes += tx + ((up & 0xf0) << 12); |
1030 | 1026 | ||
1031 | EL3WINDOW(1); | 1027 | EL3WINDOW(1); |
1032 | } | 1028 | } |
1033 | 1029 | ||
1034 | static int el3_rx(struct net_device *dev, int worklimit) | 1030 | static int el3_rx(struct net_device *dev, int worklimit) |
1035 | { | 1031 | { |
1036 | struct el3_private *lp = netdev_priv(dev); | ||
1037 | unsigned int ioaddr = dev->base_addr; | 1032 | unsigned int ioaddr = dev->base_addr; |
1038 | short rx_status; | 1033 | short rx_status; |
1039 | 1034 | ||
@@ -1043,14 +1038,14 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
1043 | (--worklimit >= 0)) { | 1038 | (--worklimit >= 0)) { |
1044 | if (rx_status & 0x4000) { /* Error, update stats. */ | 1039 | if (rx_status & 0x4000) { /* Error, update stats. */ |
1045 | short error = rx_status & 0x3800; | 1040 | short error = rx_status & 0x3800; |
1046 | lp->stats.rx_errors++; | 1041 | dev->stats.rx_errors++; |
1047 | switch (error) { | 1042 | switch (error) { |
1048 | case 0x0000: lp->stats.rx_over_errors++; break; | 1043 | case 0x0000: dev->stats.rx_over_errors++; break; |
1049 | case 0x0800: lp->stats.rx_length_errors++; break; | 1044 | case 0x0800: dev->stats.rx_length_errors++; break; |
1050 | case 0x1000: lp->stats.rx_frame_errors++; break; | 1045 | case 0x1000: dev->stats.rx_frame_errors++; break; |
1051 | case 0x1800: lp->stats.rx_length_errors++; break; | 1046 | case 0x1800: dev->stats.rx_length_errors++; break; |
1052 | case 0x2000: lp->stats.rx_frame_errors++; break; | 1047 | case 0x2000: dev->stats.rx_frame_errors++; break; |
1053 | case 0x2800: lp->stats.rx_crc_errors++; break; | 1048 | case 0x2800: dev->stats.rx_crc_errors++; break; |
1054 | } | 1049 | } |
1055 | } else { | 1050 | } else { |
1056 | short pkt_len = rx_status & 0x7ff; | 1051 | short pkt_len = rx_status & 0x7ff; |
@@ -1067,12 +1062,12 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
1067 | skb->protocol = eth_type_trans(skb, dev); | 1062 | skb->protocol = eth_type_trans(skb, dev); |
1068 | netif_rx(skb); | 1063 | netif_rx(skb); |
1069 | dev->last_rx = jiffies; | 1064 | dev->last_rx = jiffies; |
1070 | lp->stats.rx_packets++; | 1065 | dev->stats.rx_packets++; |
1071 | lp->stats.rx_bytes += pkt_len; | 1066 | dev->stats.rx_bytes += pkt_len; |
1072 | } else { | 1067 | } else { |
1073 | DEBUG(1, "%s: couldn't allocate a sk_buff of" | 1068 | DEBUG(1, "%s: couldn't allocate a sk_buff of" |
1074 | " size %d.\n", dev->name, pkt_len); | 1069 | " size %d.\n", dev->name, pkt_len); |
1075 | lp->stats.rx_dropped++; | 1070 | dev->stats.rx_dropped++; |
1076 | } | 1071 | } |
1077 | } | 1072 | } |
1078 | tc574_wait_for_completion(dev, RxDiscard); | 1073 | tc574_wait_for_completion(dev, RxDiscard); |