linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: linux-can@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH 1/7] can: berr_limit support
Date: Mon, 07 Oct 2013 21:42:18 +0200	[thread overview]
Message-ID: <52530E9A.7050403@pengutronix.de> (raw)
In-Reply-To: <52530DB6.2020407@grandegger.com>

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

On 10/07/2013 09:38 PM, Wolfgang Grandegger wrote:
> Hi Marc,
> 
> On 10/07/2013 04:40 PM, Marc Kleine-Budde wrote:
>> Hello,
>>
>> this series does first some cleanups in can/dev.c, the implementation of three
>> functions is sorted by IFLA_CAN_*, that we can see at the first look, that all
>> needed IFLA_CAN_* are handled and that new code can be added at the end. 
>>
>> Then the bus error limiting (short: berr_limit) infrastructure + netlink
>> configuration interface is added. Last patch is an example implementation on
>> the flexcan hardware.
>>
>> The CAN bus, like the old 10BASE2 Ethernet, needs bus termination. An open CAN
>> bus doesn't work and will produce lots of CAN bus errors.
>>
>> If the user wants to detect an open CAN bus, the CAN bus error interrupts have
>> to be enabled. This is represented by the control mode
>> CAN_CTRLMODE_BERR_REPORTING.
>>
>> On an unterminated CAN bus at 500 kbit/s, this can lead to more then 8000
>> interrupts/s on some SoCs with integrated CAN cores. These interrupts and the
>> associated processing in software lead to a significant load and may reader the
>> system unresponsive and even unusable at CAN bus speeds of 1000 kbit/s.
> 
> And there might be more than just one interface.

Which makes it even worse.

>> This patch adds the infrastructure to limit these interrupts. The driver has to
>> implement the do_berr_restart() callback, which re-enables the bus error
>> interrupts. The idea is to delay the re-enabling of the interrupts after they
>> have been served. The delay is configured by berr_limit_delay. A value of 0
>> means interrupts are restarted immediately, any other other value will start a
>> timer and call do_berr_restart() when the timer fires.
> 
> IIRC, some versions of the Flexcan controller need bus error interupts
> enabled otherwise state changes are not realized. This makes an
> efficient support for CAN_CTRLMODE_BERR_REPORTING impossible, which can
> normally be achieved by simply masking the interrupt source. Does state
> change reporting still work properly with this kind of interrupt
> throttling? Apart from that the approach looks good.

I'll do some tests with another imx system. I think the state change
will be delayed until the bus error interrupts will be enabled again.

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

      reply	other threads:[~2013-10-07 19:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-07 14:40 [PATCH 1/7] can: berr_limit support Marc Kleine-Budde
2013-10-07 14:40 ` [PATCH 1/7] can: dev: fix nlmsg size calculation in can_get_size() Marc Kleine-Budde
2013-10-07 14:40 ` [PATCH 2/7] can: dev: sort can_get_size() by IFLA_CAN_* Marc Kleine-Budde
2013-10-07 14:40 ` [PATCH 3/7] can: dev: sort can_fill_info() " Marc Kleine-Budde
2013-10-07 14:40 ` [PATCH 4/7] can: dev: sort can_changelink() " Marc Kleine-Budde
2013-10-07 14:40 ` [PATCH 5/7] can: dev: add berr_limit infrastrucutre Marc Kleine-Budde
2013-10-07 15:39   ` Alexander Stein
2013-10-07 15:56     ` Marc Kleine-Budde
2013-10-07 16:00       ` Marc Kleine-Budde
2013-10-08  6:03         ` Alexander Stein
2013-10-08  7:05           ` Marc Kleine-Budde
2013-10-07 14:40 ` [PATCH 6/7] can: dev: berr_limit netlink support for configuration Marc Kleine-Budde
2013-10-07 14:40 ` [PATCH 7/7] can: flexcan: add berr_limit support Marc Kleine-Budde
2013-10-07 19:38 ` [PATCH 1/7] can: " Wolfgang Grandegger
2013-10-07 19:42   ` Marc Kleine-Budde [this message]

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=52530E9A.7050403@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --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).