can: gw: add support for CAN FD frames
Introduce CAN FD support which needs an extension of the netlink API to pass CAN FD type content to the kernel which has a different size to Classic CAN. Additionally the struct canfd_frame has a new 'flags' element that can now be modified with can-gw. The new CGW_FLAGS_CAN_FD option flag defines whether the routing job handles Classic CAN or CAN FD frames. This setting is very strict at reception time and enables the new possibilities, e.g. CGW_FDMOD_* and modifying the flags element of struct canfd_frame, only when CGW_FLAGS_CAN_FD is set. Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:

committed by
Marc Kleine-Budde

parent
e9dc7c6050
commit
456a8a646b
@@ -80,6 +80,10 @@ enum {
|
||||
CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */
|
||||
CGW_LIM_HOPS, /* limit the number of hops of this specific rule */
|
||||
CGW_MOD_UID, /* user defined identifier for modification updates */
|
||||
CGW_FDMOD_AND, /* CAN FD frame modification binary AND */
|
||||
CGW_FDMOD_OR, /* CAN FD frame modification binary OR */
|
||||
CGW_FDMOD_XOR, /* CAN FD frame modification binary XOR */
|
||||
CGW_FDMOD_SET, /* CAN FD frame modification set alternate values */
|
||||
__CGW_MAX
|
||||
};
|
||||
|
||||
@@ -88,6 +92,7 @@ enum {
|
||||
#define CGW_FLAGS_CAN_ECHO 0x01
|
||||
#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
|
||||
#define CGW_FLAGS_CAN_IIF_TX_OK 0x04
|
||||
#define CGW_FLAGS_CAN_FD 0x08
|
||||
|
||||
#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
|
||||
|
||||
@@ -96,8 +101,9 @@ enum {
|
||||
#define CGW_MOD_DLC 0x02 /* contains the data length in bytes */
|
||||
#define CGW_MOD_LEN CGW_MOD_DLC /* CAN FD length representation */
|
||||
#define CGW_MOD_DATA 0x04
|
||||
#define CGW_MOD_FLAGS 0x08 /* CAN FD flags */
|
||||
|
||||
#define CGW_FRAME_MODS 3 /* ID DLC/LEN DATA */
|
||||
#define CGW_FRAME_MODS 4 /* ID DLC/LEN DATA FLAGS */
|
||||
|
||||
#define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
|
||||
|
||||
@@ -106,7 +112,13 @@ struct cgw_frame_mod {
|
||||
__u8 modtype;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct cgw_fdframe_mod {
|
||||
struct canfd_frame cf;
|
||||
__u8 modtype;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod)
|
||||
#define CGW_FDMODATTR_LEN sizeof(struct cgw_fdframe_mod)
|
||||
|
||||
struct cgw_csum_xor {
|
||||
__s8 from_idx;
|
||||
|
Reference in New Issue
Block a user