Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __NET_TC_MIR_H
0003 #define __NET_TC_MIR_H
0004 
0005 #include <net/act_api.h>
0006 #include <linux/tc_act/tc_mirred.h>
0007 
0008 struct tcf_mirred {
0009     struct tc_action    common;
0010     int         tcfm_eaction;
0011     bool            tcfm_mac_header_xmit;
0012     struct net_device __rcu *tcfm_dev;
0013     netdevice_tracker   tcfm_dev_tracker;
0014     struct list_head    tcfm_list;
0015 };
0016 #define to_mirred(a) ((struct tcf_mirred *)a)
0017 
0018 static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a)
0019 {
0020 #ifdef CONFIG_NET_CLS_ACT
0021     if (a->ops && a->ops->id == TCA_ID_MIRRED)
0022         return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR;
0023 #endif
0024     return false;
0025 }
0026 
0027 static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a)
0028 {
0029 #ifdef CONFIG_NET_CLS_ACT
0030     if (a->ops && a->ops->id == TCA_ID_MIRRED)
0031         return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR;
0032 #endif
0033     return false;
0034 }
0035 
0036 static inline bool is_tcf_mirred_ingress_redirect(const struct tc_action *a)
0037 {
0038 #ifdef CONFIG_NET_CLS_ACT
0039     if (a->ops && a->ops->id == TCA_ID_MIRRED)
0040         return to_mirred(a)->tcfm_eaction == TCA_INGRESS_REDIR;
0041 #endif
0042     return false;
0043 }
0044 
0045 static inline bool is_tcf_mirred_ingress_mirror(const struct tc_action *a)
0046 {
0047 #ifdef CONFIG_NET_CLS_ACT
0048     if (a->ops && a->ops->id == TCA_ID_MIRRED)
0049         return to_mirred(a)->tcfm_eaction == TCA_INGRESS_MIRROR;
0050 #endif
0051     return false;
0052 }
0053 
0054 static inline struct net_device *tcf_mirred_dev(const struct tc_action *a)
0055 {
0056     return rtnl_dereference(to_mirred(a)->tcfm_dev);
0057 }
0058 
0059 #endif /* __NET_TC_MIR_H */