OSDN Git Service

bpf: Extend batch operations for map-in-map bpf-maps
authorTakshak Chahande <ctakshak@fb.com>
Tue, 10 May 2022 08:22:20 +0000 (01:22 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 10 May 2022 17:34:57 +0000 (10:34 -0700)
commit9263dddc7b6f816fdd327eee435cc54ba51dd095
tree14509baef62b14a30ed234e8fd0cd2fcd0af60b8
parent174efa7811659b3e3dec05b3649dc6d66c8c4628
bpf: Extend batch operations for map-in-map bpf-maps

This patch extends batch operations support for map-in-map map-types:
BPF_MAP_TYPE_HASH_OF_MAPS and BPF_MAP_TYPE_ARRAY_OF_MAPS

A usecase where outer HASH map holds hundred of VIP entries and its
associated reuse-ports per VIP stored in REUSEPORT_SOCKARRAY type
inner map, needs to do batch operation for performance gain.

This patch leverages the exiting generic functions for most of the batch
operations. As map-in-map's value contains the actual reference of the inner map,
for BPF_MAP_TYPE_HASH_OF_MAPS type, it needed an extra step to fetch the
map_id from the reference value.

selftests are added in next patch 2/2.

Signed-off-by: Takshak Chahande <ctakshak@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220510082221.2390540-1-ctakshak@fb.com
kernel/bpf/arraymap.c
kernel/bpf/hashtab.c