I would like to detect the number of frame dropped on a CAN socket implemented using linux socketCAN. When the command ip -details -statistics link show can0
is given on terminal I can get the number of dropped frame in the dropped column for both Rx and Tx.
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 250000 sample-point 0.866
tq 266 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
clock 30000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
1860 356 0 0 0 0
TX: bytes packets errors dropped carrier collsns
13789 1843 0 0 0 0
How can I get/detect the dropped number for Rx and Tx using C code?. Thanks for the time and answer in advance.