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 21 #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) 22 23 enum { 24 TCA_PEDIT_KEY_EX_HTYPE = 1, 25 TCA_PEDIT_KEY_EX_CMD = 2, 26 __TCA_PEDIT_KEY_EX_MAX 27 }; 28 29 #define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1) 30 31 /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It 32 * means no specific header type - offset is relative to the network layer 33 */ 34 enum pedit_header_type { 35 TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0, 36 TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1, 37 TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2, 38 TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3, 39 TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4, 40 TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5, 41 __PEDIT_HDR_TYPE_MAX, 42 }; 43 44 #define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1) 45 46 enum pedit_cmd { 47 TCA_PEDIT_KEY_EX_CMD_SET = 0, 48 TCA_PEDIT_KEY_EX_CMD_ADD = 1, 49 __PEDIT_CMD_MAX, 50 }; 51 52 #define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1) 53 54 struct tc_pedit_key { 55 __u32 mask; /* AND */ 56 __u32 val; /*XOR */ 57 __u32 off; /*offset */ 58 __u32 at; 59 __u32 offmask; 60 __u32 shift; 61 }; 62 63 struct tc_pedit_sel { 64 tc_gen; 65 unsigned char nkeys; 66 unsigned char flags; 67 struct tc_pedit_key keys[0]; 68 }; 69 70 #define tc_pedit tc_pedit_sel 71 72 #endif 73