bpf: Factor out htab_elem_value helper()
authorHou Tao <houtao1@huawei.com>
Tue, 1 Apr 2025 06:22:45 +0000 (14:22 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 10 Apr 2025 03:12:53 +0000 (20:12 -0700)
commitba2b31b0f39fca12abbd21c53a92838bbc026023
tree908ed7acbcad977afd81f6e6fce781a8638a0644
parent5a15a050df714959f0d5a57ac3201bd1c6594984
bpf: Factor out htab_elem_value helper()

All hash maps store map key and map value together. The relative offset
of the map value compared to the map key is round_up(key_size, 8).
Therefore, factor out a common helper htab_elem_value() to calculate the
address of the map value instead of duplicating the logic.

Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250401062250.543403-2-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/hashtab.c