Re: [PATCH 16/16] c_can: fix TX packet accounting
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2013-09-09 10:31:06
Also in:
linux-can
On 09/09/2013 09:25 AM, Benedikt Spranger wrote:
Due to the integration of the FlexCard support the TX stats accounting got lost. Readd the accounting.
Please squash into the appropriate patch. Marc
quoted hunk ↗ jump to hunk
Signed-off-by: Benedikt Spranger <redacted> --- drivers/net/can/c_can/c_can.c | 6 ++++++ 1 file changed, 6 insertions(+)diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 92c1444..b409cf2 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c@@ -619,6 +619,7 @@ static netdev_tx_t c_can_start_xmit(struct sk_buff *skb, u32 msg_obj_no; struct c_can_priv *priv = netdev_priv(dev); struct can_frame *frame = (struct can_frame *)skb->data; + struct net_device_stats *stats = &dev->stats; int tx_fifo, txie_off; if (can_dropped_invalid_skb(dev, skb))@@ -664,6 +665,9 @@ static netdev_tx_t c_can_start_xmit(struct sk_buff *skb, ctrl = readl(priv->base + FC_TXFIFO_CTRL); ctrl |= FC_TXFIFO_CTRL_REQ; writel(ctrl, priv->base + FC_TXFIFO_CTRL); + + stats->tx_bytes += frame->can_dlc; + stats->tx_packets++; kfree_skb(skb); } else { msg_obj_no = get_tx_next_msg_obj(priv);@@ -672,6 +676,8 @@ static netdev_tx_t c_can_start_xmit(struct sk_buff *skb, c_can_write_msg_object(dev, 0, frame, msg_obj_no, txie_off); priv->tx_next++; + stats->tx_bytes += frame->can_dlc; + stats->tx_packets++; can_put_echo_skb(skb, dev, msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST); /* we have to stop the queue in case of a wrap around or * if the next TX message object is still in use
-- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Attachments
- signature.asc [application/pgp-signature] 259 bytes