Re: [PATCH 2/2] can/peak_usb/pcan_usb: add support of rxerr/txerr counters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/15/19 2:21 PM, Stéphane Grosjean wrote:
>>>  /*
>>>   * start interface
>>>   */
>>>  static int pcan_usb_start(struct peak_usb_device *dev)  {
>>>  struct pcan_usb *pdev = container_of(dev, struct pcan_usb, dev);
>>> +int err;
>>>
>>>  /* number of bits used in timestamps read from adapter struct */
>>>  peak_usb_init_time_ref(&pdev->time_ref, &pcan_usb);
>>>
>>> +pdev->bec.rxerr = 0;
>>> +pdev->bec.txerr = 0;
>>> +
>>> +/* be notified on any error counter change */
>>
>> Does the device offer the possibility to read the error counters? If so please
>> do it in pcan_usb_get_berr_counter().

> Nope! The value of the error counters can only be obtained through
> the below "bus error" notification mechanism:

I assume in the current kernel the device shows 0 errors, right?
How many errors will the device generate on a proper terminated bus
without a 2nd CAN device acking the send packages?

On SoC with integrated CAN controllers this will generate a huge load of
CAN frames, resulting in quite a lot of CPU load (~50%). So I'm a bit
hesitated.

>>> +err = pcan_usb_set_err_frame(dev, PCAN_USB_ERR_ECC |
>>> +     PCAN_USB_ERR_RXERR |
>> PCAN_USB_ERR_TXERR |
>>> +     PCAN_USB_ERR_RXERR_CNT |
>>> +     PCAN_USB_ERR_TXERR_CNT);
>>
>> Better only enable bus errors, if the user has requested them. See:
>>
>> https://elixir.bootlin.com/linux/latest/source/drivers/net/can/sja1000/sja10
>> 00.c#L152
> 
> Ok.  But this also means that the rx/tx err counters will always be 0
> if user didn't request "berr-reporting on". Is this ok?

I tend to say yes, it doesn't change the behaviour of the driver. Can
you generate some numbers for the alone-on-the-bus scenario? Error
frames per seconds, IRQs per second.

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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux