-
- /*
- * Following Ken Tindells *worst* case calculation for stuff-bits
- * (see "Guaranteeing Message Latencies on Controller Area Network" 1st ICC'94)
- * the needed bits on the wire can be calculated as:
- *
- * (34 + 8n)/5 + 47 + 8n for SFF frames (11 bit CAN-ID) => (269 + 48n)/5
- * (54 + 8n)/5 + 67 + 8n for EFF frames (29 bit CAN-ID) => (389 + 48n)/5
- *
- * while 'n' is the data length code (number of payload bytes)
- *
- */
-
- if (ignore_bitstuffing) {
- /* calculation without bitstuffing */
- if (frame.can_id & CAN_EFF_FLAG)
- stat[i].recv_bits_total += 67 + frame.can_dlc*8;
- else
- stat[i].recv_bits_total += 47 + frame.can_dlc*8;
- } else {
- /* needed bits including estimated worst case stuff bits */
- if (frame.can_id & CAN_EFF_FLAG)
- stat[i].recv_bits_total += (389 + frame.can_dlc*48)/5;
- else
- stat[i].recv_bits_total += (269 + frame.can_dlc*48)/5;
- }