diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-04 22:13:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-05 22:41:14 -0400 |
commit | 661a16ce9da615eb75d1052cbb13b6545f0080b4 (patch) | |
tree | b3e199ca74edede6d483613ed7ae1ce1251f2b36 | |
parent | 275defc958acc9bf5bc81eb46209346d3aebe0fa (diff) |
cs89x0: 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>
-rw-r--r-- | drivers/net/cs89x0.c | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 2ccb9f12805b..e3a7dca23025 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -218,7 +218,6 @@ static unsigned int net_debug = DEBUGGING; | |||
218 | 218 | ||
219 | /* Information that need to be kept for each board. */ | 219 | /* Information that need to be kept for each board. */ |
220 | struct net_local { | 220 | struct net_local { |
221 | struct net_device_stats stats; | ||
222 | int chip_type; /* one of: CS8900, CS8920, CS8920M */ | 221 | int chip_type; /* one of: CS8900, CS8920, CS8920M */ |
223 | char chip_revision; /* revision letter of the chip ('A'...) */ | 222 | char chip_revision; /* revision letter of the chip ('A'...) */ |
224 | int send_cmd; /* the proper send command: TX_NOW, TX_AFTER_381, or TX_AFTER_ALL */ | 223 | int send_cmd; /* the proper send command: TX_NOW, TX_AFTER_381, or TX_AFTER_ALL */ |
@@ -257,7 +256,7 @@ static void reset_chip(struct net_device *dev); | |||
257 | static int get_eeprom_data(struct net_device *dev, int off, int len, int *buffer); | 256 | static int get_eeprom_data(struct net_device *dev, int off, int len, int *buffer); |
258 | static int get_eeprom_cksum(int off, int len, int *buffer); | 257 | static int get_eeprom_cksum(int off, int len, int *buffer); |
259 | static int set_mac_address(struct net_device *dev, void *addr); | 258 | static int set_mac_address(struct net_device *dev, void *addr); |
260 | static void count_rx_errors(int status, struct net_local *lp); | 259 | static void count_rx_errors(int status, struct net_device *dev); |
261 | #ifdef CONFIG_NET_POLL_CONTROLLER | 260 | #ifdef CONFIG_NET_POLL_CONTROLLER |
262 | static void net_poll_controller(struct net_device *dev); | 261 | static void net_poll_controller(struct net_device *dev); |
263 | #endif | 262 | #endif |
@@ -983,7 +982,7 @@ dma_rx(struct net_device *dev) | |||
983 | dev->name, (unsigned long)bp, status, length); | 982 | dev->name, (unsigned long)bp, status, length); |
984 | } | 983 | } |
985 | if ((status & RX_OK) == 0) { | 984 | if ((status & RX_OK) == 0) { |
986 | count_rx_errors(status, lp); | 985 | count_rx_errors(status, dev); |
987 | goto skip_this_frame; | 986 | goto skip_this_frame; |
988 | } | 987 | } |
989 | 988 | ||
@@ -992,7 +991,7 @@ dma_rx(struct net_device *dev) | |||
992 | if (skb == NULL) { | 991 | if (skb == NULL) { |
993 | if (net_debug) /* I don't think we want to do this to a stressed system */ | 992 | if (net_debug) /* I don't think we want to do this to a stressed system */ |
994 | printk("%s: Memory squeeze, dropping packet.\n", dev->name); | 993 | printk("%s: Memory squeeze, dropping packet.\n", dev->name); |
995 | lp->stats.rx_dropped++; | 994 | dev->stats.rx_dropped++; |
996 | 995 | ||
997 | /* AKPM: advance bp to the next frame */ | 996 | /* AKPM: advance bp to the next frame */ |
998 | skip_this_frame: | 997 | skip_this_frame: |
@@ -1022,8 +1021,8 @@ skip_this_frame: | |||
1022 | } | 1021 | } |
1023 | skb->protocol=eth_type_trans(skb,dev); | 1022 | skb->protocol=eth_type_trans(skb,dev); |
1024 | netif_rx(skb); | 1023 | netif_rx(skb); |
1025 | lp->stats.rx_packets++; | 1024 | dev->stats.rx_packets++; |
1026 | lp->stats.rx_bytes += length; | 1025 | dev->stats.rx_bytes += length; |
1027 | } | 1026 | } |
1028 | 1027 | ||
1029 | #endif /* ALLOW_DMA */ | 1028 | #endif /* ALLOW_DMA */ |
@@ -1552,7 +1551,7 @@ static netdev_tx_t net_send_packet(struct sk_buff *skb,struct net_device *dev) | |||
1552 | /* Write the contents of the packet */ | 1551 | /* Write the contents of the packet */ |
1553 | writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); | 1552 | writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); |
1554 | spin_unlock_irqrestore(&lp->lock, flags); | 1553 | spin_unlock_irqrestore(&lp->lock, flags); |
1555 | lp->stats.tx_bytes += skb->len; | 1554 | dev->stats.tx_bytes += skb->len; |
1556 | dev_kfree_skb (skb); | 1555 | dev_kfree_skb (skb); |
1557 | 1556 | ||
1558 | /* | 1557 | /* |
@@ -1598,18 +1597,23 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
1598 | net_rx(dev); | 1597 | net_rx(dev); |
1599 | break; | 1598 | break; |
1600 | case ISQ_TRANSMITTER_EVENT: | 1599 | case ISQ_TRANSMITTER_EVENT: |
1601 | lp->stats.tx_packets++; | 1600 | dev->stats.tx_packets++; |
1602 | netif_wake_queue(dev); /* Inform upper layers. */ | 1601 | netif_wake_queue(dev); /* Inform upper layers. */ |
1603 | if ((status & ( TX_OK | | 1602 | if ((status & ( TX_OK | |
1604 | TX_LOST_CRS | | 1603 | TX_LOST_CRS | |
1605 | TX_SQE_ERROR | | 1604 | TX_SQE_ERROR | |
1606 | TX_LATE_COL | | 1605 | TX_LATE_COL | |
1607 | TX_16_COL)) != TX_OK) { | 1606 | TX_16_COL)) != TX_OK) { |
1608 | if ((status & TX_OK) == 0) lp->stats.tx_errors++; | 1607 | if ((status & TX_OK) == 0) |
1609 | if (status & TX_LOST_CRS) lp->stats.tx_carrier_errors++; | 1608 | dev->stats.tx_errors++; |
1610 | if (status & TX_SQE_ERROR) lp->stats.tx_heartbeat_errors++; | 1609 | if (status & TX_LOST_CRS) |
1611 | if (status & TX_LATE_COL) lp->stats.tx_window_errors++; | 1610 | dev->stats.tx_carrier_errors++; |
1612 | if (status & TX_16_COL) lp->stats.tx_aborted_errors++; | 1611 | if (status & TX_SQE_ERROR) |
1612 | dev->stats.tx_heartbeat_errors++; | ||
1613 | if (status & TX_LATE_COL) | ||
1614 | dev->stats.tx_window_errors++; | ||
1615 | if (status & TX_16_COL) | ||
1616 | dev->stats.tx_aborted_errors++; | ||
1613 | } | 1617 | } |
1614 | break; | 1618 | break; |
1615 | case ISQ_BUFFER_EVENT: | 1619 | case ISQ_BUFFER_EVENT: |
@@ -1651,10 +1655,10 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
1651 | #endif | 1655 | #endif |
1652 | break; | 1656 | break; |
1653 | case ISQ_RX_MISS_EVENT: | 1657 | case ISQ_RX_MISS_EVENT: |
1654 | lp->stats.rx_missed_errors += (status >>6); | 1658 | dev->stats.rx_missed_errors += (status >> 6); |
1655 | break; | 1659 | break; |
1656 | case ISQ_TX_COL_EVENT: | 1660 | case ISQ_TX_COL_EVENT: |
1657 | lp->stats.collisions += (status >>6); | 1661 | dev->stats.collisions += (status >> 6); |
1658 | break; | 1662 | break; |
1659 | } | 1663 | } |
1660 | } | 1664 | } |
@@ -1662,22 +1666,24 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
1662 | } | 1666 | } |
1663 | 1667 | ||
1664 | static void | 1668 | static void |
1665 | count_rx_errors(int status, struct net_local *lp) | 1669 | count_rx_errors(int status, struct net_device *dev) |
1666 | { | 1670 | { |
1667 | lp->stats.rx_errors++; | 1671 | dev->stats.rx_errors++; |
1668 | if (status & RX_RUNT) lp->stats.rx_length_errors++; | 1672 | if (status & RX_RUNT) |
1669 | if (status & RX_EXTRA_DATA) lp->stats.rx_length_errors++; | 1673 | dev->stats.rx_length_errors++; |
1670 | if (status & RX_CRC_ERROR) if (!(status & (RX_EXTRA_DATA|RX_RUNT))) | 1674 | if (status & RX_EXTRA_DATA) |
1675 | dev->stats.rx_length_errors++; | ||
1676 | if ((status & RX_CRC_ERROR) && !(status & (RX_EXTRA_DATA|RX_RUNT))) | ||
1671 | /* per str 172 */ | 1677 | /* per str 172 */ |
1672 | lp->stats.rx_crc_errors++; | 1678 | dev->stats.rx_crc_errors++; |
1673 | if (status & RX_DRIBBLE) lp->stats.rx_frame_errors++; | 1679 | if (status & RX_DRIBBLE) |
1680 | dev->stats.rx_frame_errors++; | ||
1674 | } | 1681 | } |
1675 | 1682 | ||
1676 | /* We have a good packet(s), get it/them out of the buffers. */ | 1683 | /* We have a good packet(s), get it/them out of the buffers. */ |
1677 | static void | 1684 | static void |
1678 | net_rx(struct net_device *dev) | 1685 | net_rx(struct net_device *dev) |
1679 | { | 1686 | { |
1680 | struct net_local *lp = netdev_priv(dev); | ||
1681 | struct sk_buff *skb; | 1687 | struct sk_buff *skb; |
1682 | int status, length; | 1688 | int status, length; |
1683 | 1689 | ||
@@ -1686,7 +1692,7 @@ net_rx(struct net_device *dev) | |||
1686 | length = readword(ioaddr, RX_FRAME_PORT); | 1692 | length = readword(ioaddr, RX_FRAME_PORT); |
1687 | 1693 | ||
1688 | if ((status & RX_OK) == 0) { | 1694 | if ((status & RX_OK) == 0) { |
1689 | count_rx_errors(status, lp); | 1695 | count_rx_errors(status, dev); |
1690 | return; | 1696 | return; |
1691 | } | 1697 | } |
1692 | 1698 | ||
@@ -1696,7 +1702,7 @@ net_rx(struct net_device *dev) | |||
1696 | #if 0 /* Again, this seems a cruel thing to do */ | 1702 | #if 0 /* Again, this seems a cruel thing to do */ |
1697 | printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); | 1703 | printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); |
1698 | #endif | 1704 | #endif |
1699 | lp->stats.rx_dropped++; | 1705 | dev->stats.rx_dropped++; |
1700 | return; | 1706 | return; |
1701 | } | 1707 | } |
1702 | skb_reserve(skb, 2); /* longword align L3 header */ | 1708 | skb_reserve(skb, 2); /* longword align L3 header */ |
@@ -1713,8 +1719,8 @@ net_rx(struct net_device *dev) | |||
1713 | 1719 | ||
1714 | skb->protocol=eth_type_trans(skb,dev); | 1720 | skb->protocol=eth_type_trans(skb,dev); |
1715 | netif_rx(skb); | 1721 | netif_rx(skb); |
1716 | lp->stats.rx_packets++; | 1722 | dev->stats.rx_packets++; |
1717 | lp->stats.rx_bytes += length; | 1723 | dev->stats.rx_bytes += length; |
1718 | } | 1724 | } |
1719 | 1725 | ||
1720 | #if ALLOW_DMA | 1726 | #if ALLOW_DMA |
@@ -1765,11 +1771,11 @@ net_get_stats(struct net_device *dev) | |||
1765 | 1771 | ||
1766 | spin_lock_irqsave(&lp->lock, flags); | 1772 | spin_lock_irqsave(&lp->lock, flags); |
1767 | /* Update the statistics from the device registers. */ | 1773 | /* Update the statistics from the device registers. */ |
1768 | lp->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6); | 1774 | dev->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6); |
1769 | lp->stats.collisions += (readreg(dev, PP_TxCol) >> 6); | 1775 | dev->stats.collisions += (readreg(dev, PP_TxCol) >> 6); |
1770 | spin_unlock_irqrestore(&lp->lock, flags); | 1776 | spin_unlock_irqrestore(&lp->lock, flags); |
1771 | 1777 | ||
1772 | return &lp->stats; | 1778 | return &dev->stats; |
1773 | } | 1779 | } |
1774 | 1780 | ||
1775 | static void set_multicast_list(struct net_device *dev) | 1781 | static void set_multicast_list(struct net_device *dev) |