tc_mirred.h 979 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NET_TC_MIR_H
  3. #define __NET_TC_MIR_H
  4. #include <net/act_api.h>
  5. #include <linux/tc_act/tc_mirred.h>
  6. struct tcf_mirred {
  7. struct tc_action common;
  8. int tcfm_eaction;
  9. int tcfm_ifindex;
  10. bool tcfm_mac_header_xmit;
  11. struct net_device __rcu *tcfm_dev;
  12. struct list_head tcfm_list;
  13. };
  14. #define to_mirred(a) ((struct tcf_mirred *)a)
  15. static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a)
  16. {
  17. #ifdef CONFIG_NET_CLS_ACT
  18. if (a->ops && a->ops->type == TCA_ACT_MIRRED)
  19. return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR;
  20. #endif
  21. return false;
  22. }
  23. static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a)
  24. {
  25. #ifdef CONFIG_NET_CLS_ACT
  26. if (a->ops && a->ops->type == TCA_ACT_MIRRED)
  27. return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR;
  28. #endif
  29. return false;
  30. }
  31. static inline int tcf_mirred_ifindex(const struct tc_action *a)
  32. {
  33. return to_mirred(a)->tcfm_ifindex;
  34. }
  35. #endif /* __NET_TC_MIR_H */