]> git.baikalelectronics.ru Git - kernel.git/commit
samples/bpf: xdp_redirect_cpu: Set MAX_CPUS according to NR_CPUS
authorLorenzo Bianconi <lorenzo@kernel.org>
Tue, 12 May 2020 16:30:40 +0000 (18:30 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 15 May 2020 01:27:00 +0000 (18:27 -0700)
commitf8a9c9072b31b52f9b45d3f2bed67c96c15d14c4
tree6c0440b39af3f58237445d117e75369a71a69e78
parentbbd2bc54d7cf95e6ba10b341f55db26e0af92d69
samples/bpf: xdp_redirect_cpu: Set MAX_CPUS according to NR_CPUS

xdp_redirect_cpu is currently failing in bpf_prog_load_xattr()
allocating cpu_map map if CONFIG_NR_CPUS is less than 64 since
cpu_map_alloc() requires max_entries to be less than NR_CPUS.
Set cpu_map max_entries according to NR_CPUS in xdp_redirect_cpu_kern.c
and get currently running cpus in xdp_redirect_cpu_user.c

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/374472755001c260158c4e4b22f193bdd3c56fb7.1589300442.git.lorenzo@kernel.org
samples/bpf/xdp_redirect_cpu_kern.c
samples/bpf/xdp_redirect_cpu_user.c