On 10/12/2010 12:53 PM, Michal Sojka wrote:
> On Mon, 11 Oct 2010, Wolfgang Grandegger wrote:
>> On 10/11/2010 05:01 PM, "Müller, René" wrote:
>>> Now we have two cases, one with missing frames and one without:
>>> Case 1:
>>>  - candump -l -s2 can0 -> logging in an file which is stored in RAM
>>>  - we get all messages in the logfile
>>>
>>> Case 2:
>>>  - candump -l -s2 can0 -> logging in an file which is stored on an 
>>> CompactFlash-card
>>>  - the CF-card is connected via the IDE-interface without DMA (we don't get 
>>> DMA working with the CF-card, unfortunately it only works with harddrives)
>>>  - we are loosing messages:
>>>    - every 35s we are missing messages in blocks, never we are missing 1 
>>> message, always 5-6 at once
>>>
>>> Anyone had similar problems? Any hints?
>>
>> Sounds like a receive buffer overrun when the application is not able to
>> read messages fast enough. You could use setsockopt(... ,SOL_SOCKET,
>> SO_RCVBUF, ....) to increase the buffer size. It's also possible to
>> detect dropped CAN frames as described here:
> 
> I'm not sure whether this is receive buffer overrun. AFAIK 5200 has some
> problems with ATA. People using 5200 with CF complain about hudge
> latencies caused by ATA interrupts. I do not know whether this is
> related to using DMA or not.
> 
> The CAN controller on 5200 has hardware buffers only for 2 messages. The
> driver reads the received messages in soft-irq so if the soft-irq is
> delayed you loose the mesasges because of hardware buffer overruns. I
> gess this is very likely especially if you use CF.

Yes, packet losses can also happen, when the message buffers are not
read out fast enough. But then you should see overrun errors, which you
should see with "candump any,0:0,#FFFFFFFF". See also:

http://lxr.linux.no/#linux+v2.6.35.7/drivers/net/can/mscan/mscan.c#L353

Also "# ip -d -s link show can0" should list them.

> We were able to avoid losing messages by reading them in hard-irq
> context (with lincan driver), but I'm not sure whether this will help if
> you use CF (we do not use it).

Well, if the CF card driver is causing huge latencies, it should be
fixed. It should not be too difficult to spot the latency evil with ftrace.

Wolfgang.
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to