aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti/cpsw.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-03-10 08:12:23 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-10 21:53:01 -0400
commit8dc43ddc9fe0af3a555af235a69a398c3eba2639 (patch)
tree42e458d4c673350dc9ebee4d1e17f2ce776368b0 /drivers/net/ethernet/ti/cpsw.c
parentd32d9bb85c65f52bed99a0149b47e9f6578c44c5 (diff)
net: eth: cpsw: Use net_device_stats from struct net_device
Instead of using an own copy of struct net_device_stats in struct cpsw_priv, use stats from struct net_device. Also remove the thus unnecessary .ndo_get_stats function, as it just returns dev->stats, which is the default. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Acked-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti/cpsw.c')
-rw-r--r--drivers/net/ethernet/ti/cpsw.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 53f85dd3bbad..543a0813c9e0 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -378,7 +378,6 @@ struct cpsw_priv {
378 u32 version; 378 u32 version;
379 u32 coal_intvl; 379 u32 coal_intvl;
380 u32 bus_freq_mhz; 380 u32 bus_freq_mhz;
381 struct net_device_stats stats;
382 int rx_packet_max; 381 int rx_packet_max;
383 int host_port; 382 int host_port;
384 struct clk *clk; 383 struct clk *clk;
@@ -673,8 +672,8 @@ static void cpsw_tx_handler(void *token, int len, int status)
673 if (unlikely(netif_queue_stopped(ndev))) 672 if (unlikely(netif_queue_stopped(ndev)))
674 netif_wake_queue(ndev); 673 netif_wake_queue(ndev);
675 cpts_tx_timestamp(priv->cpts, skb); 674 cpts_tx_timestamp(priv->cpts, skb);
676 priv->stats.tx_packets++; 675 ndev->stats.tx_packets++;
677 priv->stats.tx_bytes += len; 676 ndev->stats.tx_bytes += len;
678 dev_kfree_skb_any(skb); 677 dev_kfree_skb_any(skb);
679} 678}
680 679
@@ -700,10 +699,10 @@ static void cpsw_rx_handler(void *token, int len, int status)
700 cpts_rx_timestamp(priv->cpts, skb); 699 cpts_rx_timestamp(priv->cpts, skb);
701 skb->protocol = eth_type_trans(skb, ndev); 700 skb->protocol = eth_type_trans(skb, ndev);
702 netif_receive_skb(skb); 701 netif_receive_skb(skb);
703 priv->stats.rx_bytes += len; 702 ndev->stats.rx_bytes += len;
704 priv->stats.rx_packets++; 703 ndev->stats.rx_packets++;
705 } else { 704 } else {
706 priv->stats.rx_dropped++; 705 ndev->stats.rx_dropped++;
707 new_skb = skb; 706 new_skb = skb;
708 } 707 }
709 708
@@ -1313,7 +1312,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
1313 1312
1314 if (skb_padto(skb, CPSW_MIN_PACKET_SIZE)) { 1313 if (skb_padto(skb, CPSW_MIN_PACKET_SIZE)) {
1315 cpsw_err(priv, tx_err, "packet pad failed\n"); 1314 cpsw_err(priv, tx_err, "packet pad failed\n");
1316 priv->stats.tx_dropped++; 1315 ndev->stats.tx_dropped++;
1317 return NETDEV_TX_OK; 1316 return NETDEV_TX_OK;
1318 } 1317 }
1319 1318
@@ -1337,7 +1336,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
1337 1336
1338 return NETDEV_TX_OK; 1337 return NETDEV_TX_OK;
1339fail: 1338fail:
1340 priv->stats.tx_dropped++; 1339 ndev->stats.tx_dropped++;
1341 netif_stop_queue(ndev); 1340 netif_stop_queue(ndev);
1342 return NETDEV_TX_BUSY; 1341 return NETDEV_TX_BUSY;
1343} 1342}
@@ -1501,7 +1500,7 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev)
1501 struct cpsw_priv *priv = netdev_priv(ndev); 1500 struct cpsw_priv *priv = netdev_priv(ndev);
1502 1501
1503 cpsw_err(priv, tx_err, "transmit timeout, restarting dma\n"); 1502 cpsw_err(priv, tx_err, "transmit timeout, restarting dma\n");
1504 priv->stats.tx_errors++; 1503 ndev->stats.tx_errors++;
1505 cpsw_intr_disable(priv); 1504 cpsw_intr_disable(priv);
1506 cpdma_ctlr_int_ctrl(priv->dma, false); 1505 cpdma_ctlr_int_ctrl(priv->dma, false);
1507 cpdma_chan_stop(priv->txch); 1506 cpdma_chan_stop(priv->txch);
@@ -1540,12 +1539,6 @@ static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
1540 return 0; 1539 return 0;
1541} 1540}
1542 1541
1543static struct net_device_stats *cpsw_ndo_get_stats(struct net_device *ndev)
1544{
1545 struct cpsw_priv *priv = netdev_priv(ndev);
1546 return &priv->stats;
1547}
1548
1549#ifdef CONFIG_NET_POLL_CONTROLLER 1542#ifdef CONFIG_NET_POLL_CONTROLLER
1550static void cpsw_ndo_poll_controller(struct net_device *ndev) 1543static void cpsw_ndo_poll_controller(struct net_device *ndev)
1551{ 1544{
@@ -1638,7 +1631,6 @@ static const struct net_device_ops cpsw_netdev_ops = {
1638 .ndo_validate_addr = eth_validate_addr, 1631 .ndo_validate_addr = eth_validate_addr,
1639 .ndo_change_mtu = eth_change_mtu, 1632 .ndo_change_mtu = eth_change_mtu,
1640 .ndo_tx_timeout = cpsw_ndo_tx_timeout, 1633 .ndo_tx_timeout = cpsw_ndo_tx_timeout,
1641 .ndo_get_stats = cpsw_ndo_get_stats,
1642 .ndo_set_rx_mode = cpsw_ndo_set_rx_mode, 1634 .ndo_set_rx_mode = cpsw_ndo_set_rx_mode,
1643#ifdef CONFIG_NET_POLL_CONTROLLER 1635#ifdef CONFIG_NET_POLL_CONTROLLER
1644 .ndo_poll_controller = cpsw_ndo_poll_controller, 1636 .ndo_poll_controller = cpsw_ndo_poll_controller,