Skip to contentSkip to conversation

Squash to "selftests/bpf: Add bpf_rr scheduler"

PATCH In review Geliang Tang 2 participants 3 messages Oct 9, 2022 – Oct 10, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Squash to "selftests/bpf: Add bpf_rr scheduler"

Use last_snd instead of msk->last_snd, then last_snd of mptcp_sock could be removed.

---
 tools/testing/selftests/bpf/bpf_tcp_helpers.h    | 1 -
 tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c | 7 +++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/bpf_tcp_helpers.h +0 -1
index c7d4a9a69cfc..c8792e6f125a 100644
@@ -257,7 +257,6 @@ struct mptcp_sched_ops {
 struct mptcp_sock {
 	struct inet_connection_sock	sk;
 
-	struct sock	*last_snd;
 	__u32		token;
 	struct sock	*first;
 	char		ca_name[TCP_CA_NAME_MAX];
tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +5 -2
index ce4e98f83e43..65d4f7f41bc2 100644
@@ -5,10 +5,12 @@
 #include "bpf_tcp_helpers.h"
 
 char _license[] SEC("license") = "GPL";
+struct sock *last_snd = NULL;
 
 SEC("struct_ops/mptcp_sched_rr_init")
 void BPF_PROG(mptcp_sched_rr_init, const struct mptcp_sock *msk)
 {
+	last_snd = msk->first;
 }
 
 SEC("struct_ops/mptcp_sched_rr_release")
@@ -22,10 +24,10 @@ void BPF_STRUCT_OPS(bpf_rr_get_subflow, const struct mptcp_sock *msk,
 	int nr = 0;
 
 	for (int i = 0; i < MPTCP_SUBFLOWS_MAX; i++) {
-		if (!msk->last_snd || !data->contexts[i])
+		if (!last_snd || !data->contexts[i])
 			break;
 
-		if (data->contexts[i]->tcp_sock == msk->last_snd) {
+		if (data->contexts[i]->tcp_sock == last_snd) {
 			if (i + 1 == MPTCP_SUBFLOWS_MAX || !data->contexts[i + 1])
 				break;
 
@@ -35,6 +37,7 @@ void BPF_STRUCT_OPS(bpf_rr_get_subflow, const struct mptcp_sock *msk,
 	}
 
 	mptcp_subflow_set_scheduled(data->contexts[nr], true);
+	last_snd = data->contexts[nr]->tcp_sock;
 }
 
 SEC(".struct_ops")
Signature · 1 line
2.35.3
#1 lore raw

Re: Squash to "selftests/bpf: Add bpf_rr scheduler": Tests Results

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
- Success! ✅:
- Task: https://cirrus-ci.com/task/6426348104187904
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6426348104187904/summary/summary.txt

- KVM Validation: debug:
- Success! ✅:
- Task: https://cirrus-ci.com/task/5018973220634624
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5018973220634624/summary/summary.txt

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

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)

#2 lore raw
In reply to Geliang Tang
Quoted 26 lines · Geliang Tang

Use last_snd instead of msk->last_snd, then last_snd of mptcp_sock could be removed.

---
 tools/testing/selftests/bpf/bpf_tcp_helpers.h    | 1 -
 tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c | 7 +++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/bpf_tcp_helpers.h +0 -1
index c7d4a9a69cfc..c8792e6f125a 100644
@@ -257,7 +257,6 @@ struct mptcp_sched_ops {
 struct mptcp_sock {
 	struct inet_connection_sock	sk;
 
-	struct sock	*last_snd;
 	__u32		token;
 	struct sock	*first;
 	char		ca_name[TCP_CA_NAME_MAX];
tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +0 -0
index ce4e98f83e43..65d4f7f41bc2 100644

tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c line 13

Quoted 9 lines
tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +2 -0
@@ -5,10 +5,12 @@
 #include "bpf_tcp_helpers.h"
 
 char _license[] SEC("license") = "GPL";
+struct sock *last_snd = NULL;
 
 SEC("struct_ops/mptcp_sched_rr_init")
 void BPF_PROG(mptcp_sched_rr_init, const struct mptcp_sock *msk)
 {
+	last_snd = msk->first;

This line should be dropped. Will update in v6.

-Geliang

Quoted 27 lines
tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +3 -2
 }
 
 SEC("struct_ops/mptcp_sched_rr_release")
@@ -22,10 +24,10 @@ void BPF_STRUCT_OPS(bpf_rr_get_subflow, const struct mptcp_sock *msk,
 	int nr = 0;
 
 	for (int i = 0; i < MPTCP_SUBFLOWS_MAX; i++) {
-		if (!msk->last_snd || !data->contexts[i])
+		if (!last_snd || !data->contexts[i])
 			break;
 
-		if (data->contexts[i]->tcp_sock == msk->last_snd) {
+		if (data->contexts[i]->tcp_sock == last_snd) {
 			if (i + 1 == MPTCP_SUBFLOWS_MAX || !data->contexts[i + 1])
 				break;
 
@@ -35,6 +37,7 @@ void BPF_STRUCT_OPS(bpf_rr_get_subflow, const struct mptcp_sock *msk,
 	}
 
 	mptcp_subflow_set_scheduled(data->contexts[nr], true);
+	last_snd = data->contexts[nr]->tcp_sock;
 }
 
 SEC(".struct_ops")
Signature · 1 line
2.35.3