On Wed, Feb 24, 2021 at 11:33 PM Yonghong Song <yhs@xxxxxx> wrote: > diff --git a/kernel/bpf/bpf_iter.c b/kernel/bpf/bpf_iter.c > index a0d9eade9c80..931870f9cf56 100644 > --- a/kernel/bpf/bpf_iter.c > +++ b/kernel/bpf/bpf_iter.c > @@ -675,3 +675,19 @@ int bpf_iter_run_prog(struct bpf_prog *prog, void *ctx) > */ > return ret == 0 ? 0 : -EAGAIN; > } > + > +BPF_CALL_4(bpf_for_each_map_elem, struct bpf_map *, map, void *, callback_fn, > + void *, callback_ctx, u64, flags) > +{ > + return map->ops->map_for_each_callback(map, callback_fn, callback_ctx, flags); > +} A quick question: is ->map_for_each_callback() now mandatory for every map? I do not see you check for NULL here. Or you check map types somewhere I miss? At least some maps do not support iteration, for example, queue/stack. If you can document supported maps in bpf_for_each_map_elem() doc, it would be very nice. Thanks for working on this!