All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: David Jander <david@protonic.nl>
Cc: Wolfgang Grandegger <wg@grandegger.com>, linux-can@vger.kernel.org
Subject: Re: [PATCH v4] can: flexcan: Re-write receive path to use MB queue instead of FIFO
Date: Tue, 23 Sep 2014 15:34:35 +0200	[thread overview]
Message-ID: <542176EB.6050308@pengutronix.de> (raw)
In-Reply-To: <54216E5F.2010804@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1691 bytes --]

On 09/23/2014 02:58 PM, Marc Kleine-Budde wrote:
> On 09/18/2014 03:48 PM, David Jander wrote:
>> > The FlexCAN controller has a RX FIFO that is only 6 messages deep, and a
>> > mailbox space capable of holding up to 63 messages.
>> > This space was largely unused, limiting the permissible latency from
>> > interrupt to NAPI to only 6 messages. This patch uses all available MBs
>> > for message reception and frees the MBs in the IRQ handler to greatly
>> > decrease the likelihood of receive overruns.
>> > 
>> > Signed-off-by: David Jander <david@protonic.nl>
> I think we can improve the algorithm a bit.
> 
> I see a problem when you receive 4 CAN frames:
> 
> 0-1-2-3
> 
> then the irq handler starts, 0 gets processed and is empty (E)
> 
> E-1-2-3
> 
> while in the interrupt handler another two frames come in:
> 
> 4-1-2-3-5
> 
> I suggest add a variable to the priv which indicates the next MB to read
> from. Further, don't clear the mailbox direclty after it's been read,
> wait until a certain amount of read mailboxes accumulate, .e.g. when the
> rx_next point to 32. I have a work-in-progress code which to abstract
> this algorithm, but it limited to 32 mailboxes. It should work on the
> at91 but I don't know if it's flexible enought yet to work on the
> flexcan, too.

For the algorithm see the rx-fifo branch on linux-can-next. Feel free to
comment.

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: 181 bytes --]

  reply	other threads:[~2014-09-23 13:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 13:48 [PATCH v4] can: flexcan: Re-write receive path to use MB queue instead of FIFO David Jander
2014-09-23 12:58 ` Marc Kleine-Budde
2014-09-23 13:34   ` Marc Kleine-Budde [this message]
2014-09-23 13:53   ` David Jander
2014-09-26  9:35     ` Marc Kleine-Budde
2014-09-29 13:24       ` David Jander

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=542176EB.6050308@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=david@protonic.nl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.