@@ -220,15 +220,26 @@ struct bpf_iter_mptcp_subflow_kern {
220220__bpf_kfunc_start_defs ();
221221
222222__bpf_kfunc static struct mptcp_subflow_context *
223- bpf_mptcp_subflow_ctx (const struct sock * sk )
223+ bpf_mptcp_subflow_ctx (const struct sock * sk__ign )
224224{
225+ const struct sock * sk = sk__ign ;
226+
225227 if (sk && sk_fullsock (sk ) &&
226228 sk -> sk_protocol == IPPROTO_TCP && sk_is_mptcp (sk ))
227229 return mptcp_subflow_ctx (sk );
228230
229231 return NULL ;
230232}
231233
234+ __bpf_kfunc static struct sock *
235+ bpf_mptcp_subflow_tcp_sock (const struct mptcp_subflow_context * subflow )
236+ {
237+ if (!subflow )
238+ return NULL ;
239+
240+ return mptcp_subflow_tcp_sock (subflow );
241+ }
242+
232243__bpf_kfunc static int
233244bpf_iter_mptcp_subflow_new (struct bpf_iter_mptcp_subflow * it ,
234245 struct sock * sk )
@@ -273,13 +284,37 @@ bpf_iter_mptcp_subflow_destroy(struct bpf_iter_mptcp_subflow *it)
273284{
274285}
275286
287+ __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty (struct sock * sk )
288+ {
289+ return tcp_rtx_queue_empty (sk );
290+ }
291+
292+ __bpf_kfunc static bool bpf_sk_stream_memory_free (const struct sock * sk__ign )
293+ {
294+ const struct sock * sk = sk__ign ;
295+
296+ if (sk && sk_fullsock (sk ) &&
297+ sk -> sk_protocol == IPPROTO_TCP && sk_is_mptcp (sk ))
298+ return sk_stream_memory_free (sk );
299+
300+ return NULL ;
301+ }
302+
276303__bpf_kfunc_end_defs ();
277304
278305BTF_KFUNCS_START (bpf_mptcp_common_kfunc_ids )
279306BTF_ID_FLAGS (func , bpf_mptcp_subflow_ctx , KF_RET_NULL )
307+ BTF_ID_FLAGS (func , bpf_mptcp_subflow_tcp_sock , KF_RET_NULL )
280308BTF_ID_FLAGS (func , bpf_iter_mptcp_subflow_new , KF_ITER_NEW | KF_TRUSTED_ARGS )
281309BTF_ID_FLAGS (func , bpf_iter_mptcp_subflow_next , KF_ITER_NEXT | KF_RET_NULL )
282310BTF_ID_FLAGS (func , bpf_iter_mptcp_subflow_destroy , KF_ITER_DESTROY )
311+ BTF_ID_FLAGS (func , mptcp_subflow_set_scheduled )
312+ BTF_ID_FLAGS (func , mptcp_subflow_active )
313+ BTF_ID_FLAGS (func , mptcp_set_timeout )
314+ BTF_ID_FLAGS (func , mptcp_wnd_end )
315+ BTF_ID_FLAGS (func , bpf_sk_stream_memory_free , KF_RET_NULL )
316+ BTF_ID_FLAGS (func , bpf_mptcp_subflow_queues_empty )
317+ BTF_ID_FLAGS (func , mptcp_pm_subflow_chk_stale , KF_SLEEPABLE )
283318BTF_KFUNCS_END (bpf_mptcp_common_kfunc_ids )
284319
285320static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = {
@@ -294,6 +329,8 @@ static int __init bpf_mptcp_kfunc_init(void)
294329 ret = register_btf_fmodret_id_set (& bpf_mptcp_fmodret_set );
295330 ret = ret ?: register_btf_kfunc_id_set (BPF_PROG_TYPE_CGROUP_SOCKOPT ,
296331 & bpf_mptcp_common_kfunc_set );
332+ ret = ret ?: register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS ,
333+ & bpf_mptcp_common_kfunc_set );
297334#ifdef CONFIG_BPF_JIT
298335 ret = ret ?: register_bpf_struct_ops (& bpf_mptcp_sched_ops , mptcp_sched_ops );
299336#endif
0 commit comments