[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220213040545.365600-1-tilan7663@gmail.com>
Date: Sat, 12 Feb 2022 23:05:45 -0500
From: Tian Lan <tilan7663@...il.com>
To: edumazet@...gle.com, netdev@...r.kernel.org
Cc: Andrew.Chester@...sigma.com, Tian Lan <Tian.Lan@...sigma.com>
Subject: [PATCH] tcp: allow the initial receive window to be greater than 64KiB
From: Tian Lan <Tian.Lan@...sigma.com>
Commit 13d3b1ebe287 ("bpf: Support for setting initial receive window")
introduced a BPF_SOCK_OPS option which allows setting a larger value
for the initial advertised receive window up to the receive buffer space
for both active and passive TCP connections.
However, the commit a337531b942b ("tcp: up initial rmem to 128KB and SYN
rwin to around 64KB") would limit the initial receive window to be at most
64KiB which partially negates the change made previously.
With this patch, the initial receive window will be set to the
min(64KiB, space) if there is no init_rcv_wnd provided. Else set the
initial receive window to be the min(init_rcv_wnd * mss, space).
Signed-off-by: Tian Lan <Tian.Lan@...sigma.com>
---
net/ipv4/tcp_output.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 5079832af5c1..6fc17efbe70f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -229,13 +229,14 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,
* which we interpret as a sign the remote TCP is not
* misinterpreting the window field as a signed quantity.
*/
- if (sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows)
- (*rcv_wnd) = min(space, MAX_TCP_WINDOW);
- else
- (*rcv_wnd) = min_t(u32, space, U16_MAX);
-
- if (init_rcv_wnd)
- *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
+ if (sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows) {
+ *rcv_wnd = min(space, MAX_TCP_WINDOW);
+ if (init_rcv_wnd)
+ *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
+ } else {
+ *rcv_wnd = (init_rcv_wnd ? init_rcv_wnd * mss : U16_MAX);
+ *rcv_wnd = min_t(u32, *rcv_wnd, space);
+ }
*rcv_wscale = 0;
if (wscale_ok) {
--
2.25.1
Powered by blists - more mailing lists