xref: /openbmc/linux/include/net/tc_act/tc_gact.h (revision 4da722ca19f30f7db250db808d1ab1703607a932)
1 #ifndef __NET_TC_GACT_H
2 #define __NET_TC_GACT_H
3 
4 #include <net/act_api.h>
5 #include <linux/tc_act/tc_gact.h>
6 
7 struct tcf_gact {
8 	struct tc_action	common;
9 #ifdef CONFIG_GACT_PROB
10 	u16			tcfg_ptype;
11 	u16			tcfg_pval;
12 	int			tcfg_paction;
13 	atomic_t		packets;
14 #endif
15 };
16 #define to_gact(a) ((struct tcf_gact *)a)
17 
18 static inline bool __is_tcf_gact_act(const struct tc_action *a, int act)
19 {
20 #ifdef CONFIG_NET_CLS_ACT
21 	struct tcf_gact *gact;
22 
23 	if (a->ops && a->ops->type != TCA_ACT_GACT)
24 		return false;
25 
26 	gact = to_gact(a);
27 	if (gact->tcf_action == act)
28 		return true;
29 
30 #endif
31 	return false;
32 }
33 
34 static inline bool is_tcf_gact_shot(const struct tc_action *a)
35 {
36 	return __is_tcf_gact_act(a, TC_ACT_SHOT);
37 }
38 
39 static inline bool is_tcf_gact_trap(const struct tc_action *a)
40 {
41 	return __is_tcf_gact_act(a, TC_ACT_TRAP);
42 }
43 
44 #endif /* __NET_TC_GACT_H */
45