mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
UPSTREAM: bpf: net: Use precomputed btf_id for bpf iterators
One additional field btf_id is added to struct bpf_ctx_arg_aux to store the precomputed btf_ids. The btf_id is computed at build time with BTF_ID_LIST or BTF_ID_LIST_GLOBAL macro definitions. All existing bpf iterators are changed to used pre-compute btf_ids. Change-Id: I1cb3532f3c31b426f279ed17e092e311649d54e1 Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
This commit is contained in:
parent
0d692dd8f9
commit
6be51943c7
8 changed files with 38 additions and 9 deletions
|
|
@ -62,6 +62,7 @@
|
|||
#include <net/l3mdev.h>
|
||||
#include <net/ip.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/btf_ids.h>
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
#include <linux/sysctl.h>
|
||||
|
|
@ -6411,7 +6412,10 @@ void __init ip6_route_init_special_entries(void)
|
|||
#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
|
||||
DEFINE_BPF_ITER_FUNC(ipv6_route, struct bpf_iter_meta *meta, struct fib6_info *rt)
|
||||
|
||||
static const struct bpf_iter_reg ipv6_route_reg_info = {
|
||||
BTF_ID_LIST(btf_fib6_info_id)
|
||||
BTF_ID(struct, fib6_info)
|
||||
|
||||
static struct bpf_iter_reg ipv6_route_reg_info = {
|
||||
.target = "ipv6_route",
|
||||
.seq_ops = &ipv6_route_seq_ops,
|
||||
.init_seq_private = bpf_iter_init_seq_net,
|
||||
|
|
@ -6426,6 +6430,7 @@ static const struct bpf_iter_reg ipv6_route_reg_info = {
|
|||
|
||||
static int __init bpf_iter_register(void)
|
||||
{
|
||||
ipv6_route_reg_info.ctx_arg_info[0].btf_id = *btf_fib6_info_id;
|
||||
return bpf_iter_reg_target(&ipv6_route_reg_info);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue