Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netwave: convert to internal net_device_stats

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Hemminger and committed by
David S. Miller
f56ef16e 7dd0b6e0

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