aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/can
diff options
context:
space:
mode:
authorWolfgang Grandegger <wg@grandegger.com>2010-02-22 17:21:17 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-26 04:48:49 -0500
commit52c793f24054f5dc30d228e37e0e19cc8313f086 (patch)
treeb7ebb686f5c2b0d58d05e42cc9d452adf651a83b /include/linux/can
parent78ca90ea995cb86c72cde9308276d2a701bd3c40 (diff)
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.h2
-rw-r--r--include/linux/can/netlink.h18
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 {
47 int (*do_set_mode)(struct net_device *dev, enum can_mode mode); 47 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
48 int (*do_get_state)(const struct net_device *dev, 48 int (*do_get_state)(const struct net_device *dev,
49 enum can_state *state); 49 enum can_state *state);
50 int (*do_get_berr_counter)(const struct net_device *dev,
51 struct can_berr_counter *bec);
50 52
51 unsigned int echo_skb_max; 53 unsigned int echo_skb_max;
52 struct sk_buff **echo_skb; 54 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 {
70}; 70};
71 71
72/* 72/*
73 * CAN bus error counters
74 */
75struct can_berr_counter {
76 __u16 txerr;
77 __u16 rxerr;
78};
79
80/*
73 * CAN controller mode 81 * CAN controller mode
74 */ 82 */
75struct can_ctrlmode { 83struct can_ctrlmode {
@@ -77,10 +85,11 @@ struct can_ctrlmode {
77 __u32 flags; 85 __u32 flags;
78}; 86};
79 87
80#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */ 88#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */
81#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */ 89#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */
82#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */ 90#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */
83#define CAN_CTRLMODE_ONE_SHOT 0x8 /* One-Shot mode */ 91#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
92#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
84 93
85/* 94/*
86 * CAN device statistics 95 * CAN device statistics
@@ -106,6 +115,7 @@ enum {
106 IFLA_CAN_CTRLMODE, 115 IFLA_CAN_CTRLMODE,
107 IFLA_CAN_RESTART_MS, 116 IFLA_CAN_RESTART_MS,
108 IFLA_CAN_RESTART, 117 IFLA_CAN_RESTART,
118 IFLA_CAN_BERR_COUNTER,
109 __IFLA_CAN_MAX 119 __IFLA_CAN_MAX
110}; 120};
111 121