linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Richard Andrysek <richard.andrysek@rg-mechatronics.com>
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH v6] can: sja1000: fix {pre,post}_irq() handling and IRQ handler return value
Date: Fri, 06 Dec 2013 11:12:51 +0100	[thread overview]
Message-ID: <52A1A323.1030605@pengutronix.de> (raw)
In-Reply-To: <loom.20131206T100036-664@post.gmane.org>

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

On 12/06/2013 10:27 AM, Richard Andrysek wrote:
>> What do you mean? CAN belongs to the network world. What does the
>> following command report:
>>
>>  # ip -d -s link show can0
> 
> I have now already modified driver, but before it shown the overrun &
> arbitration lost errors. Perfect command:)
>>
>>> Then each event "arbitration lost" generates an IRQ.
>>
>> From a CAN device?
> 
> Yes you can see it in a code of driver/net/can/sja1000/sja1000.c,
> function:
> 
> static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
> { 
>    ...
>    if (isrc & IRQ_ALI) {
>       /* arbitration lost interrupt */
>       netdev_dbg(dev, "arbitration lost interrupt\n");
>       alc = priv->read_reg(priv, SJA1000_ALC);
>       priv->can.can_stats.arbitration_lost++;
>       stats->tx_errors++;
>       cf->can_id |= CAN_ERR_LOSTARB;
>       cf->data[0] = alc & 0x1f;
>    }
>    ...
> }
> 
> 
> I've just studied sja1000.c I do not know yet, if it is healthy.
> May be something in upper levels will be not anymore well handled. 
> I've changed a code in a function (see IRQ_ALI part):

You can send a diff, to illustrate your changes.

> static void set_normal_mode(struct net_device *dev)
> {
>   ...
>                if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
>                     priv->write_reg(priv, SJA1000_IER, IRQ_ALL & ~IRQ_ALI);
>                else
>                     priv->write_reg(priv, SJA1000_IER,
>                                     IRQ_ALL & ~(IRQ_BEI | IRQ_ALI));
>   ...
> }
> 
> But I prefare to make some kind of "ioctl" support for that. There are
> applications, where it shall not happend. Concurrently I've played with
> taskset and priorities.

ioctl() is not a option here, but there are two options:
1) We can put the arbitration lost error to the bus errors,
   but I think that's wrong.
2) You can add another ctrlmode to disable arbitration lost error
   reporting.

> $ ps -e -o pid,rtprio,comm | grep "irq/19"
>    56     89 irq/19-uhci_hcd
>  1877     88 irq/19-can0
>  1922     88 irq/19-can1
> 
> I do not still understand, what does it mean "irq/19-uhci_hcd". Which is
> also active, even I do not have any USB device. Mouse and keyboard are
> connected through PS2.

The USB interrupt is needed, even if you don't have a device plugged
into an USB port. You have to disable you USB Device in your BIOS,
disable the driver or something like that.

> $ lsusb
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> 
> Now I have NO FAILURE. To make 100% confirmation, I have to improve  tests.
> Until now:
> 
> $ ip -d -s link show can0
> 3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode
> DEFAULT qlen 10
>     link/can
>     can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
>     bitrate 1000000 sample-point 0.750
>     tq 250 prop-seg 1 phase-seg1 1 phase-seg2 1 sjw 1
>     sja1000: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
>     clock 8000000
>     re-started bus-errors arbit-lost error-warn error-pass bus-off
>     0          0          0          0          0          0
>     RX: bytes  packets  errors  dropped overrun mcast
>     1874449440 234306180 0       0       0       0
>     TX: bytes  packets  errors  dropped carrier collsns
>     771292494  107205646 0       0       0       0
> 
> $ ip -d -s link show can1
> 4: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode
> DEFAULT qlen 10
>     link/can
>     can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
>     bitrate 1000000 sample-point 0.750
>     tq 250 prop-seg 1 phase-seg1 1 phase-seg2 1 sjw 1
>     sja1000: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
>     clock 8000000
>     re-started bus-errors arbit-lost error-warn error-pass bus-off
>     0          0          0          0          0          0
>     RX: bytes  packets  errors  dropped overrun mcast
>     384541802  59160277 0       0       0       0
>     TX: bytes  packets  errors  dropped carrier collsns
>     77591108   9843156  0       0       0       0
> 
> 
> Please keep in mind arbit-lost is now zero forever.

Because you disabled it, right?

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 --]

  parent reply	other threads:[~2013-12-06 10:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24 23:03 [PATCH v6] can: sja1000: fix {pre,post}_irq() handling and IRQ handler return value Marc Kleine-Budde
2013-11-25  8:54 ` Marc Kleine-Budde
2013-11-25 18:12   ` Oliver Hartkopp
2013-11-25 22:05   ` Austin Schuh
2013-12-09 19:48   ` Austin Schuh
2013-12-09 21:07     ` Marc Kleine-Budde
2013-12-09 23:50       ` Austin Schuh
2013-12-05 15:50 ` Richard Andrysek
2013-12-05 17:50   ` Wolfgang Grandegger
2013-12-05 19:37     ` Richard Andrysek
2013-12-05 20:26       ` Wolfgang Grandegger
2013-12-06  9:27         ` Richard Andrysek
2013-12-06  9:56           ` Wolfgang Grandegger
2013-12-06 10:32             ` Richard Andrysek
2013-12-06 18:32               ` Wolfgang Grandegger
2013-12-09  9:29                 ` Richard Andrysek
2013-12-06 10:12           ` Marc Kleine-Budde [this message]
2013-12-06 10:57             ` Richard Andrysek
2013-12-06 11:45               ` arbitration lost error reporting (was: Re: [PATCH v6] can: sja1000: fix {pre,post}_irq() handling and IRQ handler return value) Marc Kleine-Budde
2013-12-06 12:02                 ` arbitration lost error reporting Oliver Hartkopp
2013-12-06 12:16                   ` Marc Kleine-Budde
2013-12-06 13:21                     ` Richard Andrysek
2013-12-06 13:23                       ` Marc Kleine-Budde
2013-12-06 17:59                   ` Wolfgang Grandegger
2013-12-07 13:13                     ` Oliver Hartkopp
2013-12-09  9:01                     ` Richard Andrysek
2013-12-09 10:32                       ` 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=52A1A323.1030605@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=richard.andrysek@rg-mechatronics.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).