diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-04 22:13:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-05 22:41:12 -0400 |
commit | 78e8c5325aa8ae99b6738eaab0ebb7e3f53007ff (patch) | |
tree | 8f5420593fa0d6604e9c62a35bd0b94962aa7261 /drivers/net/davinci_emac.c | |
parent | 0a17ee90a16ddf6b410bc1a8a28a7e875dc08f8d (diff) |
davinci_emac: 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/davinci_emac.c')
-rw-r--r-- | drivers/net/davinci_emac.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 08e82b1a0b33..25e14d2da755 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -470,7 +470,6 @@ struct emac_priv { | |||
470 | u32 isr_count; | 470 | u32 isr_count; |
471 | u8 rmii_en; | 471 | u8 rmii_en; |
472 | u8 version; | 472 | u8 version; |
473 | struct net_device_stats net_dev_stats; | ||
474 | u32 mac_hash1; | 473 | u32 mac_hash1; |
475 | u32 mac_hash2; | 474 | u32 mac_hash2; |
476 | u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS]; | 475 | u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS]; |
@@ -1180,16 +1179,17 @@ static int emac_net_tx_complete(struct emac_priv *priv, | |||
1180 | void **net_data_tokens, | 1179 | void **net_data_tokens, |
1181 | int num_tokens, u32 ch) | 1180 | int num_tokens, u32 ch) |
1182 | { | 1181 | { |
1182 | struct net_device *ndev = priv->ndev; | ||
1183 | u32 cnt; | 1183 | u32 cnt; |
1184 | 1184 | ||
1185 | if (unlikely(num_tokens && netif_queue_stopped(priv->ndev))) | 1185 | if (unlikely(num_tokens && netif_queue_stopped(dev))) |
1186 | netif_start_queue(priv->ndev); | 1186 | netif_start_queue(dev); |
1187 | for (cnt = 0; cnt < num_tokens; cnt++) { | 1187 | for (cnt = 0; cnt < num_tokens; cnt++) { |
1188 | struct sk_buff *skb = (struct sk_buff *)net_data_tokens[cnt]; | 1188 | struct sk_buff *skb = (struct sk_buff *)net_data_tokens[cnt]; |
1189 | if (skb == NULL) | 1189 | if (skb == NULL) |
1190 | continue; | 1190 | continue; |
1191 | priv->net_dev_stats.tx_packets++; | 1191 | ndev->stats.tx_packets++; |
1192 | priv->net_dev_stats.tx_bytes += skb->len; | 1192 | ndev->stats.tx_bytes += skb->len; |
1193 | dev_kfree_skb_any(skb); | 1193 | dev_kfree_skb_any(skb); |
1194 | } | 1194 | } |
1195 | return 0; | 1195 | return 0; |
@@ -1476,7 +1476,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1476 | " err. Out of TX BD's"); | 1476 | " err. Out of TX BD's"); |
1477 | netif_stop_queue(priv->ndev); | 1477 | netif_stop_queue(priv->ndev); |
1478 | } | 1478 | } |
1479 | priv->net_dev_stats.tx_dropped++; | 1479 | ndev->stats.tx_dropped++; |
1480 | return NETDEV_TX_BUSY; | 1480 | return NETDEV_TX_BUSY; |
1481 | } | 1481 | } |
1482 | 1482 | ||
@@ -1501,7 +1501,7 @@ static void emac_dev_tx_timeout(struct net_device *ndev) | |||
1501 | if (netif_msg_tx_err(priv)) | 1501 | if (netif_msg_tx_err(priv)) |
1502 | dev_err(emac_dev, "DaVinci EMAC: xmit timeout, restarting TX"); | 1502 | dev_err(emac_dev, "DaVinci EMAC: xmit timeout, restarting TX"); |
1503 | 1503 | ||
1504 | priv->net_dev_stats.tx_errors++; | 1504 | ndev->stats.tx_errors++; |
1505 | emac_int_disable(priv); | 1505 | emac_int_disable(priv); |
1506 | emac_stop_txch(priv, EMAC_DEF_TX_CH); | 1506 | emac_stop_txch(priv, EMAC_DEF_TX_CH); |
1507 | emac_cleanup_txch(priv, EMAC_DEF_TX_CH); | 1507 | emac_cleanup_txch(priv, EMAC_DEF_TX_CH); |
@@ -1926,14 +1926,14 @@ static void emac_addbd_to_rx_queue(struct emac_priv *priv, u32 ch, | |||
1926 | static int emac_net_rx_cb(struct emac_priv *priv, | 1926 | static int emac_net_rx_cb(struct emac_priv *priv, |
1927 | struct emac_netpktobj *net_pkt_list) | 1927 | struct emac_netpktobj *net_pkt_list) |
1928 | { | 1928 | { |
1929 | struct sk_buff *p_skb; | 1929 | struct net_device *ndev = priv->ndev; |
1930 | p_skb = (struct sk_buff *)net_pkt_list->pkt_token; | 1930 | struct sk_buff *p_skb = net_pkt_list->pkt_token; |
1931 | /* set length of packet */ | 1931 | /* set length of packet */ |
1932 | skb_put(p_skb, net_pkt_list->pkt_length); | 1932 | skb_put(p_skb, net_pkt_list->pkt_length); |
1933 | p_skb->protocol = eth_type_trans(p_skb, priv->ndev); | 1933 | p_skb->protocol = eth_type_trans(p_skb, priv->ndev); |
1934 | netif_receive_skb(p_skb); | 1934 | netif_receive_skb(p_skb); |
1935 | priv->net_dev_stats.rx_bytes += net_pkt_list->pkt_length; | 1935 | ndev->stats.rx_bytes += net_pkt_list->pkt_length; |
1936 | priv->net_dev_stats.rx_packets++; | 1936 | ndev->stats.rx_packets++; |
1937 | return 0; | 1937 | return 0; |
1938 | } | 1938 | } |
1939 | 1939 | ||
@@ -2570,39 +2570,39 @@ static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) | |||
2570 | else | 2570 | else |
2571 | stats_clear_mask = 0; | 2571 | stats_clear_mask = 0; |
2572 | 2572 | ||
2573 | priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES); | 2573 | ndev->stats.multicast += emac_read(EMAC_RXMCASTFRAMES); |
2574 | emac_write(EMAC_RXMCASTFRAMES, stats_clear_mask); | 2574 | emac_write(EMAC_RXMCASTFRAMES, stats_clear_mask); |
2575 | 2575 | ||
2576 | priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) + | 2576 | ndev->stats.collisions += (emac_read(EMAC_TXCOLLISION) + |
2577 | emac_read(EMAC_TXSINGLECOLL) + | 2577 | emac_read(EMAC_TXSINGLECOLL) + |
2578 | emac_read(EMAC_TXMULTICOLL)); | 2578 | emac_read(EMAC_TXMULTICOLL)); |
2579 | emac_write(EMAC_TXCOLLISION, stats_clear_mask); | 2579 | emac_write(EMAC_TXCOLLISION, stats_clear_mask); |
2580 | emac_write(EMAC_TXSINGLECOLL, stats_clear_mask); | 2580 | emac_write(EMAC_TXSINGLECOLL, stats_clear_mask); |
2581 | emac_write(EMAC_TXMULTICOLL, stats_clear_mask); | 2581 | emac_write(EMAC_TXMULTICOLL, stats_clear_mask); |
2582 | 2582 | ||
2583 | priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + | 2583 | ndev->stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + |
2584 | emac_read(EMAC_RXJABBER) + | 2584 | emac_read(EMAC_RXJABBER) + |
2585 | emac_read(EMAC_RXUNDERSIZED)); | 2585 | emac_read(EMAC_RXUNDERSIZED)); |
2586 | emac_write(EMAC_RXOVERSIZED, stats_clear_mask); | 2586 | emac_write(EMAC_RXOVERSIZED, stats_clear_mask); |
2587 | emac_write(EMAC_RXJABBER, stats_clear_mask); | 2587 | emac_write(EMAC_RXJABBER, stats_clear_mask); |
2588 | emac_write(EMAC_RXUNDERSIZED, stats_clear_mask); | 2588 | emac_write(EMAC_RXUNDERSIZED, stats_clear_mask); |
2589 | 2589 | ||
2590 | priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + | 2590 | ndev->stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + |
2591 | emac_read(EMAC_RXMOFOVERRUNS)); | 2591 | emac_read(EMAC_RXMOFOVERRUNS)); |
2592 | emac_write(EMAC_RXSOFOVERRUNS, stats_clear_mask); | 2592 | emac_write(EMAC_RXSOFOVERRUNS, stats_clear_mask); |
2593 | emac_write(EMAC_RXMOFOVERRUNS, stats_clear_mask); | 2593 | emac_write(EMAC_RXMOFOVERRUNS, stats_clear_mask); |
2594 | 2594 | ||
2595 | priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); | 2595 | ndev->stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); |
2596 | emac_write(EMAC_RXDMAOVERRUNS, stats_clear_mask); | 2596 | emac_write(EMAC_RXDMAOVERRUNS, stats_clear_mask); |
2597 | 2597 | ||
2598 | priv->net_dev_stats.tx_carrier_errors += | 2598 | ndev->stats.tx_carrier_errors += |
2599 | emac_read(EMAC_TXCARRIERSENSE); | 2599 | emac_read(EMAC_TXCARRIERSENSE); |
2600 | emac_write(EMAC_TXCARRIERSENSE, stats_clear_mask); | 2600 | emac_write(EMAC_TXCARRIERSENSE, stats_clear_mask); |
2601 | 2601 | ||
2602 | priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); | 2602 | ndev->stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); |
2603 | emac_write(EMAC_TXUNDERRUN, stats_clear_mask); | 2603 | emac_write(EMAC_TXUNDERRUN, stats_clear_mask); |
2604 | 2604 | ||
2605 | return &priv->net_dev_stats; | 2605 | return &ndev->stats; |
2606 | } | 2606 | } |
2607 | 2607 | ||
2608 | static const struct net_device_ops emac_netdev_ops = { | 2608 | static const struct net_device_ops emac_netdev_ops = { |