Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __NET_TC_MIR_H |
| 2 | #define __NET_TC_MIR_H |
| 3 | |
| 4 | #include <net/act_api.h> |
Sridhar Samudrala | 229d285 | 2016-05-02 03:33:42 -0700 | [diff] [blame] | 5 | #include <linux/tc_act/tc_mirred.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_mirred { |
WANG Cong | ec0595c | 2016-07-25 16:09:42 -0700 | [diff] [blame] | 8 | struct tc_action common; |
David S. Miller | e9ce1cd | 2006-08-21 23:54:55 -0700 | [diff] [blame] | 9 | int tcfm_eaction; |
| 10 | int tcfm_ifindex; |
Shmulik Ladkani | 1657792 | 2016-10-13 09:06:41 +0300 | [diff] [blame] | 11 | bool tcfm_mac_header_xmit; |
Eric Dumazet | 2ee22a9 | 2015-07-06 05:18:09 -0700 | [diff] [blame] | 12 | struct net_device __rcu *tcfm_dev; |
stephen hemminger | 3b87956 | 2010-07-22 18:45:04 +0000 | [diff] [blame] | 13 | struct list_head tcfm_list; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | }; |
WANG Cong | a85a970 | 2016-07-25 16:09:41 -0700 | [diff] [blame] | 15 | #define to_mirred(a) ((struct tcf_mirred *)a) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Shmulik Ladkani | 5724b8b | 2016-10-13 09:06:43 +0300 | [diff] [blame] | 17 | static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a) |
Sridhar Samudrala | 229d285 | 2016-05-02 03:33:42 -0700 | [diff] [blame] | 18 | { |
| 19 | #ifdef CONFIG_NET_CLS_ACT |
| 20 | if (a->ops && a->ops->type == TCA_ACT_MIRRED) |
| 21 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR; |
| 22 | #endif |
| 23 | return false; |
| 24 | } |
| 25 | |
Shmulik Ladkani | 5724b8b | 2016-10-13 09:06:43 +0300 | [diff] [blame] | 26 | static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a) |
Yotam Gigi | 56a2068 | 2016-07-21 12:03:16 +0200 | [diff] [blame] | 27 | { |
| 28 | #ifdef CONFIG_NET_CLS_ACT |
| 29 | if (a->ops && a->ops->type == TCA_ACT_MIRRED) |
| 30 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR; |
| 31 | #endif |
| 32 | return false; |
| 33 | } |
| 34 | |
Sridhar Samudrala | 229d285 | 2016-05-02 03:33:42 -0700 | [diff] [blame] | 35 | static inline int tcf_mirred_ifindex(const struct tc_action *a) |
| 36 | { |
| 37 | return to_mirred(a)->tcfm_ifindex; |
| 38 | } |
| 39 | |
David S. Miller | e9ce1cd | 2006-08-21 23:54:55 -0700 | [diff] [blame] | 40 | #endif /* __NET_TC_MIR_H */ |