From: Kurt Van Dijck <kurt.van.dijck@eia.be>
To: Jan Altenberg <jan@linutronix.de>
Cc: bhupesh.sharma@st.com, wg@grandegger.com,
b.spranger@linutronix.de, netdev@vger.kernel.org
Subject: Re: can: c_can: TX echo
Date: Wed, 23 Mar 2011 09:51:33 +0100 [thread overview]
Message-ID: <20110323085133.GB346@e-circ.dyndns.org> (raw)
In-Reply-To: <16a340801622a96218c76dbbabc7a23f.squirrel@www.linutronix.de>
I'm not too familiar with the c_can chip.
So I have a few questions inside my reply.
On Tue, Mar 22, 2011 at 04:59:23PM +0100, Jan Altenberg wrote:
> Hi all,
>
> I did some more testing on the SocketCAN driver for the Bosch c_can
> controller and I observed some strange behaviour for the TX handling.
> First of all the TX bytes are not accounted correctly. The reason for that
> seems to be quite obvious if we look into c_can_do_tx():
>
> [...]
>
> 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,
> msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
> stats->tx_bytes += priv->read_reg(priv,
> &priv->regs->ifregs[0].msg_cntrl)
> & IF_MCONT_DLC_MASK;
>
> So, we first invalidate the message object and afterwards we read the DLC
> value from the msg_cntrl (which is 0 after invalidating the
> message object) to account the TX bytes. So tx_bytes will always be 0. The
> fix should be easy, I think, we can just move
> c_can_inval_msg_object to the end of that loop.
IMO, it looks necessary to call c_can_inval_msg_object inside the if (),
after it has been transmitted. Otherwise, if for some other (TX) reason you
get in this loop, you may clear a pending transmission?
Again, I haven't read this one's datasheet. I was familiar with its predecessor.
>
> Cheers,
> Jan
Regards,
Kurt
next prev parent reply other threads:[~2011-03-23 8:51 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 ` Kurt Van Dijck [this message]
2011-03-23 13:54 ` can: c_can: TX echo 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 ` [PATCH] can: c_can: Fix tx_bytes accounting Jan Altenberg
2011-03-24 10:00 ` 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=20110323085133.GB346@e-circ.dyndns.org \
--to=kurt.van.dijck@eia.be \
--cc=b.spranger@linutronix.de \
--cc=bhupesh.sharma@st.com \
--cc=jan@linutronix.de \
--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).