diff mbox series

[mptcp-next,v8,01/13] mptcp: check sk_stream_memory_free in loop

Message ID 0c7d7cc7882ed66112656bca6031e6436ddbf250.1729676320.git.tanggeliang@kylinos.cn (mailing list archive)
State Superseded, archived
Headers show
Series use bpf_iter in bpf schedulers | expand

Checks

Context Check Description
matttbe/KVM_Validation__normal warning Unstable: 1 failed test(s): selftest_mptcp_join
matttbe/KVM_Validation__debug warning Unstable: 2 failed test(s): packetdrill_regressions selftest_mptcp_join
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ success Success! ✅
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ success Success! ✅
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/build success Build and static analysis OK

Commit Message

Geliang Tang Oct. 23, 2024, 9:40 a.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

In order to make it easier to implement similar logic to the burst
scheduler in BPF program, the sk_stream_memory_free() check is moved
forward into mptcp_for_each_subflow loop.

Assignment like "ssk = send_info[SSK_MODE_ACTIVE].ssk" is not allowed
in BPF, so bpf_core_cast() is used to cast it. But a casted pointer can't
pass to a kfunc (sk_stream_memory_free). To solve this, In BPF burst
scheduler sk_stream_memory_free check is moved forward to the position
of mptcp_subflow_active() in bpf_for_each() loop.

To keep mptcp_subflow_get_send() and BPF burst scheduler code consistent,
this patch also synchronizes the change in BPF burst scheduler into
mptcp_subflow_get_send().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/protocol.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 21bc3586c33e..f36e63b84b88 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1444,7 +1444,8 @@  struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
 
 		trace_mptcp_subflow_get_send(subflow);
 		ssk =  mptcp_subflow_tcp_sock(subflow);
-		if (!mptcp_subflow_active(subflow))
+		if (!mptcp_subflow_active(subflow) ||
+		    !sk_stream_memory_free(ssk))
 			continue;
 
 		tout = max(tout, mptcp_timeout_from_subflow(subflow));
@@ -1482,7 +1483,7 @@  struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
 	 * to check that subflow has a non empty cwin.
 	 */
 	ssk = send_info[SSK_MODE_ACTIVE].ssk;
-	if (!ssk || !sk_stream_memory_free(ssk))
+	if (!ssk)
 		return NULL;
 
 	burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt);