From: David Jander <david@protonic.nl>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Alexander Stein <alexander.stein@systec-electronic.com>,
Wolfgang Grandegger <wg@grandegger.com>,
linux-can@vger.kernel.org
Subject: Re: [PATCH v5] can: flexcan: Re-write receive path to use MB queue instead of FIFO
Date: Mon, 6 Oct 2014 13:17:51 +0200 [thread overview]
Message-ID: <20141006131751.75823c82@archvile> (raw)
In-Reply-To: <54326823.7030000@pengutronix.de>
Dear Marc,
On Mon, 06 Oct 2014 12:00:03 +0200
Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 10/06/2014 09:28 AM, David Jander wrote:
> >>> 2.- Since the problem addressed by my patch to at91_can is very similar,
> >>> what about solving these problems in the SocketCAN framework (if that is
> >>> possible)?
> >>
> >> Have you had a look at my rx-fifo branch in
> >> https://gitorious.org/linux-can/linux-can-next? It already tries to
> >> abstract the simulation of the FIFO with the linear mailboxes.
> >
> > Looks interesting. I think it is a good idea to do this in dev.c, since
> > there are obviously more CAN drivers that can use this. Unfortunately it
> > seems you are still pretending the napi-poll handler to call
> > can_rx_fifo_poll(). Wouldn't it be better to just empty all MBs into a
> > circular buffer or kfifo from the interrupt handler instead?
>
> Yes probably, I started the rx-fifo patch before you came up with that idea.
>
> > I still don't understand the results Alexander is getting, though....
> >
> > What are you going to do with the rx-fifo work? Do you recommend to base my
> > patch on that? In that case, calling can_rx_fifo_poll() from the interrupt
> > handler will look a little awkward... but it should work. Or should I
> > propose an extension to rx-fifo?
>
> My plans, or rather the points that need to be addressed for the rx-fifo
> are:
> - improve to work with more than 32 mailboxes. 64 are probably enough
> for everybody :)
Just did that. Basically a s/u32/u64/g and s/BIT/BIT_ULL/g sort of thing.
> - make it work with the flexcan linear buffers
I am busy with that one... one thing I am pondering whether the "disable first
and then read-out" -logic holds up here, since the flexcan has it's own locking
thing... I'll have to see.
> - make it work with the ti_hecc driver
Never seen that one...
> - add option or convert to run from interrupt handler and copy to
> kfifo/cyclic buffer/...
Almost done. Basically I am introducing this:
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -75,6 +75,8 @@ struct can_rx_fifo {
void (*mailbox_enable_mask)(struct can_rx_fifo *rx_fifo, u64 mask);
void (*mailbox_disable)(struct can_rx_fifo *rx_fifo, unsigned int mb);
void (*mailbox_receive)(struct can_rx_fifo *rx_fifo, unsigned int mb);
+ void (*mailbox_move_to_buffer)(struct can_rx_fifo *rx_fifo,
+ struct can_frame *frame, unsigned int mb);
u64 mask_low;
u64 mask_high;
@@ -83,6 +85,10 @@ struct can_rx_fifo {
unsigned int next;
bool inc;
+
+ struct can_frame *ring;
+ unsigned int ring_head;
+ unsigned int ring_tail;
};
If the user defines fifo->mailbox_move_to_buffer() it is called instead of
fifo->mailbox_receive() and he whole circular buffer magic is done in
can_rx_fifo_poll(). I also need to add something like a generic NAPI poll
handler then, that just reads out this ring-buffer. Should simplify drivers a
lot I guess.
What do you think?
Best regards,
--
David Jander
Protonic Holland.
next prev parent reply other threads:[~2014-10-06 11:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-29 12:52 [PATCH v5] can: flexcan: Re-write receive path to use MB queue instead of FIFO David Jander
2014-09-29 13:29 ` Alexander Stein
2014-09-29 14:39 ` David Jander
2014-09-29 15:02 ` Alexander Stein
2014-09-30 7:13 ` David Jander
2014-09-30 7:43 ` Alexander Stein
2014-10-01 6:29 ` David Jander
2014-10-01 7:11 ` Alexander Stein
2014-10-01 7:15 ` Marc Kleine-Budde
2014-10-01 8:29 ` Alexander Stein
2014-10-01 9:07 ` David Jander
2014-10-01 9:19 ` Alexander Stein
2014-10-01 9:34 ` David Jander
2014-10-01 9:58 ` Marc Kleine-Budde
2014-10-06 7:28 ` David Jander
2014-10-06 10:00 ` Marc Kleine-Budde
2014-10-06 11:17 ` David Jander [this message]
2014-10-07 9:30 ` [RFC PATCH 1/2] can: rx-fifo: Increase MB size limit from 32 to 64 David Jander
2014-10-07 9:30 ` [RFC PATCH 2/2] can: rx-fifo: Add support for IRQ readout and NAPI poll David Jander
2014-10-07 13:17 ` [RFC PATCH 1/2] can: rx-fifo: Increase MB size limit from 32 to 64 Marc Kleine-Budde
2014-10-07 13:27 ` David Jander
2014-10-07 14:18 ` Marc Kleine-Budde
2014-10-08 9:08 ` [PATCH v5] can: flexcan: Re-write receive path to use MB queue instead of FIFO David Jander
2014-10-08 9:56 ` Marc Kleine-Budde
2014-10-08 10:36 ` Alexander Stein
2014-10-08 10:43 ` Marc Kleine-Budde
2014-10-08 14:01 ` David Jander
2014-10-09 10:37 ` David Jander
2014-10-01 9:19 ` 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=20141006131751.75823c82@archvile \
--to=david@protonic.nl \
--cc=alexander.stein@systec-electronic.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.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).