tc_csum.h 801 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NET_TC_CSUM_H
  3. #define __NET_TC_CSUM_H
  4. #include <linux/types.h>
  5. #include <net/act_api.h>
  6. #include <linux/tc_act/tc_csum.h>
  7. struct tcf_csum_params {
  8. u32 update_flags;
  9. struct rcu_head rcu;
  10. };
  11. struct tcf_csum {
  12. struct tc_action common;
  13. struct tcf_csum_params __rcu *params;
  14. };
  15. #define to_tcf_csum(a) ((struct tcf_csum *)a)
  16. static inline bool is_tcf_csum(const struct tc_action *a)
  17. {
  18. #ifdef CONFIG_NET_CLS_ACT
  19. if (a->ops && a->ops->type == TCA_ACT_CSUM)
  20. return true;
  21. #endif
  22. return false;
  23. }
  24. static inline u32 tcf_csum_update_flags(const struct tc_action *a)
  25. {
  26. u32 update_flags;
  27. rcu_read_lock();
  28. update_flags = rcu_dereference(to_tcf_csum(a)->params)->update_flags;
  29. rcu_read_unlock();
  30. return update_flags;
  31. }
  32. #endif /* __NET_TC_CSUM_H */