Skip to content

Commit e70a326

Browse files
vincent-mailholmarckleinebudde
authored andcommitted
can: error: specify the values of data[5..7] of CAN error frames
Currently, data[5..7] of struct can_frame, when used as a CAN error frame, are defined as being "controller specific". Device specific behaviours are problematic because it prevents someone from writing code which is portable between devices. As a matter of fact, data[5] is never used, data[6] is always used to report TX error counter and data[7] is always used to report RX error counter. can-utils also relies on this. This patch updates the comment in the uapi header to specify that data[5] is reserved (and thus should not be used) and that data[6..7] are used for error counters. Fixes: 0d66548 ("[CAN]: Add PF_CAN core module") Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Vincent Mailhol <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent aebe8a2 commit e70a326

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/uapi/linux/can/error.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */
121121
#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
122122

123-
/* controller specific additional information / data[5..7] */
123+
/* data[5] is reserved (do not use) */
124+
125+
/* TX error counter / data[6] */
126+
/* RX error counter / data[7] */
124127

125128
#endif /* _UAPI_CAN_ERROR_H */

0 commit comments

Comments
 (0)