public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] mptcp: misc. cleanups
@ 2024-06-05  7:15 Matthieu Baerts (NGI0)
  2024-06-05  7:15 ` [PATCH net-next 1/3] mptcp: use mptcp_win_from_space helper Matthieu Baerts (NGI0)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-06-05  7:15 UTC (permalink / raw)
  To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Matthieu Baerts (NGI0), Geliang Tang,
	Davide Caratti

Here is a small collection of miscellaneous cleanups:

- Patch 1 uses an MPTCP helper, instead of a TCP one, to do the same
  thing.

- Patch 2 adds a similar MPTCP helper, instead of using a TCP one
  directly.

- Patch 3 uses more appropriated terms in comments.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Davide Caratti (1):
      mptcp: refer to 'MPTCP' socket in comments

Geliang Tang (2):
      mptcp: use mptcp_win_from_space helper
      mptcp: add mptcp_space_from_win helper

 net/mptcp/protocol.c | 8 ++++----
 net/mptcp/protocol.h | 5 +++++
 net/mptcp/sockopt.c  | 2 +-
 net/mptcp/subflow.c  | 2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)
---
base-commit: a6ba5125f10bd7307e775e585ad21a8f7eda1b59
change-id: 20240604-upstream-net-next-20240604-misc-cleanup-77d32539c55f

Best regards,
-- 
Matthieu Baerts (NGI0) <matttbe@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/3] mptcp: use mptcp_win_from_space helper
  2024-06-05  7:15 [PATCH net-next 0/3] mptcp: misc. cleanups Matthieu Baerts (NGI0)
@ 2024-06-05  7:15 ` Matthieu Baerts (NGI0)
  2024-06-05  7:15 ` [PATCH net-next 2/3] mptcp: add mptcp_space_from_win helper Matthieu Baerts (NGI0)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-06-05  7:15 UTC (permalink / raw)
  To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Matthieu Baerts (NGI0), Geliang Tang

From: Geliang Tang <tanggeliang@kylinos.cn>

The MPTCP dedicated win_from_space helper mptcp_win_from_space() is defined
in protocol.h, use it in mptcp_rcv_space_adjust() instead of using the TCP
one. Here scaling_ratio is the same as msk->scaling_ratio.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 7d44196ec5b6..546c80c6702a 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2046,7 +2046,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 		if (rcvbuf > sk->sk_rcvbuf) {
 			u32 window_clamp;
 
-			window_clamp = __tcp_win_from_space(scaling_ratio, rcvbuf);
+			window_clamp = mptcp_win_from_space(sk, rcvbuf);
 			WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
 
 			/* Make subflows follow along.  If we do not do this, we

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/3] mptcp: add mptcp_space_from_win helper
  2024-06-05  7:15 [PATCH net-next 0/3] mptcp: misc. cleanups Matthieu Baerts (NGI0)
  2024-06-05  7:15 ` [PATCH net-next 1/3] mptcp: use mptcp_win_from_space helper Matthieu Baerts (NGI0)
@ 2024-06-05  7:15 ` Matthieu Baerts (NGI0)
  2024-06-05  7:15 ` [PATCH net-next 3/3] mptcp: refer to 'MPTCP' socket in comments Matthieu Baerts (NGI0)
  2024-06-06 13:20 ` [PATCH net-next 0/3] mptcp: misc. cleanups patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-06-05  7:15 UTC (permalink / raw)
  To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Matthieu Baerts (NGI0), Geliang Tang

From: Geliang Tang <tanggeliang@kylinos.cn>

As a wrapper of __tcp_space_from_win(), this patch adds a MPTCP dedicated
space_from_win helper mptcp_space_from_win() in protocol.h to paired with
mptcp_win_from_space().

Use it instead of __tcp_space_from_win() in both mptcp_rcv_space_adjust()
and mptcp_set_rcvlowat().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/protocol.c | 2 +-
 net/mptcp/protocol.h | 5 +++++
 net/mptcp/sockopt.c  | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 546c80c6702a..7ce11bee3b79 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2040,7 +2040,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 		do_div(grow, msk->rcvq_space.space);
 		rcvwin += (grow << 1);
 
-		rcvbuf = min_t(u64, __tcp_space_from_win(scaling_ratio, rcvwin),
+		rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin),
 			       READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
 
 		if (rcvbuf > sk->sk_rcvbuf) {
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 7aa47e2dd52b..b11a4e50d52b 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -386,6 +386,11 @@ static inline int mptcp_win_from_space(const struct sock *sk, int space)
 	return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space);
 }
 
+static inline int mptcp_space_from_win(const struct sock *sk, int win)
+{
+	return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win);
+}
+
 static inline int __mptcp_space(const struct sock *sk)
 {
 	return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - __mptcp_rmem(sk));
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index f9a4fb17b5b7..2026a9a36f80 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -1579,7 +1579,7 @@ int mptcp_set_rcvlowat(struct sock *sk, int val)
 	if (sk->sk_userlocks & SOCK_RCVBUF_LOCK)
 		return 0;
 
-	space = __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, val);
+	space = mptcp_space_from_win(sk, val);
 	if (space <= sk->sk_rcvbuf)
 		return 0;
 

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 3/3] mptcp: refer to 'MPTCP' socket in comments
  2024-06-05  7:15 [PATCH net-next 0/3] mptcp: misc. cleanups Matthieu Baerts (NGI0)
  2024-06-05  7:15 ` [PATCH net-next 1/3] mptcp: use mptcp_win_from_space helper Matthieu Baerts (NGI0)
  2024-06-05  7:15 ` [PATCH net-next 2/3] mptcp: add mptcp_space_from_win helper Matthieu Baerts (NGI0)
@ 2024-06-05  7:15 ` Matthieu Baerts (NGI0)
  2024-06-06 13:20 ` [PATCH net-next 0/3] mptcp: misc. cleanups patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-06-05  7:15 UTC (permalink / raw)
  To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Matthieu Baerts (NGI0), Davide Caratti

From: Davide Caratti <dcaratti@redhat.com>

We used to call it 'master' socket at the early stages of MPTCP
development, but the correct wording is 'MPTCP' socket opposed to 'TCP
subflows': convert the last 3 comments to use a more appropriate term.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/protocol.c | 4 ++--
 net/mptcp/subflow.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 7ce11bee3b79..ead0bf63cf95 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2202,7 +2202,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 		if (skb_queue_empty(&msk->receive_queue) && __mptcp_move_skbs(msk))
 			continue;
 
-		/* only the master socket status is relevant here. The exit
+		/* only the MPTCP socket status is relevant here. The exit
 		 * conditions mirror closely tcp_recvmsg()
 		 */
 		if (copied >= target)
@@ -3521,7 +3521,7 @@ void mptcp_subflow_process_delegated(struct sock *ssk, long status)
 static int mptcp_hash(struct sock *sk)
 {
 	/* should never be called,
-	 * we hash the TCP subflows not the master socket
+	 * we hash the TCP subflows not the MPTCP socket
 	 */
 	WARN_ON_ONCE(1);
 	return 0;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 612c38570a64..39e2cbdf3801 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1719,7 +1719,7 @@ int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
 	mptcp_sockopt_sync_locked(mptcp_sk(sk), sf->sk);
 	release_sock(sf->sk);
 
-	/* the newly created socket really belongs to the owning MPTCP master
+	/* the newly created socket really belongs to the owning MPTCP
 	 * socket, even if for additional subflows the allocation is performed
 	 * by a kernel workqueue. Adjust inode references, so that the
 	 * procfs/diag interfaces really show this one belonging to the correct

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/3] mptcp: misc. cleanups
  2024-06-05  7:15 [PATCH net-next 0/3] mptcp: misc. cleanups Matthieu Baerts (NGI0)
                   ` (2 preceding siblings ...)
  2024-06-05  7:15 ` [PATCH net-next 3/3] mptcp: refer to 'MPTCP' socket in comments Matthieu Baerts (NGI0)
@ 2024-06-06 13:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-06 13:20 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: mptcp, martineau, geliang, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, tanggeliang, dcaratti

Hello:

This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 05 Jun 2024 09:15:39 +0200 you wrote:
> Here is a small collection of miscellaneous cleanups:
> 
> - Patch 1 uses an MPTCP helper, instead of a TCP one, to do the same
>   thing.
> 
> - Patch 2 adds a similar MPTCP helper, instead of using a TCP one
>   directly.
> 
> [...]

Here is the summary with links:
  - [net-next,1/3] mptcp: use mptcp_win_from_space helper
    https://git.kernel.org/netdev/net-next/c/5f0d0649c83f
  - [net-next,2/3] mptcp: add mptcp_space_from_win helper
    https://git.kernel.org/netdev/net-next/c/5cdedad62eab
  - [net-next,3/3] mptcp: refer to 'MPTCP' socket in comments
    https://git.kernel.org/netdev/net-next/c/92f74c1e05b0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-06 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05  7:15 [PATCH net-next 0/3] mptcp: misc. cleanups Matthieu Baerts (NGI0)
2024-06-05  7:15 ` [PATCH net-next 1/3] mptcp: use mptcp_win_from_space helper Matthieu Baerts (NGI0)
2024-06-05  7:15 ` [PATCH net-next 2/3] mptcp: add mptcp_space_from_win helper Matthieu Baerts (NGI0)
2024-06-05  7:15 ` [PATCH net-next 3/3] mptcp: refer to 'MPTCP' socket in comments Matthieu Baerts (NGI0)
2024-06-06 13:20 ` [PATCH net-next 0/3] mptcp: misc. cleanups patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox