hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/uapi/linux/can/gw.h
....@@ -1,4 +1,4 @@
1
-/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
1
+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */
22 /*
33 * linux/can/gw.h
44 *
....@@ -80,6 +80,10 @@
8080 CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */
8181 CGW_LIM_HOPS, /* limit the number of hops of this specific rule */
8282 CGW_MOD_UID, /* user defined identifier for modification updates */
83
+ CGW_FDMOD_AND, /* CAN FD frame modification binary AND */
84
+ CGW_FDMOD_OR, /* CAN FD frame modification binary OR */
85
+ CGW_FDMOD_XOR, /* CAN FD frame modification binary XOR */
86
+ CGW_FDMOD_SET, /* CAN FD frame modification set alternate values */
8387 __CGW_MAX
8488 };
8589
....@@ -88,15 +92,18 @@
8892 #define CGW_FLAGS_CAN_ECHO 0x01
8993 #define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
9094 #define CGW_FLAGS_CAN_IIF_TX_OK 0x04
95
+#define CGW_FLAGS_CAN_FD 0x08
9196
9297 #define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
9398
9499 /* CAN frame elements that are affected by curr. 3 CAN frame modifications */
95100 #define CGW_MOD_ID 0x01
96
-#define CGW_MOD_DLC 0x02
101
+#define CGW_MOD_DLC 0x02 /* contains the data length in bytes */
102
+#define CGW_MOD_LEN CGW_MOD_DLC /* CAN FD length representation */
97103 #define CGW_MOD_DATA 0x04
104
+#define CGW_MOD_FLAGS 0x08 /* CAN FD flags */
98105
99
-#define CGW_FRAME_MODS 3 /* ID DLC DATA */
106
+#define CGW_FRAME_MODS 4 /* ID DLC/LEN DATA FLAGS */
100107
101108 #define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
102109
....@@ -105,7 +112,13 @@
105112 __u8 modtype;
106113 } __attribute__((packed));
107114
115
+struct cgw_fdframe_mod {
116
+ struct canfd_frame cf;
117
+ __u8 modtype;
118
+} __attribute__((packed));
119
+
108120 #define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod)
121
+#define CGW_FDMODATTR_LEN sizeof(struct cgw_fdframe_mod)
109122
110123 struct cgw_csum_xor {
111124 __s8 from_idx;