diff mbox series

[mptcp-next,v2,1/2] tcp: define initial scaling factor value as a macro

Message ID c71297499300a20bc41fe9c526d4a6cad08c176f.1696237983.git.pabeni@redhat.com (mailing list archive)
State Accepted, archived
Commit 3a6e7c602676fe1ddb6b965c9d2a51fa5fa0d5ef
Delegated to: Matthieu Baerts
Headers show
Series [mptcp-next,v2,1/2] tcp: define initial scaling factor value as a macro | expand

Commit Message

Paolo Abeni Oct. 2, 2023, 9:13 a.m. UTC
So that other users could access it. Notably MPTCP will use
it in the next patch.

No functional change intended.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 include/net/tcp.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Matthieu Baerts Oct. 3, 2023, 4:45 p.m. UTC | #1
Hi Paolo,

On 02/10/2023 11:13, Paolo Abeni wrote:
> So that other users could access it. Notably MPTCP will use
> it in the next patch.
> 
> No functional change intended.

Thank you for the new version, it looks good to me!

Acked-by: Matthieu Baerts <matttbe@kernel.org>

Cheers,
Matt
diff mbox series

Patch

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 91688d0dadcd..8b0364b44dd9 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1453,13 +1453,15 @@  static inline int tcp_space_from_win(const struct sock *sk, int win)
 	return __tcp_space_from_win(tcp_sk(sk)->scaling_ratio, win);
 }
 
+/* Assume a conservative default of 1200 bytes of payload per 4K page.
+ * This may be adjusted later in tcp_measure_rcv_mss().
+ */
+#define TCP_DEFAULT_SCALING_RATIO ((1200 << TCP_RMEM_TO_WIN_SCALE) / \
+				   SKB_TRUESIZE(4096))
+
 static inline void tcp_scaling_ratio_init(struct sock *sk)
 {
-	/* Assume a conservative default of 1200 bytes of payload per 4K page.
-	 * This may be adjusted later in tcp_measure_rcv_mss().
-	 */
-	tcp_sk(sk)->scaling_ratio = (1200 << TCP_RMEM_TO_WIN_SCALE) /
-				    SKB_TRUESIZE(4096);
+	tcp_sk(sk)->scaling_ratio = TCP_DEFAULT_SCALING_RATIO;
 }
 
 /* Note: caller must be prepared to deal with negative returns */