diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-03-20 15:36:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-22 01:43:56 -0400 |
commit | f56ef16eb0c30bf76acf7c2ac9ee68781a7aef6a (patch) | |
tree | 01c596e40a6c015033241b402c0651d9afc2ee45 /drivers/net/wireless | |
parent | 7dd0b6e0feca6cd4269e120d63c46eeb63164ca2 (diff) |
netwave: convert to internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/netwave_cs.c | 72 |
1 files changed, 14 insertions, 58 deletions
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 24caec6caf1f..9e7e37f5cdcb 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -210,10 +210,6 @@ static int netwave_rx( struct net_device *dev); | |||
210 | static irqreturn_t netwave_interrupt(int irq, void *dev_id); | 210 | static irqreturn_t netwave_interrupt(int irq, void *dev_id); |
211 | static void netwave_watchdog(struct net_device *); | 211 | static void netwave_watchdog(struct net_device *); |
212 | 212 | ||
213 | /* Statistics */ | ||
214 | static void update_stats(struct net_device *dev); | ||
215 | static struct net_device_stats *netwave_get_stats(struct net_device *dev); | ||
216 | |||
217 | /* Wireless extensions */ | 213 | /* Wireless extensions */ |
218 | static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev); | 214 | static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev); |
219 | 215 | ||
@@ -275,14 +271,9 @@ typedef struct netwave_private { | |||
275 | int lastExec; | 271 | int lastExec; |
276 | struct timer_list watchdog; /* To avoid blocking state */ | 272 | struct timer_list watchdog; /* To avoid blocking state */ |
277 | struct site_survey nss; | 273 | struct site_survey nss; |
278 | struct net_device_stats stats; | ||
279 | struct iw_statistics iw_stats; /* Wireless stats */ | 274 | struct iw_statistics iw_stats; /* Wireless stats */ |
280 | } netwave_private; | 275 | } netwave_private; |
281 | 276 | ||
282 | #ifdef NETWAVE_STATS | ||
283 | static struct net_device_stats *netwave_get_stats(struct net_device *dev); | ||
284 | #endif | ||
285 | |||
286 | /* | 277 | /* |
287 | * The Netwave card is little-endian, so won't work for big endian | 278 | * The Netwave card is little-endian, so won't work for big endian |
288 | * systems. | 279 | * systems. |
@@ -413,7 +404,6 @@ static int netwave_probe(struct pcmcia_device *link) | |||
413 | 404 | ||
414 | /* Netwave specific entries in the device structure */ | 405 | /* Netwave specific entries in the device structure */ |
415 | dev->hard_start_xmit = &netwave_start_xmit; | 406 | dev->hard_start_xmit = &netwave_start_xmit; |
416 | dev->get_stats = &netwave_get_stats; | ||
417 | dev->set_multicast_list = &set_multicast_list; | 407 | dev->set_multicast_list = &set_multicast_list; |
418 | /* wireless extensions */ | 408 | /* wireless extensions */ |
419 | dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def; | 409 | dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def; |
@@ -988,7 +978,7 @@ static int netwave_hw_xmit(unsigned char* data, int len, | |||
988 | return 1; | 978 | return 1; |
989 | } | 979 | } |
990 | 980 | ||
991 | priv->stats.tx_bytes += len; | 981 | dev->stats.tx_bytes += len; |
992 | 982 | ||
993 | DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", | 983 | DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", |
994 | readb(ramBase + NETWAVE_EREG_SPCQ), | 984 | readb(ramBase + NETWAVE_EREG_SPCQ), |
@@ -1107,11 +1097,11 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1107 | rser = readb(ramBase + NETWAVE_EREG_RSER); | 1097 | rser = readb(ramBase + NETWAVE_EREG_RSER); |
1108 | 1098 | ||
1109 | if (rser & 0x04) { | 1099 | if (rser & 0x04) { |
1110 | ++priv->stats.rx_dropped; | 1100 | ++dev->stats.rx_dropped; |
1111 | ++priv->stats.rx_crc_errors; | 1101 | ++dev->stats.rx_crc_errors; |
1112 | } | 1102 | } |
1113 | if (rser & 0x02) | 1103 | if (rser & 0x02) |
1114 | ++priv->stats.rx_frame_errors; | 1104 | ++dev->stats.rx_frame_errors; |
1115 | 1105 | ||
1116 | /* Clear the RxErr bit in RSER. RSER+4 is the | 1106 | /* Clear the RxErr bit in RSER. RSER+4 is the |
1117 | * write part. Also clear the RxCRC (0x04) and | 1107 | * write part. Also clear the RxCRC (0x04) and |
@@ -1125,8 +1115,8 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1125 | wait_WOC(iobase); | 1115 | wait_WOC(iobase); |
1126 | writeb(0x40, ramBase + NETWAVE_EREG_ASCC); | 1116 | writeb(0x40, ramBase + NETWAVE_EREG_ASCC); |
1127 | 1117 | ||
1128 | /* Remember to count up priv->stats on error packets */ | 1118 | /* Remember to count up dev->stats on error packets */ |
1129 | ++priv->stats.rx_errors; | 1119 | ++dev->stats.rx_errors; |
1130 | } | 1120 | } |
1131 | /* TxDN */ | 1121 | /* TxDN */ |
1132 | if (status & 0x20) { | 1122 | if (status & 0x20) { |
@@ -1140,17 +1130,17 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1140 | /* Transmitting was okay, clear bits */ | 1130 | /* Transmitting was okay, clear bits */ |
1141 | wait_WOC(iobase); | 1131 | wait_WOC(iobase); |
1142 | writeb(0x2f, ramBase + NETWAVE_EREG_TSER + 4); | 1132 | writeb(0x2f, ramBase + NETWAVE_EREG_TSER + 4); |
1143 | ++priv->stats.tx_packets; | 1133 | ++dev->stats.tx_packets; |
1144 | } | 1134 | } |
1145 | 1135 | ||
1146 | if (txStatus & 0xd0) { | 1136 | if (txStatus & 0xd0) { |
1147 | if (txStatus & 0x80) { | 1137 | if (txStatus & 0x80) { |
1148 | ++priv->stats.collisions; /* Because of /proc/net/dev*/ | 1138 | ++dev->stats.collisions; /* Because of /proc/net/dev*/ |
1149 | /* ++priv->stats.tx_aborted_errors; */ | 1139 | /* ++dev->stats.tx_aborted_errors; */ |
1150 | /* printk("Collision. %ld\n", jiffies - dev->trans_start); */ | 1140 | /* printk("Collision. %ld\n", jiffies - dev->trans_start); */ |
1151 | } | 1141 | } |
1152 | if (txStatus & 0x40) | 1142 | if (txStatus & 0x40) |
1153 | ++priv->stats.tx_carrier_errors; | 1143 | ++dev->stats.tx_carrier_errors; |
1154 | /* 0x80 TxGU Transmit giveup - nine times and no luck | 1144 | /* 0x80 TxGU Transmit giveup - nine times and no luck |
1155 | * 0x40 TxNOAP No access point. Discarded packet. | 1145 | * 0x40 TxNOAP No access point. Discarded packet. |
1156 | * 0x10 TxErr Transmit error. Always set when | 1146 | * 0x10 TxErr Transmit error. Always set when |
@@ -1163,7 +1153,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1163 | /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ | 1153 | /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ |
1164 | wait_WOC(iobase); | 1154 | wait_WOC(iobase); |
1165 | writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); | 1155 | writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); |
1166 | ++priv->stats.tx_errors; | 1156 | ++dev->stats.tx_errors; |
1167 | } | 1157 | } |
1168 | DEBUG(3, "New status is TSER %x ASR %x\n", | 1158 | DEBUG(3, "New status is TSER %x ASR %x\n", |
1169 | readb(ramBase + NETWAVE_EREG_TSER), | 1159 | readb(ramBase + NETWAVE_EREG_TSER), |
@@ -1197,40 +1187,6 @@ static void netwave_watchdog(struct net_device *dev) { | |||
1197 | netif_wake_queue(dev); | 1187 | netif_wake_queue(dev); |
1198 | } /* netwave_watchdog */ | 1188 | } /* netwave_watchdog */ |
1199 | 1189 | ||
1200 | static struct net_device_stats *netwave_get_stats(struct net_device *dev) { | ||
1201 | netwave_private *priv = netdev_priv(dev); | ||
1202 | |||
1203 | update_stats(dev); | ||
1204 | |||
1205 | DEBUG(2, "netwave: SPCQ %x SPU %x LIF %x ISPLQ %x MHS %x rxtx %x" | ||
1206 | " %x tx %x %x %x %x\n", | ||
1207 | readb(priv->ramBase + NETWAVE_EREG_SPCQ), | ||
1208 | readb(priv->ramBase + NETWAVE_EREG_SPU), | ||
1209 | readb(priv->ramBase + NETWAVE_EREG_LIF), | ||
1210 | readb(priv->ramBase + NETWAVE_EREG_ISPLQ), | ||
1211 | readb(priv->ramBase + NETWAVE_EREG_MHS), | ||
1212 | readb(priv->ramBase + NETWAVE_EREG_EC + 0xe), | ||
1213 | readb(priv->ramBase + NETWAVE_EREG_EC + 0xf), | ||
1214 | readb(priv->ramBase + NETWAVE_EREG_EC + 0x18), | ||
1215 | readb(priv->ramBase + NETWAVE_EREG_EC + 0x19), | ||
1216 | readb(priv->ramBase + NETWAVE_EREG_EC + 0x1a), | ||
1217 | readb(priv->ramBase + NETWAVE_EREG_EC + 0x1b)); | ||
1218 | |||
1219 | return &priv->stats; | ||
1220 | } | ||
1221 | |||
1222 | static void update_stats(struct net_device *dev) { | ||
1223 | //unsigned long flags; | ||
1224 | /* netwave_private *priv = netdev_priv(dev); */ | ||
1225 | |||
1226 | //spin_lock_irqsave(&priv->spinlock, flags); | ||
1227 | |||
1228 | /* priv->stats.rx_packets = readb(priv->ramBase + 0x18e); | ||
1229 | priv->stats.tx_packets = readb(priv->ramBase + 0x18f); */ | ||
1230 | |||
1231 | //spin_unlock_irqrestore(&priv->spinlock, flags); | ||
1232 | } | ||
1233 | |||
1234 | static int netwave_rx(struct net_device *dev) | 1190 | static int netwave_rx(struct net_device *dev) |
1235 | { | 1191 | { |
1236 | netwave_private *priv = netdev_priv(dev); | 1192 | netwave_private *priv = netdev_priv(dev); |
@@ -1274,7 +1230,7 @@ static int netwave_rx(struct net_device *dev) | |||
1274 | if (skb == NULL) { | 1230 | if (skb == NULL) { |
1275 | DEBUG(1, "netwave_rx: Could not allocate an sk_buff of " | 1231 | DEBUG(1, "netwave_rx: Could not allocate an sk_buff of " |
1276 | "length %d\n", rcvLen); | 1232 | "length %d\n", rcvLen); |
1277 | ++priv->stats.rx_dropped; | 1233 | ++dev->stats.rx_dropped; |
1278 | /* Tell the adapter to skip the packet */ | 1234 | /* Tell the adapter to skip the packet */ |
1279 | wait_WOC(iobase); | 1235 | wait_WOC(iobase); |
1280 | writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); | 1236 | writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); |
@@ -1307,8 +1263,8 @@ static int netwave_rx(struct net_device *dev) | |||
1307 | /* Queue packet for network layer */ | 1263 | /* Queue packet for network layer */ |
1308 | netif_rx(skb); | 1264 | netif_rx(skb); |
1309 | 1265 | ||
1310 | priv->stats.rx_packets++; | 1266 | dev->stats.rx_packets++; |
1311 | priv->stats.rx_bytes += rcvLen; | 1267 | dev->stats.rx_bytes += rcvLen; |
1312 | 1268 | ||
1313 | /* Got the packet, tell the adapter to skip it */ | 1269 | /* Got the packet, tell the adapter to skip it */ |
1314 | wait_WOC(iobase); | 1270 | wait_WOC(iobase); |