diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-04 22:13:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-05 22:41:17 -0400 |
commit | 897dd41d3b3235fe7e973dc5ca04781acf0dd8b2 (patch) | |
tree | 60c1092e6ab214ee8407b2f52c42ad6382b7fa40 /drivers/net/ksz884x.c | |
parent | 7bfba0b0c15962265950ac0efe6bd4f42414db6d (diff) |
ksz884x: 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/ksz884x.c')
-rw-r--r-- | drivers/net/ksz884x.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c index 62362b4a8c5..b3c010b8565 100644 --- a/drivers/net/ksz884x.c +++ b/drivers/net/ksz884x.c | |||
@@ -1457,7 +1457,6 @@ struct dev_info { | |||
1457 | * @adapter: Adapter device information. | 1457 | * @adapter: Adapter device information. |
1458 | * @port: Port information. | 1458 | * @port: Port information. |
1459 | * @monitor_time_info: Timer to monitor ports. | 1459 | * @monitor_time_info: Timer to monitor ports. |
1460 | * @stats: Network statistics. | ||
1461 | * @proc_sem: Semaphore for proc accessing. | 1460 | * @proc_sem: Semaphore for proc accessing. |
1462 | * @id: Device ID. | 1461 | * @id: Device ID. |
1463 | * @mii_if: MII interface information. | 1462 | * @mii_if: MII interface information. |
@@ -1471,7 +1470,6 @@ struct dev_priv { | |||
1471 | struct dev_info *adapter; | 1470 | struct dev_info *adapter; |
1472 | struct ksz_port port; | 1471 | struct ksz_port port; |
1473 | struct ksz_timer_info monitor_timer_info; | 1472 | struct ksz_timer_info monitor_timer_info; |
1474 | struct net_device_stats stats; | ||
1475 | 1473 | ||
1476 | struct semaphore proc_sem; | 1474 | struct semaphore proc_sem; |
1477 | int id; | 1475 | int id; |
@@ -4751,8 +4749,8 @@ static void send_packet(struct sk_buff *skb, struct net_device *dev) | |||
4751 | hw_send_pkt(hw); | 4749 | hw_send_pkt(hw); |
4752 | 4750 | ||
4753 | /* Update transmit statistics. */ | 4751 | /* Update transmit statistics. */ |
4754 | priv->stats.tx_packets++; | 4752 | dev->stats.tx_packets++; |
4755 | priv->stats.tx_bytes += len; | 4753 | dev->stats.tx_bytes += len; |
4756 | } | 4754 | } |
4757 | 4755 | ||
4758 | /** | 4756 | /** |
@@ -5030,7 +5028,7 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw, | |||
5030 | /* skb->data != skb->head */ | 5028 | /* skb->data != skb->head */ |
5031 | skb = dev_alloc_skb(packet_len + 2); | 5029 | skb = dev_alloc_skb(packet_len + 2); |
5032 | if (!skb) { | 5030 | if (!skb) { |
5033 | priv->stats.rx_dropped++; | 5031 | dev->stats.rx_dropped++; |
5034 | return -ENOMEM; | 5032 | return -ENOMEM; |
5035 | } | 5033 | } |
5036 | 5034 | ||
@@ -5050,8 +5048,8 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw, | |||
5050 | csum_verified(skb); | 5048 | csum_verified(skb); |
5051 | 5049 | ||
5052 | /* Update receive statistics. */ | 5050 | /* Update receive statistics. */ |
5053 | priv->stats.rx_packets++; | 5051 | dev->stats.rx_packets++; |
5054 | priv->stats.rx_bytes += packet_len; | 5052 | dev->stats.rx_bytes += packet_len; |
5055 | 5053 | ||
5056 | /* Notify upper layer for received packet. */ | 5054 | /* Notify upper layer for received packet. */ |
5057 | rx_status = netif_rx(skb); | 5055 | rx_status = netif_rx(skb); |
@@ -5291,7 +5289,7 @@ static irqreturn_t netdev_intr(int irq, void *dev_id) | |||
5291 | } | 5289 | } |
5292 | 5290 | ||
5293 | if (unlikely(int_enable & KS884X_INT_RX_OVERRUN)) { | 5291 | if (unlikely(int_enable & KS884X_INT_RX_OVERRUN)) { |
5294 | priv->stats.rx_fifo_errors++; | 5292 | dev->stats.rx_fifo_errors++; |
5295 | hw_resume_rx(hw); | 5293 | hw_resume_rx(hw); |
5296 | } | 5294 | } |
5297 | 5295 | ||
@@ -5522,7 +5520,7 @@ static int netdev_open(struct net_device *dev) | |||
5522 | priv->promiscuous = 0; | 5520 | priv->promiscuous = 0; |
5523 | 5521 | ||
5524 | /* Reset device statistics. */ | 5522 | /* Reset device statistics. */ |
5525 | memset(&priv->stats, 0, sizeof(struct net_device_stats)); | 5523 | memset(&dev->stats, 0, sizeof(struct net_device_stats)); |
5526 | memset((void *) port->counter, 0, | 5524 | memset((void *) port->counter, 0, |
5527 | (sizeof(u64) * OID_COUNTER_LAST)); | 5525 | (sizeof(u64) * OID_COUNTER_LAST)); |
5528 | 5526 | ||
@@ -5622,42 +5620,42 @@ static struct net_device_stats *netdev_query_statistics(struct net_device *dev) | |||
5622 | int i; | 5620 | int i; |
5623 | int p; | 5621 | int p; |
5624 | 5622 | ||
5625 | priv->stats.rx_errors = port->counter[OID_COUNTER_RCV_ERROR]; | 5623 | dev->stats.rx_errors = port->counter[OID_COUNTER_RCV_ERROR]; |
5626 | priv->stats.tx_errors = port->counter[OID_COUNTER_XMIT_ERROR]; | 5624 | dev->stats.tx_errors = port->counter[OID_COUNTER_XMIT_ERROR]; |
5627 | 5625 | ||
5628 | /* Reset to zero to add count later. */ | 5626 | /* Reset to zero to add count later. */ |
5629 | priv->stats.multicast = 0; | 5627 | dev->stats.multicast = 0; |
5630 | priv->stats.collisions = 0; | 5628 | dev->stats.collisions = 0; |
5631 | priv->stats.rx_length_errors = 0; | 5629 | dev->stats.rx_length_errors = 0; |
5632 | priv->stats.rx_crc_errors = 0; | 5630 | dev->stats.rx_crc_errors = 0; |
5633 | priv->stats.rx_frame_errors = 0; | 5631 | dev->stats.rx_frame_errors = 0; |
5634 | priv->stats.tx_window_errors = 0; | 5632 | dev->stats.tx_window_errors = 0; |
5635 | 5633 | ||
5636 | for (i = 0, p = port->first_port; i < port->mib_port_cnt; i++, p++) { | 5634 | for (i = 0, p = port->first_port; i < port->mib_port_cnt; i++, p++) { |
5637 | mib = &hw->port_mib[p]; | 5635 | mib = &hw->port_mib[p]; |
5638 | 5636 | ||
5639 | priv->stats.multicast += (unsigned long) | 5637 | dev->stats.multicast += (unsigned long) |
5640 | mib->counter[MIB_COUNTER_RX_MULTICAST]; | 5638 | mib->counter[MIB_COUNTER_RX_MULTICAST]; |
5641 | 5639 | ||
5642 | priv->stats.collisions += (unsigned long) | 5640 | dev->stats.collisions += (unsigned long) |
5643 | mib->counter[MIB_COUNTER_TX_TOTAL_COLLISION]; | 5641 | mib->counter[MIB_COUNTER_TX_TOTAL_COLLISION]; |
5644 | 5642 | ||
5645 | priv->stats.rx_length_errors += (unsigned long)( | 5643 | dev->stats.rx_length_errors += (unsigned long)( |
5646 | mib->counter[MIB_COUNTER_RX_UNDERSIZE] + | 5644 | mib->counter[MIB_COUNTER_RX_UNDERSIZE] + |
5647 | mib->counter[MIB_COUNTER_RX_FRAGMENT] + | 5645 | mib->counter[MIB_COUNTER_RX_FRAGMENT] + |
5648 | mib->counter[MIB_COUNTER_RX_OVERSIZE] + | 5646 | mib->counter[MIB_COUNTER_RX_OVERSIZE] + |
5649 | mib->counter[MIB_COUNTER_RX_JABBER]); | 5647 | mib->counter[MIB_COUNTER_RX_JABBER]); |
5650 | priv->stats.rx_crc_errors += (unsigned long) | 5648 | dev->stats.rx_crc_errors += (unsigned long) |
5651 | mib->counter[MIB_COUNTER_RX_CRC_ERR]; | 5649 | mib->counter[MIB_COUNTER_RX_CRC_ERR]; |
5652 | priv->stats.rx_frame_errors += (unsigned long)( | 5650 | dev->stats.rx_frame_errors += (unsigned long)( |
5653 | mib->counter[MIB_COUNTER_RX_ALIGNMENT_ERR] + | 5651 | mib->counter[MIB_COUNTER_RX_ALIGNMENT_ERR] + |
5654 | mib->counter[MIB_COUNTER_RX_SYMBOL_ERR]); | 5652 | mib->counter[MIB_COUNTER_RX_SYMBOL_ERR]); |
5655 | 5653 | ||
5656 | priv->stats.tx_window_errors += (unsigned long) | 5654 | dev->stats.tx_window_errors += (unsigned long) |
5657 | mib->counter[MIB_COUNTER_TX_LATE_COLLISION]; | 5655 | mib->counter[MIB_COUNTER_TX_LATE_COLLISION]; |
5658 | } | 5656 | } |
5659 | 5657 | ||
5660 | return &priv->stats; | 5658 | return &dev->stats; |
5661 | } | 5659 | } |
5662 | 5660 | ||
5663 | /** | 5661 | /** |