diff mbox series

[mptcp-next,2/2] Squash to "selftests/bpf: Add bpf_burst scheduler & test"

Message ID a1d8abd098a6b68a5c619b8cd7558f963f7d342a.1725546472.git.tanggeliang@kylinos.cn (mailing list archive)
State Superseded, archived
Delegated to: Geliang Tang
Headers show
Series cleanups for bpf schedulers | expand

Checks

Context Check Description
matttbe/build success Build and static analysis OK
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf__only_bpftest_all_ success Success! ✅

Commit Message

Geliang Tang Sept. 5, 2024, 2:28 p.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

Use nr_active variable just like in mptcp_subflow_get_send().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
index 3a673291b4dd..eb21119aa8f7 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
+++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
@@ -74,9 +74,9 @@  static int bpf_burst_get_send(struct mptcp_sock *msk,
 	struct mptcp_subflow_context *subflow;
 	struct sock *sk = (struct sock *)msk;
 	__u32 pace, burst, wmem;
+	int i, nr_active = 0;
 	__u64 linger_time;
 	struct sock *ssk;
-	int i;
 
 	/* pick the subflow with the lower wmem/wspace ratio */
 	for (i = 0; i < SSK_MODE_MAX; ++i) {
@@ -97,6 +97,7 @@  static int bpf_burst_get_send(struct mptcp_sock *msk,
 		if (!mptcp_subflow_active(subflow))
 			continue;
 
+		nr_active += !backup;
 		pace = subflow->avg_pacing_rate;
 		if (!pace) {
 			/* init pacing rate from socket */
@@ -115,7 +116,7 @@  static int bpf_burst_get_send(struct mptcp_sock *msk,
 	mptcp_set_timeout(sk);
 
 	/* pick the best backup if no other subflow is active */
-	if (send_info[SSK_MODE_ACTIVE].subflow_id == MPTCP_SUBFLOWS_MAX)
+	if (!nr_active)
 		send_info[SSK_MODE_ACTIVE].subflow_id = send_info[SSK_MODE_BACKUP].subflow_id;
 
 	subflow = bpf_mptcp_subflow_ctx_by_pos(data, send_info[SSK_MODE_ACTIVE].subflow_id);