License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / include / net / tc_act / tc_mirred.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef __NET_TC_MIR_H
3#define __NET_TC_MIR_H
4
5#include <net/act_api.h>
229d2850 6#include <linux/tc_act/tc_mirred.h>
1da177e4 7
e9ce1cd3 8struct tcf_mirred {
ec0595cc 9 struct tc_action common;
e9ce1cd3
DM
10 int tcfm_eaction;
11 int tcfm_ifindex;
16577923 12 bool tcfm_mac_header_xmit;
2ee22a90 13 struct net_device __rcu *tcfm_dev;
3b87956e 14 struct list_head tcfm_list;
1da177e4 15};
a85a970a 16#define to_mirred(a) ((struct tcf_mirred *)a)
1da177e4 17
5724b8b5 18static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a)
229d2850
SS
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
5724b8b5 27static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a)
56a20680
YG
28{
29#ifdef CONFIG_NET_CLS_ACT
30 if (a->ops && a->ops->type == TCA_ACT_MIRRED)
31 return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR;
32#endif
33 return false;
34}
35
229d2850
SS
36static inline int tcf_mirred_ifindex(const struct tc_action *a)
37{
38 return to_mirred(a)->tcfm_ifindex;
39}
40
e9ce1cd3 41#endif /* __NET_TC_MIR_H */