staging: rtl8188eu: rename HalSetBrateCfg() - style
[linux/fpc-iii.git] / include / net / tc_act / tc_gact.h
blobef8dd0db70ceca2b4d41b707833faaf6044c9061
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>
8 struct tcf_gact {
9 struct tc_action common;
10 #ifdef CONFIG_GACT_PROB
11 u16 tcfg_ptype;
12 u16 tcfg_pval;
13 int tcfg_paction;
14 atomic_t packets;
15 #endif
17 #define to_gact(a) ((struct tcf_gact *)a)
19 static inline bool __is_tcf_gact_act(const struct tc_action *a, int act,
20 bool is_ext)
22 #ifdef CONFIG_NET_CLS_ACT
23 struct tcf_gact *gact;
25 if (a->ops && a->ops->type != TCA_ACT_GACT)
26 return false;
28 gact = to_gact(a);
29 if ((!is_ext && gact->tcf_action == act) ||
30 (is_ext && TC_ACT_EXT_CMP(gact->tcf_action, act)))
31 return true;
33 #endif
34 return false;
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 a->goto_chain->index;
62 #endif /* __NET_TC_GACT_H */