18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci#ifndef __LINUX_TC_PED_H
38c2ecf20Sopenharmony_ci#define __LINUX_TC_PED_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/types.h>
68c2ecf20Sopenharmony_ci#include <linux/pkt_cls.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cienum {
98c2ecf20Sopenharmony_ci	TCA_PEDIT_UNSPEC,
108c2ecf20Sopenharmony_ci	TCA_PEDIT_TM,
118c2ecf20Sopenharmony_ci	TCA_PEDIT_PARMS,
128c2ecf20Sopenharmony_ci	TCA_PEDIT_PAD,
138c2ecf20Sopenharmony_ci	TCA_PEDIT_PARMS_EX,
148c2ecf20Sopenharmony_ci	TCA_PEDIT_KEYS_EX,
158c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX,
168c2ecf20Sopenharmony_ci	__TCA_PEDIT_MAX
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cienum {
228c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_HTYPE = 1,
238c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_CMD = 2,
248c2ecf20Sopenharmony_ci	__TCA_PEDIT_KEY_EX_MAX
258c2ecf20Sopenharmony_ci};
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It
308c2ecf20Sopenharmony_ci  * means no specific header type - offset is relative to the network layer
318c2ecf20Sopenharmony_ci  */
328c2ecf20Sopenharmony_cienum pedit_header_type {
338c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0,
348c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1,
358c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2,
368c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3,
378c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4,
388c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5,
398c2ecf20Sopenharmony_ci	__PEDIT_HDR_TYPE_MAX,
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cienum pedit_cmd {
458c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_CMD_SET = 0,
468c2ecf20Sopenharmony_ci	TCA_PEDIT_KEY_EX_CMD_ADD = 1,
478c2ecf20Sopenharmony_ci	__PEDIT_CMD_MAX,
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistruct tc_pedit_key {
538c2ecf20Sopenharmony_ci	__u32           mask;  /* AND */
548c2ecf20Sopenharmony_ci	__u32           val;   /*XOR */
558c2ecf20Sopenharmony_ci	__u32           off;  /*offset */
568c2ecf20Sopenharmony_ci	__u32           at;
578c2ecf20Sopenharmony_ci	__u32           offmask;
588c2ecf20Sopenharmony_ci	__u32           shift;
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistruct tc_pedit_sel {
628c2ecf20Sopenharmony_ci	tc_gen;
638c2ecf20Sopenharmony_ci	unsigned char           nkeys;
648c2ecf20Sopenharmony_ci	unsigned char           flags;
658c2ecf20Sopenharmony_ci	struct tc_pedit_key     keys[0];
668c2ecf20Sopenharmony_ci};
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define tc_pedit tc_pedit_sel
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#endif
71