+ memcpy(cf->data, m->msg.can_msg.data, cf->can_dlc);Please count them, too.
+
+ /* don't count error frames as real packets */
+ if (!(canid & CAN_ERR_FLAG)) {
+ stats->rx_packets++;
+ stats->rx_bytes += cf->can_dlc;
+ }
root@rk3399-q7:~# ip -details -statistics link show can0[...]
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 20425 0 0 0