mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -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
|
|
@ -60,6 +60,7 @@
|
|||
#include <linux/genetlink.h>
|
||||
#include <linux/net_namespace.h>
|
||||
#include <linux/nospec.h>
|
||||
#include <linux/btf_ids.h>
|
||||
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/netns/generic.h>
|
||||
|
|
@ -2820,7 +2821,10 @@ static const struct rhashtable_params netlink_rhashtable_params = {
|
|||
};
|
||||
|
||||
#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
|
||||
static const struct bpf_iter_reg netlink_reg_info = {
|
||||
BTF_ID_LIST(btf_netlink_sock_id)
|
||||
BTF_ID(struct, netlink_sock)
|
||||
|
||||
static struct bpf_iter_reg netlink_reg_info = {
|
||||
.target = "netlink",
|
||||
.seq_ops = &netlink_seq_ops,
|
||||
.init_seq_private = bpf_iter_init_seq_net,
|
||||
|
|
@ -2835,6 +2839,7 @@ static const struct bpf_iter_reg netlink_reg_info = {
|
|||
|
||||
static int __init bpf_iter_register(void)
|
||||
{
|
||||
netlink_reg_info.ctx_arg_info[0].btf_id = *btf_netlink_sock_id;
|
||||
return bpf_iter_reg_target(&netlink_reg_info);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue