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

3c515: 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>

authored by

Paulius Zaleckas and committed by
Jeff Garzik
dfd44151 815f8802

+30 -34
+30 -34
drivers/net/3c515.c
··· 310 310 struct sk_buff *tx_skbuff[TX_RING_SIZE]; 311 311 unsigned int cur_rx, cur_tx; /* The next free ring entry */ 312 312 unsigned int dirty_rx, dirty_tx;/* The ring entries to be free()ed. */ 313 - struct net_device_stats stats; 314 313 struct sk_buff *tx_skb; /* Packet being eaten by bus master ctrl. */ 315 314 struct timer_list timer; /* Media selection timer. */ 316 315 int capabilities ; /* Adapter capabilities word. */ ··· 982 983 break; 983 984 outw(TxEnable, ioaddr + EL3_CMD); 984 985 dev->trans_start = jiffies; 985 - vp->stats.tx_errors++; 986 - vp->stats.tx_dropped++; 986 + dev->stats.tx_errors++; 987 + dev->stats.tx_dropped++; 987 988 netif_wake_queue(dev); 988 989 } 989 990 ··· 1049 1050 } 1050 1051 /* Put out the doubleword header... */ 1051 1052 outl(skb->len, ioaddr + TX_FIFO); 1052 - vp->stats.tx_bytes += skb->len; 1053 + dev->stats.tx_bytes += skb->len; 1053 1054 #ifdef VORTEX_BUS_MASTER 1054 1055 if (vp->bus_master) { 1055 1056 /* Set the bus-master controller to transfer the packet. */ ··· 1093 1094 printk("%s: Tx error, status %2.2x.\n", 1094 1095 dev->name, tx_status); 1095 1096 if (tx_status & 0x04) 1096 - vp->stats.tx_fifo_errors++; 1097 + dev->stats.tx_fifo_errors++; 1097 1098 if (tx_status & 0x38) 1098 - vp->stats.tx_aborted_errors++; 1099 + dev->stats.tx_aborted_errors++; 1099 1100 if (tx_status & 0x30) { 1100 1101 int j; 1101 1102 outw(TxReset, ioaddr + EL3_CMD); ··· 1256 1257 1257 1258 static int corkscrew_rx(struct net_device *dev) 1258 1259 { 1259 - struct corkscrew_private *vp = netdev_priv(dev); 1260 1260 int ioaddr = dev->base_addr; 1261 1261 int i; 1262 1262 short rx_status; ··· 1269 1271 if (corkscrew_debug > 2) 1270 1272 printk(" Rx error: status %2.2x.\n", 1271 1273 rx_error); 1272 - vp->stats.rx_errors++; 1274 + dev->stats.rx_errors++; 1273 1275 if (rx_error & 0x01) 1274 - vp->stats.rx_over_errors++; 1276 + dev->stats.rx_over_errors++; 1275 1277 if (rx_error & 0x02) 1276 - vp->stats.rx_length_errors++; 1278 + dev->stats.rx_length_errors++; 1277 1279 if (rx_error & 0x04) 1278 - vp->stats.rx_frame_errors++; 1280 + dev->stats.rx_frame_errors++; 1279 1281 if (rx_error & 0x08) 1280 - vp->stats.rx_crc_errors++; 1282 + dev->stats.rx_crc_errors++; 1281 1283 if (rx_error & 0x10) 1282 - vp->stats.rx_length_errors++; 1284 + dev->stats.rx_length_errors++; 1283 1285 } else { 1284 1286 /* The packet length: up to 4.5K!. */ 1285 1287 short pkt_len = rx_status & 0x1fff; ··· 1299 1301 skb->protocol = eth_type_trans(skb, dev); 1300 1302 netif_rx(skb); 1301 1303 dev->last_rx = jiffies; 1302 - vp->stats.rx_packets++; 1303 - vp->stats.rx_bytes += pkt_len; 1304 + dev->stats.rx_packets++; 1305 + dev->stats.rx_bytes += pkt_len; 1304 1306 /* Wait a limited time to go to next packet. */ 1305 1307 for (i = 200; i >= 0; i--) 1306 1308 if (! (inw(ioaddr + EL3_STATUS) & CmdInProgress)) ··· 1310 1312 printk("%s: Couldn't allocate a sk_buff of size %d.\n", dev->name, pkt_len); 1311 1313 } 1312 1314 outw(RxDiscard, ioaddr + EL3_CMD); 1313 - vp->stats.rx_dropped++; 1315 + dev->stats.rx_dropped++; 1314 1316 /* Wait a limited time to skip this packet. */ 1315 1317 for (i = 200; i >= 0; i--) 1316 1318 if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress)) ··· 1335 1337 if (corkscrew_debug > 2) 1336 1338 printk(" Rx error: status %2.2x.\n", 1337 1339 rx_error); 1338 - vp->stats.rx_errors++; 1340 + dev->stats.rx_errors++; 1339 1341 if (rx_error & 0x01) 1340 - vp->stats.rx_over_errors++; 1342 + dev->stats.rx_over_errors++; 1341 1343 if (rx_error & 0x02) 1342 - vp->stats.rx_length_errors++; 1344 + dev->stats.rx_length_errors++; 1343 1345 if (rx_error & 0x04) 1344 - vp->stats.rx_frame_errors++; 1346 + dev->stats.rx_frame_errors++; 1345 1347 if (rx_error & 0x08) 1346 - vp->stats.rx_crc_errors++; 1348 + dev->stats.rx_crc_errors++; 1347 1349 if (rx_error & 0x10) 1348 - vp->stats.rx_length_errors++; 1350 + dev->stats.rx_length_errors++; 1349 1351 } else { 1350 1352 /* The packet length: up to 4.5K!. */ 1351 1353 short pkt_len = rx_status & 0x1fff; 1352 1354 struct sk_buff *skb; 1353 1355 1354 - vp->stats.rx_bytes += pkt_len; 1356 + dev->stats.rx_bytes += pkt_len; 1355 1357 if (corkscrew_debug > 4) 1356 1358 printk("Receiving packet size %d status %4.4x.\n", 1357 1359 pkt_len, rx_status); ··· 1386 1388 skb->protocol = eth_type_trans(skb, dev); 1387 1389 netif_rx(skb); 1388 1390 dev->last_rx = jiffies; 1389 - vp->stats.rx_packets++; 1391 + dev->stats.rx_packets++; 1390 1392 } 1391 1393 entry = (++vp->cur_rx) % RX_RING_SIZE; 1392 1394 } ··· 1473 1475 update_stats(dev->base_addr, dev); 1474 1476 spin_unlock_irqrestore(&vp->lock, flags); 1475 1477 } 1476 - return &vp->stats; 1478 + return &dev->stats; 1477 1479 } 1478 1480 1479 1481 /* Update statistics. ··· 1485 1487 */ 1486 1488 static void update_stats(int ioaddr, struct net_device *dev) 1487 1489 { 1488 - struct corkscrew_private *vp = netdev_priv(dev); 1489 - 1490 1490 /* Unlike the 3c5x9 we need not turn off stats updates while reading. */ 1491 1491 /* Switch to the stats window, and read everything. */ 1492 1492 EL3WINDOW(6); 1493 - vp->stats.tx_carrier_errors += inb(ioaddr + 0); 1494 - vp->stats.tx_heartbeat_errors += inb(ioaddr + 1); 1493 + dev->stats.tx_carrier_errors += inb(ioaddr + 0); 1494 + dev->stats.tx_heartbeat_errors += inb(ioaddr + 1); 1495 1495 /* Multiple collisions. */ inb(ioaddr + 2); 1496 - vp->stats.collisions += inb(ioaddr + 3); 1497 - vp->stats.tx_window_errors += inb(ioaddr + 4); 1498 - vp->stats.rx_fifo_errors += inb(ioaddr + 5); 1499 - vp->stats.tx_packets += inb(ioaddr + 6); 1500 - vp->stats.tx_packets += (inb(ioaddr + 9) & 0x30) << 4; 1496 + dev->stats.collisions += inb(ioaddr + 3); 1497 + dev->stats.tx_window_errors += inb(ioaddr + 4); 1498 + dev->stats.rx_fifo_errors += inb(ioaddr + 5); 1499 + dev->stats.tx_packets += inb(ioaddr + 6); 1500 + dev->stats.tx_packets += (inb(ioaddr + 9) & 0x30) << 4; 1501 1501 /* Rx packets */ inb(ioaddr + 7); 1502 1502 /* Must read to clear */ 1503 1503 /* Tx deferrals */ inb(ioaddr + 8);