diff options
| author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-08-17 02:57:56 -0400 |
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-08-17 03:01:08 -0400 |
| commit | a22ddff8bedfe33eeb1330bbb7ef1fbe007a42c4 (patch) | |
| tree | 61a2eb7fa62f5af10c2b913ca429e6b068b0eb2d /include/linux/can | |
| parent | 20d5a540e55a29daeef12706f9ee73baf5641c16 (diff) | |
| parent | d9875690d9b89a866022ff49e3fcea892345ad92 (diff) | |
Merge tag 'v3.6-rc2' into drm-intel-next
Backmerge Linux 3.6-rc2 to resolve a few funny conflicts before we put
even more madness on top:
- drivers/gpu/drm/i915/i915_irq.c: Just a spurious WARN removed in
-fixes, that has been changed in a variable-rename in -next, too.
- drivers/gpu/drm/i915/intel_ringbuffer.c: -next remove scratch_addr
(since all their users have been extracted in another fucntion),
-fixes added another user for a hw workaroudn.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/linux/can')
| -rw-r--r-- | include/linux/can/core.h | 4 | ||||
| -rw-r--r-- | include/linux/can/dev.h | 35 | ||||
| -rw-r--r-- | include/linux/can/error.h | 4 | ||||
| -rw-r--r-- | include/linux/can/raw.h | 3 |
4 files changed, 32 insertions, 14 deletions
diff --git a/include/linux/can/core.h b/include/linux/can/core.h index 0ccc1cd28b95..78c6c52073ad 100644 --- a/include/linux/can/core.h +++ b/include/linux/can/core.h | |||
| @@ -17,10 +17,10 @@ | |||
| 17 | #include <linux/skbuff.h> | 17 | #include <linux/skbuff.h> |
| 18 | #include <linux/netdevice.h> | 18 | #include <linux/netdevice.h> |
| 19 | 19 | ||
| 20 | #define CAN_VERSION "20090105" | 20 | #define CAN_VERSION "20120528" |
| 21 | 21 | ||
| 22 | /* increment this number each time you change some user-space interface */ | 22 | /* increment this number each time you change some user-space interface */ |
| 23 | #define CAN_ABI_VERSION "8" | 23 | #define CAN_ABI_VERSION "9" |
| 24 | 24 | ||
| 25 | #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION | 25 | #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION |
| 26 | 26 | ||
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 5d2efe7e3f1b..2b2fc345afca 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
| @@ -33,7 +33,7 @@ struct can_priv { | |||
| 33 | struct can_device_stats can_stats; | 33 | struct can_device_stats can_stats; |
| 34 | 34 | ||
| 35 | struct can_bittiming bittiming; | 35 | struct can_bittiming bittiming; |
| 36 | struct can_bittiming_const *bittiming_const; | 36 | const struct can_bittiming_const *bittiming_const; |
| 37 | struct can_clock clock; | 37 | struct can_clock clock; |
| 38 | 38 | ||
| 39 | enum can_state state; | 39 | enum can_state state; |
| @@ -61,23 +61,40 @@ struct can_priv { | |||
| 61 | * To be used in the CAN netdriver receive path to ensure conformance with | 61 | * To be used in the CAN netdriver receive path to ensure conformance with |
| 62 | * ISO 11898-1 Chapter 8.4.2.3 (DLC field) | 62 | * ISO 11898-1 Chapter 8.4.2.3 (DLC field) |
| 63 | */ | 63 | */ |
| 64 | #define get_can_dlc(i) (min_t(__u8, (i), 8)) | 64 | #define get_can_dlc(i) (min_t(__u8, (i), CAN_MAX_DLC)) |
| 65 | #define get_canfd_dlc(i) (min_t(__u8, (i), CANFD_MAX_DLC)) | ||
| 65 | 66 | ||
| 66 | /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ | 67 | /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ |
| 67 | static inline int can_dropped_invalid_skb(struct net_device *dev, | 68 | static inline int can_dropped_invalid_skb(struct net_device *dev, |
| 68 | struct sk_buff *skb) | 69 | struct sk_buff *skb) |
| 69 | { | 70 | { |
| 70 | const struct can_frame *cf = (struct can_frame *)skb->data; | 71 | const struct canfd_frame *cfd = (struct canfd_frame *)skb->data; |
| 71 | 72 | ||
| 72 | if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) { | 73 | if (skb->protocol == htons(ETH_P_CAN)) { |
| 73 | kfree_skb(skb); | 74 | if (unlikely(skb->len != CAN_MTU || |
| 74 | dev->stats.tx_dropped++; | 75 | cfd->len > CAN_MAX_DLEN)) |
| 75 | return 1; | 76 | goto inval_skb; |
| 76 | } | 77 | } else if (skb->protocol == htons(ETH_P_CANFD)) { |
| 78 | if (unlikely(skb->len != CANFD_MTU || | ||
| 79 | cfd->len > CANFD_MAX_DLEN)) | ||
| 80 | goto inval_skb; | ||
| 81 | } else | ||
| 82 | goto inval_skb; | ||
| 77 | 83 | ||
| 78 | return 0; | 84 | return 0; |
| 85 | |||
| 86 | inval_skb: | ||
| 87 | kfree_skb(skb); | ||
| 88 | dev->stats.tx_dropped++; | ||
| 89 | return 1; | ||
| 79 | } | 90 | } |
| 80 | 91 | ||
| 92 | /* get data length from can_dlc with sanitized can_dlc */ | ||
| 93 | u8 can_dlc2len(u8 can_dlc); | ||
| 94 | |||
| 95 | /* map the sanitized data length to an appropriate data length code */ | ||
| 96 | u8 can_len2dlc(u8 len); | ||
| 97 | |||
| 81 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); | 98 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); |
| 82 | void free_candev(struct net_device *dev); | 99 | void free_candev(struct net_device *dev); |
| 83 | 100 | ||
diff --git a/include/linux/can/error.h b/include/linux/can/error.h index 63e855ea6b84..7b7148bded71 100644 --- a/include/linux/can/error.h +++ b/include/linux/can/error.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/can/error.h | 2 | * linux/can/error.h |
| 3 | * | 3 | * |
| 4 | * Definitions of the CAN error frame to be filtered and passed to the user. | 4 | * Definitions of the CAN error messages to be filtered and passed to the user. |
| 5 | * | 5 | * |
| 6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | 6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> |
| 7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | 7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research |
| @@ -12,7 +12,7 @@ | |||
| 12 | #ifndef CAN_ERROR_H | 12 | #ifndef CAN_ERROR_H |
| 13 | #define CAN_ERROR_H | 13 | #define CAN_ERROR_H |
| 14 | 14 | ||
| 15 | #define CAN_ERR_DLC 8 /* dlc for error frames */ | 15 | #define CAN_ERR_DLC 8 /* dlc for error message frames */ |
| 16 | 16 | ||
| 17 | /* error class (mask) in can_id */ | 17 | /* error class (mask) in can_id */ |
| 18 | #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ | 18 | #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ |
diff --git a/include/linux/can/raw.h b/include/linux/can/raw.h index 781f3a3701be..a814062b0719 100644 --- a/include/linux/can/raw.h +++ b/include/linux/can/raw.h | |||
| @@ -23,7 +23,8 @@ enum { | |||
| 23 | CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ | 23 | CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ |
| 24 | CAN_RAW_ERR_FILTER, /* set filter for error frames */ | 24 | CAN_RAW_ERR_FILTER, /* set filter for error frames */ |
| 25 | CAN_RAW_LOOPBACK, /* local loopback (default:on) */ | 25 | CAN_RAW_LOOPBACK, /* local loopback (default:on) */ |
| 26 | CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */ | 26 | CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */ |
| 27 | CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ | ||
| 27 | }; | 28 | }; |
| 28 | 29 | ||
| 29 | #endif | 30 | #endif |
