@@ -222,15 +222,26 @@ struct bpf_iter_mptcp_subflow_kern {
222222__bpf_kfunc_start_defs ();
223223
224224__bpf_kfunc static struct mptcp_subflow_context *
225- bpf_mptcp_subflow_ctx (const struct sock * sk )
225+ bpf_mptcp_subflow_ctx (const struct sock * sk__ign )
226226{
227+ const struct sock * sk = sk__ign ;
228+
227229 if (sk && sk_fullsock (sk ) &&
228230 sk -> sk_protocol == IPPROTO_TCP && sk_is_mptcp (sk ))
229231 return mptcp_subflow_ctx (sk );
230232
231233 return NULL ;
232234}
233235
236+ __bpf_kfunc static struct sock *
237+ bpf_mptcp_subflow_tcp_sock (const struct mptcp_subflow_context * subflow )
238+ {
239+ if (!subflow )
240+ return NULL ;
241+
242+ return mptcp_subflow_tcp_sock (subflow );
243+ }
244+
234245__bpf_kfunc static int
235246bpf_iter_mptcp_subflow_new (struct bpf_iter_mptcp_subflow * it ,
236247 struct sock * sk )
@@ -275,13 +286,37 @@ bpf_iter_mptcp_subflow_destroy(struct bpf_iter_mptcp_subflow *it)
275286{
276287}
277288
289+ __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty (struct sock * sk )
290+ {
291+ return tcp_rtx_queue_empty (sk );
292+ }
293+
294+ __bpf_kfunc static bool bpf_sk_stream_memory_free (const struct sock * sk__ign )
295+ {
296+ const struct sock * sk = sk__ign ;
297+
298+ if (sk && sk_fullsock (sk ) &&
299+ sk -> sk_protocol == IPPROTO_TCP && sk_is_mptcp (sk ))
300+ return sk_stream_memory_free (sk );
301+
302+ return NULL ;
303+ }
304+
278305__bpf_kfunc_end_defs ();
279306
280307BTF_KFUNCS_START (bpf_mptcp_common_kfunc_ids )
281308BTF_ID_FLAGS (func , bpf_mptcp_subflow_ctx , KF_RET_NULL )
309+ BTF_ID_FLAGS (func , bpf_mptcp_subflow_tcp_sock , KF_RET_NULL )
282310BTF_ID_FLAGS (func , bpf_iter_mptcp_subflow_new , KF_ITER_NEW | KF_TRUSTED_ARGS )
283311BTF_ID_FLAGS (func , bpf_iter_mptcp_subflow_next , KF_ITER_NEXT | KF_RET_NULL )
284312BTF_ID_FLAGS (func , bpf_iter_mptcp_subflow_destroy , KF_ITER_DESTROY )
313+ BTF_ID_FLAGS (func , mptcp_subflow_set_scheduled )
314+ BTF_ID_FLAGS (func , mptcp_subflow_active )
315+ BTF_ID_FLAGS (func , mptcp_set_timeout )
316+ BTF_ID_FLAGS (func , mptcp_wnd_end )
317+ BTF_ID_FLAGS (func , bpf_sk_stream_memory_free , KF_RET_NULL )
318+ BTF_ID_FLAGS (func , bpf_mptcp_subflow_queues_empty )
319+ BTF_ID_FLAGS (func , mptcp_pm_subflow_chk_stale , KF_SLEEPABLE )
285320BTF_KFUNCS_END (bpf_mptcp_common_kfunc_ids )
286321
287322static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = {
@@ -296,6 +331,8 @@ static int __init bpf_mptcp_kfunc_init(void)
296331 ret = register_btf_fmodret_id_set (& bpf_mptcp_fmodret_set );
297332 ret = ret ?: register_btf_kfunc_id_set (BPF_PROG_TYPE_CGROUP_SOCKOPT ,
298333 & bpf_mptcp_common_kfunc_set );
334+ ret = ret ?: register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS ,
335+ & bpf_mptcp_common_kfunc_set );
299336#ifdef CONFIG_BPF_JIT
300337 ret = ret ?: register_bpf_struct_ops (& bpf_mptcp_sched_ops , mptcp_sched_ops );
301338#endif
0 commit comments