psample.h 782 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __NET_PSAMPLE_H
  2. #define __NET_PSAMPLE_H
  3. #include <uapi/linux/psample.h>
  4. #include <linux/module.h>
  5. #include <linux/list.h>
  6. struct psample_group {
  7. struct list_head list;
  8. struct net *net;
  9. u32 group_num;
  10. u32 refcount;
  11. u32 seq;
  12. };
  13. struct psample_group *psample_group_get(struct net *net, u32 group_num);
  14. void psample_group_put(struct psample_group *group);
  15. #if IS_ENABLED(CONFIG_PSAMPLE)
  16. void psample_sample_packet(struct psample_group *group, struct sk_buff *skb,
  17. u32 trunc_size, int in_ifindex, int out_ifindex,
  18. u32 sample_rate);
  19. #else
  20. static inline void psample_sample_packet(struct psample_group *group,
  21. struct sk_buff *skb, u32 trunc_size,
  22. int in_ifindex, int out_ifindex,
  23. u32 sample_rate)
  24. {
  25. }
  26. #endif
  27. #endif /* __NET_PSAMPLE_H */