summaryrefslogtreecommitdiffstats
path: root/kernel/bpf/offload.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2018-01-18 04:13:27 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2018-01-18 22:54:25 +0100
commit7a0ef6939548b9eb74bf464daf55ad68a23602a2 (patch)
tree3d1619b5fb9a88b6b1cce0fcb41ccaad87fb694d /kernel/bpf/offload.c
parentbpf: arraymap: use bpf_map_init_from_attr() (diff)
downloadlinux-7a0ef6939548b9eb74bf464daf55ad68a23602a2.tar.xz
linux-7a0ef6939548b9eb74bf464daf55ad68a23602a2.zip
bpf: offload: allow array map offload
The special handling of different map types is left to the driver. Allow offload of array maps by simply adding it to accepted types. For nfp we have to make sure array elements are not deleted. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf/offload.c')
-rw-r--r--kernel/bpf/offload.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
index 6c0baa1cf8f8..2657976aec2a 100644
--- a/kernel/bpf/offload.c
+++ b/kernel/bpf/offload.c
@@ -299,7 +299,8 @@ struct bpf_map *bpf_map_offload_map_alloc(union bpf_attr *attr)
if (!capable(CAP_SYS_ADMIN))
return ERR_PTR(-EPERM);
- if (attr->map_type != BPF_MAP_TYPE_HASH)
+ if (attr->map_type != BPF_MAP_TYPE_ARRAY &&
+ attr->map_type != BPF_MAP_TYPE_HASH)
return ERR_PTR(-EINVAL);
offmap = kzalloc(sizeof(*offmap), GFP_USER);