summaryrefslogtreecommitdiffstats
path: root/include/linux/bpf.h
diff options
context:
space:
mode:
authorJakub Kicinski2018-05-04 03:37:08 +0200
committerDaniel Borkmann2018-05-04 23:41:03 +0200
commit0cd3cbed3caf6eae3bc0fa4afa4f26a9babfe55a (patch)
tree6c85805d0e926386e47ebbe193ccd56dc1a94fa2 /include/linux/bpf.h
parentMerge branch 'bpf-subprog-mgmt-cleanup' (diff)
downloadkernel-qcow2-linux-0cd3cbed3caf6eae3bc0fa4afa4f26a9babfe55a.tar.gz
kernel-qcow2-linux-0cd3cbed3caf6eae3bc0fa4afa4f26a9babfe55a.tar.xz
kernel-qcow2-linux-0cd3cbed3caf6eae3bc0fa4afa4f26a9babfe55a.zip
bpf: offload: allow offloaded programs to use perf event arrays
BPF_MAP_TYPE_PERF_EVENT_ARRAY is special as far as offload goes. The map only holds glue to perf ring, not actual data. Allow non-offloaded perf event arrays to be used in offloaded programs. Offload driver can extract the events from HW and put them in the map for user space to retrieve. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Reviewed-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r--include/linux/bpf.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 0e00a13ff01b..321969da67b7 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -110,6 +110,11 @@ static inline struct bpf_offloaded_map *map_to_offmap(struct bpf_map *map)
return container_of(map, struct bpf_offloaded_map, map);
}
+static inline bool bpf_map_offload_neutral(const struct bpf_map *map)
+{
+ return map->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY;
+}
+
static inline bool bpf_map_support_seq_show(const struct bpf_map *map)
{
return map->ops->map_seq_show_elem && map->ops->map_check_btf;