summaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2020-05-13 11:02:19 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-05-13 12:30:50 -0700
commit15172a46fa2796c1a1358a36babd31274716ed41 (patch)
treec03b6ee05a943f83193860af50c6a9b364b13d4f /net/ipv6
parent2e3ed68bfcd9c5ca2cf8b88ba23a34992ccd0b1f (diff)
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. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200513180219.2949605-1-yhs@fb.com
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/route.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 25f6d3e619d0..6ad2fa51a23a 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6397,17 +6397,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(&reg_info);
+ return bpf_iter_reg_target(&ipv6_route_reg_info);
}
static void bpf_iter_unregister(void)