summaryrefslogtreecommitdiff
path: root/samples/bpf/xdp_redirect_cpu_kern.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-05-12 18:30:40 +0200
committerAlexei Starovoitov <ast@kernel.org>2020-05-14 18:27:00 -0700
commit6a09815428547657f3ffd2f5c31ac2a191e7fdf3 (patch)
tree6c0440b39af3f58237445d117e75369a71a69e78 /samples/bpf/xdp_redirect_cpu_kern.c
parent8f4605ac3e64cbb929df1fa09d5c6cdf3f195e7b (diff)
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
Diffstat (limited to 'samples/bpf/xdp_redirect_cpu_kern.c')
-rw-r--r--samples/bpf/xdp_redirect_cpu_kern.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/xdp_redirect_cpu_kern.c b/samples/bpf/xdp_redirect_cpu_kern.c
index 313a8fe6d125..2baf8db1f7e7 100644
--- a/samples/bpf/xdp_redirect_cpu_kern.c
+++ b/samples/bpf/xdp_redirect_cpu_kern.c
@@ -15,7 +15,7 @@
#include <bpf/bpf_helpers.h>
#include "hash_func01.h"
-#define MAX_CPUS 64 /* WARNING - sync with _user.c */
+#define MAX_CPUS NR_CPUS
/* Special map type that can XDP_REDIRECT frames to another CPU */
struct {