1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2008, Intel Corporation.
5 * Author: Alexander Duyck <alexander.h.duyck@intel.com>
8 #ifndef __NET_TC_SKBEDIT_H
9 #define __NET_TC_SKBEDIT_H
11 #include <net/act_api.h>
12 #include <linux/tc_act/tc_skbedit.h>
14 struct tcf_skbedit_params {
26 struct tc_action common;
27 struct tcf_skbedit_params __rcu *params;
29 #define to_skbedit(a) ((struct tcf_skbedit *)a)
31 /* Return true iff action is the one identified by FLAG. */
32 static inline bool is_tcf_skbedit_with_flag(const struct tc_action *a, u32 flag)
34 #ifdef CONFIG_NET_CLS_ACT
37 if (a->ops && a->ops->id == TCA_ID_SKBEDIT) {
39 flags = rcu_dereference(to_skbedit(a)->params)->flags;
47 /* Return true iff action is mark */
48 static inline bool is_tcf_skbedit_mark(const struct tc_action *a)
50 return is_tcf_skbedit_with_flag(a, SKBEDIT_F_MARK);
53 static inline u32 tcf_skbedit_mark(const struct tc_action *a)
58 mark = rcu_dereference(to_skbedit(a)->params)->mark;
64 /* Return true iff action is ptype */
65 static inline bool is_tcf_skbedit_ptype(const struct tc_action *a)
67 return is_tcf_skbedit_with_flag(a, SKBEDIT_F_PTYPE);
70 static inline u32 tcf_skbedit_ptype(const struct tc_action *a)
75 ptype = rcu_dereference(to_skbedit(a)->params)->ptype;
81 /* Return true iff action is priority */
82 static inline bool is_tcf_skbedit_priority(const struct tc_action *a)
84 return is_tcf_skbedit_with_flag(a, SKBEDIT_F_PRIORITY);
87 static inline u32 tcf_skbedit_priority(const struct tc_action *a)
92 priority = rcu_dereference(to_skbedit(a)->params)->priority;
98 /* Return true iff action is queue_mapping */
99 static inline bool is_tcf_skbedit_queue_mapping(const struct tc_action *a)
101 return is_tcf_skbedit_with_flag(a, SKBEDIT_F_QUEUE_MAPPING);
104 /* Return true iff action is inheritdsfield */
105 static inline bool is_tcf_skbedit_inheritdsfield(const struct tc_action *a)
107 return is_tcf_skbedit_with_flag(a, SKBEDIT_F_INHERITDSFIELD);
110 #endif /* __NET_TC_SKBEDIT_H */