mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
UPSTREAM: bpf: net: Refactor bpf_iter target registration
Currently bpf_iter_reg_target takes parameters from target and allocates memory to save them. This is really not necessary, esp. in the future we may grow information passed from targets to bpf_iter manager. The patch refactors the code so target reg_info becomes static and bpf_iter manager can just take a reference to it. Change-Id: Ib9eb1c718ac5066304a775986f499c2db4109c44 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
0b7924ed8b
commit
ba0998fc06
6 changed files with 61 additions and 61 deletions
|
|
@ -6411,17 +6411,17 @@ 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 = {
|
||||
.target = "ipv6_route",
|
||||
.seq_ops = &ipv6_route_seq_ops,
|
||||
.init_seq_private = bpf_iter_init_seq_net,
|
||||
.fini_seq_private = bpf_iter_fini_seq_net,
|
||||
.seq_priv_size = sizeof(struct ipv6_route_iter),
|
||||
};
|
||||
|
||||
static int __init bpf_iter_register(void)
|
||||
{
|
||||
struct bpf_iter_reg reg_info = {
|
||||
.target = "ipv6_route",
|
||||
.seq_ops = &ipv6_route_seq_ops,
|
||||
.init_seq_private = bpf_iter_init_seq_net,
|
||||
.fini_seq_private = bpf_iter_fini_seq_net,
|
||||
.seq_priv_size = sizeof(struct ipv6_route_iter),
|
||||
};
|
||||
|
||||
return bpf_iter_reg_target(®_info);
|
||||
return bpf_iter_reg_target(&ipv6_route_reg_info);
|
||||
}
|
||||
|
||||
static void bpf_iter_unregister(void)
|
||||
|
|
|
|||
Loading…
Reference in a new issue