From: Thor Thayer <tthayer@opensource.altera.com>
To: Richard Andrysek <richard.andrysek@gomtec.de>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: wg@grandegger.com, mkl@pengutronix.de
Subject: Re: AW: AW: c_can driver sometimes sends first two bytes filled with zeros
Date: Thu, 19 May 2016 18:00:42 -0500 [thread overview]
Message-ID: <573E459A.1000300@opensource.altera.com> (raw)
In-Reply-To: <0120733A154AE74CA608A286CE7FFD2621D9CB60@rg-contact.RG.local>
Hi Richard,
On 05/19/2016 09:07 AM, Richard Andrysek wrote:
> Hi Thor,
>
> I am sending my test program and a makefile. The application accept up to 2 arguments:
> ## send 8 messages in 2ms cycle
> # test 8 2000
>
> ## default 16 messages in 2.6ms (the zip file data)
> # test
>
> In the zip file you can see my logging files (channel 1 and channel 2), on the channel 2 you can find failures
> in the "Failure_dump.txt".
>
Yes, I can see the zero bytes in your data.
Am I correct that both can0 and can1 are receiving the same data? If I'm
understanding, can0 seems to be fine but can1 periodically shows
corruption with the first 2 bytes set to 0?
Since the attached program uses a write, I'm confused about who is
sending the data? Is that the PCAN USB you referred to in an earlier email?
Also, where is the 2.6ms that you refer to and is in the code? From the
data, it seems like the spacing between frames is ~.120ms and ~1msec
between 16 frame bursts.
> Initialization of can channels is done from the shell:
>
> # ip link set can0 up type can bitrate 1000000
> # ip link set can1 up type can bitrate 1000000
>
> The cpu load is max 5%.
>
> Question1:
> I've checked a driver it looks good. Except one line in the function :
>
> static netdev_tx_t c_can_start_xmit(struct sk_buff *skb,
> struct net_device *dev)
> {
> struct can_frame *frame = (struct can_frame *)skb->data;
> struct c_can_priv *priv = netdev_priv(dev);
> u32 idx, obj;
>
> if (can_dropped_invalid_skb(dev, skb))
> return NETDEV_TX_OK;
> /*
> * This is not a FIFO. C/D_CAN sends out the buffers
> * prioritized. The lowest buffer number wins.
> */
> idx = fls(atomic_read(&priv->tx_active)); /*!!!!! Why so !!!! */
> ...
> ...
> /* Update the active bits */
> atomic_add((1 << idx), &priv->tx_active);
>
> Are these atomic operations correct? atomic_add I understand, but shall not be atomic_read used like this:
>
> Atomic block start
> idx = fls(read(&priv->tx->active))
> remove_idx_from(&priv->tx->active, idx)
> Atomic block stop
>
I'm not sure about this. I'm including the maintainers in the CC.
> Question2: What can make corrupted CAN messages on the channel 2?
>
Hmm. I've only worked with the first CAN so I can't speak for the 2nd
can device.
> Ch.
>
> Richard
>
>
next prev parent reply other threads:[~2016-05-19 22:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 9:23 c_can driver sometimes sends first two bytes filled with zeros Richard Andrysek
2016-05-16 18:14 ` Thor Thayer
2016-05-17 17:18 ` AW: " Richard Andrysek
2016-05-18 15:35 ` Thor Thayer
[not found] ` <0120733A154AE74CA608A286CE7FFD2621D9CB60@rg-contact.RG.local>
2016-05-19 23:00 ` Thor Thayer [this message]
2016-05-20 12:01 ` AW: AW: " Richard Andrysek
2016-05-23 14:22 ` Thor Thayer
2016-05-23 18:19 ` Wolfgang Grandegger
2016-06-01 9:40 ` AW: " Richard Andrysek
2016-06-01 13:09 ` Wolfgang Grandegger
2016-06-10 10:49 ` Andy Haydon
2016-06-10 12:55 ` Wolfgang Grandegger
2016-06-10 13:12 ` Andy Haydon
2016-06-10 13:36 ` Wolfgang Grandegger
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=573E459A.1000300@opensource.altera.com \
--to=tthayer@opensource.altera.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=richard.andrysek@gomtec.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).