CAPI: Call a controller 'controller', not 'card'
[pandora-kernel.git] / include / linux / can / dev.h
index 3db7767..c8c660a 100644 (file)
@@ -38,6 +38,7 @@ struct can_priv {
 
        enum can_state state;
        u32 ctrlmode;
+       u32 ctrlmode_supported;
 
        int restart_ms;
        struct timer_list restart_timer;
@@ -60,6 +61,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);