'SocketCAN recovery from buffer overflow CAN_ERR_CRTL_RX_OVERFLOW
I write an application in C/C++ which uses SocketCAN. Under some conditions I can generate an buffer overflow error CAN_ERR_CRTL_RX_OVERFLOW on my system. An ip command shows growing number of overflow errors.
ip -details -statistics link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-WARNING (berr-counter tx 0 rx 0) restart-ms 100
bitrate 250000 sample-point 0.875
tq 41 prop-seg 41 phase-seg1 42 phase-seg2 12 sjw 1
m_can: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp-inc 1
m_can: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..32 dbrp-inc 1
clock 24000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 1 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
399532 72671 754 0 754 0
TX: bytes packets errors dropped carrier collsns
639 128 0 0 0 0
Moreover, at this state the operating system is getting laggy due to high cpu usage by following system processes also after killing my application:
- [irq/61-5a001000]
- [ksoftirqd/0]
- [kworker/u4:0+ev]
I would like to programmatically recover from this error state and somehow flush the buffer taking packet loss into account.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
