diff options
Diffstat (limited to 'include/linux/can')
-rw-r--r-- | include/linux/can/dev.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 3db7767d2a17..c8c660a79f90 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
@@ -38,6 +38,7 @@ struct can_priv { | |||
38 | 38 | ||
39 | enum can_state state; | 39 | enum can_state state; |
40 | u32 ctrlmode; | 40 | u32 ctrlmode; |
41 | u32 ctrlmode_supported; | ||
41 | 42 | ||
42 | int restart_ms; | 43 | int restart_ms; |
43 | struct timer_list restart_timer; | 44 | struct timer_list restart_timer; |
@@ -60,6 +61,21 @@ struct can_priv { | |||
60 | */ | 61 | */ |
61 | #define get_can_dlc(i) (min_t(__u8, (i), 8)) | 62 | #define get_can_dlc(i) (min_t(__u8, (i), 8)) |
62 | 63 | ||
64 | /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ | ||
65 | static inline int can_dropped_invalid_skb(struct net_device *dev, | ||
66 | struct sk_buff *skb) | ||
67 | { | ||
68 | const struct can_frame *cf = (struct can_frame *)skb->data; | ||
69 | |||
70 | if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) { | ||
71 | kfree_skb(skb); | ||
72 | dev->stats.tx_dropped++; | ||
73 | return 1; | ||
74 | } | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
63 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); | 79 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); |
64 | void free_candev(struct net_device *dev); | 80 | void free_candev(struct net_device *dev); |
65 | 81 | ||