diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-04 22:13:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-05 22:41:13 -0400 |
commit | d117b6665847084cfe8a44b870f771153e18991d (patch) | |
tree | 0494f3bbc7981b057617ede9d01eb8c5611acd64 /drivers/net/fealnx.c | |
parent | 78e8c5325aa8ae99b6738eaab0ebb7e3f53007ff (diff) |
fealnx: Use the instance of net_device_stats from net_device.
Since net_device has an instance of net_device_stats,
we can remove the instance of this from the adapter structure.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fealnx.c')
-rw-r--r-- | drivers/net/fealnx.c | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 15f4f8d3d46d..d7e8f6b8f4cf 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -382,8 +382,6 @@ struct netdev_private { | |||
382 | 382 | ||
383 | spinlock_t lock; | 383 | spinlock_t lock; |
384 | 384 | ||
385 | struct net_device_stats stats; | ||
386 | |||
387 | /* Media monitoring timer. */ | 385 | /* Media monitoring timer. */ |
388 | struct timer_list timer; | 386 | struct timer_list timer; |
389 | 387 | ||
@@ -1234,7 +1232,7 @@ static void fealnx_tx_timeout(struct net_device *dev) | |||
1234 | spin_unlock_irqrestore(&np->lock, flags); | 1232 | spin_unlock_irqrestore(&np->lock, flags); |
1235 | 1233 | ||
1236 | dev->trans_start = jiffies; /* prevent tx timeout */ | 1234 | dev->trans_start = jiffies; /* prevent tx timeout */ |
1237 | np->stats.tx_errors++; | 1235 | dev->stats.tx_errors++; |
1238 | netif_wake_queue(dev); /* or .._start_.. ?? */ | 1236 | netif_wake_queue(dev); /* or .._start_.. ?? */ |
1239 | } | 1237 | } |
1240 | 1238 | ||
@@ -1479,10 +1477,11 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1479 | 1477 | ||
1480 | if (intr_status & CNTOVF) { | 1478 | if (intr_status & CNTOVF) { |
1481 | /* missed pkts */ | 1479 | /* missed pkts */ |
1482 | np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff; | 1480 | dev->stats.rx_missed_errors += |
1481 | ioread32(ioaddr + TALLY) & 0x7fff; | ||
1483 | 1482 | ||
1484 | /* crc error */ | 1483 | /* crc error */ |
1485 | np->stats.rx_crc_errors += | 1484 | dev->stats.rx_crc_errors += |
1486 | (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; | 1485 | (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; |
1487 | } | 1486 | } |
1488 | 1487 | ||
@@ -1513,30 +1512,30 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1513 | 1512 | ||
1514 | if (!(np->crvalue & CR_W_ENH)) { | 1513 | if (!(np->crvalue & CR_W_ENH)) { |
1515 | if (tx_status & (CSL | LC | EC | UDF | HF)) { | 1514 | if (tx_status & (CSL | LC | EC | UDF | HF)) { |
1516 | np->stats.tx_errors++; | 1515 | dev->stats.tx_errors++; |
1517 | if (tx_status & EC) | 1516 | if (tx_status & EC) |
1518 | np->stats.tx_aborted_errors++; | 1517 | dev->stats.tx_aborted_errors++; |
1519 | if (tx_status & CSL) | 1518 | if (tx_status & CSL) |
1520 | np->stats.tx_carrier_errors++; | 1519 | dev->stats.tx_carrier_errors++; |
1521 | if (tx_status & LC) | 1520 | if (tx_status & LC) |
1522 | np->stats.tx_window_errors++; | 1521 | dev->stats.tx_window_errors++; |
1523 | if (tx_status & UDF) | 1522 | if (tx_status & UDF) |
1524 | np->stats.tx_fifo_errors++; | 1523 | dev->stats.tx_fifo_errors++; |
1525 | if ((tx_status & HF) && np->mii.full_duplex == 0) | 1524 | if ((tx_status & HF) && np->mii.full_duplex == 0) |
1526 | np->stats.tx_heartbeat_errors++; | 1525 | dev->stats.tx_heartbeat_errors++; |
1527 | 1526 | ||
1528 | } else { | 1527 | } else { |
1529 | np->stats.tx_bytes += | 1528 | dev->stats.tx_bytes += |
1530 | ((tx_control & PKTSMask) >> PKTSShift); | 1529 | ((tx_control & PKTSMask) >> PKTSShift); |
1531 | 1530 | ||
1532 | np->stats.collisions += | 1531 | dev->stats.collisions += |
1533 | ((tx_status & NCRMask) >> NCRShift); | 1532 | ((tx_status & NCRMask) >> NCRShift); |
1534 | np->stats.tx_packets++; | 1533 | dev->stats.tx_packets++; |
1535 | } | 1534 | } |
1536 | } else { | 1535 | } else { |
1537 | np->stats.tx_bytes += | 1536 | dev->stats.tx_bytes += |
1538 | ((tx_control & PKTSMask) >> PKTSShift); | 1537 | ((tx_control & PKTSMask) >> PKTSShift); |
1539 | np->stats.tx_packets++; | 1538 | dev->stats.tx_packets++; |
1540 | } | 1539 | } |
1541 | 1540 | ||
1542 | /* Free the original skb. */ | 1541 | /* Free the original skb. */ |
@@ -1564,10 +1563,12 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1564 | long data; | 1563 | long data; |
1565 | 1564 | ||
1566 | data = ioread32(ioaddr + TSR); | 1565 | data = ioread32(ioaddr + TSR); |
1567 | np->stats.tx_errors += (data & 0xff000000) >> 24; | 1566 | dev->stats.tx_errors += (data & 0xff000000) >> 24; |
1568 | np->stats.tx_aborted_errors += (data & 0xff000000) >> 24; | 1567 | dev->stats.tx_aborted_errors += |
1569 | np->stats.tx_window_errors += (data & 0x00ff0000) >> 16; | 1568 | (data & 0xff000000) >> 24; |
1570 | np->stats.collisions += (data & 0x0000ffff); | 1569 | dev->stats.tx_window_errors += |
1570 | (data & 0x00ff0000) >> 16; | ||
1571 | dev->stats.collisions += (data & 0x0000ffff); | ||
1571 | } | 1572 | } |
1572 | 1573 | ||
1573 | if (--boguscnt < 0) { | 1574 | if (--boguscnt < 0) { |
@@ -1593,10 +1594,11 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
1593 | 1594 | ||
1594 | /* read the tally counters */ | 1595 | /* read the tally counters */ |
1595 | /* missed pkts */ | 1596 | /* missed pkts */ |
1596 | np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff; | 1597 | dev->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff; |
1597 | 1598 | ||
1598 | /* crc error */ | 1599 | /* crc error */ |
1599 | np->stats.rx_crc_errors += (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; | 1600 | dev->stats.rx_crc_errors += |
1601 | (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; | ||
1600 | 1602 | ||
1601 | if (debug) | 1603 | if (debug) |
1602 | printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", | 1604 | printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", |
@@ -1635,13 +1637,13 @@ static int netdev_rx(struct net_device *dev) | |||
1635 | "%s: Receive error, Rx status %8.8x.\n", | 1637 | "%s: Receive error, Rx status %8.8x.\n", |
1636 | dev->name, rx_status); | 1638 | dev->name, rx_status); |
1637 | 1639 | ||
1638 | np->stats.rx_errors++; /* end of a packet. */ | 1640 | dev->stats.rx_errors++; /* end of a packet. */ |
1639 | if (rx_status & (LONG | RUNT)) | 1641 | if (rx_status & (LONG | RUNT)) |
1640 | np->stats.rx_length_errors++; | 1642 | dev->stats.rx_length_errors++; |
1641 | if (rx_status & RXER) | 1643 | if (rx_status & RXER) |
1642 | np->stats.rx_frame_errors++; | 1644 | dev->stats.rx_frame_errors++; |
1643 | if (rx_status & CRC) | 1645 | if (rx_status & CRC) |
1644 | np->stats.rx_crc_errors++; | 1646 | dev->stats.rx_crc_errors++; |
1645 | } else { | 1647 | } else { |
1646 | int need_to_reset = 0; | 1648 | int need_to_reset = 0; |
1647 | int desno = 0; | 1649 | int desno = 0; |
@@ -1667,7 +1669,7 @@ static int netdev_rx(struct net_device *dev) | |||
1667 | if (need_to_reset == 0) { | 1669 | if (need_to_reset == 0) { |
1668 | int i; | 1670 | int i; |
1669 | 1671 | ||
1670 | np->stats.rx_length_errors++; | 1672 | dev->stats.rx_length_errors++; |
1671 | 1673 | ||
1672 | /* free all rx descriptors related this long pkt */ | 1674 | /* free all rx descriptors related this long pkt */ |
1673 | for (i = 0; i < desno; ++i) { | 1675 | for (i = 0; i < desno; ++i) { |
@@ -1733,8 +1735,8 @@ static int netdev_rx(struct net_device *dev) | |||
1733 | } | 1735 | } |
1734 | skb->protocol = eth_type_trans(skb, dev); | 1736 | skb->protocol = eth_type_trans(skb, dev); |
1735 | netif_rx(skb); | 1737 | netif_rx(skb); |
1736 | np->stats.rx_packets++; | 1738 | dev->stats.rx_packets++; |
1737 | np->stats.rx_bytes += pkt_len; | 1739 | dev->stats.rx_bytes += pkt_len; |
1738 | } | 1740 | } |
1739 | 1741 | ||
1740 | np->cur_rx = np->cur_rx->next_desc_logical; | 1742 | np->cur_rx = np->cur_rx->next_desc_logical; |
@@ -1754,11 +1756,13 @@ static struct net_device_stats *get_stats(struct net_device *dev) | |||
1754 | 1756 | ||
1755 | /* The chip only need report frame silently dropped. */ | 1757 | /* The chip only need report frame silently dropped. */ |
1756 | if (netif_running(dev)) { | 1758 | if (netif_running(dev)) { |
1757 | np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff; | 1759 | dev->stats.rx_missed_errors += |
1758 | np->stats.rx_crc_errors += (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; | 1760 | ioread32(ioaddr + TALLY) & 0x7fff; |
1761 | dev->stats.rx_crc_errors += | ||
1762 | (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; | ||
1759 | } | 1763 | } |
1760 | 1764 | ||
1761 | return &np->stats; | 1765 | return &dev->stats; |
1762 | } | 1766 | } |
1763 | 1767 | ||
1764 | 1768 | ||