net/mptcp/bpf.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
The commit "bpf: Add update_socket_protocol hook" on bpf-next tree will
conflict with the commit "bpf: Add bpf_mptcp_sched_kfunc_set". This
patch fixes it.
Please update the commit log:
'''
This patch adds a new struct btf_kfunc_id_set for MPTCP scheduler. Add
mptcp_subflow_set_scheduled() and mptcp_sched_data_set_contexts() helpers
into this id_set, and register it in bpf_mptcp_kfunc_init() to make sure
these helpers can be accessed from the BPF context.
'''
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/bpf.c | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index 4911293919c2..92cf6fbf8275 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -144,24 +144,6 @@ struct bpf_struct_ops bpf_mptcp_sched_ops = {
.init = bpf_mptcp_sched_init,
.name = "mptcp_sched_ops",
};
-
-BTF_SET8_START(bpf_mptcp_sched_kfunc_ids)
-BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
-BTF_ID_FLAGS(func, mptcp_sched_data_set_contexts)
-BTF_ID_FLAGS(func, mptcp_subflow_ctx_by_pos)
-BTF_SET8_END(bpf_mptcp_sched_kfunc_ids)
-
-static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = {
- .owner = THIS_MODULE,
- .set = &bpf_mptcp_sched_kfunc_ids,
-};
-
-static int __init bpf_mptcp_kfunc_init(void)
-{
- return register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
- &bpf_mptcp_sched_kfunc_set);
-}
-late_initcall(bpf_mptcp_kfunc_init);
#endif /* CONFIG_BPF_JIT */
struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
@@ -181,8 +163,23 @@ static const struct btf_kfunc_id_set bpf_mptcp_fmodret_set = {
.set = &bpf_mptcp_fmodret_ids,
};
+BTF_SET8_START(bpf_mptcp_sched_kfunc_ids)
+BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
+BTF_ID_FLAGS(func, mptcp_sched_data_set_contexts)
+BTF_ID_FLAGS(func, mptcp_subflow_ctx_by_pos)
+BTF_SET8_END(bpf_mptcp_sched_kfunc_ids)
+
+static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = {
+ .owner = THIS_MODULE,
+ .set = &bpf_mptcp_sched_kfunc_ids,
+};
+
static int __init bpf_mptcp_kfunc_init(void)
{
- return register_btf_fmodret_id_set(&bpf_mptcp_fmodret_set);
+ int ret;
+
+ ret = register_btf_fmodret_id_set(&bpf_mptcp_fmodret_set);
+ return ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
+ &bpf_mptcp_sched_kfunc_set);
}
late_initcall(bpf_mptcp_kfunc_init);
--
2.35.3
Hi Geliang,
(I also have a question for you at the end)
On 17/08/2023 06:51, Geliang Tang wrote:
> The commit "bpf: Add update_socket_protocol hook" on bpf-next tree will
> conflict with the commit "bpf: Add bpf_mptcp_sched_kfunc_set". This
> patch fixes it.
Thank you for the follow up!
> Please update the commit log:
>
> '''
> This patch adds a new struct btf_kfunc_id_set for MPTCP scheduler. Add
> mptcp_subflow_set_scheduled() and mptcp_sched_data_set_contexts() helpers
> into this id_set, and register it in bpf_mptcp_kfunc_init() to make sure
> these helpers can be accessed from the BPF context.
> '''
Done!
I hope everything has been applied correctly.
New patches for t/upstream:
- 134c0805ac94: "squashed" in "bpf: Add bpf_mptcp_sched_kfunc_set"
- de64a137c29f: tg:msg: update after the recent squash-to patch
- 0642c8af7143: conflict in t/bpf-Export-more-bpf_burst-related-functions
- Results: 88082befad3d..f28cd69d6233 (export)
Tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20230817T085246
(...)
> diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
> index 4911293919c2..92cf6fbf8275 100644
> --- a/net/mptcp/bpf.c
> +++ b/net/mptcp/bpf.c
> @@ -144,24 +144,6 @@ struct bpf_struct_ops bpf_mptcp_sched_ops = {
> .init = bpf_mptcp_sched_init,
> .name = "mptcp_sched_ops",
> };
> -
> -BTF_SET8_START(bpf_mptcp_sched_kfunc_ids)
> -BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
> -BTF_ID_FLAGS(func, mptcp_sched_data_set_contexts)
> -BTF_ID_FLAGS(func, mptcp_subflow_ctx_by_pos)
> -BTF_SET8_END(bpf_mptcp_sched_kfunc_ids)
> -
> -static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = {
> - .owner = THIS_MODULE,
> - .set = &bpf_mptcp_sched_kfunc_ids,
> -};
> -
> -static int __init bpf_mptcp_kfunc_init(void)
> -{
> - return register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
> - &bpf_mptcp_sched_kfunc_set);
> -}
> -late_initcall(bpf_mptcp_kfunc_init);
> #endif /* CONFIG_BPF_JIT */
Do we not need to move this somewhere else?
>
> struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
> @@ -181,8 +163,23 @@ static const struct btf_kfunc_id_set bpf_mptcp_fmodret_set = {
> .set = &bpf_mptcp_fmodret_ids,
> };
>
> +BTF_SET8_START(bpf_mptcp_sched_kfunc_ids)
> +BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
> +BTF_ID_FLAGS(func, mptcp_sched_data_set_contexts)
> +BTF_ID_FLAGS(func, mptcp_subflow_ctx_by_pos)
> +BTF_SET8_END(bpf_mptcp_sched_kfunc_ids)
> +
> +static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = {
> + .owner = THIS_MODULE,
> + .set = &bpf_mptcp_sched_kfunc_ids,
> +};
> +
> static int __init bpf_mptcp_kfunc_init(void)
> {
> - return register_btf_fmodret_id_set(&bpf_mptcp_fmodret_set);
> + int ret;
> +
> + ret = register_btf_fmodret_id_set(&bpf_mptcp_fmodret_set);
> + return ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
> + &bpf_mptcp_sched_kfunc_set);
> }
> late_initcall(bpf_mptcp_kfunc_init);
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
© 2016 - 2026 Red Hat, Inc.