* [PATCH] net: eth: cpsw: Use net_device_stats from struct net_device
@ 2014-03-10 12:12 Tobias Klauser
2014-03-10 12:22 ` Mugunthan V N
2014-03-11 1:54 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Tobias Klauser @ 2014-03-10 12:12 UTC (permalink / raw)
To: David S. Miller, Mugunthan V N; +Cc: Sebastian Siewior, netdev
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>
---
drivers/net/ethernet/ti/cpsw.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 53f85dd..543a081 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -378,7 +378,6 @@ struct cpsw_priv {
u32 version;
u32 coal_intvl;
u32 bus_freq_mhz;
- struct net_device_stats stats;
int rx_packet_max;
int host_port;
struct clk *clk;
@@ -673,8 +672,8 @@ static void cpsw_tx_handler(void *token, int len, int status)
if (unlikely(netif_queue_stopped(ndev)))
netif_wake_queue(ndev);
cpts_tx_timestamp(priv->cpts, skb);
- priv->stats.tx_packets++;
- priv->stats.tx_bytes += len;
+ ndev->stats.tx_packets++;
+ ndev->stats.tx_bytes += len;
dev_kfree_skb_any(skb);
}
@@ -700,10 +699,10 @@ static void cpsw_rx_handler(void *token, int len, int status)
cpts_rx_timestamp(priv->cpts, skb);
skb->protocol = eth_type_trans(skb, ndev);
netif_receive_skb(skb);
- priv->stats.rx_bytes += len;
- priv->stats.rx_packets++;
+ ndev->stats.rx_bytes += len;
+ ndev->stats.rx_packets++;
} else {
- priv->stats.rx_dropped++;
+ ndev->stats.rx_dropped++;
new_skb = skb;
}
@@ -1313,7 +1312,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
if (skb_padto(skb, CPSW_MIN_PACKET_SIZE)) {
cpsw_err(priv, tx_err, "packet pad failed\n");
- priv->stats.tx_dropped++;
+ ndev->stats.tx_dropped++;
return NETDEV_TX_OK;
}
@@ -1337,7 +1336,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
fail:
- priv->stats.tx_dropped++;
+ ndev->stats.tx_dropped++;
netif_stop_queue(ndev);
return NETDEV_TX_BUSY;
}
@@ -1501,7 +1500,7 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev)
struct cpsw_priv *priv = netdev_priv(ndev);
cpsw_err(priv, tx_err, "transmit timeout, restarting dma\n");
- priv->stats.tx_errors++;
+ ndev->stats.tx_errors++;
cpsw_intr_disable(priv);
cpdma_ctlr_int_ctrl(priv->dma, false);
cpdma_chan_stop(priv->txch);
@@ -1540,12 +1539,6 @@ static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
return 0;
}
-static struct net_device_stats *cpsw_ndo_get_stats(struct net_device *ndev)
-{
- struct cpsw_priv *priv = netdev_priv(ndev);
- return &priv->stats;
-}
-
#ifdef CONFIG_NET_POLL_CONTROLLER
static void cpsw_ndo_poll_controller(struct net_device *ndev)
{
@@ -1638,7 +1631,6 @@ static const struct net_device_ops cpsw_netdev_ops = {
.ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = eth_change_mtu,
.ndo_tx_timeout = cpsw_ndo_tx_timeout,
- .ndo_get_stats = cpsw_ndo_get_stats,
.ndo_set_rx_mode = cpsw_ndo_set_rx_mode,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cpsw_ndo_poll_controller,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: eth: cpsw: Use net_device_stats from struct net_device
2014-03-10 12:12 [PATCH] net: eth: cpsw: Use net_device_stats from struct net_device Tobias Klauser
@ 2014-03-10 12:22 ` Mugunthan V N
2014-03-11 1:54 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Mugunthan V N @ 2014-03-10 12:22 UTC (permalink / raw)
To: Tobias Klauser, David S. Miller; +Cc: Sebastian Siewior, netdev
On Monday 10 March 2014 05:42 PM, Tobias Klauser wrote:
> 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>
Looks good to me.
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Regards
Mugunthan V N
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: eth: cpsw: Use net_device_stats from struct net_device
2014-03-10 12:12 [PATCH] net: eth: cpsw: Use net_device_stats from struct net_device Tobias Klauser
2014-03-10 12:22 ` Mugunthan V N
@ 2014-03-11 1:54 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-03-11 1:54 UTC (permalink / raw)
To: tklauser; +Cc: mugunthanvnm, bigeasy, netdev
From: Tobias Klauser <tklauser@distanz.ch>
Date: Mon, 10 Mar 2014 13:12:23 +0100
> 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>
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-11 1:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 12:12 [PATCH] net: eth: cpsw: Use net_device_stats from struct net_device Tobias Klauser
2014-03-10 12:22 ` Mugunthan V N
2014-03-11 1:54 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).