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
This commit is contained in:

committed by
Alexei Starovoitov

parent
d6c4503cc2
commit
d3cc2ab546
@@ -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;
|
||||
|
Reference in New Issue
Block a user