blob: e891835eb74e765bbed654362f1bf53439780904 [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 {
8 struct tcf_common common;
9 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 Cong86062032014-02-11 17:07:31 -080015#define to_mirred(a) \
16 container_of(a->priv, struct tcf_mirred, common)
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Sridhar Samudrala229d2852016-05-02 03:33:42 -070018static inline bool is_tcf_mirred_redirect(const struct tc_action *a)
19{
20#ifdef CONFIG_NET_CLS_ACT
21 if (a->ops && a->ops->type == TCA_ACT_MIRRED)
22 return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR;
23#endif
24 return false;
25}
26
27static inline int tcf_mirred_ifindex(const struct tc_action *a)
28{
29 return to_mirred(a)->tcfm_ifindex;
30}
31
David S. Millere9ce1cd2006-08-21 23:54:55 -070032#endif /* __NET_TC_MIR_H */