From patchwork Thu Oct 24 10:22:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13848723 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0A3C3399F for ; Thu, 24 Oct 2024 10:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729765368; cv=none; b=DJzeS4KUdgwRbZcqTBVlE1sihQYbpwLltYYETIIumWsYgC7nlSKZ/jXeTNYKPcOjymF5fWMZRqv88FAxfH/oInTeds6FYAqsvu+yAqZRCuxo67phqxzmg2WBY3WzZ2nJWwAh0cqXHs2BvUlfZmiDCJ+CEehdLv/w9pdNbfL0q20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729765368; c=relaxed/simple; bh=NbnOHO+BntEtJFgdsQz2dac8wIePPluLxW1MSut+Vpo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SvYWAPKdybbvdMUFztePJLAs99yVD4UZxWMdHcWhttmUYauIymW0D6rUU+9wMm78y6NNNTaX+C40VhKl0U59ubVtJptHo3mBO3GaashBBtwsC2uOrBhSI+pnmsmsV1c3REmBmNxz2/N0bDK4ZyY2bu3XvjkVz7QZNuahzMu3T/Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LgicaJBG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LgicaJBG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27146C4CECC; Thu, 24 Oct 2024 10:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729765368; bh=NbnOHO+BntEtJFgdsQz2dac8wIePPluLxW1MSut+Vpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LgicaJBGnQ8qeyxAle7IkreGqW8src9zAXMgr/a7VQBEqyWkrYxKd5AmgeaRj5oLM bu3EMY7P19wprJ+ZdIEkuhi4GIzUk4MyFSJyAKpEJB0f/NEfZAnuqhLGgvodBoAsv7 ljRAdqleBB5hB8fXq6fSxpzvHzJGWaenDqPHNsZFoEErWbMzBN5u2Jz5bdcM+1h3eV rlZdK3lYLY9wDLiZtNerXHpsnVk2z206P0xG8WaYcPW9lR2JsT1Io7W3whjGtBMX1h UTN3Av0JHzPQOwxPEeX+F2CQGYyiUK0ZR4tLkXP9eP2/JoUvPU5LE+Li0Tkw1RTNB/ +wbb8CWSW7DTQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 1/3] Squash to "mptcp: check sk_stream_memory_free in loop" Date: Thu, 24 Oct 2024 18:22:02 +0800 Message-ID: <664f278b99385aa3d539d07e1a16ef2598a800de.1729765157.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Fix mptcp_join.sh (22) and packetdrill errors reported by CI. Move sk_stream_memory_free check before "send_info[backup].ssk = ssk". Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f36e63b84b88..2ae9b8012dcd 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1444,8 +1444,7 @@ 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) || - !sk_stream_memory_free(ssk)) + if (!mptcp_subflow_active(subflow)) continue; tout = max(tout, mptcp_timeout_from_subflow(subflow)); @@ -1461,6 +1460,8 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); if (linger_time < send_info[backup].linger_time) { + if (!sk_stream_memory_free(ssk)) + continue; send_info[backup].ssk = ssk; send_info[backup].linger_time = linger_time; } From patchwork Thu Oct 24 10:22:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13848724 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BA7F3399F for ; Thu, 24 Oct 2024 10:22:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729765370; cv=none; b=gl+Cpm7yuKYt2ekbniyK/mo7kpgXRTZXjOBbfQtYPoCxN3T6TZaRWbsfWUZXjtY0FHGnDNz5GDrZTyITETIBUxmJp0+Jm4uMXL1ihXUG6oSH3fB0ZEdHRsY+i5uDTdkMIVcXfMSHbNzOewaZeL64Hfk0BeMrC3wToQKn6BocL7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729765370; c=relaxed/simple; bh=VT43MGQuTuntnrzOsd2zKMJLJlTGKEs3kCyDsZa1odY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UZ8fnUBsK0y3BKHnf6W7FB2DzGufu89qTI4mJkoJilwFhtRchqbrbHiNZDcOHBlNL264ZQd8hLE6b2P6tmhwkUcMRBB3OdDXRAq3blsfcpn14l5erADwdq9yzSXmnKH81a4L6rR4xQ9ciOdjZcT/gbv/J9dyg+kr1VeapAMkpL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mu/NvehG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mu/NvehG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 013F5C4CEE7; Thu, 24 Oct 2024 10:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729765370; bh=VT43MGQuTuntnrzOsd2zKMJLJlTGKEs3kCyDsZa1odY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mu/NvehGExxDBw3aynDIcL1SH2GlJB+ap8mXrCBsW7xl7uZ5/CRoe46SzA9C/gFNS v0zVR1ScnlxfZ4rPKsEdWtzZLX3xlVoWZDaRS13YvZw22NE/n6T2mDMv0rpfqGEO1T d9NRJM3NFDNS3EsFE3Rqjk1wh7HCzXPSy4MhhdajH4ZgxZRupt4A3iE7G8Ya5Uap/y mNGA/W3JSOEhb/sjPIrCyrk3JU2/Hu+gwULqykDOcmz8RStz0r4WBAungM9/idXgKi 1DEMLH3r5qmEwnHOcgmymU8IFIvfd0oR8WDb7aLlin8jlHi6MeucJTMY1PI84bfbe0 7MRv1xEMS9B8g== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 2/3] Squash to "bpf: Export mptcp packet scheduler helpers" Date: Thu, 24 Oct 2024 18:22:03 +0800 Message-ID: <02394532426ceb8b5d9baa3d6ed25c1dfe60208c.1729765157.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Should use mptcp_stream_memory_free in burst scheduler, not tcp_stream_memory_free. Add a wrapper for it. Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 13bdcbe34e1f..72d8be2f3853 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -284,6 +284,11 @@ __bpf_kfunc static void bpf_mptcp_sock_release(struct mptcp_sock *msk) WARN_ON_ONCE(!sk || !refcount_dec_not_one(&sk->sk_refcnt)); } +__bpf_kfunc bool bpf_mptcp_stream_memory_free(const struct sock *sk, int wake) +{ + return mptcp_stream_memory_free(sk, wake); +} + __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk) { return tcp_rtx_queue_empty(sk); @@ -311,7 +316,7 @@ BTF_KFUNCS_START(bpf_mptcp_sched_kfunc_ids) BTF_ID_FLAGS(func, mptcp_subflow_active) BTF_ID_FLAGS(func, mptcp_set_timeout) BTF_ID_FLAGS(func, mptcp_wnd_end) -BTF_ID_FLAGS(func, tcp_stream_memory_free) +BTF_ID_FLAGS(func, bpf_mptcp_stream_memory_free) BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale) BTF_KFUNCS_END(bpf_mptcp_sched_kfunc_ids) From patchwork Thu Oct 24 10:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13848725 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 266D13399F for ; Thu, 24 Oct 2024 10:22:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729765372; cv=none; b=aqZSl5YeRb+nc/y1A4qbBsRvAuGL4ZGenLmdRhXz+k+fd+76enn4kUA/5m16kM7ZmUUgmZhYETk3YbU+2oz8rf4QP5IPjsvzX68UKKVcTi8zty/bYrz2EEMyQjXxf2Km6YFbfhXj1NAncnE9feRGlRTC2BMZgweROTJEg7QKVyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729765372; c=relaxed/simple; bh=w6pzZgUEQKDHCrJ5SZzqhNjOmGuJ5Vq13ySobUnLoqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bC1ZCkz6MWO7thdIT4KSaqptucK/TSnaoenz1OFgfvDyIhwtJTsvUCMJW0obxm5IR7YSGfLwRSTGi+FqRdqwi4kJe2tGzZ+4HfuEKb4kZvCMIDkL+k6oLKWTcC1LKeccYvvsuUqIMmVV8rRplGBKbYb5bns/BUw6WeoQpwrCxS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LZZ+HzuI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LZZ+HzuI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9D3C4CEC7; Thu, 24 Oct 2024 10:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729765372; bh=w6pzZgUEQKDHCrJ5SZzqhNjOmGuJ5Vq13ySobUnLoqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZZ+HzuIUugPmHiRQLlIo7lUrH/VjikOLP81y3mc1uK4mPQfo7W/0eQrVmvmQteKX Z7O6cCYk5TqSSICJB0U1ptJYxgXuJO6+pbUftDvlG6fjYfwhOCcDZxfimztLP9yy3i 9SQtO9dLWd9aWAZm+35t9sEZOzlp6s+xgWIim7UFnPQfCoeB//4INo7B76LXSCNAwZ z2ETu8nNhmT0/iJiOLBL3EMJFDNJu/Iuu61I04UaLYpLe/6ZEEL5HzEzSF22ggtrFt UD9iJ7H3bzCJuM1tJJXKAF3T9LIVfVa9xOX1CxvcSiluYS5UxKamkptxu6/dE/q2I0 d21MtXgHse0Jw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 3/3] Squash to "selftests/bpf: Add bpf_burst scheduler & test" Date: Thu, 24 Oct 2024 18:22:04 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang 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 --- tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; }