blob: 62770add15bd80a069747119e564244b8f9055ff [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __NET_TC_MIR_H
2#define __NET_TC_MIR_H
3
4#include <net/act_api.h>
Sridhar Samudrala229d2852016-05-02 03:33:42 -07005#include <linux/tc_act/tc_mirred.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
David S. Millere9ce1cd2006-08-21 23:54:55 -07007struct tcf_mirred {
WANG Congec0595c2016-07-25 16:09:42 -07008 struct tc_action common;
David S. Millere9ce1cd2006-08-21 23:54:55 -07009 int tcfm_eaction;
10 int tcfm_ifindex;
11 int tcfm_ok_push;
Eric Dumazet2ee22a92015-07-06 05:18:09 -070012 struct net_device __rcu *tcfm_dev;
stephen hemminger3b879562010-07-22 18:45:04 +000013 struct list_head tcfm_list;
Linus Torvalds1da177e2005-04-16 15:20:36 -070014};
WANG Conga85a9702016-07-25 16:09:41 -070015#define to_mirred(a) ((struct tcf_mirred *)a)
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Sridhar Samudrala229d2852016-05-02 03:33:42 -070017static inline bool is_tcf_mirred_redirect(const struct tc_action *a)
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
Yotam Gigi56a20682016-07-21 12:03:16 +020026static inline bool is_tcf_mirred_mirror(const struct tc_action *a)
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 Samudrala229d2852016-05-02 03:33:42 -070035static inline int tcf_mirred_ifindex(const struct tc_action *a)
36{
37 return to_mirred(a)->tcfm_ifindex;
38}
39
David S. Millere9ce1cd2006-08-21 23:54:55 -070040#endif /* __NET_TC_MIR_H */