From: Geliang Tang <tanggeliang@kylinos.cn>
Since the kfuncs mptcp_subflow_active() and mptcp_subflow_set_scheduled()
are invoked in the mptcp_subflow bpf_iter test in a ftrace hook for
mptcp_sched_get_send(), it's necessary to register them into a
BPF_PROG_TYPE_TRACING type kfunc set together with the bpf_iter
mptcp_subflow helpers bpf_iter_mptcp_subflow_new()/_next()/_destroy().
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/bpf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index 350672e24a3d..0b7a0c2634c4 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -260,9 +260,12 @@ __bpf_kfunc bool bpf_mptcp_subflow_queues_empty(struct sock *sk)
__bpf_kfunc_end_defs();
BTF_KFUNCS_START(bpf_mptcp_sched_kfunc_ids)
+BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new)
+BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next)
+BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy)
+BTF_ID_FLAGS(func, mptcp_subflow_active)
BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx_by_pos)
-BTF_ID_FLAGS(func, mptcp_subflow_active)
BTF_ID_FLAGS(func, mptcp_set_timeout)
BTF_ID_FLAGS(func, mptcp_wnd_end)
BTF_ID_FLAGS(func, tcp_stream_memory_free)
@@ -280,6 +283,8 @@ static int __init bpf_mptcp_kfunc_init(void)
int ret;
ret = register_btf_fmodret_id_set(&bpf_mptcp_fmodret_set);
+ ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING,
+ &bpf_mptcp_sched_kfunc_set);
ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
&bpf_mptcp_sched_kfunc_set);
#ifdef CONFIG_BPF_JIT
--
2.43.0