Skip to contentSkip to conversation

BPF packet scheduler updates part 3

PATCH Superseded Geliang Tang 2 participants 7 messages Jul 31, 2023

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover BPF packet scheduler updates part 3

Some cleanups.

Geliang Tang (4):
Squash to "mptcp: add sched_data helpers" Squash to "bpf: Add bpf_mptcp_sched_kfunc_set" Squash to "selftests/bpf: add two mptcp netns helpers" Squash to "bpf: Export more bpf_burst related functions"

 net/mptcp/bpf.c                                | 10 ++++++++--
 net/mptcp/protocol.h                           |  6 ------
 net/mptcp/sched.c                              |  6 ++++++
 tools/testing/selftests/bpf/prog_tests/mptcp.c |  1 -
 4 files changed, 14 insertions(+), 9 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/4 Squash to "mptcp: add sched_data helpers"

Add "ignore -Wmissing-prototypes".

---
 net/mptcp/protocol.h | 4 ----
 net/mptcp/sched.c    | 6 ++++++
 2 files changed, 6 insertions(+), 4 deletions(-)
net/mptcp/protocol.h +0 -4
index 915d1fbd554b..bb7215c6b8cb 100644
@@ -672,10 +672,6 @@ int mptcp_init_sched(struct mptcp_sock *msk,
 void mptcp_release_sched(struct mptcp_sock *msk);
 void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
 				 bool scheduled);
-void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,
-				   struct mptcp_sched_data *data);
-struct mptcp_subflow_context *
-mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos);
 struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk);
 struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk);
 int mptcp_sched_get_send(struct mptcp_sock *msk);
net/mptcp/sched.c +6 -0
index a80cf0481edf..5d78efc9c96c 100644
@@ -127,6 +127,10 @@ void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
 	WRITE_ONCE(subflow->scheduled, scheduled);
 }
 
+__diag_push();
+__diag_ignore_all("-Wmissing-prototypes",
+		  "kfuncs which will be used in BPF programs");
+
 void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,
 				   struct mptcp_sched_data *data)
 {
@@ -155,6 +159,8 @@ mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos)
 	return data->contexts[pos];
 }
 
+__diag_pop();
+
 int mptcp_sched_get_send(struct mptcp_sock *msk)
 {
 	struct mptcp_subflow_context *subflow;
Signature · 1 line
2.35.3
#2 lore raw

PATCH 2/4 Squash to "bpf: Add bpf_mptcp_sched_kfunc_set"

In reply to Geliang Tang

Rename bpf_mptcp_sched_kfunc_init to bpf_mptcp_kfunc_init. Since some kfuncs related "mptcpify" will init in this function too.

---
 net/mptcp/bpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/bpf.c +2 -2
index 0cb25ae3ee30..c33b5c7b1649 100644
@@ -171,12 +171,12 @@ static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = {
 	.set	= &bpf_mptcp_sched_kfunc_ids,
 };
 
-static int __init bpf_mptcp_sched_kfunc_init(void)
+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_sched_kfunc_init);
+late_initcall(bpf_mptcp_kfunc_init);
 #endif /* CONFIG_BPF_JIT */
 
 struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
Signature · 1 line
2.35.3
#3 lore raw

PATCH 3/4 Squash to "selftests/bpf: add two mptcp netns helpers"

In reply to Geliang Tang

Just drop a black line.

---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 1 -
 1 file changed, 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/mptcp.c +0 -1
index ad6b5e889d9d..09770aa31f4a 100644
@@ -198,7 +198,6 @@ static void test_base(void)
 
 fail:
 	cleanup_netns(nstoken);
-
 	close(cgroup_fd);
 }
 
Signature · 1 line
2.35.3
#4 lore raw

PATCH 4/4 Squash to "bpf: Export more bpf_burst related functions"

In reply to Geliang Tang

Add "ignore -Wmissing-prototypes".

---
 net/mptcp/bpf.c      | 6 ++++++
 net/mptcp/protocol.h | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)
net/mptcp/bpf.c +6 -0
index c33b5c7b1649..51634efe4741 100644
@@ -144,6 +144,10 @@ struct bpf_struct_ops bpf_mptcp_sched_ops = {
 	.name		= "mptcp_sched_ops",
 };
 
+__diag_push();
+__diag_ignore_all("-Wmissing-prototypes",
+		  "kfuncs which will be used in BPF programs");
+
 bool bpf_mptcp_subflow_memory_free(const struct sock *sk)
 {
 	return sk_stream_memory_free(sk);
@@ -154,6 +158,8 @@ bool bpf_mptcp_subflow_queues_empty(const struct sock *sk)
 	return tcp_rtx_and_write_queues_empty(sk);
 }
 
+__diag_pop();
+
 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)
net/mptcp/protocol.h +0 -2
index bb7215c6b8cb..a080328a8226 100644
@@ -643,8 +643,6 @@ void mptcp_subflow_queue_clean(struct sock *sk, struct sock *ssk);
 void mptcp_sock_graft(struct sock *sk, struct socket *parent);
 u64 mptcp_wnd_end(const struct mptcp_sock *msk);
 void mptcp_set_timeout(struct sock *sk);
-bool bpf_mptcp_subflow_memory_free(const struct sock *sk);
-bool bpf_mptcp_subflow_queues_empty(const struct sock *sk);
 struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk);
 bool __mptcp_close(struct sock *sk, long timeout);
 void mptcp_cancel_work(struct sock *sk);
Signature · 1 line
2.35.3
#5 lore raw

Re: Squash to "bpf: Export more bpf_burst related functions": Build Failure

Hi Geliang,

Thank you for your modifications, that's great!

But sadly, our CI spotted some issues with it when trying to build it.

You can find more details there:

https://patchwork.kernel.org/project/mptcp/patch/d2bc86f8116310c2f3b2931fc3565ef7cce17027.1690801329.git.geliang.tang@suse.com/
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5714012631

Status: failure
Initiator: MPTCPimporter
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/23c0513506c6

Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one.

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

#6 lore raw

Re: Squash to "bpf: Export more bpf_burst related functions": Tests Results

In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5989050666975232
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5989050666975232/summary/summary.txt

- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5426100713553920
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5426100713553920/summary/summary.txt

- KVM Validation: debug (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4722413271777280
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4722413271777280/summary/summary.txt

- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6552000620396544
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6552000620396544/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/23c0513506c6

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)