1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NET_TC_GACT_H
3 #define __NET_TC_GACT_H
5 #include <net/act_api.h>
6 #include <linux/tc_act/tc_gact.h>
9 struct tc_action common;
10 #ifdef CONFIG_GACT_PROB
17 #define to_gact(a) ((struct tcf_gact *)a)
19 static inline bool __is_tcf_gact_act(const struct tc_action *a, int act,
22 #ifdef CONFIG_NET_CLS_ACT
23 struct tcf_gact *gact;
25 if (a->ops && a->ops->id != TCA_ID_GACT)
29 if ((!is_ext && gact->tcf_action == act) ||
30 (is_ext && TC_ACT_EXT_CMP(gact->tcf_action, act)))
37 static inline bool is_tcf_gact_ok(const struct tc_action *a)
39 return __is_tcf_gact_act(a, TC_ACT_OK, false);
42 static inline bool is_tcf_gact_shot(const struct tc_action *a)
44 return __is_tcf_gact_act(a, TC_ACT_SHOT, false);
47 static inline bool is_tcf_gact_trap(const struct tc_action *a)
49 return __is_tcf_gact_act(a, TC_ACT_TRAP, false);
52 static inline bool is_tcf_gact_goto_chain(const struct tc_action *a)
54 return __is_tcf_gact_act(a, TC_ACT_GOTO_CHAIN, true);
57 static inline u32 tcf_gact_goto_chain_index(const struct tc_action *a)
59 return READ_ONCE(a->tcfa_action) & TC_ACT_EXT_VAL_MASK;
62 static inline bool is_tcf_gact_continue(const struct tc_action *a)
64 return __is_tcf_gact_act(a, TC_ACT_UNSPEC, false);
67 static inline bool is_tcf_gact_reclassify(const struct tc_action *a)
69 return __is_tcf_gact_act(a, TC_ACT_RECLASSIFY, false);
72 static inline bool is_tcf_gact_pipe(const struct tc_action *a)
74 return __is_tcf_gact_act(a, TC_ACT_PIPE, false);
77 #endif /* __NET_TC_GACT_H */