From 52c793f24054f5dc30d228e37e0e19cc8313f086 Mon Sep 17 00:00:00 2001 From: Wolfgang Grandegger Date: Mon, 22 Feb 2010 22:21:17 +0000 Subject: can: netlink support for bus-error reporting and counters This patch makes the bus-error reporting configurable and allows to retrieve the CAN TX and RX bus error counters via netlink interface. I have added support for the SJA1000. The TX and RX bus error counters are also copied to the data fields 6..7 of error messages when state changes are reported. Signed-off-by: Wolfgang Grandegger Signed-off-by: David S. Miller --- include/linux/can/netlink.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'include/linux/can/netlink.h') diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h index c818335fbb1..3250de935e1 100644 --- a/include/linux/can/netlink.h +++ b/include/linux/can/netlink.h @@ -69,6 +69,14 @@ enum can_state { CAN_STATE_MAX }; +/* + * CAN bus error counters + */ +struct can_berr_counter { + __u16 txerr; + __u16 rxerr; +}; + /* * CAN controller mode */ @@ -77,10 +85,11 @@ struct can_ctrlmode { __u32 flags; }; -#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */ -#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */ -#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */ -#define CAN_CTRLMODE_ONE_SHOT 0x8 /* One-Shot mode */ +#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ +#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ +#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ +#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ +#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ /* * CAN device statistics @@ -106,6 +115,7 @@ enum { IFLA_CAN_CTRLMODE, IFLA_CAN_RESTART_MS, IFLA_CAN_RESTART, + IFLA_CAN_BERR_COUNTER, __IFLA_CAN_MAX }; -- cgit v1.2.3