summaryrefslogtreecommitdiff
path: root/kernel/bpf/map_iter.c
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2020-07-23 11:41:15 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-07-25 20:16:33 -0700
commitd3cc2ab546adc6e52b65f36f7c34820d2830d0c9 (patch)
tree600669df82d2095897e71afd63df3ffad0df754b /kernel/bpf/map_iter.c
parentd6c4503cc29638f328e1a6e6fefbdbda401c28fc (diff)
bpf: Implement bpf iterator for array maps
The bpf iterators for array and percpu array are implemented. Similar to hash maps, for percpu array map, bpf program will receive values from all cpus. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200723184115.590532-1-yhs@fb.com
Diffstat (limited to 'kernel/bpf/map_iter.c')
-rw-r--r--kernel/bpf/map_iter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/bpf/map_iter.c b/kernel/bpf/map_iter.c
index bcb68b55bf65..fbe1f557cb88 100644
--- a/kernel/bpf/map_iter.c
+++ b/kernel/bpf/map_iter.c
@@ -106,10 +106,12 @@ static int bpf_iter_check_map(struct bpf_prog *prog,
bool is_percpu = false;
if (map->map_type == BPF_MAP_TYPE_PERCPU_HASH ||
- map->map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH)
+ map->map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH ||
+ map->map_type == BPF_MAP_TYPE_PERCPU_ARRAY)
is_percpu = true;
else if (map->map_type != BPF_MAP_TYPE_HASH &&
- map->map_type != BPF_MAP_TYPE_LRU_HASH)
+ map->map_type != BPF_MAP_TYPE_LRU_HASH &&
+ map->map_type != BPF_MAP_TYPE_ARRAY)
return -EINVAL;
key_acc_size = prog->aux->max_rdonly_access;