diff options
Diffstat (limited to 'include/linux/can/dev.h')
| -rw-r--r-- | include/linux/can/dev.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 5824b20b5fcb..3db7767d2a17 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
| @@ -29,8 +29,6 @@ enum can_mode { | |||
| 29 | /* | 29 | /* |
| 30 | * CAN common private data | 30 | * CAN common private data |
| 31 | */ | 31 | */ |
| 32 | #define CAN_ECHO_SKB_MAX 4 | ||
| 33 | |||
| 34 | struct can_priv { | 32 | struct can_priv { |
| 35 | struct can_device_stats can_stats; | 33 | struct can_device_stats can_stats; |
| 36 | 34 | ||
| @@ -44,15 +42,25 @@ struct can_priv { | |||
| 44 | int restart_ms; | 42 | int restart_ms; |
| 45 | struct timer_list restart_timer; | 43 | struct timer_list restart_timer; |
| 46 | 44 | ||
| 47 | struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX]; | ||
| 48 | |||
| 49 | int (*do_set_bittiming)(struct net_device *dev); | 45 | int (*do_set_bittiming)(struct net_device *dev); |
| 50 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); | 46 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); |
| 51 | int (*do_get_state)(const struct net_device *dev, | 47 | int (*do_get_state)(const struct net_device *dev, |
| 52 | enum can_state *state); | 48 | enum can_state *state); |
| 49 | |||
| 50 | unsigned int echo_skb_max; | ||
| 51 | struct sk_buff **echo_skb; | ||
| 53 | }; | 52 | }; |
| 54 | 53 | ||
| 55 | struct net_device *alloc_candev(int sizeof_priv); | 54 | /* |
| 55 | * get_can_dlc(value) - helper macro to cast a given data length code (dlc) | ||
| 56 | * to __u8 and ensure the dlc value to be max. 8 bytes. | ||
| 57 | * | ||
| 58 | * To be used in the CAN netdriver receive path to ensure conformance with | ||
| 59 | * ISO 11898-1 Chapter 8.4.2.3 (DLC field) | ||
| 60 | */ | ||
| 61 | #define get_can_dlc(i) (min_t(__u8, (i), 8)) | ||
| 62 | |||
| 63 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); | ||
| 56 | void free_candev(struct net_device *dev); | 64 | void free_candev(struct net_device *dev); |
| 57 | 65 | ||
| 58 | int open_candev(struct net_device *dev); | 66 | int open_candev(struct net_device *dev); |
| @@ -64,8 +72,13 @@ void unregister_candev(struct net_device *dev); | |||
| 64 | int can_restart_now(struct net_device *dev); | 72 | int can_restart_now(struct net_device *dev); |
| 65 | void can_bus_off(struct net_device *dev); | 73 | void can_bus_off(struct net_device *dev); |
| 66 | 74 | ||
| 67 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx); | 75 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, |
| 68 | void can_get_echo_skb(struct net_device *dev, int idx); | 76 | unsigned int idx); |
| 69 | void can_free_echo_skb(struct net_device *dev, int idx); | 77 | void can_get_echo_skb(struct net_device *dev, unsigned int idx); |
| 78 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); | ||
| 79 | |||
| 80 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); | ||
| 81 | struct sk_buff *alloc_can_err_skb(struct net_device *dev, | ||
| 82 | struct can_frame **cf); | ||
| 70 | 83 | ||
| 71 | #endif /* CAN_DEV_H */ | 84 | #endif /* CAN_DEV_H */ |
