summaryrefslogtreecommitdiff
path: root/include/linux/can/dev.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-03-22 17:05:48 +0100
committerTakashi Iwai <tiwai@suse.de>2010-03-22 17:05:48 +0100
commit2fb20b61550d3c5335e59819ed22734900d4d6e3 (patch)
tree5ac7690306a0230b51e79afe5cfd3e6575b98cb1 /include/linux/can/dev.h
parent23caaf19b11eda7054348452e1618d4512a86907 (diff)
parent6da7a2aa899f75116e1a62cef78c358ada9878b7 (diff)
Merge branch 'topic/misc' into topic/usb
Diffstat (limited to 'include/linux/can/dev.h')
-rw-r--r--include/linux/can/dev.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 3db7767d2a17..6e5a7f00223d 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -38,6 +38,7 @@ struct can_priv {
enum can_state state;
u32 ctrlmode;
+ u32 ctrlmode_supported;
int restart_ms;
struct timer_list restart_timer;
@@ -46,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;
@@ -60,6 +63,21 @@ struct can_priv {
*/
#define get_can_dlc(i) (min_t(__u8, (i), 8))
+/* Drop a given socketbuffer if it does not contain a valid CAN frame. */
+static inline int can_dropped_invalid_skb(struct net_device *dev,
+ struct sk_buff *skb)
+{
+ const struct can_frame *cf = (struct can_frame *)skb->data;
+
+ if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) {
+ kfree_skb(skb);
+ dev->stats.tx_dropped++;
+ return 1;
+ }
+
+ return 0;
+}
+
struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
void free_candev(struct net_device *dev);