diff options
author | Oliver Hartkopp <socketcan@hartkopp.net> | 2012-06-13 14:04:33 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2012-06-19 15:39:50 -0400 |
commit | 7c9416365c60f150ef8961a2855fafbc7394ad6b (patch) | |
tree | 56af7e0eb5ad94c6da14ff7dde79935eb58628a5 /net/can | |
parent | 5b92da0443c2585e31b64e86c2e1b8e22845d4bb (diff) |
canfd: add new data structures and constants
- add new struct canfd_frame
- check identical element offsets in struct can_frame and struct canfd_frame
- new ETH_P_CANFD definition to tag CAN FD skbs correctly
- add CAN_MTU and CANFD_MTU definitions for easy frame and mode detection
- add CAN[FD]_MAX_[DLC|DLEN] helper constants to remove hard coded values
- update existing struct can_frame with helper constants and comments
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can')
-rw-r--r-- | net/can/af_can.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index 6efcd37b4bd0..c96140a1458e 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -41,6 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <linux/module.h> | 43 | #include <linux/module.h> |
44 | #include <linux/stddef.h> | ||
44 | #include <linux/init.h> | 45 | #include <linux/init.h> |
45 | #include <linux/kmod.h> | 46 | #include <linux/kmod.h> |
46 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
@@ -824,6 +825,12 @@ static struct notifier_block can_netdev_notifier __read_mostly = { | |||
824 | 825 | ||
825 | static __init int can_init(void) | 826 | static __init int can_init(void) |
826 | { | 827 | { |
828 | /* check for correct padding to be able to use the structs similarly */ | ||
829 | BUILD_BUG_ON(offsetof(struct can_frame, can_dlc) != | ||
830 | offsetof(struct canfd_frame, len) || | ||
831 | offsetof(struct can_frame, data) != | ||
832 | offsetof(struct canfd_frame, data)); | ||
833 | |||
827 | printk(banner); | 834 | printk(banner); |
828 | 835 | ||
829 | memset(&can_rx_alldev_list, 0, sizeof(can_rx_alldev_list)); | 836 | memset(&can_rx_alldev_list, 0, sizeof(can_rx_alldev_list)); |