diff mbox series

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

Message ID f7cc83a335efc23ca65b825062c804914c9227db.1729765157.git.tanggeliang@kylinos.cn (mailing list archive)
State Superseded, archived
Headers show
Series Fixes for "use bpf_iter in bpf schedulers" v8 | expand

Checks

Context Check Description
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 33 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/build warning Build error with: make C=1 net/mptcp/bpf.o

Commit Message

Geliang Tang Oct. 24, 2024, 10:22 a.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

Move sk_stream_memory_free check before "send_info[backup].subflow
= subflow".

Use mptcp_stream_memory_free instead of using tcp_stream_memory_free.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 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 6242430d0330..1157921d2f0b 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
+++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
@@ -23,7 +23,7 @@  struct bpf_subflow_send_info {
 extern bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) __ksym;
 extern void mptcp_set_timeout(struct sock *sk) __ksym;
 extern __u64 mptcp_wnd_end(const struct mptcp_sock *msk) __ksym;
-extern bool tcp_stream_memory_free(const struct sock *sk, int wake) __ksym;
+extern bool bpf_mptcp_stream_memory_free(const struct sock *sk, int wake) __ksym;
 extern bool bpf_mptcp_subflow_queues_empty(struct sock *sk) __ksym;
 extern void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) __ksym;
 
@@ -49,7 +49,7 @@  static __always_inline bool __sk_stream_memory_free(const struct sock *sk, int w
 	if (sk->sk_wmem_queued >= sk->sk_sndbuf)
 		return false;
 
-	return tcp_stream_memory_free(sk, wake);
+	return bpf_mptcp_stream_memory_free(sk, wake);
 }
 
 static __always_inline bool sk_stream_memory_free(const struct sock *sk)
@@ -87,8 +87,7 @@  static int bpf_burst_get_send(struct mptcp_sock *msk)
 		bool backup = subflow->backup || subflow->request_bkup;
 
 		ssk = mptcp_subflow_tcp_sock(subflow);
-		if (!mptcp_subflow_active(subflow) ||
-		    !sk_stream_memory_free(ssk))
+		if (!mptcp_subflow_active(subflow))
 			continue;
 
 		nr_active += !backup;
@@ -103,6 +102,8 @@  static int bpf_burst_get_send(struct mptcp_sock *msk)
 
 		linger_time = div_u64((__u64)ssk->sk_wmem_queued << 32, pace);
 		if (linger_time < send_info[backup].linger_time) {
+			if (!sk_stream_memory_free(ssk))
+				continue;
 			send_info[backup].subflow = subflow;
 			send_info[backup].linger_time = linger_time;
 		}