Commit 78e8c532 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by David S. Miller

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: default avatarKulikov Vasiliy <segooon@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a17ee90
...@@ -470,7 +470,6 @@ struct emac_priv { ...@@ -470,7 +470,6 @@ struct emac_priv {
u32 isr_count; u32 isr_count;
u8 rmii_en; u8 rmii_en;
u8 version; u8 version;
struct net_device_stats net_dev_stats;
u32 mac_hash1; u32 mac_hash1;
u32 mac_hash2; u32 mac_hash2;
u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS]; u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS];
...@@ -1180,16 +1179,17 @@ static int emac_net_tx_complete(struct emac_priv *priv, ...@@ -1180,16 +1179,17 @@ static int emac_net_tx_complete(struct emac_priv *priv,
void **net_data_tokens, void **net_data_tokens,
int num_tokens, u32 ch) int num_tokens, u32 ch)
{ {
struct net_device *ndev = priv->ndev;
u32 cnt; u32 cnt;
if (unlikely(num_tokens && netif_queue_stopped(priv->ndev))) if (unlikely(num_tokens && netif_queue_stopped(dev)))
netif_start_queue(priv->ndev); netif_start_queue(dev);
for (cnt = 0; cnt < num_tokens; cnt++) { for (cnt = 0; cnt < num_tokens; cnt++) {
struct sk_buff *skb = (struct sk_buff *)net_data_tokens[cnt]; struct sk_buff *skb = (struct sk_buff *)net_data_tokens[cnt];
if (skb == NULL) if (skb == NULL)
continue; continue;
priv->net_dev_stats.tx_packets++; ndev->stats.tx_packets++;
priv->net_dev_stats.tx_bytes += skb->len; ndev->stats.tx_bytes += skb->len;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
return 0; return 0;
...@@ -1476,7 +1476,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1476,7 +1476,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
" err. Out of TX BD's"); " err. Out of TX BD's");
netif_stop_queue(priv->ndev); netif_stop_queue(priv->ndev);
} }
priv->net_dev_stats.tx_dropped++; ndev->stats.tx_dropped++;
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -1501,7 +1501,7 @@ static void emac_dev_tx_timeout(struct net_device *ndev) ...@@ -1501,7 +1501,7 @@ static void emac_dev_tx_timeout(struct net_device *ndev)
if (netif_msg_tx_err(priv)) if (netif_msg_tx_err(priv))
dev_err(emac_dev, "DaVinci EMAC: xmit timeout, restarting TX"); dev_err(emac_dev, "DaVinci EMAC: xmit timeout, restarting TX");
priv->net_dev_stats.tx_errors++; ndev->stats.tx_errors++;
emac_int_disable(priv); emac_int_disable(priv);
emac_stop_txch(priv, EMAC_DEF_TX_CH); emac_stop_txch(priv, EMAC_DEF_TX_CH);
emac_cleanup_txch(priv, EMAC_DEF_TX_CH); 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,14 +1926,14 @@ static void emac_addbd_to_rx_queue(struct emac_priv *priv, u32 ch,
static int emac_net_rx_cb(struct emac_priv *priv, static int emac_net_rx_cb(struct emac_priv *priv,
struct emac_netpktobj *net_pkt_list) struct emac_netpktobj *net_pkt_list)
{ {
struct sk_buff *p_skb; struct net_device *ndev = priv->ndev;
p_skb = (struct sk_buff *)net_pkt_list->pkt_token; struct sk_buff *p_skb = net_pkt_list->pkt_token;
/* set length of packet */ /* set length of packet */
skb_put(p_skb, net_pkt_list->pkt_length); skb_put(p_skb, net_pkt_list->pkt_length);
p_skb->protocol = eth_type_trans(p_skb, priv->ndev); p_skb->protocol = eth_type_trans(p_skb, priv->ndev);
netif_receive_skb(p_skb); netif_receive_skb(p_skb);
priv->net_dev_stats.rx_bytes += net_pkt_list->pkt_length; ndev->stats.rx_bytes += net_pkt_list->pkt_length;
priv->net_dev_stats.rx_packets++; ndev->stats.rx_packets++;
return 0; return 0;
} }
...@@ -2570,39 +2570,39 @@ static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) ...@@ -2570,39 +2570,39 @@ static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev)
else else
stats_clear_mask = 0; stats_clear_mask = 0;
priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES); ndev->stats.multicast += emac_read(EMAC_RXMCASTFRAMES);
emac_write(EMAC_RXMCASTFRAMES, stats_clear_mask); emac_write(EMAC_RXMCASTFRAMES, stats_clear_mask);
priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) + ndev->stats.collisions += (emac_read(EMAC_TXCOLLISION) +
emac_read(EMAC_TXSINGLECOLL) + emac_read(EMAC_TXSINGLECOLL) +
emac_read(EMAC_TXMULTICOLL)); emac_read(EMAC_TXMULTICOLL));
emac_write(EMAC_TXCOLLISION, stats_clear_mask); emac_write(EMAC_TXCOLLISION, stats_clear_mask);
emac_write(EMAC_TXSINGLECOLL, stats_clear_mask); emac_write(EMAC_TXSINGLECOLL, stats_clear_mask);
emac_write(EMAC_TXMULTICOLL, stats_clear_mask); emac_write(EMAC_TXMULTICOLL, stats_clear_mask);
priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + ndev->stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) +
emac_read(EMAC_RXJABBER) + emac_read(EMAC_RXJABBER) +
emac_read(EMAC_RXUNDERSIZED)); emac_read(EMAC_RXUNDERSIZED));
emac_write(EMAC_RXOVERSIZED, stats_clear_mask); emac_write(EMAC_RXOVERSIZED, stats_clear_mask);
emac_write(EMAC_RXJABBER, stats_clear_mask); emac_write(EMAC_RXJABBER, stats_clear_mask);
emac_write(EMAC_RXUNDERSIZED, stats_clear_mask); emac_write(EMAC_RXUNDERSIZED, stats_clear_mask);
priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + ndev->stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) +
emac_read(EMAC_RXMOFOVERRUNS)); emac_read(EMAC_RXMOFOVERRUNS));
emac_write(EMAC_RXSOFOVERRUNS, stats_clear_mask); emac_write(EMAC_RXSOFOVERRUNS, stats_clear_mask);
emac_write(EMAC_RXMOFOVERRUNS, stats_clear_mask); emac_write(EMAC_RXMOFOVERRUNS, stats_clear_mask);
priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); ndev->stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS);
emac_write(EMAC_RXDMAOVERRUNS, stats_clear_mask); emac_write(EMAC_RXDMAOVERRUNS, stats_clear_mask);
priv->net_dev_stats.tx_carrier_errors += ndev->stats.tx_carrier_errors +=
emac_read(EMAC_TXCARRIERSENSE); emac_read(EMAC_TXCARRIERSENSE);
emac_write(EMAC_TXCARRIERSENSE, stats_clear_mask); emac_write(EMAC_TXCARRIERSENSE, stats_clear_mask);
priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); ndev->stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN);
emac_write(EMAC_TXUNDERRUN, stats_clear_mask); emac_write(EMAC_TXUNDERRUN, stats_clear_mask);
return &priv->net_dev_stats; return &ndev->stats;
} }
static const struct net_device_ops emac_netdev_ops = { static const struct net_device_ops emac_netdev_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment