diff options
author | Wolfgang Grandegger <wg@grandegger.com> | 2010-02-22 22:21:17 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-26 01:48:49 -0800 |
commit | 52c793f24054f5dc30d228e37e0e19cc8313f086 (patch) | |
tree | b7ebb686f5c2b0d58d05e42cc9d452adf651a83b /include/linux/can | |
parent | 78ca90ea995cb86c72cde9308276d2a701bd3c40 (diff) | |
download | linux-52c793f24054f5dc30d228e37e0e19cc8313f086.tar.gz linux-52c793f24054f5dc30d228e37e0e19cc8313f086.tar.bz2 linux-52c793f24054f5dc30d228e37e0e19cc8313f086.zip |
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 <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/can')
-rw-r--r-- | include/linux/can/dev.h | 2 | ||||
-rw-r--r-- | include/linux/can/netlink.h | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index c8c660a79f90..6e5a7f00223d 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -47,6 +47,8 @@ struct can_priv { int (*do_set_mode)(struct net_device *dev, enum can_mode mode); int (*do_get_state)(const struct net_device *dev, enum can_state *state); + int (*do_get_berr_counter)(const struct net_device *dev, + struct can_berr_counter *bec); unsigned int echo_skb_max; struct sk_buff **echo_skb; diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h index c818335fbb13..3250de935e1a 100644 --- a/include/linux/can/netlink.h +++ b/include/linux/can/netlink.h @@ -70,6 +70,14 @@ enum can_state { }; /* + * CAN bus error counters + */ +struct can_berr_counter { + __u16 txerr; + __u16 rxerr; +}; + +/* * CAN controller mode */ struct can_ctrlmode { @@ -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 }; |