1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef PERF_UTIL_BPF_FILTER_H 3 #define PERF_UTIL_BPF_FILTER_H 4 5 #include <linux/list.h> 6 7 #include "bpf_skel/sample-filter.h" 8 9 struct perf_bpf_filter_expr { 10 struct list_head list; 11 enum perf_bpf_filter_op op; 12 unsigned long sample_flags; 13 unsigned long val; 14 }; 15 16 struct evsel; 17 18 #ifdef HAVE_BPF_SKEL 19 struct perf_bpf_filter_expr *perf_bpf_filter_expr__new(unsigned long sample_flags, 20 enum perf_bpf_filter_op op, 21 unsigned long val); 22 int perf_bpf_filter__parse(struct list_head *expr_head, const char *str); 23 int perf_bpf_filter__prepare(struct evsel *evsel); 24 int perf_bpf_filter__destroy(struct evsel *evsel); 25 u64 perf_bpf_filter__lost_count(struct evsel *evsel); 26 27 #else /* !HAVE_BPF_SKEL */ 28 29 static inline int perf_bpf_filter__parse(struct list_head *expr_head __maybe_unused, 30 const char *str __maybe_unused) 31 { 32 return -EOPNOTSUPP; 33 } 34 static inline int perf_bpf_filter__prepare(struct evsel *evsel __maybe_unused) 35 { 36 return -EOPNOTSUPP; 37 } 38 static inline int perf_bpf_filter__destroy(struct evsel *evsel __maybe_unused) 39 { 40 return -EOPNOTSUPP; 41 } 42 static inline u64 perf_bpf_filter__lost_count(struct evsel *evsel __maybe_unused) 43 { 44 return 0; 45 } 46 #endif /* HAVE_BPF_SKEL*/ 47 #endif /* PERF_UTIL_BPF_FILTER_H */ 48