1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef __LINUX_TC_PED_H
3 #define __LINUX_TC_PED_H
4 
5 #include <linux/types.h>
6 #include <linux/pkt_cls.h>
7 
8 #define TCA_ACT_PEDIT 7
9 
10 enum {
11 	TCA_PEDIT_UNSPEC,
12 	TCA_PEDIT_TM,
13 	TCA_PEDIT_PARMS,
14 	TCA_PEDIT_PAD,
15 	TCA_PEDIT_PARMS_EX,
16 	TCA_PEDIT_KEYS_EX,
17 	TCA_PEDIT_KEY_EX,
18 	__TCA_PEDIT_MAX
19 };
20 #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1)
21 
22 enum {
23 	TCA_PEDIT_KEY_EX_HTYPE = 1,
24 	TCA_PEDIT_KEY_EX_CMD = 2,
25 	__TCA_PEDIT_KEY_EX_MAX
26 };
27 #define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1)
28 
29  /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It
30   * means no specific header type - offset is relative to the network layer
31   */
32 enum pedit_header_type {
33 	TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0,
34 	TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1,
35 	TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2,
36 	TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3,
37 	TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4,
38 	TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5,
39 	__PEDIT_HDR_TYPE_MAX,
40 };
41 #define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1)
42 
43 enum pedit_cmd {
44 	TCA_PEDIT_KEY_EX_CMD_SET = 0,
45 	TCA_PEDIT_KEY_EX_CMD_ADD = 1,
46 	__PEDIT_CMD_MAX,
47 };
48 #define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1)
49 
50 struct tc_pedit_key {
51 	__u32           mask;  /* AND */
52 	__u32           val;   /*XOR */
53 	__u32           off;  /*offset */
54 	__u32           at;
55 	__u32           offmask;
56 	__u32           shift;
57 };
58 
59 struct tc_pedit_sel {
60 	tc_gen;
61 	unsigned char           nkeys;
62 	unsigned char           flags;
63 	struct tc_pedit_key     keys[0];
64 };
65 #define tc_pedit tc_pedit_sel
66 
67 #endif
68