From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: Henrik Bork Steffensen <hbs@rosetechnology.dk>,
linux-can@vger.kernel.org
Subject: Re: at91_can.c: Data transmission stops
Date: Wed, 28 Nov 2012 15:56:49 +0100 [thread overview]
Message-ID: <50B62631.8070606@pengutronix.de> (raw)
In-Reply-To: <50B4EAE1.6070400@grandegger.com>
[-- Attachment #1: Type: text/plain, Size: 1817 bytes --]
On 11/27/2012 05:31 PM, Wolfgang Grandegger wrote:
[...]
> As mentioned above, on the c_can there is definitely a race with the
> message ram due to the busy wait after accessing it. See:
>
> http://lxr.linux.no/#linux+v3.6.8/drivers/net/can/c_can/c_can.c#L237
>
>> Or is it the potential race between "c_can_start_xmit" and "c_can_do_tx" ?
>> Or even the access to the net api?
>>
>> Would someone care to explain?
>
> I will try. In at91_start_xmit, if we get interrupted
>
> if (!(at91_read(priv, AT91_MSR(get_tx_next_mb(priv))) &
> AT91_MSR_MRDY) ||
> (priv->tx_next & get_next_mask(priv)) == 0)
>
> /* HERE */
>
> netif_stop_queue(dev);
>
> and then at91_irq_tx() is called executing netif_wake_queue() we may end
> up with a stopped tx queue. But I'm not yet 100% sure.
I don't think so, because after this follows[1]
/* Enable interrupt for this mailbox */
at91_write(priv, AT91_IER, 1 << mb);
[1] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L524
So first the queued ist stopped, then the interrupt activated.
Then in the interrupt handler[2], [3]:
reg_sr = at91_read(priv, AT91_SR);
reg_imr = at91_read(priv, AT91_IMR);
reg_sr &= reg_imr;
...
if (reg_sr & AT91_IRQ_MB_TX)
at91_irq_tx(dev, reg_sr);
[2] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L1081
[3] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L1104
The at91_irq_tx() function works on the reg_sr.
Marc
--
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 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]
next prev parent reply other threads:[~2012-11-28 14:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-26 14:28 at91_can.c: Data transmission stops Henrik Bork Steffensen
2012-11-26 15:25 ` Wolfgang Grandegger
2012-11-26 16:29 ` Henrik Bork Steffensen
2012-11-27 14:11 ` Henrik Bork Steffensen
2012-11-27 16:31 ` Wolfgang Grandegger
2012-11-28 14:22 ` Henrik Bork Steffensen
2012-11-28 14:29 ` Marc Kleine-Budde
2012-11-28 15:09 ` Henrik Bork Steffensen
2012-11-28 15:12 ` Marc Kleine-Budde
2012-11-28 15:44 ` Henrik Bork Steffensen
2012-11-28 16:23 ` Wolfgang Grandegger
2012-12-03 16:13 ` Henrik Bork Steffensen
2012-11-28 14:38 ` Wolfgang Grandegger
2012-11-28 15:17 ` Henrik Bork Steffensen
2012-11-28 14:56 ` Marc Kleine-Budde [this message]
2012-11-28 15:17 ` Wolfgang Grandegger
2012-11-26 16:36 ` Marc Kleine-Budde
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=50B62631.8070606@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=hbs@rosetechnology.dk \
--cc=linux-can@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).