aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/via-rhine.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-05-27 06:34:50 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-27 18:47:07 -0400
commit553e2335625e6c96cb6d76c0d63cfc1034747614 (patch)
tree12a772c1e31b96ee195ee87b5a71e946ae35d03d /drivers/net/via-rhine.c
parent1ce8e7b57b3a4527ef83da1c5c7bd8a6b9d87b56 (diff)
net: use netdev stats in b44, sundance, via-rhine and via-velocity
Use struct net_device_stats provided in struct net_device instead of private ones. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/via-rhine.c')
-rw-r--r--drivers/net/via-rhine.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 45daba726b66..d3489a3c4c03 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -388,7 +388,6 @@ struct rhine_private {
388 long pioaddr; 388 long pioaddr;
389 struct net_device *dev; 389 struct net_device *dev;
390 struct napi_struct napi; 390 struct napi_struct napi;
391 struct net_device_stats stats;
392 spinlock_t lock; 391 spinlock_t lock;
393 392
394 /* Frequently used values: keep some adjacent for cache effect. */ 393 /* Frequently used values: keep some adjacent for cache effect. */
@@ -1209,7 +1208,7 @@ static void rhine_tx_timeout(struct net_device *dev)
1209 enable_irq(rp->pdev->irq); 1208 enable_irq(rp->pdev->irq);
1210 1209
1211 dev->trans_start = jiffies; 1210 dev->trans_start = jiffies;
1212 rp->stats.tx_errors++; 1211 dev->stats.tx_errors++;
1213 netif_wake_queue(dev); 1212 netif_wake_queue(dev);
1214} 1213}
1215 1214
@@ -1237,7 +1236,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
1237 /* packet too long, drop it */ 1236 /* packet too long, drop it */
1238 dev_kfree_skb(skb); 1237 dev_kfree_skb(skb);
1239 rp->tx_skbuff[entry] = NULL; 1238 rp->tx_skbuff[entry] = NULL;
1240 rp->stats.tx_dropped++; 1239 dev->stats.tx_dropped++;
1241 return 0; 1240 return 0;
1242 } 1241 }
1243 1242
@@ -1378,29 +1377,33 @@ static void rhine_tx(struct net_device *dev)
1378 printk(KERN_DEBUG "%s: Transmit error, " 1377 printk(KERN_DEBUG "%s: Transmit error, "
1379 "Tx status %8.8x.\n", 1378 "Tx status %8.8x.\n",
1380 dev->name, txstatus); 1379 dev->name, txstatus);
1381 rp->stats.tx_errors++; 1380 dev->stats.tx_errors++;
1382 if (txstatus & 0x0400) rp->stats.tx_carrier_errors++; 1381 if (txstatus & 0x0400)
1383 if (txstatus & 0x0200) rp->stats.tx_window_errors++; 1382 dev->stats.tx_carrier_errors++;
1384 if (txstatus & 0x0100) rp->stats.tx_aborted_errors++; 1383 if (txstatus & 0x0200)
1385 if (txstatus & 0x0080) rp->stats.tx_heartbeat_errors++; 1384 dev->stats.tx_window_errors++;
1385 if (txstatus & 0x0100)
1386 dev->stats.tx_aborted_errors++;
1387 if (txstatus & 0x0080)
1388 dev->stats.tx_heartbeat_errors++;
1386 if (((rp->quirks & rqRhineI) && txstatus & 0x0002) || 1389 if (((rp->quirks & rqRhineI) && txstatus & 0x0002) ||
1387 (txstatus & 0x0800) || (txstatus & 0x1000)) { 1390 (txstatus & 0x0800) || (txstatus & 0x1000)) {
1388 rp->stats.tx_fifo_errors++; 1391 dev->stats.tx_fifo_errors++;
1389 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); 1392 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
1390 break; /* Keep the skb - we try again */ 1393 break; /* Keep the skb - we try again */
1391 } 1394 }
1392 /* Transmitter restarted in 'abnormal' handler. */ 1395 /* Transmitter restarted in 'abnormal' handler. */
1393 } else { 1396 } else {
1394 if (rp->quirks & rqRhineI) 1397 if (rp->quirks & rqRhineI)
1395 rp->stats.collisions += (txstatus >> 3) & 0x0F; 1398 dev->stats.collisions += (txstatus >> 3) & 0x0F;
1396 else 1399 else
1397 rp->stats.collisions += txstatus & 0x0F; 1400 dev->stats.collisions += txstatus & 0x0F;
1398 if (debug > 6) 1401 if (debug > 6)
1399 printk(KERN_DEBUG "collisions: %1.1x:%1.1x\n", 1402 printk(KERN_DEBUG "collisions: %1.1x:%1.1x\n",
1400 (txstatus >> 3) & 0xF, 1403 (txstatus >> 3) & 0xF,
1401 txstatus & 0xF); 1404 txstatus & 0xF);
1402 rp->stats.tx_bytes += rp->tx_skbuff[entry]->len; 1405 dev->stats.tx_bytes += rp->tx_skbuff[entry]->len;
1403 rp->stats.tx_packets++; 1406 dev->stats.tx_packets++;
1404 } 1407 }
1405 /* Free the original skb. */ 1408 /* Free the original skb. */
1406 if (rp->tx_skbuff_dma[entry]) { 1409 if (rp->tx_skbuff_dma[entry]) {
@@ -1455,21 +1458,24 @@ static int rhine_rx(struct net_device *dev, int limit)
1455 printk(KERN_WARNING "%s: Oversized Ethernet " 1458 printk(KERN_WARNING "%s: Oversized Ethernet "
1456 "frame %p vs %p.\n", dev->name, 1459 "frame %p vs %p.\n", dev->name,
1457 rp->rx_head_desc, &rp->rx_ring[entry]); 1460 rp->rx_head_desc, &rp->rx_ring[entry]);
1458 rp->stats.rx_length_errors++; 1461 dev->stats.rx_length_errors++;
1459 } else if (desc_status & RxErr) { 1462 } else if (desc_status & RxErr) {
1460 /* There was a error. */ 1463 /* There was a error. */
1461 if (debug > 2) 1464 if (debug > 2)
1462 printk(KERN_DEBUG "rhine_rx() Rx " 1465 printk(KERN_DEBUG "rhine_rx() Rx "
1463 "error was %8.8x.\n", 1466 "error was %8.8x.\n",
1464 desc_status); 1467 desc_status);
1465 rp->stats.rx_errors++; 1468 dev->stats.rx_errors++;
1466 if (desc_status & 0x0030) rp->stats.rx_length_errors++; 1469 if (desc_status & 0x0030)
1467 if (desc_status & 0x0048) rp->stats.rx_fifo_errors++; 1470 dev->stats.rx_length_errors++;
1468 if (desc_status & 0x0004) rp->stats.rx_frame_errors++; 1471 if (desc_status & 0x0048)
1472 dev->stats.rx_fifo_errors++;
1473 if (desc_status & 0x0004)
1474 dev->stats.rx_frame_errors++;
1469 if (desc_status & 0x0002) { 1475 if (desc_status & 0x0002) {
1470 /* this can also be updated outside the interrupt handler */ 1476 /* this can also be updated outside the interrupt handler */
1471 spin_lock(&rp->lock); 1477 spin_lock(&rp->lock);
1472 rp->stats.rx_crc_errors++; 1478 dev->stats.rx_crc_errors++;
1473 spin_unlock(&rp->lock); 1479 spin_unlock(&rp->lock);
1474 } 1480 }
1475 } 1481 }
@@ -1513,8 +1519,8 @@ static int rhine_rx(struct net_device *dev, int limit)
1513 } 1519 }
1514 skb->protocol = eth_type_trans(skb, dev); 1520 skb->protocol = eth_type_trans(skb, dev);
1515 netif_receive_skb(skb); 1521 netif_receive_skb(skb);
1516 rp->stats.rx_bytes += pkt_len; 1522 dev->stats.rx_bytes += pkt_len;
1517 rp->stats.rx_packets++; 1523 dev->stats.rx_packets++;
1518 } 1524 }
1519 entry = (++rp->cur_rx) % RX_RING_SIZE; 1525 entry = (++rp->cur_rx) % RX_RING_SIZE;
1520 rp->rx_head_desc = &rp->rx_ring[entry]; 1526 rp->rx_head_desc = &rp->rx_ring[entry];
@@ -1599,8 +1605,8 @@ static void rhine_error(struct net_device *dev, int intr_status)
1599 if (intr_status & IntrLinkChange) 1605 if (intr_status & IntrLinkChange)
1600 rhine_check_media(dev, 0); 1606 rhine_check_media(dev, 0);
1601 if (intr_status & IntrStatsMax) { 1607 if (intr_status & IntrStatsMax) {
1602 rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); 1608 dev->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
1603 rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); 1609 dev->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
1604 clear_tally_counters(ioaddr); 1610 clear_tally_counters(ioaddr);
1605 } 1611 }
1606 if (intr_status & IntrTxAborted) { 1612 if (intr_status & IntrTxAborted) {
@@ -1654,12 +1660,12 @@ static struct net_device_stats *rhine_get_stats(struct net_device *dev)
1654 unsigned long flags; 1660 unsigned long flags;
1655 1661
1656 spin_lock_irqsave(&rp->lock, flags); 1662 spin_lock_irqsave(&rp->lock, flags);
1657 rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); 1663 dev->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
1658 rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); 1664 dev->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
1659 clear_tally_counters(ioaddr); 1665 clear_tally_counters(ioaddr);
1660 spin_unlock_irqrestore(&rp->lock, flags); 1666 spin_unlock_irqrestore(&rp->lock, flags);
1661 1667
1662 return &rp->stats; 1668 return &dev->stats;
1663} 1669}
1664 1670
1665static void rhine_set_rx_mode(struct net_device *dev) 1671static void rhine_set_rx_mode(struct net_device *dev)