All of lore.kernel.org
 help / color / mirror / Atom feed
* Please explain berr-reporting
@ 2017-03-09 19:31 Hans L
  2017-03-09 20:20 ` Wolfgang Grandegger
  0 siblings, 1 reply; 5+ messages in thread
From: Hans L @ 2017-03-09 19:31 UTC (permalink / raw)
  To: linux-can

I tried asking this as a part of a larger issue a few months ago and
didn't get any explanation, so I'm trying again, focusing specifically
on this single issue.

Can anyone tell me what enabling berr-reporting does?

It is only mentioned once in this documentation, in the list of ip
link options: https://www.kernel.org/doc/Documentation/networking/can.txt

There seems to be absolutely zero documentation of what this is
supposed to do.  Does anyone know?  Does it really do anything?

Hans

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Please explain berr-reporting
  2017-03-09 19:31 Please explain berr-reporting Hans L
@ 2017-03-09 20:20 ` Wolfgang Grandegger
  2017-03-09 20:42   ` Hans L
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2017-03-09 20:20 UTC (permalink / raw)
  To: Hans L, linux-can

Hello Hans,

Am 09.03.2017 um 20:31 schrieb Hans L:
> I tried asking this as a part of a larger issue a few months ago and
> didn't get any explanation, so I'm trying again, focusing specifically
> on this single issue.
>
> Can anyone tell me what enabling berr-reporting does?
>
> It is only mentioned once in this documentation, in the list of ip
> link options: https://www.kernel.org/doc/Documentation/networking/can.txt
>
> There seems to be absolutely zero documentation of what this is
> supposed to do.  Does anyone know?  Does it really do anything?

I think it can easily be understood by looking to the SJA1000 driver:

http://lxr.free-electrons.com/source/drivers/net/can/sja1000/sja1000.c#L152

	if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
		priv->write_reg(priv, SJA1000_IER, IRQ_ALL);
	else
		priv->write_reg(priv, SJA1000_IER,
				IRQ_ALL & ~IRQ_BEI);

If bus error reporting is enabled via "ip link set canX type can ... 
*berr-reporting on* ...", the bus error interrupt (IRQ_BEI) of the 
SJA1000 will be enabled. Then any bus error will trigger an interrupt 
and deliver an error message. The problem is that bus errors can occur 
at a very high rate. E.g. if no cable is connected it will flood the 
system with these interrupts. On slow systems it can overload/hang it. 
Therefore bus error reporting is disabled by default. Unfortunately 
disabling bus errors is not on all controllers that easy to achieve then 
on the SJA1000.

Wolfgang.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Please explain berr-reporting
  2017-03-09 20:20 ` Wolfgang Grandegger
@ 2017-03-09 20:42   ` Hans L
  2017-03-09 21:23     ` Wolfgang Grandegger
  0 siblings, 1 reply; 5+ messages in thread
From: Hans L @ 2017-03-09 20:42 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: linux-can

So it doesn't have any effect on whether or not "Error frames" are created?

I don't think my application is using the SJA1000 driver, how can I
figure out which one is being used?

The chip I am using is this: http://www.ti.com/product/TMS320DM8148
which has a CAN interface built in.
They just call it "DCAN", but I don't see any driver file with "dcan"
in the name, from the directory tree on the site you linked.

Hans


On Thu, Mar 9, 2017 at 2:20 PM, Wolfgang Grandegger <wg@grandegger.com> wrote:
> Hello Hans,
>
> Am 09.03.2017 um 20:31 schrieb Hans L:
>>
>> I tried asking this as a part of a larger issue a few months ago and
>> didn't get any explanation, so I'm trying again, focusing specifically
>> on this single issue.
>>
>> Can anyone tell me what enabling berr-reporting does?
>>
>> It is only mentioned once in this documentation, in the list of ip
>> link options: https://www.kernel.org/doc/Documentation/networking/can.txt
>>
>> There seems to be absolutely zero documentation of what this is
>> supposed to do.  Does anyone know?  Does it really do anything?
>
>
> I think it can easily be understood by looking to the SJA1000 driver:
>
> http://lxr.free-electrons.com/source/drivers/net/can/sja1000/sja1000.c#L152
>
>         if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
>                 priv->write_reg(priv, SJA1000_IER, IRQ_ALL);
>         else
>                 priv->write_reg(priv, SJA1000_IER,
>                                 IRQ_ALL & ~IRQ_BEI);
>
> If bus error reporting is enabled via "ip link set canX type can ...
> *berr-reporting on* ...", the bus error interrupt (IRQ_BEI) of the SJA1000
> will be enabled. Then any bus error will trigger an interrupt and deliver an
> error message. The problem is that bus errors can occur at a very high rate.
> E.g. if no cable is connected it will flood the system with these
> interrupts. On slow systems it can overload/hang it. Therefore bus error
> reporting is disabled by default. Unfortunately disabling bus errors is not
> on all controllers that easy to achieve then on the SJA1000.
>
> Wolfgang.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Please explain berr-reporting
  2017-03-09 20:42   ` Hans L
@ 2017-03-09 21:23     ` Wolfgang Grandegger
       [not found]       ` <CAFoRp-NrO3Z5orEsrPDhAwamkTcsn8j=e_sePxFY_w9c1a4nvQ@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2017-03-09 21:23 UTC (permalink / raw)
  To: Hans L; +Cc: linux-can

Hello,

Am 09.03.2017 um 21:42 schrieb Hans L:
> So it doesn't have any effect on whether or not "Error frames" are created?

Yes, if you mean error frames on the physical CAN bus. Sometimes this 
term is also used for CAN error messages generated by the CAN driver. If 
berr-reporting is off, no error messages for *bus errors* will be 
generated. Messages for state changes are not affected by this flag.

> I don't think my application is using the SJA1000 driver, how can I
> figure out which one is being used?
>
> The chip I am using is this: http://www.ti.com/product/TMS320DM8148
> which has a CAN interface built in.
> They just call it "DCAN", but I don't see any driver file with "dcan"
> in the name, from the directory tree on the site you linked.

What does the following command report:

$ ls -l /sys/class/net/can0/device/driver

I think it's the c_can/d_can driver. It support berr_reporting. Bus 
error interrupts are still triggered but no error messages will be 
generated:

http://lxr.free-electrons.com/source/drivers/net/can/c_can/c_can.c#L972

To see bus errors start "candump -e any,0:0,#FFFFFF" and disconnect the 
CAN bus connector. Then send a message with cansend. If the interface is 
configured with "ip ... berr-reporting on", you will get many bus error 
messages. If not you will just see the error state change messages.

Hope it's clear now.

Wolfgang.

> On Thu, Mar 9, 2017 at 2:20 PM, Wolfgang Grandegger <wg@grandegger.com> wrote:
>> Hello Hans,
>>
>> Am 09.03.2017 um 20:31 schrieb Hans L:
>>>
>>> I tried asking this as a part of a larger issue a few months ago and
>>> didn't get any explanation, so I'm trying again, focusing specifically
>>> on this single issue.
>>>
>>> Can anyone tell me what enabling berr-reporting does?
>>>
>>> It is only mentioned once in this documentation, in the list of ip
>>> link options: https://www.kernel.org/doc/Documentation/networking/can.txt
>>>
>>> There seems to be absolutely zero documentation of what this is
>>> supposed to do.  Does anyone know?  Does it really do anything?
>>
>>
>> I think it can easily be understood by looking to the SJA1000 driver:
>>
>> http://lxr.free-electrons.com/source/drivers/net/can/sja1000/sja1000.c#L152
>>
>>         if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
>>                 priv->write_reg(priv, SJA1000_IER, IRQ_ALL);
>>         else
>>                 priv->write_reg(priv, SJA1000_IER,
>>                                 IRQ_ALL & ~IRQ_BEI);
>>
>> If bus error reporting is enabled via "ip link set canX type can ...
>> *berr-reporting on* ...", the bus error interrupt (IRQ_BEI) of the SJA1000
>> will be enabled. Then any bus error will trigger an interrupt and deliver an
>> error message. The problem is that bus errors can occur at a very high rate.
>> E.g. if no cable is connected it will flood the system with these
>> interrupts. On slow systems it can overload/hang it. Therefore bus error
>> reporting is disabled by default. Unfortunately disabling bus errors is not
>> on all controllers that easy to achieve then on the SJA1000.
>>
>> Wolfgang.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Please explain berr-reporting
       [not found]       ` <CAFoRp-NrO3Z5orEsrPDhAwamkTcsn8j=e_sePxFY_w9c1a4nvQ@mail.gmail.com>
@ 2017-03-10  7:22         ` Wolfgang Grandegger
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Grandegger @ 2017-03-10  7:22 UTC (permalink / raw)
  To: Hans L; +Cc: linux-can

Hello Hans,

lease don't drop the CC to the mailing list.

Am 10.03.2017 um 00:33 schrieb Hans L:
> On Thu, Mar 9, 2017 at 3:23 PM, Wolfgang Grandegger <wg@grandegger.com> wrote:
>> Hello,
>>
>> Am 09.03.2017 um 21:42 schrieb Hans L:
>>>
>>> So it doesn't have any effect on whether or not "Error frames" are
>>> created?
>>
>>
>> Yes, if you mean error frames on the physical CAN bus. Sometimes this term
>> is also used for CAN error messages generated by the CAN driver. If
>> berr-reporting is off, no error messages for *bus errors* will be generated.
>> Messages for state changes are not affected by this flag.
>
> I meant to say "Error Message Frames" which is refered to in section
> "3.3 network problem notifications" from here:
> https://www.kernel.org/doc/Documentation/networking/can.txt

This section mentions the "error frames" on the CAN bus.

>> What does the following command report:
>>
>> $ ls -l /sys/class/net/can0/device/driver
>>
> it shows:
> /sys/class/net/can0/device/driver -> ../../../bus/platform/drivers/d_can

I think it's TI's driver. It's actually a clone of the "c_can" mainline 
driver, which supports "d_can" as well. It's not supported by the 
linux-can community.

> Anyways, I was able to find d_can source files in the RDK for the
> device I'm using, so I can browse those files and hopefully shed some
> light on this.
>
> I'll try making a test app to see if I can understand how to enable
> and interpret the "Error Message Frames".
>
> I'd also like to know which of the network statistics (from
> /sys/class/net/can0/statistics ) are actually relevant to CAN.  And do
> the "Error Message Frames" give any additional information that could
> not be read from these statistics?
>
> The full list of statistics for me is:  collisions, rx_compressed,
> rx_errors, rx_length_errors, rx_packets, tx_carrier_errors, tx_errors,
> tx_packets, multicast, rx_crc_errors, rx_fifo_errors,
> rx_missed_errors, tx_aborted_errors, tx_compressed, tx_fifo_errors,
> tx_window_errors, rx_bytes, rx_dropped, rx_frame_errors,
> rx_over_errors, tx_bytes, tx_dropped, tx_heartbeat_errors

This is the standard network statistic. CAN specific stats can be 
displayed with:

    # ip -s -d link show can0
    ...
    re-started bus-errors arbit-lost error-warn error-pass bus-off
     0          0          0          1          0          0

The bus error counter is "bus-errors". If you want to know more about 
the type of bus error, you can inspect the bus error messages, e.g. with 
the "candump" utility and "ip ... berr-reporting on".

Wolfgang.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-10  7:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09 19:31 Please explain berr-reporting Hans L
2017-03-09 20:20 ` Wolfgang Grandegger
2017-03-09 20:42   ` Hans L
2017-03-09 21:23     ` Wolfgang Grandegger
     [not found]       ` <CAFoRp-NrO3Z5orEsrPDhAwamkTcsn8j=e_sePxFY_w9c1a4nvQ@mail.gmail.com>
2017-03-10  7:22         ` Wolfgang Grandegger

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.