Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / util / bpf-filter.h
blob916ed7770b734f1533b9abe11bae18919a729762
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PERF_UTIL_BPF_FILTER_H
3 #define PERF_UTIL_BPF_FILTER_H
5 #include <linux/list.h>
7 #include "bpf_skel/sample-filter.h"
9 struct perf_bpf_filter_expr {
10 struct list_head list;
11 struct list_head groups;
12 enum perf_bpf_filter_op op;
13 int part;
14 enum perf_bpf_filter_term term;
15 unsigned long val;
18 struct evsel;
19 struct target;
21 /* path in BPF-fs for the pinned program and maps */
22 #define PERF_BPF_FILTER_PIN_PATH "perf_filter"
24 #ifdef HAVE_BPF_SKEL
25 struct perf_bpf_filter_expr *perf_bpf_filter_expr__new(enum perf_bpf_filter_term term,
26 int part,
27 enum perf_bpf_filter_op op,
28 unsigned long val);
29 int perf_bpf_filter__parse(struct list_head *expr_head, const char *str);
30 int perf_bpf_filter__prepare(struct evsel *evsel, struct target *target);
31 int perf_bpf_filter__destroy(struct evsel *evsel);
32 u64 perf_bpf_filter__lost_count(struct evsel *evsel);
33 int perf_bpf_filter__pin(void);
34 int perf_bpf_filter__unpin(void);
36 #else /* !HAVE_BPF_SKEL */
38 static inline int perf_bpf_filter__parse(struct list_head *expr_head __maybe_unused,
39 const char *str __maybe_unused)
41 return -EOPNOTSUPP;
43 static inline int perf_bpf_filter__prepare(struct evsel *evsel __maybe_unused,
44 struct target *target __maybe_unused)
46 return -EOPNOTSUPP;
48 static inline int perf_bpf_filter__destroy(struct evsel *evsel __maybe_unused)
50 return -EOPNOTSUPP;
52 static inline u64 perf_bpf_filter__lost_count(struct evsel *evsel __maybe_unused)
54 return 0;
56 static inline int perf_bpf_filter__pin(void)
58 return -EOPNOTSUPP;
60 static inline int perf_bpf_filter__unpin(void)
62 return -EOPNOTSUPP;
64 #endif /* HAVE_BPF_SKEL*/
65 #endif /* PERF_UTIL_BPF_FILTER_H */