]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Sat, 8 Aug 2020 05:53:12 +0000 (01:53 -0400)
commit87650387351460e5de74ee0aca643e0f188d617a
tree03f5c7719e2d05b2cb27451ca0e30d2be4979967
parent40f2414ba9a732e3ca8538a17acb8dfeb1e6441f
samples/bpf: xdp_redirect_cpu: Set MAX_CPUS according to NR_CPUS

BugLink: https://bugs.launchpad.net/bugs/1885942
[ Upstream commit 6a09815428547657f3ffd2f5c31ac2a191e7fdf3 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
samples/bpf/xdp_redirect_cpu_kern.c
samples/bpf/xdp_redirect_cpu_user.c