Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __NET_TC_GACT_H |
2 | #define __NET_TC_GACT_H | ||||
3 | |||||
4 | #include <net/act_api.h> | ||||
John Fastabend | 3b01cf5 | 2016-02-16 21:18:03 -0800 | [diff] [blame] | 5 | #include <linux/tc_act/tc_gact.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
David S. Miller | e9ce1cd | 2006-08-21 23:54:55 -0700 | [diff] [blame] | 7 | struct tcf_gact { |
WANG Cong | ec0595c | 2016-07-25 16:09:42 -0700 | [diff] [blame] | 8 | struct tc_action common; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #ifdef CONFIG_GACT_PROB |
Eric Dumazet | cc6510a | 2015-07-06 05:18:06 -0700 | [diff] [blame] | 10 | u16 tcfg_ptype; |
11 | u16 tcfg_pval; | ||||
12 | int tcfg_paction; | ||||
13 | atomic_t packets; | ||||
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | }; |
WANG Cong | a85a970 | 2016-07-25 16:09:41 -0700 | [diff] [blame] | 16 | #define to_gact(a) ((struct tcf_gact *)a) |
David S. Miller | e9ce1cd | 2006-08-21 23:54:55 -0700 | [diff] [blame] | 17 | |
Jiri Pirko | 5a4d1fe | 2017-06-06 14:12:03 +0200 | [diff] [blame] | 18 | static inline bool __is_tcf_gact_act(const struct tc_action *a, int act) |
John Fastabend | 3b01cf5 | 2016-02-16 21:18:03 -0800 | [diff] [blame] | 19 | { |
Amir Vadai | 00175ae | 2016-03-08 12:42:31 +0200 | [diff] [blame] | 20 | #ifdef CONFIG_NET_CLS_ACT |
John Fastabend | 3b01cf5 | 2016-02-16 21:18:03 -0800 | [diff] [blame] | 21 | struct tcf_gact *gact; |
22 | |||||
23 | if (a->ops && a->ops->type != TCA_ACT_GACT) | ||||
24 | return false; | ||||
25 | |||||
WANG Cong | a85a970 | 2016-07-25 16:09:41 -0700 | [diff] [blame] | 26 | gact = to_gact(a); |
Jiri Pirko | 5a4d1fe | 2017-06-06 14:12:03 +0200 | [diff] [blame] | 27 | if (gact->tcf_action == act) |
John Fastabend | 3b01cf5 | 2016-02-16 21:18:03 -0800 | [diff] [blame] | 28 | return true; |
29 | |||||
Amir Vadai | 00175ae | 2016-03-08 12:42:31 +0200 | [diff] [blame] | 30 | #endif |
John Fastabend | 3b01cf5 | 2016-02-16 21:18:03 -0800 | [diff] [blame] | 31 | return false; |
32 | } | ||||
Jiri Pirko | 5a4d1fe | 2017-06-06 14:12:03 +0200 | [diff] [blame] | 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 | |||||
David S. Miller | e9ce1cd | 2006-08-21 23:54:55 -0700 | [diff] [blame] | 44 | #endif /* __NET_TC_GACT_H */ |