^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __NET_PSAMPLE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __NET_PSAMPLE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <uapi/linux/psample.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct psample_group {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct net *net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) u32 group_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) u32 refcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) u32 seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct psample_group *psample_group_get(struct net *net, u32 group_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) void psample_group_take(struct psample_group *group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) void psample_group_put(struct psample_group *group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct sk_buff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #if IS_ENABLED(CONFIG_PSAMPLE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) void psample_sample_packet(struct psample_group *group, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) u32 trunc_size, int in_ifindex, int out_ifindex,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) u32 sample_rate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static inline void psample_sample_packet(struct psample_group *group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct sk_buff *skb, u32 trunc_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int in_ifindex, int out_ifindex,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) u32 sample_rate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #endif /* __NET_PSAMPLE_H */