netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Altenberg <jan@linutronix.de>
To: Bhupesh SHARMA <bhupesh.sharma@st.com>
Cc: "wg@grandegger.com" <wg@grandegger.com>,
	"kurt.van.dijck@eia.be" <kurt.van.dijck@eia.be>,
	"b.spranger@linutronix.de" <b.spranger@linutronix.de>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Socketcan-core@lists.berlios.de"
	<Socketcan-core@lists.berlios.de>,
	jan@linutronix.de
Subject: [PATCH] can: c_can: Fix tx_bytes accounting
Date: Thu, 24 Mar 2011 11:38:40 +0100	[thread overview]
Message-ID: <1300963120.3295.7.camel@localhost> (raw)
In-Reply-To: <D5ECB3C7A6F99444980976A8C6D896384DF0D6F721@EAPEX1MAIL1.st.com>

Hi Bhupesh,

as discussed I moved c_can_inval_msg_object() to the end of the if()
statement. That should fix the tx_bytes accounting. For me it's working
fine now.

Signed-off-by: Jan Altenberg <jan@linutronix.de>
---
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 110eda0..f895c04 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -704,7 +704,6 @@ static void c_can_do_tx(struct net_device *dev)
 
 	for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
 		msg_obj_no = get_tx_echo_msg_obj(priv);
-		c_can_inval_msg_object(dev, 0, msg_obj_no);
 		val = c_can_read_reg32(priv, &priv->regs->txrqst1);
 		if (!(val & (1 << msg_obj_no))) {
 			can_get_echo_skb(dev,
@@ -713,6 +712,7 @@ static void c_can_do_tx(struct net_device *dev)
 					&priv->regs->ifregs[0].msg_cntrl)
 					& IF_MCONT_DLC_MASK;
 			stats->tx_packets++;
+			c_can_inval_msg_object(dev, 0, msg_obj_no);
 		}
 	}
 



  reply	other threads:[~2011-03-24  9:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 15:59 can: c_can: TX handling Jan Altenberg
2011-03-23  8:51 ` can: c_can: TX echo Kurt Van Dijck
2011-03-23 13:54   ` Jan Altenberg
2011-03-23 14:25     ` Wolfgang Grandegger
2011-03-23 14:52       ` Jan Altenberg
2011-03-23  8:53 ` can: c_can: TX delivery Kurt Van Dijck
2011-03-23 15:32   ` Jan Altenberg
2011-03-23 15:49     ` Kurt Van Dijck
2011-03-24 10:02     ` Marc Kleine-Budde
2011-03-24  4:18 ` c_can: TX handling Bhupesh SHARMA
2011-03-24 10:56   ` Jan Altenberg
2011-03-24  5:43 ` Bhupesh SHARMA
2011-03-24 10:38   ` Jan Altenberg [this message]
2011-03-24 10:00     ` [PATCH] can: c_can: Fix tx_bytes accounting Wolfgang Grandegger
2011-03-24 11:26       ` [PATCH resend] " Jan Altenberg
2011-03-24 10:49         ` Kurt Van Dijck
     [not found]           ` <20110324104925.GB339-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
2011-03-24 11:49             ` Wolfgang Grandegger
     [not found]               ` <4D8B2FAF.5040000-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2011-03-28  1:24                 ` David Miller

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=1300963120.3295.7.camel@localhost \
    --to=jan@linutronix.de \
    --cc=Socketcan-core@lists.berlios.de \
    --cc=b.spranger@linutronix.de \
    --cc=bhupesh.sharma@st.com \
    --cc=kurt.van.dijck@eia.be \
    --cc=netdev@vger.kernel.org \
    --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).