tc_vlan.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #ifndef __NET_TC_VLAN_H
  10. #define __NET_TC_VLAN_H
  11. #include <net/act_api.h>
  12. #include <linux/tc_act/tc_vlan.h>
  13. struct tcf_vlan {
  14. struct tc_action common;
  15. int tcfv_action;
  16. u16 tcfv_push_vid;
  17. __be16 tcfv_push_proto;
  18. u8 tcfv_push_prio;
  19. };
  20. #define to_vlan(a) ((struct tcf_vlan *)a)
  21. static inline bool is_tcf_vlan(const struct tc_action *a)
  22. {
  23. #ifdef CONFIG_NET_CLS_ACT
  24. if (a->ops && a->ops->type == TCA_ACT_VLAN)
  25. return true;
  26. #endif
  27. return false;
  28. }
  29. static inline u32 tcf_vlan_action(const struct tc_action *a)
  30. {
  31. return to_vlan(a)->tcfv_action;
  32. }
  33. static inline u16 tcf_vlan_push_vid(const struct tc_action *a)
  34. {
  35. return to_vlan(a)->tcfv_push_vid;
  36. }
  37. static inline __be16 tcf_vlan_push_proto(const struct tc_action *a)
  38. {
  39. return to_vlan(a)->tcfv_push_proto;
  40. }
  41. static inline u8 tcf_vlan_push_prio(const struct tc_action *a)
  42. {
  43. return to_vlan(a)->tcfv_push_prio;
  44. }
  45. #endif /* __NET_TC_VLAN_H */