From: David Jander <david@protonic.nl>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
linux-can@vger.kernel.org,
Alexander Stein <alexander.stein@systec-electronic.com>
Subject: Re: [PATCH 09/15] can: rx-fifo: Add can_rx_fifo_reset() function
Date: Mon, 3 Nov 2014 13:46:55 +0100 [thread overview]
Message-ID: <20141103134655.1108332b@archvile> (raw)
In-Reply-To: <54576408.5040709@pengutronix.de>
On Mon, 03 Nov 2014 12:16:24 +0100
Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 10/10/2014 05:46 PM, David Jander wrote:
> > This function needs to be called every time the CAN controller is reset
> > and before interrupts are enabled. Otherwise the irq-offload loop gets
> > out of sync. Detect this and BUG() to the user if he forgot.
> >
> > Signed-off-by: David Jander <david@protonic.nl>
> > ---
> > drivers/net/can/dev.c | 20 ++++++++++++++++++--
> > include/linux/can/dev.h | 1 +
> > 2 files changed, 19 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> > index 3e1160a..fc35d28 100644
> > --- a/drivers/net/can/dev.c
> > +++ b/drivers/net/can/dev.c
> > @@ -487,8 +487,17 @@ int can_rx_fifo_irq_offload(struct can_rx_fifo *fifo)
> > fifo->second_first = true;
> > }
> >
> > - if (received)
> > - napi_schedule(&fifo->napi);
> > + if (received) {
> > + can_rx_fifo_napi_schedule(fifo);
> > + } else {
> > + /*
> > + * This should only happen if the CAN conroller was
> > reset, but
> > + * can_rx_fifo_reset() was not called. BUG();
> > + */
> > + netdev_warn(fifo->dev, "%s: No messages found,"
> > + " RX-FIFO out of sync?\n", __func__);
> > + BUG();
>
> Can you replace the BUG() (which crashes the system) by something less
> fatal? E.g. by some of the WARN function [1]? Does it make sense to call
> the fifo_reset() function after this? We'll loose up to a FIFO size
> amount of CAN frames, but the system stays hopefully working.
Ok. We just need to make enough noise, so that the potential driver's author
sees it before release... a WARN*() should do.
> Marc
>
> [1] http://lxr.free-electrons.com/source/include/asm-generic/bug.h#L84
>
Best regards,
--
David Jander
Protonic Holland.
next prev parent reply other threads:[~2014-11-03 12:46 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-10 15:46 [RFC PATCH V3 00/15] CAN: Add rx-fifo support and port flexcan to it David Jander
2014-10-10 15:46 ` [PATCH 01/15] can: flexcan: add documentation about mailbox organizaiton David Jander
2014-10-10 15:46 ` [PATCH 02/15] can: flexcan: rename crl2 -> ctrl2 David Jander
2014-10-10 15:46 ` [PATCH 03/15] can: flexcan: replace open coded mailbox code by proper defines David Jander
2014-10-10 15:46 ` [PATCH 04/15] can: flexcan: Re-write receive path to use MB queue instead of FIFO David Jander
2014-10-10 15:46 ` [PATCH 05/15] can: dev: add preliminary rx-fifo David Jander
2014-10-10 15:46 ` [PATCH 06/15] can: rx-fifo: Increase MB size limit from 32 to 64 David Jander
2014-10-19 21:25 ` Marc Kleine-Budde
2014-10-20 6:14 ` David Jander
2014-10-10 15:46 ` [PATCH 07/15] can: rx-fifo: Change to do controller off-load in interrupt and NAPI poll David Jander
2014-10-19 22:09 ` Marc Kleine-Budde
2014-10-20 7:06 ` David Jander
2014-11-03 11:10 ` Marc Kleine-Budde
2014-11-03 12:44 ` David Jander
2014-10-10 15:46 ` [PATCH 08/15] can: rx-fifo: fix long lines David Jander
2014-10-19 21:18 ` Marc Kleine-Budde
2014-10-20 7:09 ` David Jander
2014-10-10 15:46 ` [PATCH 09/15] can: rx-fifo: Add can_rx_fifo_reset() function David Jander
2014-11-03 11:16 ` Marc Kleine-Budde
2014-11-03 12:46 ` David Jander [this message]
2014-11-03 12:51 ` Marc Kleine-Budde
2014-10-10 15:46 ` [PATCH 10/15] can: rx-fifo: remove obsolete comment David Jander
2014-10-10 15:46 ` [PATCH 11/15] can: rx-fifo: Add support for can state tracking and error polling David Jander
2014-11-03 11:24 ` Marc Kleine-Budde
2014-11-03 12:51 ` David Jander
2014-11-03 12:58 ` Marc Kleine-Budde
2014-11-03 13:09 ` David Jander
2014-11-03 13:24 ` Marc Kleine-Budde
2014-11-05 17:16 ` David Jander
2014-11-06 10:20 ` Marc Kleine-Budde
2014-11-06 11:07 ` David Jander
2014-10-10 15:46 ` [PATCH 12/15] can: flexcan: Add support for RX-FIFO David Jander
2014-11-03 11:26 ` Marc Kleine-Budde
2014-11-03 12:55 ` David Jander
2014-11-03 13:34 ` Marc Kleine-Budde
2014-10-10 15:46 ` [PATCH 13/15] can: rx-fifo: Add support for simple irq offloading David Jander
2014-11-03 11:59 ` Marc Kleine-Budde
2014-10-10 15:46 ` [PATCH 14/15] can: flexcan: Add MB/Fifo specific column to comment table of IP versions David Jander
2014-10-10 15:47 ` [PATCH 15/15] can: flexcan: Re-enable RTR reception support for older flexcan IPs David Jander
2014-11-03 12:02 ` 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=20141103134655.1108332b@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