11da177e4SLinus Torvalds #ifndef __NET_TC_MIR_H 21da177e4SLinus Torvalds #define __NET_TC_MIR_H 31da177e4SLinus Torvalds 41da177e4SLinus Torvalds #include <net/act_api.h> 5229d2850SSridhar Samudrala #include <linux/tc_act/tc_mirred.h> 61da177e4SLinus Torvalds 7e9ce1cd3SDavid S. Miller struct tcf_mirred { 8e9ce1cd3SDavid S. Miller struct tcf_common common; 9e9ce1cd3SDavid S. Miller int tcfm_eaction; 10e9ce1cd3SDavid S. Miller int tcfm_ifindex; 11e9ce1cd3SDavid S. Miller int tcfm_ok_push; 122ee22a90SEric Dumazet struct net_device __rcu *tcfm_dev; 133b87956eSstephen hemminger struct list_head tcfm_list; 141da177e4SLinus Torvalds }; 1586062033SWANG Cong #define to_mirred(a) \ 1686062033SWANG Cong container_of(a->priv, struct tcf_mirred, common) 171da177e4SLinus Torvalds 18229d2850SSridhar Samudrala static inline bool is_tcf_mirred_redirect(const struct tc_action *a) 19229d2850SSridhar Samudrala { 20229d2850SSridhar Samudrala #ifdef CONFIG_NET_CLS_ACT 21229d2850SSridhar Samudrala if (a->ops && a->ops->type == TCA_ACT_MIRRED) 22229d2850SSridhar Samudrala return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR; 23229d2850SSridhar Samudrala #endif 24229d2850SSridhar Samudrala return false; 25229d2850SSridhar Samudrala } 26229d2850SSridhar Samudrala 27*56a20680SYotam Gigi static inline bool is_tcf_mirred_mirror(const struct tc_action *a) 28*56a20680SYotam Gigi { 29*56a20680SYotam Gigi #ifdef CONFIG_NET_CLS_ACT 30*56a20680SYotam Gigi if (a->ops && a->ops->type == TCA_ACT_MIRRED) 31*56a20680SYotam Gigi return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR; 32*56a20680SYotam Gigi #endif 33*56a20680SYotam Gigi return false; 34*56a20680SYotam Gigi } 35*56a20680SYotam Gigi 36229d2850SSridhar Samudrala static inline int tcf_mirred_ifindex(const struct tc_action *a) 37229d2850SSridhar Samudrala { 38229d2850SSridhar Samudrala return to_mirred(a)->tcfm_ifindex; 39229d2850SSridhar Samudrala } 40229d2850SSridhar Samudrala 41e9ce1cd3SDavid S. Miller #endif /* __NET_TC_MIR_H */ 42