tc_sample.h 752 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NET_TC_SAMPLE_H
  3. #define __NET_TC_SAMPLE_H
  4. #include <net/act_api.h>
  5. #include <linux/tc_act/tc_sample.h>
  6. #include <net/psample.h>
  7. struct tcf_sample {
  8. struct tc_action common;
  9. u32 rate;
  10. bool truncate;
  11. u32 trunc_size;
  12. struct psample_group __rcu *psample_group;
  13. u32 psample_group_num;
  14. struct list_head tcfm_list;
  15. };
  16. #define to_sample(a) ((struct tcf_sample *)a)
  17. static inline __u32 tcf_sample_rate(const struct tc_action *a)
  18. {
  19. return to_sample(a)->rate;
  20. }
  21. static inline bool tcf_sample_truncate(const struct tc_action *a)
  22. {
  23. return to_sample(a)->truncate;
  24. }
  25. static inline int tcf_sample_trunc_size(const struct tc_action *a)
  26. {
  27. return to_sample(a)->trunc_size;
  28. }
  29. #endif /* __NET_TC_SAMPLE_H */