From nobody Sun Mar 22 09:41:17 2026 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DDC0386439 for ; Sat, 14 Mar 2026 20:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773519289; cv=none; b=TZ4iDMhwubkTZn1WtqgHLyZ+iDmeIFNINsspZ13gEshCoWmgxS0D7nAINAa+cCSPVa+mPuLYclHMzbZjdMqPfrybIn3T0HTiJMMIB+b8MpLbUtsKp3+5VAsC48wSPywtMpAhJloOuhLDOszUP1fILl8dTFhYxpPlQAB5HQwiWtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773519289; c=relaxed/simple; bh=Ttxd17H5LIzMMzsw2TR13aHibCW2LBBebxMgXaknmMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iRvHxNJyiBaXBw5L5vCGTRSo+7NXoaLbl/B4dEnY2Z/QiBOveYx/OrX51kiMgZN6znwhQlCFEt2kQRWGr2kIMzlYpaH1BEKIgb40hLLDMAdbzZYj5IfU7maTi/h+xrv2yY1rJGVb5H2g6EOKogifY4YUKZwFh870Hd8b8PQfz0Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GYmglQBk; arc=none smtp.client-ip=209.85.160.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GYmglQBk" Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-40946982a78so1278351fac.2 for ; Sat, 14 Mar 2026 13:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773519286; x=1774124086; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zMcuR3aCCM7PiXgftnIc+4nYAKR8gQqAUuswiZ7+FpY=; b=GYmglQBkG2E1X7kBarsxxIkNHb6EjaPAexNG1J/bbJZ/0cXvJUreZuGHd6Q8gpCRJc THax/x7rWjLdmM93OMlNnpCT6vIx0UK2aWUQwZyYq285oHH2S/GXRP6Hh4G0zUj8G9ZH BaoLhauFbOMn6zIIziSlGKm9KLpd8yMaohK8FEe2mw/u8jtJJw4Nt1/KtZSdbznqP9dO B5/JjRREpPF0nZGjCDEX4bQQ4+i837nS/KDXSE7C+XV6rClkeTa6XyIG4kaKMeWW9HyO 9N9bsmPdqkKZEUXtur5bUZFEyOiLFOcW0S3Bcr6PBYq0+xFor32PLTZXUTlUBFPpmhN4 ZsYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773519286; x=1774124086; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zMcuR3aCCM7PiXgftnIc+4nYAKR8gQqAUuswiZ7+FpY=; b=niP6ifZYNxaciB5wwxd6GZ4m6LyQ8+Bt+UPK4WEzxQDyBlpg3/7uOnTctzCBO0w43V 1CxtNE3c/wUrOvnrVyAj/L7UgLYwYQ7KG78hiZDRtK+5c3/maZs85H2yibioDpqNHSgZ t/N11+cf7sPyNXtsNj9hqHH5j0ihD7Bs2lXP1VR1hhSsqaniuE6YWfZhTaarROeOGiTV jVBZQYgw7qUtJzt4ZAcLYlmkmABpzgCW2qLpOgiQju8RSzioeggPAePJnraHsHTR0+uC X2/LQ99iOQFTHnY6qZwd86TOzVES6eury16cFkpvUVd5qHxO4t8XtSIFYspHNi7bRZ6m cQBw== X-Gm-Message-State: AOJu0YzTgSQAqTgCyBZ7yfCSru462WnY22KjvVk1s/C6IoP1qXx3vZu2 tVzDf1xwh5EM1I6u6jO3u1ZYfKDTrGQMfJKFaii4Pk5zsHFjABZxqFHD X-Gm-Gg: ATEYQzy0OPJBnVEhWEcuevn9MmvwspcZWCVa6AeAcGDS7x252EqJ+LrV6iPIxHjVTeA je6k7lfBGTJMbFCWpRzVw1l4XpZW003BGQ/FM2nunuofFBOWeIWem9NYKLcneDWj0AW8R8BRCa5 YEOTSfwdYw8izZx5ILPq1LqQ6JLf0lfcssrCni0SQSl/G7s1oZyTZITvnd4pubsspyeLwEtWCqv mhekQcyKGFTSqU6WFUIdgAV1OylW+mWQEuOXyZXCONzEnQGN+kNT6tgQFKkxgy/AfAhmE3o8yOa W/OcwZys21caGz45j/N5GgkObLLZ9P9UmRJ7fYDCzbUI8LukwEenCzFjW5agPfkzbLshcpA7v65 w7mtcJBgTAKAKOwpk2HYgeTcqn886GryQ6IpcY3EaL0YKC7WEQYQC7lR7bGUCoUysl1ZZiduBNg s+BqD+g0LeOZb5yZPLByygfXJ9Ne9dAWRbERZ4vx7WMV6BEuvlvvigeswYUqqOa1i8t6TUVBTSo YpqkicqPEHa4s7j8Vj/jibHpd82d3rnvRK7c37a X-Received: by 2002:a05:6870:ebc9:b0:404:590:59dc with SMTP id 586e51a60fabf-417b938f328mr3924319fac.33.1773519285922; Sat, 14 Mar 2026 13:14:45 -0700 (PDT) Received: from Atwell-Laptop.. (108-212-132-20.lightspeed.irvnca.sbcglobal.net. [108.212.132.20]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4177e5e8185sm11914165fac.12.2026.03.14.13.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Mar 2026 13:14:45 -0700 (PDT) From: atwellwea@gmail.com To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, ncardwell@google.com Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mptcp@lists.linux.dev, dsahern@kernel.org, horms@kernel.org, kuniyu@google.com, andrew+netdev@lunn.ch, willemdebruijn.kernel@gmail.com, jasowang@redhat.com, skhan@linuxfoundation.org, corbet@lwn.net, matttbe@kernel.org, martineau@kernel.org, geliang@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, 0x7f454c46@gmail.com Subject: [PATCH net-next v2 03/14] tcp: refresh rcv_wnd snapshots at TCP write sites Date: Sat, 14 Mar 2026 14:13:37 -0600 Message-ID: <20260314201348.1786972-4-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260314201348.1786972-1-atwellwea@gmail.com> References: <20260314201348.1786972-1-atwellwea@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Wesley Atwell Refresh the live rwnd snapshot whenever TCP updates tp->rcv_wnd at the normal write sites, including child setup, tcp_select_window(), and the initial connect-time window selection. This keeps the live sender-visible window paired with the scaling basis that was actually advertised. Signed-off-by: Wesley Atwell --- net/ipv4/tcp_minisocks.c | 2 +- net/ipv4/tcp_output.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index d350d794a959..1c02c9cd13fe 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -603,7 +603,7 @@ struct sock *tcp_create_openreq_child(const struct sock= *sk, newtp->rx_opt.sack_ok =3D ireq->sack_ok; newtp->window_clamp =3D req->rsk_window_clamp; newtp->rcv_ssthresh =3D req->rsk_rcv_wnd; - newtp->rcv_wnd =3D req->rsk_rcv_wnd; + tcp_set_rcv_wnd(newtp, req->rsk_rcv_wnd); newtp->rcv_mwnd_seq =3D newtp->rcv_wup + req->rsk_rcv_wnd; newtp->rx_opt.wscale_ok =3D ireq->wscale_ok; if (newtp->rx_opt.wscale_ok) { diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 35c3b0ab5a0c..0b082726d7c4 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -291,7 +291,7 @@ static u16 tcp_select_window(struct sock *sk) */ if (unlikely(inet_csk(sk)->icsk_ack.pending & ICSK_ACK_NOMEM)) { tp->pred_flags =3D 0; - tp->rcv_wnd =3D 0; + tcp_set_rcv_wnd(tp, 0); tp->rcv_wup =3D tp->rcv_nxt; tcp_update_max_rcv_wnd_seq(tp); return 0; @@ -315,7 +315,7 @@ static u16 tcp_select_window(struct sock *sk) } } =20 - tp->rcv_wnd =3D new_win; + tcp_set_rcv_wnd(tp, new_win); tp->rcv_wup =3D tp->rcv_nxt; tcp_update_max_rcv_wnd_seq(tp); =20 @@ -4148,6 +4148,10 @@ static void tcp_connect_init(struct sock *sk) READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_window_scaling), &rcv_wscale, rcv_wnd); + /* tcp_select_initial_window() filled tp->rcv_wnd through its out-param, + * so snapshot the scaling_ratio we will use for that initial rwnd. + */ + tcp_set_rcv_wnd(tp, tp->rcv_wnd); =20 tp->rx_opt.rcv_wscale =3D rcv_wscale; tp->rcv_ssthresh =3D tp->rcv_wnd; --=20 2.43.0