aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sundance.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/sundance.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/sundance.c')
-rw-r--r--drivers/net/sundance.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index c399b1955c1e..545f81b34ad7 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -369,7 +369,6 @@ struct netdev_private {
369 struct sk_buff* tx_skbuff[TX_RING_SIZE]; 369 struct sk_buff* tx_skbuff[TX_RING_SIZE];
370 dma_addr_t tx_ring_dma; 370 dma_addr_t tx_ring_dma;
371 dma_addr_t rx_ring_dma; 371 dma_addr_t rx_ring_dma;
372 struct net_device_stats stats;
373 struct timer_list timer; /* Media monitoring timer. */ 372 struct timer_list timer; /* Media monitoring timer. */
374 /* Frequently used values: keep some adjacent for cache effect. */ 373 /* Frequently used values: keep some adjacent for cache effect. */
375 spinlock_t lock; 374 spinlock_t lock;
@@ -975,7 +974,7 @@ static void tx_timeout(struct net_device *dev)
975 dev->if_port = 0; 974 dev->if_port = 0;
976 975
977 dev->trans_start = jiffies; 976 dev->trans_start = jiffies;
978 np->stats.tx_errors++; 977 dev->stats.tx_errors++;
979 if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) { 978 if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
980 netif_wake_queue(dev); 979 netif_wake_queue(dev);
981 } 980 }
@@ -1123,7 +1122,7 @@ reset_tx (struct net_device *dev)
1123 else 1122 else
1124 dev_kfree_skb (skb); 1123 dev_kfree_skb (skb);
1125 np->tx_skbuff[i] = NULL; 1124 np->tx_skbuff[i] = NULL;
1126 np->stats.tx_dropped++; 1125 dev->stats.tx_dropped++;
1127 } 1126 }
1128 } 1127 }
1129 np->cur_tx = np->dirty_tx = 0; 1128 np->cur_tx = np->dirty_tx = 0;
@@ -1181,15 +1180,15 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1181 if (netif_msg_tx_err(np)) 1180 if (netif_msg_tx_err(np))
1182 printk("%s: Transmit error status %4.4x.\n", 1181 printk("%s: Transmit error status %4.4x.\n",
1183 dev->name, tx_status); 1182 dev->name, tx_status);
1184 np->stats.tx_errors++; 1183 dev->stats.tx_errors++;
1185 if (tx_status & 0x10) 1184 if (tx_status & 0x10)
1186 np->stats.tx_fifo_errors++; 1185 dev->stats.tx_fifo_errors++;
1187 if (tx_status & 0x08) 1186 if (tx_status & 0x08)
1188 np->stats.collisions++; 1187 dev->stats.collisions++;
1189 if (tx_status & 0x04) 1188 if (tx_status & 0x04)
1190 np->stats.tx_fifo_errors++; 1189 dev->stats.tx_fifo_errors++;
1191 if (tx_status & 0x02) 1190 if (tx_status & 0x02)
1192 np->stats.tx_window_errors++; 1191 dev->stats.tx_window_errors++;
1193 1192
1194 /* 1193 /*
1195 ** This reset has been verified on 1194 ** This reset has been verified on
@@ -1313,11 +1312,15 @@ static void rx_poll(unsigned long data)
1313 if (netif_msg_rx_err(np)) 1312 if (netif_msg_rx_err(np))
1314 printk(KERN_DEBUG " netdev_rx() Rx error was %8.8x.\n", 1313 printk(KERN_DEBUG " netdev_rx() Rx error was %8.8x.\n",
1315 frame_status); 1314 frame_status);
1316 np->stats.rx_errors++; 1315 dev->stats.rx_errors++;
1317 if (frame_status & 0x00100000) np->stats.rx_length_errors++; 1316 if (frame_status & 0x00100000)
1318 if (frame_status & 0x00010000) np->stats.rx_fifo_errors++; 1317 dev->stats.rx_length_errors++;
1319 if (frame_status & 0x00060000) np->stats.rx_frame_errors++; 1318 if (frame_status & 0x00010000)
1320 if (frame_status & 0x00080000) np->stats.rx_crc_errors++; 1319 dev->stats.rx_fifo_errors++;
1320 if (frame_status & 0x00060000)
1321 dev->stats.rx_frame_errors++;
1322 if (frame_status & 0x00080000)
1323 dev->stats.rx_crc_errors++;
1321 if (frame_status & 0x00100000) { 1324 if (frame_status & 0x00100000) {
1322 printk(KERN_WARNING "%s: Oversized Ethernet frame," 1325 printk(KERN_WARNING "%s: Oversized Ethernet frame,"
1323 " status %8.8x.\n", 1326 " status %8.8x.\n",
@@ -1485,22 +1488,22 @@ static struct net_device_stats *get_stats(struct net_device *dev)
1485 the vulnerability window is very small and statistics are 1488 the vulnerability window is very small and statistics are
1486 non-critical. */ 1489 non-critical. */
1487 /* The chip only need report frame silently dropped. */ 1490 /* The chip only need report frame silently dropped. */
1488 np->stats.rx_missed_errors += ioread8(ioaddr + RxMissed); 1491 dev->stats.rx_missed_errors += ioread8(ioaddr + RxMissed);
1489 np->stats.tx_packets += ioread16(ioaddr + TxFramesOK); 1492 dev->stats.tx_packets += ioread16(ioaddr + TxFramesOK);
1490 np->stats.rx_packets += ioread16(ioaddr + RxFramesOK); 1493 dev->stats.rx_packets += ioread16(ioaddr + RxFramesOK);
1491 np->stats.collisions += ioread8(ioaddr + StatsLateColl); 1494 dev->stats.collisions += ioread8(ioaddr + StatsLateColl);
1492 np->stats.collisions += ioread8(ioaddr + StatsMultiColl); 1495 dev->stats.collisions += ioread8(ioaddr + StatsMultiColl);
1493 np->stats.collisions += ioread8(ioaddr + StatsOneColl); 1496 dev->stats.collisions += ioread8(ioaddr + StatsOneColl);
1494 np->stats.tx_carrier_errors += ioread8(ioaddr + StatsCarrierError); 1497 dev->stats.tx_carrier_errors += ioread8(ioaddr + StatsCarrierError);
1495 ioread8(ioaddr + StatsTxDefer); 1498 ioread8(ioaddr + StatsTxDefer);
1496 for (i = StatsTxDefer; i <= StatsMcastRx; i++) 1499 for (i = StatsTxDefer; i <= StatsMcastRx; i++)
1497 ioread8(ioaddr + i); 1500 ioread8(ioaddr + i);
1498 np->stats.tx_bytes += ioread16(ioaddr + TxOctetsLow); 1501 dev->stats.tx_bytes += ioread16(ioaddr + TxOctetsLow);
1499 np->stats.tx_bytes += ioread16(ioaddr + TxOctetsHigh) << 16; 1502 dev->stats.tx_bytes += ioread16(ioaddr + TxOctetsHigh) << 16;
1500 np->stats.rx_bytes += ioread16(ioaddr + RxOctetsLow); 1503 dev->stats.rx_bytes += ioread16(ioaddr + RxOctetsLow);
1501 np->stats.rx_bytes += ioread16(ioaddr + RxOctetsHigh) << 16; 1504 dev->stats.rx_bytes += ioread16(ioaddr + RxOctetsHigh) << 16;
1502 1505
1503 return &np->stats; 1506 return &dev->stats;
1504} 1507}
1505 1508
1506static void set_rx_mode(struct net_device *dev) 1509static void set_rx_mode(struct net_device *dev)