From nobody Mon Sep 16 19:22:56 2024 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 DA8604A3F for ; Wed, 10 Jul 2024 13:46:17 +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=1720619177; cv=none; b=Wl4jioIooFsj9SUYVNh95JTTaCDdcY0jPdvrkdpfw+mKhCDUkFiNJorXSGMM86qSwQ+lz+RVKu2bsnXOqr2LSMAp2BN6wDsbZKL/WUs9h16tBZ+RJ4IhW9X8JchA1CH7ZaOGYUS4lKZl9cqBEShgtf64ypTESCRdY/dt/BPCJoY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720619177; c=relaxed/simple; bh=MSC2csZy0yXAx/O598k2XnLt3VLnBrCTVIY25hbcWRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KvIIkcambqNTJyE8gT6bJvLceXqSB6PlTcj64Qdk9QvRa3r+1GhZE1atzAP7Di7IiqbIwZJB0Bj12JWxgWoD8KYQ59O1tV3MuXr3km6yxKH+G0/iZ+nSP9SGNRfsqDknepEZ2dwhxVbxhmfUKFyYcYI6oppwXRALCF1uDWGPGBA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nC9Jqcjp; 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="nC9Jqcjp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C647C4AF07; Wed, 10 Jul 2024 13:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720619177; bh=MSC2csZy0yXAx/O598k2XnLt3VLnBrCTVIY25hbcWRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nC9JqcjpDVLjdaom+j6OHm+RJIfJA7egWWyWyG/b32GigBcG4tRXIloCVvuSxCnrf O2VeFWw9TioE+VQ0WPN8WB+dYianDeOaCrdKLcnC4dH8To6elfUHsdhDzFilNlLP9K Pdy2bTosqt+MhhuIjzchyzIZB/1HCUaN15OsVirjcP7svdqFhtTmO3NtKODFqE3Ot4 1qV8P2/wJO7SIikhHHyo9dp/ik3K8RnauIoNRftcN55gokwq5K5YzLiwcHSijC0DBY 6JknodrE7rEkpJlYTB4rcH9Xyl6u3JclCqQ2DiZSP3kCifJkhADRRckNd+uiMpD8lg PJDxXGJRNJkeg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 1/3] mptcp: add mptcp_snd_nxt helper Date: Wed, 10 Jul 2024 21:46:09 +0800 Message-ID: <53b582fc24af3a387417fce90377b5529b225063.1720618186.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang It's better to get msk->snd_nxt with READ_ONCE() in get_subflow() of the burst scheduler. Similar to mptcp_wnd_end() helper, this patch defines a new helper mptcp_snd_nxt(), and use it in mptcp_subflow_get_send(). It will be used in BPF burst scheduler too, so export it in protocol.h. Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 7 ++++++- net/mptcp/protocol.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index ac94225489f8..6f662e7d6ff9 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -55,6 +55,11 @@ u64 mptcp_wnd_end(const struct mptcp_sock *msk) return READ_ONCE(msk->wnd_end); } =20 +u64 mptcp_snd_nxt(const struct mptcp_sock *msk) +{ + return READ_ONCE(msk->snd_nxt); +} + static const struct proto_ops *mptcp_fallback_tcp_ops(const struct sock *s= k) { #if IS_ENABLED(CONFIG_MPTCP_IPV6) @@ -1465,7 +1470,7 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock= *msk) if (!ssk || !sk_stream_memory_free(ssk)) return NULL; =20 - burst =3D min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd= _nxt); + burst =3D min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - mptcp_sn= d_nxt(msk)); wmem =3D READ_ONCE(ssk->sk_wmem_queued); if (!burst) return ssk; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 19d60b6d5b45..26b010c88773 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -706,6 +706,7 @@ void mptcp_subflow_reset(struct sock *ssk); void mptcp_subflow_queue_clean(struct sock *sk, struct sock *ssk); void mptcp_sock_graft(struct sock *sk, struct socket *parent); u64 mptcp_wnd_end(const struct mptcp_sock *msk); +u64 mptcp_snd_nxt(const struct mptcp_sock *msk); void mptcp_set_timeout(struct sock *sk); bool bpf_mptcp_subflow_queues_empty(struct sock *sk); struct mptcp_subflow_context * --=20 2.43.0 From nobody Mon Sep 16 19:22:56 2024 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 E5F33192B8E for ; Wed, 10 Jul 2024 13:46:18 +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=1720619179; cv=none; b=nZ4OwVGrbeXuMMv0bmBTiKEWuO7mZemAE3bGd86870U+xirlSrsPyv1XH+QwR8KLJPR5orKEGrAyUZGz4nLImP9gqi8boRDfo2o2524FbL6a9sHGLpS+3wBL+qNpaAUWWHn7BpXyEFQ44v8uHNUK8RafWUPxBmZM3NosQQTq+iI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720619179; c=relaxed/simple; bh=O3tR9tbSIsQyfCbf2JpOJstEX6qV40s1stH3vP0N7KM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bOyIgCBgON2RTrqSdVHpiO9u8MmC1gf0My2GbKYBzCiweor+U/WbR9J96HKjnjSP/4RiXe/O3QZKGiqNWyWJWXdaa4Xwl2scNd5ZBx34a3y7LWKgMCRZxqVWa6GXMWF8pE2EkzQdSC6hFeVv9GxQ25pG22a7J4eJsb+NHKcp/Yg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UOqpAJQ2; 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="UOqpAJQ2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6402C32782; Wed, 10 Jul 2024 13:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720619178; bh=O3tR9tbSIsQyfCbf2JpOJstEX6qV40s1stH3vP0N7KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOqpAJQ2cl2fIJZzYQfPbJ2Etr1FqqXYbo4VpVUkhYAV6mhEw+W3KGml0rKMjxe3h GVkFgZjBFZgBAxuY2R+wYnyi5r4QaLiecb4bLC65DuWSw8joMEQ1c3X8DjnZFnMKCq IPboPGHOEb9qOh4aBzL//qyZSW5DTN+zTDa5BayF35mxhjf+gGuQPmvi49ZYWCoAr/ vzus+69Czfadg0uc5tEt/NyQ0d8XPmEd7nu3EVrMfpOLapoxrtkofrGouRcaS6Pkbo LRALANet7I7OveSoWnbabWgzcXxr4twnxFZ5Zh1Wqf7vqO/DKXsgGcxGG8HtXEH3nn g50F4wEluyD+Q== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 2/3] Squash to "bpf: Export more bpf_burst related functions" Date: Wed, 10 Jul 2024 21:46:10 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Allow mptcp_snd_nxt() helper to be accessed in BPF. Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 9672a70c24b0..9c72f080e7ee 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -229,6 +229,7 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx_by_pos) 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, mptcp_snd_nxt) BTF_ID_FLAGS(func, tcp_stream_memory_free) BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale) --=20 2.43.0 From nobody Mon Sep 16 19:22:56 2024 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 6B24C12C491 for ; Wed, 10 Jul 2024 13:46:20 +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=1720619180; cv=none; b=KSlq1LFcV9TAam9MsLuWaiofw62l0kpzirkBqGwrH4yZsf0f8nahBM4RuulCsugdWdO17hM24M+rp3quza8ZW/PtvqoGMSTZvKYJTdIzANL9X+k4aIk2fVZGdbg62E6IzgRrTPX4zVa+Ql/oQdFvwq9z7u8lTUBROjMQFV5celw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720619180; c=relaxed/simple; bh=+wNpVZ//fjsbp+H6wYeowUBjVIXrTK3pBNkIT+DURHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uQzub5xXA06tCfFmk/WrCytgez7D0Z5Cc1xq/cB2osevLTnP/odq+8b/DEatRyOyMkCUgZgvQOWA/g40H7q19+HvpghU5z766ljY269tDTbrwGLWU32daVPPTLqnfZWeU0mcXyjndyAptlDQWCrK4xWrKauA9IP3ktYdo77yRRU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nFEWm/p4; 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="nFEWm/p4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43009C32782; Wed, 10 Jul 2024 13:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720619180; bh=+wNpVZ//fjsbp+H6wYeowUBjVIXrTK3pBNkIT+DURHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFEWm/p4vRlYFSAJRAXclPwWtT+MIegZsVTD9oVFZfg9MP0QzSoGMTEZ3uIvsHz2C XmBmS41wS0Ho8MXi/UZX7qBUw1IDd7/O03soyRE5YRJekdDC2y8hLYGCEQSzcvhaLc /NNiaeMAPKWbjIbnrk3YRqYLbQlCYiKW33c0jbaIGL21So+YOREMls6gGGyUo7pCfJ 5cFJSsxsp8AiyDGttvzzucprq5bgaIk2YwmIhVpiDWn7XT3N186uA11eOnA43sR96m L28lKzTrj4CwzKHCu/zV6vQzEWJraJt0cGAgshyZR4GPxN7gm/zCLOH2DZmOFecVkF 2eqhpjEs56xGQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 3/3] Squash to "selftests/bpf: Add bpf_burst scheduler" Date: Wed, 10 Jul 2024 21:46:11 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Use mptcp_snd_nxt in bpf_burst. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/te= sting/selftests/bpf/progs/mptcp_bpf_burst.c index 0026587a94df..a8506cddcefe 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -19,6 +19,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 __u64 mptcp_snd_nxt(const struct mptcp_sock *msk) __ksym; extern bool tcp_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, struc= t sock *ssk) __ksym; @@ -121,7 +122,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, if (!ssk || !sk_stream_memory_free(ssk)) return -1; =20 - burst =3D min(MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); + burst =3D min(MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - mptcp_snd_nxt(m= sk)); wmem =3D ssk->sk_wmem_queued; if (!burst) goto out; --=20 2.43.0