linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Bechtold <Holger.Bechtold@gmx.net>
To: wg@grandegger.com, mkl@pengutronix.de
Cc: linux-can@vger.kernel.org
Subject: [PATCH] for C_CAN driver.
Date: Mon, 25 Nov 2013 15:48:19 +0100	[thread overview]
Message-ID: <20131125144819.GA5129@pc1xp> (raw)

Hello all

As suggested by Marc Kleine-Budde I re-submit a modified version of the
patch for the transmitted bytes counter.

---------- patch description -----------------------------------------------

The number of bytes transmitted was not updated correctly, if several
CAN messages (with different length) were transmitted in one 'bunch'.
Thus programs like 'ifconfig' showed wrong transmit byte counts.
Reason was, that the message object whose DLC is to be read was not
necessarily the active one at the time when
   priv->read_reg(priv, C_CAN_IFACE(MSGCTRL_REG, 0)) & IF_MCONT_DLC_MASK;
was executed.

---------- patch -----------------------------------------------------------

--- linux-3.8.13/drivers/net/can/c_can/c_can.c.Orig	2013-05-11 22:57:46.000000000 +0200
+++ linux-3.8.13/drivers/net/can/c_can/c_can.c	2013-11-25 15:21:29.000763007 +0100
@@ -751,6 +751,7 @@ static void c_can_do_tx(struct net_devic
 		if (!(val & (1 << (msg_obj_no - 1)))) {
 			can_get_echo_skb(dev,
 					msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
+			c_can_object_get(dev, 0, msg_obj_no, IF_COMM_ALL);
 			stats->tx_bytes += priv->read_reg(priv,
 					C_CAN_IFACE(MSGCTRL_REG, 0))
 					& IF_MCONT_DLC_MASK;

------------------------------------------------------------------------------

Signed-off-by: Holger Bechtold <Holger.Bechtold@gmx.net>


                 reply	other threads:[~2013-11-25 14:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131125144819.GA5129@pc1xp \
    --to=holger.bechtold@gmx.net \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).