diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-05-06 19:20:36 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-13 01:35:23 -0400 |
commit | 8e2691658f4cd2e24beacb6dcba3c33b2ff10593 (patch) | |
tree | 65c5e5dc7894012b2364004c8c5498eea5d65fb0 /drivers/net/pcmcia/axnet_cs.c | |
parent | 20c2c1fd6c842caf70dcb1d94b9d58861949fd3d (diff) |
axnet_cs: 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>
Diffstat (limited to 'drivers/net/pcmcia/axnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index ce95c5d168fe..d7018ff9e171 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -1021,7 +1021,7 @@ static void ei_tx_timeout(struct net_device *dev) | |||
1021 | int txsr, isr, tickssofar = jiffies - dev->trans_start; | 1021 | int txsr, isr, tickssofar = jiffies - dev->trans_start; |
1022 | unsigned long flags; | 1022 | unsigned long flags; |
1023 | 1023 | ||
1024 | ei_local->stat.tx_errors++; | 1024 | dev->stats.tx_errors++; |
1025 | 1025 | ||
1026 | spin_lock_irqsave(&ei_local->page_lock, flags); | 1026 | spin_lock_irqsave(&ei_local->page_lock, flags); |
1027 | txsr = inb(e8390_base+EN0_TSR); | 1027 | txsr = inb(e8390_base+EN0_TSR); |
@@ -1032,7 +1032,7 @@ static void ei_tx_timeout(struct net_device *dev) | |||
1032 | dev->name, (txsr & ENTSR_ABT) ? "excess collisions." : | 1032 | dev->name, (txsr & ENTSR_ABT) ? "excess collisions." : |
1033 | (isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar); | 1033 | (isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar); |
1034 | 1034 | ||
1035 | if (!isr && !ei_local->stat.tx_packets) | 1035 | if (!isr && !dev->stats.tx_packets) |
1036 | { | 1036 | { |
1037 | /* The 8390 probably hasn't gotten on the cable yet. */ | 1037 | /* The 8390 probably hasn't gotten on the cable yet. */ |
1038 | ei_local->interface_num ^= 1; /* Try a different xcvr. */ | 1038 | ei_local->interface_num ^= 1; /* Try a different xcvr. */ |
@@ -1122,7 +1122,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1122 | netif_stop_queue(dev); | 1122 | netif_stop_queue(dev); |
1123 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); | 1123 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); |
1124 | spin_unlock_irqrestore(&ei_local->page_lock, flags); | 1124 | spin_unlock_irqrestore(&ei_local->page_lock, flags); |
1125 | ei_local->stat.tx_errors++; | 1125 | dev->stats.tx_errors++; |
1126 | return 1; | 1126 | return 1; |
1127 | } | 1127 | } |
1128 | 1128 | ||
@@ -1170,7 +1170,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1170 | spin_unlock_irqrestore(&ei_local->page_lock, flags); | 1170 | spin_unlock_irqrestore(&ei_local->page_lock, flags); |
1171 | 1171 | ||
1172 | dev_kfree_skb (skb); | 1172 | dev_kfree_skb (skb); |
1173 | ei_local->stat.tx_bytes += send_length; | 1173 | dev->stats.tx_bytes += send_length; |
1174 | 1174 | ||
1175 | return 0; | 1175 | return 0; |
1176 | } | 1176 | } |
@@ -1262,9 +1262,9 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1262 | 1262 | ||
1263 | if (interrupts & ENISR_COUNTERS) | 1263 | if (interrupts & ENISR_COUNTERS) |
1264 | { | 1264 | { |
1265 | ei_local->stat.rx_frame_errors += inb_p(e8390_base + EN0_COUNTER0); | 1265 | dev->stats.rx_frame_errors += inb_p(e8390_base + EN0_COUNTER0); |
1266 | ei_local->stat.rx_crc_errors += inb_p(e8390_base + EN0_COUNTER1); | 1266 | dev->stats.rx_crc_errors += inb_p(e8390_base + EN0_COUNTER1); |
1267 | ei_local->stat.rx_missed_errors+= inb_p(e8390_base + EN0_COUNTER2); | 1267 | dev->stats.rx_missed_errors+= inb_p(e8390_base + EN0_COUNTER2); |
1268 | } | 1268 | } |
1269 | } | 1269 | } |
1270 | 1270 | ||
@@ -1309,7 +1309,6 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1309 | static void ei_tx_err(struct net_device *dev) | 1309 | static void ei_tx_err(struct net_device *dev) |
1310 | { | 1310 | { |
1311 | long e8390_base = dev->base_addr; | 1311 | long e8390_base = dev->base_addr; |
1312 | struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); | ||
1313 | unsigned char txsr = inb_p(e8390_base+EN0_TSR); | 1312 | unsigned char txsr = inb_p(e8390_base+EN0_TSR); |
1314 | unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU); | 1313 | unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU); |
1315 | 1314 | ||
@@ -1332,10 +1331,10 @@ static void ei_tx_err(struct net_device *dev) | |||
1332 | ei_tx_intr(dev); | 1331 | ei_tx_intr(dev); |
1333 | else | 1332 | else |
1334 | { | 1333 | { |
1335 | ei_local->stat.tx_errors++; | 1334 | dev->stats.tx_errors++; |
1336 | if (txsr & ENTSR_CRS) ei_local->stat.tx_carrier_errors++; | 1335 | if (txsr & ENTSR_CRS) dev->stats.tx_carrier_errors++; |
1337 | if (txsr & ENTSR_CDH) ei_local->stat.tx_heartbeat_errors++; | 1336 | if (txsr & ENTSR_CDH) dev->stats.tx_heartbeat_errors++; |
1338 | if (txsr & ENTSR_OWC) ei_local->stat.tx_window_errors++; | 1337 | if (txsr & ENTSR_OWC) dev->stats.tx_window_errors++; |
1339 | } | 1338 | } |
1340 | } | 1339 | } |
1341 | 1340 | ||
@@ -1397,25 +1396,25 @@ static void ei_tx_intr(struct net_device *dev) | |||
1397 | 1396 | ||
1398 | /* Minimize Tx latency: update the statistics after we restart TXing. */ | 1397 | /* Minimize Tx latency: update the statistics after we restart TXing. */ |
1399 | if (status & ENTSR_COL) | 1398 | if (status & ENTSR_COL) |
1400 | ei_local->stat.collisions++; | 1399 | dev->stats.collisions++; |
1401 | if (status & ENTSR_PTX) | 1400 | if (status & ENTSR_PTX) |
1402 | ei_local->stat.tx_packets++; | 1401 | dev->stats.tx_packets++; |
1403 | else | 1402 | else |
1404 | { | 1403 | { |
1405 | ei_local->stat.tx_errors++; | 1404 | dev->stats.tx_errors++; |
1406 | if (status & ENTSR_ABT) | 1405 | if (status & ENTSR_ABT) |
1407 | { | 1406 | { |
1408 | ei_local->stat.tx_aborted_errors++; | 1407 | dev->stats.tx_aborted_errors++; |
1409 | ei_local->stat.collisions += 16; | 1408 | dev->stats.collisions += 16; |
1410 | } | 1409 | } |
1411 | if (status & ENTSR_CRS) | 1410 | if (status & ENTSR_CRS) |
1412 | ei_local->stat.tx_carrier_errors++; | 1411 | dev->stats.tx_carrier_errors++; |
1413 | if (status & ENTSR_FU) | 1412 | if (status & ENTSR_FU) |
1414 | ei_local->stat.tx_fifo_errors++; | 1413 | dev->stats.tx_fifo_errors++; |
1415 | if (status & ENTSR_CDH) | 1414 | if (status & ENTSR_CDH) |
1416 | ei_local->stat.tx_heartbeat_errors++; | 1415 | dev->stats.tx_heartbeat_errors++; |
1417 | if (status & ENTSR_OWC) | 1416 | if (status & ENTSR_OWC) |
1418 | ei_local->stat.tx_window_errors++; | 1417 | dev->stats.tx_window_errors++; |
1419 | } | 1418 | } |
1420 | netif_wake_queue(dev); | 1419 | netif_wake_queue(dev); |
1421 | } | 1420 | } |
@@ -1476,8 +1475,8 @@ static void ei_receive(struct net_device *dev) | |||
1476 | printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n", | 1475 | printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n", |
1477 | dev->name, rx_frame.count, rx_frame.status, | 1476 | dev->name, rx_frame.count, rx_frame.status, |
1478 | rx_frame.next); | 1477 | rx_frame.next); |
1479 | ei_local->stat.rx_errors++; | 1478 | dev->stats.rx_errors++; |
1480 | ei_local->stat.rx_length_errors++; | 1479 | dev->stats.rx_length_errors++; |
1481 | } | 1480 | } |
1482 | else if ((pkt_stat & 0x0F) == ENRSR_RXOK) | 1481 | else if ((pkt_stat & 0x0F) == ENRSR_RXOK) |
1483 | { | 1482 | { |
@@ -1489,7 +1488,7 @@ static void ei_receive(struct net_device *dev) | |||
1489 | if (ei_debug > 1) | 1488 | if (ei_debug > 1) |
1490 | printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n", | 1489 | printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n", |
1491 | dev->name, pkt_len); | 1490 | dev->name, pkt_len); |
1492 | ei_local->stat.rx_dropped++; | 1491 | dev->stats.rx_dropped++; |
1493 | break; | 1492 | break; |
1494 | } | 1493 | } |
1495 | else | 1494 | else |
@@ -1500,10 +1499,10 @@ static void ei_receive(struct net_device *dev) | |||
1500 | skb->protocol=eth_type_trans(skb,dev); | 1499 | skb->protocol=eth_type_trans(skb,dev); |
1501 | netif_rx(skb); | 1500 | netif_rx(skb); |
1502 | dev->last_rx = jiffies; | 1501 | dev->last_rx = jiffies; |
1503 | ei_local->stat.rx_packets++; | 1502 | dev->stats.rx_packets++; |
1504 | ei_local->stat.rx_bytes += pkt_len; | 1503 | dev->stats.rx_bytes += pkt_len; |
1505 | if (pkt_stat & ENRSR_PHY) | 1504 | if (pkt_stat & ENRSR_PHY) |
1506 | ei_local->stat.multicast++; | 1505 | dev->stats.multicast++; |
1507 | } | 1506 | } |
1508 | } | 1507 | } |
1509 | else | 1508 | else |
@@ -1512,10 +1511,10 @@ static void ei_receive(struct net_device *dev) | |||
1512 | printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n", | 1511 | printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n", |
1513 | dev->name, rx_frame.status, rx_frame.next, | 1512 | dev->name, rx_frame.status, rx_frame.next, |
1514 | rx_frame.count); | 1513 | rx_frame.count); |
1515 | ei_local->stat.rx_errors++; | 1514 | dev->stats.rx_errors++; |
1516 | /* NB: The NIC counts CRC, frame and missed errors. */ | 1515 | /* NB: The NIC counts CRC, frame and missed errors. */ |
1517 | if (pkt_stat & ENRSR_FO) | 1516 | if (pkt_stat & ENRSR_FO) |
1518 | ei_local->stat.rx_fifo_errors++; | 1517 | dev->stats.rx_fifo_errors++; |
1519 | } | 1518 | } |
1520 | next_frame = rx_frame.next; | 1519 | next_frame = rx_frame.next; |
1521 | 1520 | ||
@@ -1550,7 +1549,6 @@ static void ei_rx_overrun(struct net_device *dev) | |||
1550 | axnet_dev_t *info = PRIV(dev); | 1549 | axnet_dev_t *info = PRIV(dev); |
1551 | long e8390_base = dev->base_addr; | 1550 | long e8390_base = dev->base_addr; |
1552 | unsigned char was_txing, must_resend = 0; | 1551 | unsigned char was_txing, must_resend = 0; |
1553 | struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); | ||
1554 | 1552 | ||
1555 | /* | 1553 | /* |
1556 | * Record whether a Tx was in progress and then issue the | 1554 | * Record whether a Tx was in progress and then issue the |
@@ -1561,7 +1559,7 @@ static void ei_rx_overrun(struct net_device *dev) | |||
1561 | 1559 | ||
1562 | if (ei_debug > 1) | 1560 | if (ei_debug > 1) |
1563 | printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name); | 1561 | printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name); |
1564 | ei_local->stat.rx_over_errors++; | 1562 | dev->stats.rx_over_errors++; |
1565 | 1563 | ||
1566 | /* | 1564 | /* |
1567 | * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total. | 1565 | * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total. |
@@ -1622,16 +1620,16 @@ static struct net_device_stats *get_stats(struct net_device *dev) | |||
1622 | 1620 | ||
1623 | /* If the card is stopped, just return the present stats. */ | 1621 | /* If the card is stopped, just return the present stats. */ |
1624 | if (!netif_running(dev)) | 1622 | if (!netif_running(dev)) |
1625 | return &ei_local->stat; | 1623 | return &dev->stats; |
1626 | 1624 | ||
1627 | spin_lock_irqsave(&ei_local->page_lock,flags); | 1625 | spin_lock_irqsave(&ei_local->page_lock,flags); |
1628 | /* Read the counter registers, assuming we are in page 0. */ | 1626 | /* Read the counter registers, assuming we are in page 0. */ |
1629 | ei_local->stat.rx_frame_errors += inb_p(ioaddr + EN0_COUNTER0); | 1627 | dev->stats.rx_frame_errors += inb_p(ioaddr + EN0_COUNTER0); |
1630 | ei_local->stat.rx_crc_errors += inb_p(ioaddr + EN0_COUNTER1); | 1628 | dev->stats.rx_crc_errors += inb_p(ioaddr + EN0_COUNTER1); |
1631 | ei_local->stat.rx_missed_errors+= inb_p(ioaddr + EN0_COUNTER2); | 1629 | dev->stats.rx_missed_errors+= inb_p(ioaddr + EN0_COUNTER2); |
1632 | spin_unlock_irqrestore(&ei_local->page_lock, flags); | 1630 | spin_unlock_irqrestore(&ei_local->page_lock, flags); |
1633 | 1631 | ||
1634 | return &ei_local->stat; | 1632 | return &dev->stats; |
1635 | } | 1633 | } |
1636 | 1634 | ||
1637 | /* | 1635 | /* |