All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "Ira W. Snyder" <iws@ovro.caltech.edu>
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH 5/6] can: janz-ican3: avoid firmware lockup caused by infinite bus error quota
Date: Thu, 19 Jul 2012 10:35:16 +0200	[thread overview]
Message-ID: <5007C6C4.1070301@pengutronix.de> (raw)
In-Reply-To: <1342650798-2991-6-git-send-email-iws@ovro.caltech.edu>

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

On 07/19/2012 12:33 AM, Ira W. Snyder wrote:
> From: "Ira W. Snyder" <iws@ovro.caltech.edu>
> 
> If the bus error quota is set to infinite and the host CPU cannot keep
> up, the Janz VMOD-ICAN3 firmware will stop responding to control
> messages until the controller is reset.
> 
> The firmware will automatically stop sending bus error messages when the
> quota is reached, and will only resume sending bus error messages when
> the quota is re-set to a positive value.
> 
> This limitation is worked around by setting the bus error quota to one
> message, and then re-setting the quota to one message every time a bus
> error message is received. By doing this, the firmware never stops
> responding to control messages. The CAN bus can be reset without a
> hard-reset of the controller card.
> 
> Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>

looks good.

Marc
> ---
>  drivers/net/can/janz-ican3.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
> index 1304712..df3ba07 100644
> --- a/drivers/net/can/janz-ican3.c
> +++ b/drivers/net/can/janz-ican3.c
> @@ -960,6 +960,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg)
>  	 * skb allocation when it will just be freed immediately.
>  	 */
>  	if (isrc == CEVTIND_BEI) {
> +		int ret;
>  		dev_dbg(mod->dev, "bus error interrupt, part 1\n");
>  
>  		/* TX error */
> @@ -970,6 +971,16 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg)
>  			stats->rx_errors++;
>  		}
>  
> +		/*
> +		 * The controller automatically disables bus-error interrupts
> +		 * and therefore we must re-enable them.
> +		 */
> +		ret = ican3_set_buserror(mod, 1);
> +		if (ret) {
> +			dev_err(mod->dev, "unable to re-enable bus-error\n");
> +			return ret;
> +		}
> +
>  		/* bus error reporting is off, return immediately */
>  		if (!(mod->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING))
>  			return 0;
> @@ -1447,7 +1458,7 @@ static int __devinit ican3_startup_module(struct ican3_dev *mod)
>  	}
>  
>  	/* default to "bus errors enabled" */
> -	ret = ican3_set_buserror(mod, ICAN3_BUSERR_QUOTA_MAX);
> +	ret = ican3_set_buserror(mod, 1);
>  	if (ret) {
>  		dev_err(mod->dev, "unable to set bus-error\n");
>  		return ret;


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

  reply	other threads:[~2012-07-19  8:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 22:33 [PATCH 0/6] can: janz-ican3: multiple fixes Ira W. Snyder
2012-07-18 22:33 ` [PATCH 1/6] can: janz-ican3: remove dead code Ira W. Snyder
2012-07-19  8:02   ` Marc Kleine-Budde
2012-07-18 22:33 ` [PATCH 2/6] can: janz-ican3: drop invalid skbs Ira W. Snyder
2012-07-19  8:02   ` Marc Kleine-Budde
2012-07-18 22:33 ` [PATCH 3/6] can: janz-ican3: fix error and byte counters Ira W. Snyder
2012-07-19  8:11   ` Marc Kleine-Budde
2012-07-19 15:50     ` Ira W. Snyder
2012-07-19 15:54       ` Ira W. Snyder
2012-07-19 19:32         ` Marc Kleine-Budde
2012-07-19 20:17           ` Ira W. Snyder
2012-07-18 22:33 ` [PATCH 4/6] can: janz-ican3: fix support for CAN_RAW_RECV_OWN_MSGS Ira W. Snyder
2012-07-19  8:33   ` Marc Kleine-Budde
2012-07-19 15:47     ` Ira W. Snyder
2012-07-19 15:54       ` Ira W. Snyder
2012-07-18 22:33 ` [PATCH 5/6] can: janz-ican3: avoid firmware lockup caused by infinite bus error quota Ira W. Snyder
2012-07-19  8:35   ` Marc Kleine-Budde [this message]
2012-07-18 22:33 ` [PATCH 6/6] can: janz-ican3: add support for one shot mode Ira W. Snyder
2012-07-19  8:35   ` 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=5007C6C4.1070301@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=iws@ovro.caltech.edu \
    --cc=linux-can@vger.kernel.org \
    /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.