diff options
| author | David Woodhouse <David.Woodhouse@intel.com> | 2010-03-26 14:55:59 +0000 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-03-26 14:55:59 +0000 |
| commit | 329f9052dbadf6f4afe2231668bd00c579a4aa10 (patch) | |
| tree | e080a5c70df40f3ae8cf28a95a3267757668ab97 /include/linux/can/dev.h | |
| parent | 395b228858778d3c44f7c413693a6acaa8bb62dc (diff) | |
| parent | 220bf991b0366cc50a94feede3d7341fa5710ee4 (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/mtd/nand/sh_flctl.c
Maxim's patch to initialise sysfs attributes depends on the patch which
actually adds sysfs_attr_init().
Diffstat (limited to 'include/linux/can/dev.h')
| -rw-r--r-- | include/linux/can/dev.h | 18 |
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); |
