diff options
author | Anssi Hannula <anssi.hannula@bitwise.fi> | 2018-02-26 14:50:35 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-07-27 10:40:17 +0200 |
commit | 11ee5fcd6af37b1107aa0e8980a40f8e17703c0b (patch) | |
tree | e61ba6e7838c4108dccba1a96f78dc78906a3920 /drivers/net/can/xilinx_can.c | |
parent | 6181dbc02b6c73fd2e07d06bb8766867bb96ebbe (diff) | |
download | linux-11ee5fcd6af37b1107aa0e8980a40f8e17703c0b.tar.bz2 |
can: xilinx_can: update stats.tx_bytes after transmission
The driver updates stats.tx_bytes in start_xmit() even though it could
do so in TX interrupt handler.
Change the code to update tx_bytes in the interrupt handler, using the
return value of can_get_echo_skb().
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/xilinx_can.c')
-rw-r--r-- | drivers/net/can/xilinx_can.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index c7e5373a8f3c..9bce846acfcc 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -403,7 +403,6 @@ static int xcan_do_set_mode(struct net_device *ndev, enum can_mode mode) static netdev_tx_t xcan_start_xmit(struct sk_buff *skb, struct net_device *ndev) { struct xcan_priv *priv = netdev_priv(ndev); - struct net_device_stats *stats = &ndev->stats; struct can_frame *cf = (struct can_frame *)skb->data; u32 id, dlc, data[2] = {0, 0}; unsigned long flags; @@ -469,7 +468,6 @@ static netdev_tx_t xcan_start_xmit(struct sk_buff *skb, struct net_device *ndev) * write triggers tranmission */ priv->write_reg(priv, XCAN_TXFIFO_DW2_OFFSET, data[1]); - stats->tx_bytes += cf->can_dlc; } /* Clear TX-FIFO-empty interrupt for xcan_tx_interrupt() */ @@ -889,8 +887,8 @@ static void xcan_tx_interrupt(struct net_device *ndev, u32 isr) } while (frames_sent--) { - can_get_echo_skb(ndev, priv->tx_tail % - priv->tx_max); + stats->tx_bytes += can_get_echo_skb(ndev, priv->tx_tail % + priv->tx_max); priv->tx_tail++; stats->tx_packets++; } |