From nobody Fri Apr 3 02:57:00 2026 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (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 757FB35A38C for ; Tue, 24 Mar 2026 20:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774385592; cv=none; b=HWQZcccLw/xcYae+EE3h1hC2GfU9uLr9JypJwxRVlR2I1Ovdx4whxaAEcxLXOyKnaeri4Zeka9/qvK5Q9NOuwhT4yx4Pk+6cISielxLrDTvQqiLEZ4RjQWme45xZk2I5Z5oW3+b0zC23RrGPnR5xyIN9LjloZMOKXZMEr3ileLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774385592; c=relaxed/simple; bh=MecEpZvlRBPcpBi8sq+iqUvHanol5HuJ9vfTFHwBoEA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hn/Kj41qsornRoo5knQTo7gydjXI6lYdW3mhcT4l/ePDcifYvGkdrRS5nyx+rFSa0rX+7jyv5tHgrw3SxiAR3rVXROPN4U0HVQDAGM0R/6RmDYeh3UgoK84v2ewdkj8P9QgBD216eT5Dlrgu5+YjevB2BHszcYimk7jzUfa6rhU= 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=MeVZW3Pm; arc=none smtp.client-ip=209.85.210.41 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="MeVZW3Pm" Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-7d9bba96f7dso1451052a34.1 for ; Tue, 24 Mar 2026 13:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774385590; x=1774990390; 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=WqQ3x3m7rF+rvEu9cT7z+2urBJztBsKv9f9L3zEtIa4=; b=MeVZW3Pm1xg27UmJWLQUrUnnHTY280fP2MZ6ucy6WffGaQsdsuUKBjIHsMWdvW8Egd ocJGMgPNvbkBAg3/OMnIkQlw0u5uu35My8NmJpo9r+N0Uvnat/tq0eVUbnZ1P4s8zidy 05ufdadx5Z++tn4EolJW6JgD/gWOIDbbWsGgPsy1V3lYgl7E3P0FoWhQQm8BKN9s468Q yAYPSTm6S20hFefnbbI/1R6WJV9USGU9O/1Zgj25KATffuHputrdn148gYWoI7HzgcYn upEGNX6xaXYzvTHQfvRUjrrjXrHYZkZepHfUzxW+btOlwuhz5FRBbugqDO1sredMRgtZ AWbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774385590; x=1774990390; 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=WqQ3x3m7rF+rvEu9cT7z+2urBJztBsKv9f9L3zEtIa4=; b=UkDKu0hO3icXKQVTigU5nkR8b2u+/VBY5zQJ3Nd1ZT6hLKlmOuHhv6mP9R0D/R9gVO MKk0YSfL39/gydNwRG4qUmlrY/yBeN3gc+C6u44Pb1gAt/cMa5o5XUMQRHCcz19n4ECu Xxc0NxTBOlJIDCEfAW0s1CfcErz4TyjNyNj5w2LEx4mM//l5N0eVbarwFvMiJgPdQQx8 v6jaWxx3q2covtTlpnCvHGRqXiCXGg/kmrVSMaWyWpTLqGXRCvqBjsICt5lUXXsdoiVs E6KFOmh/cRLDYNm5jxi0eUbePL9mVc0OixtM3zbwG7MtakQThA5TV2BHSwk56b5Cz5HM 3UCg== X-Forwarded-Encrypted: i=1; AJvYcCVV7vSKoSuFx+f6UaMxU18OU4hHsm7/IPKUwfuD6v170nU8znKGmxjCuRb7Wvnb6P3LgJ/S8W18Q6QFKnk=@vger.kernel.org X-Gm-Message-State: AOJu0Ywv1aTC1vxAihXkeThF0MgWa6ZtO3ruShgO7ggIZcZaqhOTHyHN 97EF0ISvMNKj5IxA7GGrETFs0kgz2h09Eb20+Od2v+rsRG2992TgLCgO X-Gm-Gg: ATEYQzwT766vvvpvTu6eBKjvCaFFXq90L3z8VDiCnP/yMrKqN+WIPKOHuxRFqpayy99 6iFlsqCDp2x/YDaZ5m5hv8HQ6b+Il0PCA/5XD7Cs823meDnfWjqCITPIW+4l1CM0S+4eQ4kqK5g vn2n0yLWiDkTivPPKuMOYcBzmumWG5dhJ07VBtJzKKuCWahZhg8P8Wmbljiosi2cLHigt9TLuAT Y6E4hIS56cwuuHGnWSLq2UiS1YXAwSjN48GaSslMlhSv6QQaiCbgHZplx+2AbO9k0yIoZTU5+Um 0ghgpH76MxrgFI0y1U7BPKOkSFwdPCeyHRpGWTYKYYkQnko8bBR4Zl0wIPdNeqpR0Kqv/Mv+/tf OlhwTBemJQwcD8As43uWe8lvlv0H0OHOOrJusZd+ymDGh8KFS8o5uK+8p5/tFJWA6p3o/7dNH2n o4h2vvE1P1gjfqRKu4MPA7dR0c7X5GcQ9x8hOWIaeYa1Z5cwAa3bH1+ChAJ+KqIKstYULq1mqlY 2wAbHea/ml/36zxIq/PPba965Luk2ku/1Tj4TxgTQ== X-Received: by 2002:a4a:ec4c:0:b0:67c:27a7:8c4d with SMTP id 006d021491bc7-67dff55c413mr774454eaf.48.1774385590432; Tue, 24 Mar 2026 13:53:10 -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 006d021491bc7-67c252c91d0sm9125161eaf.5.2026.03.24.13.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 13:53:10 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Eric Dumazet , Neal Cardwell , Kuniyuki Iwashima , David Ahern , Simon Horman , Simon Baatz , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Wesley Atwell Subject: [PATCH net-next v3 1/3] selftests: packetdrill: stop pinning rwnd in tcp_ooo_rcv_mss Date: Tue, 24 Mar 2026 14:52:59 -0600 Message-ID: <20260324205301.1361608-2-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324205301.1361608-1-atwellwea@gmail.com> References: <20260324205301.1361608-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" tcp_ooo_rcv_mss.pkt cares about the OOO SACK state and the resulting tcpi_rcv_mss update. Its exact advertised receive-window value is incidental to that test and can legitimately move when unrelated rwnd accounting changes adjust the ACK window. Drop the hard-coded win 81 checks and keep only the ACK/SACK shape and the tcpi_rcv_mss assertion. Signed-off-by: Wesley Atwell --- v3: - drop the explanatory packetdrill comment per review tools/testing/selftests/net/packetdrill/tcp_ooo_rcv_mss.pkt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/packetdrill/tcp_ooo_rcv_mss.pkt b/= tools/testing/selftests/net/packetdrill/tcp_ooo_rcv_mss.pkt index 7e6bc5fb0c8d78f36dc3d18842ff11d938c4e41b..0116abd86093e1920f14d027d34= ff5ad30ccaeef 100644 --- a/tools/testing/selftests/net/packetdrill/tcp_ooo_rcv_mss.pkt +++ b/tools/testing/selftests/net/packetdrill/tcp_ooo_rcv_mss.pkt @@ -17,11 +17,10 @@ sysctl -q net.ipv4.tcp_rmem=3D"4096 131072 $((32*1024*1= 024))"` +0 accept(3, ..., ...) =3D 4 =20 +0 < . 2001:11001(9000) ack 1 win 257 - +0 > . 1:1(0) ack 1 win 81 + +0 > . 1:1(0) ack 1 =20 // check that ooo packet properly updates tcpi_rcv_mss +0 %{ assert tcpi_rcv_mss =3D=3D 1000, tcpi_rcv_mss }% =20 +0 < . 11001:21001(10000) ack 1 win 257 - +0 > . 1:1(0) ack 1 win 81 - + +0 > . 1:1(0) ack 1 --=20 2.43.0 From nobody Fri Apr 3 02:57:00 2026 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (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 A2B8B35AC3D for ; Tue, 24 Mar 2026 20:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774385594; cv=none; b=UMKRjq9WFvKxrR1oB4qbRozCQsffSPjLswKCBF2jUr9MWu6l91SWXe8KxhUakNFXFKkhRU9NeSTlw+WCGT5ygg3L7BxXmtd+GziceZE3+WYUy/cV8kURiN6Ik+ERG21nvgdyOENIOnz3LBglPXzMuAoewR1xDjQyFfLZFRp96eM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774385594; c=relaxed/simple; bh=4QGpcwp1qxPVf6ZUcecn/0yfhjD9Mu5cjlL/DeSgN9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q4r8Kou2pOFX9bdyvGTcs/ymZssHKE1a7BL+axi5D7wBD/zCgXB/uq3wdF8l7KH1j9wxgoNwRHb0spemT9JRrgU1P3fG+dYiMZ+sYUAuTK+aa4ygXv/RKj8ugRWLTEZJvZRev3xhHerMVkYdYf1Tg+ybthxMK4SelaikZk15IQg= 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=mxkmaBfi; arc=none smtp.client-ip=209.85.161.49 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="mxkmaBfi" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-67c1b8b1f96so1017937eaf.2 for ; Tue, 24 Mar 2026 13:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774385591; x=1774990391; 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=JBlpY7eubv7wZkuI5bb1efaRXZw3P7J6opPPvgxaNtg=; b=mxkmaBfiiys8Bxyv1jLPrcyliG/ecgKNNJ1J+m7TW71vVzX9cWmytPhu+6OVwnE3e8 MyrZIV/B9MNEEBbAcuQg+Id4eokapaXXU54U/AYcPf7nvklixqEwmRbGBLICqq0Zc8QI qOyBHiUZ5FaYcw/GM4op/gnV5RBLERLpfIewwa02qrtsu12YnSje3yLTGtN4odoo6gor EnIth+NejuoivYyZccISs467oWk2ywisEJgnKkFXcrOYiJ58kM3FrmXEARrFJJ0F6c/D sgpE78gr5ak1ANM2TrTUYPxRZW+JZ8sB4k+P66tV8Gi6a9OPYC7Flb1VWq6EK04dOOR4 2M1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774385591; x=1774990391; 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=JBlpY7eubv7wZkuI5bb1efaRXZw3P7J6opPPvgxaNtg=; b=VgYuxtHgR1MoO20dNKqC4iF732z0iQ0JBJynBhIyHA04x7noxI/ecb3L/npf3bjLWT 5Q+tU/kR9p9mUPYllZWg35vYHZv1NjlGZrZ370LKP4twWS0DRC9suThkphuec1Emyis3 15VM8Y42dvIdxkXEuRrivsMoybNulH1eFye/sSgr1SgUNNX+SdsaqPWpRepkd47uo3Vc fhGwfXM2fw1YpeIJa6qvUyW/2ef+SaPcIhHgniyYFCyfXRxntlAQn3qPHY0m4OY1d3lA o0PGMEDghRcLOBDPLmawlhXa9ZenQpjUNFM4bOn/hCXZ8uQMM24WIYPgG1Gsxh0nlxP/ RKIA== X-Forwarded-Encrypted: i=1; AJvYcCUH6Ce4sZQD/1MIfFBHoR7Wfo1QMlj8eefa+CmX7mo7yJPWESoGNDMmStGUf4BfFSHCWGPy+IGy1sLkwCg=@vger.kernel.org X-Gm-Message-State: AOJu0YxqmQZoySgGdSRLP0ZCNXv9KrXNtml0X89oJp/hQpcn5nVCO3q7 VvAQQCzYveyvkv5bq3eBqe0gPMaZ10CuyCBAXvp7Sq4hCWW3/XjOUzCc X-Gm-Gg: ATEYQzx1K4LG+jO05G2wxqPJ8zWQZ0kFF3fgCfy2mvmMIoiKdtwow9UxqAe4g2XaYAl enSUTV7tHgz3695EQUzyf5VGTPR3xBDlraM8uQCNOTLf3W4mN7Mj6ljwo3te/0oG+ZGB68n5GX8 Svl7BoVUkTH4AcjIhReQ7rIwKtgtGR+asig6Dp5NAhEPaZ7K0AEnHdRH2kON2oUIff+9px11KlS ilDSyp4QYQ89BUV7+2G2TPaSkVCpdg+h9h6OyMnsY5ovwv2DFn68bW5YocC9gC+HYnlP6p2Weiw HweNHKavdBdf2krlqbr9rU83KiQXyWOQcqOqR6lNDdw0BAGsjDCQM88jIqzKJHJFsY1cHiVgLio 5p4Unnx1WuLpEtg/3Dm3WhiHU6g+yanmfbweR/kIUEw/AaXaJ6cR5OuWNWOWjXTAeANti7mYBX3 4jI2tIGzqXpNtS26P62vjrAFCo1Lwcy1jY13bXG57buyR+mP71a37DAR6Aln7H1cRBYynR7auDW FYg6PFzv6fVTxMZAz08XY4BN6ccqsVAQBTxDPjVhg== X-Received: by 2002:a05:6820:4d05:b0:67d:fa1a:a660 with SMTP id 006d021491bc7-67dff5142ebmr685123eaf.41.1774385591560; Tue, 24 Mar 2026 13:53:11 -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 006d021491bc7-67c252c91d0sm9125161eaf.5.2026.03.24.13.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 13:53:11 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Eric Dumazet , Neal Cardwell , Kuniyuki Iwashima , David Ahern , Simon Horman , Simon Baatz , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Wesley Atwell Subject: [PATCH net-next v3 2/3] tcp: keep scaled no-shrink window representable Date: Tue, 24 Mar 2026 14:53:00 -0600 Message-ID: <20260324205301.1361608-3-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324205301.1361608-1-atwellwea@gmail.com> References: <20260324205301.1361608-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" In the scaled no-shrink path, __tcp_select_window() currently rounds the raw free-space value up to the receive-window scale quantum. When raw backed free_space sits just below the next quantum, that can expose fresh sender-visible credit beyond the currently backed receive space. Fix this by keeping tp->rcv_wnd representable in scaled units: round larger windows down to the scale quantum and preserve only the small non-zero case that would otherwise scale away to zero. This series intentionally leaves that smaller longstanding non-zero case unchanged. The proven bug and the new reproducer are both in the larger-window path where free_space is at least one scale quantum, so changing 0 < free_space < granularity into zero would be a separate behavior change. That representability matters across ACK transitions too, not only on the immediate raw-free_space-limited ACK. tcp_select_window() preserves the currently offered window when shrinking is disallowed, so if an earlier ACK stores a rounded-up value in tp->rcv_wnd, a later raw-free_space-limited ACK can keep inheriting that extra unit. Keeping tp->rcv_wnd representable throughout the scaled no-shrink path prevents that carry-forward and makes later no-shrink decisions reason from a right edge the peer could actually have seen on the wire. This removes the larger-window quantization slack while preserving the small non-zero case needed to avoid scaling away to zero. Signed-off-by: Wesley Atwell --- v3: - keep granularity in signed int space so the free_space comparison stays type-safe v2: - rename gran to granularity - clarify why representable tp->rcv_wnd state is required across later no-shrink transitions - clarify that this series still intentionally leaves the smaller longstanding non-zero case unchanged net/ipv4/tcp_output.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 35c3b0ab5a0cb714155d5720fe56888f71aecced..5fc0e0d22f10bf56ece1be536b7= 5013768112acf 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3375,13 +3375,19 @@ u32 __tcp_select_window(struct sock *sk) * scaled window will not line up with the MSS boundary anyway. */ if (tp->rx_opt.rcv_wscale) { - window =3D free_space; + int granularity =3D 1 << tp->rx_opt.rcv_wscale; =20 - /* Advertise enough space so that it won't get scaled away. - * Import case: prevent zero window announcement if - * 1< mss. + /* Keep tp->rcv_wnd representable in scaled units so later + * no-shrink decisions reason about the same right edge we + * can advertise on the wire. Preserve only a small non-zero + * offer that would otherwise get scaled away to zero. */ - window =3D ALIGN(window, (1 << tp->rx_opt.rcv_wscale)); + if (free_space >=3D granularity) + window =3D round_down(free_space, granularity); + else if (free_space > 0) + window =3D granularity; + else + window =3D 0; } else { window =3D tp->rcv_wnd; /* Get the largest window that is a nice multiple of mss. --=20 2.43.0 From nobody Fri Apr 3 02:57:00 2026 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (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 8105A35E95E for ; Tue, 24 Mar 2026 20:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774385594; cv=none; b=iFDIW6FpkklH335Uw0XfXRIJ/AXdPMoiLMfu4gdWe03cY6mjRaIjgrCrCzYyg+ps9jwmzdNe9oB+Lr62wOtycZEZnbPby8Uda1ZgDEIubsTmgT4yWT9EQO0RHFWHePjAzEVUxzUertSlqUB443NKNdd2gSTmPTga/hIM7yBrvpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774385594; c=relaxed/simple; bh=xqZQ3SvaBjFkGhtlaYhusneOcuRfyDHHa5x9/WtiaUc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dfe1dwVuQTQkhUygzOg1LVpj26SbW4ItW1LoYbRVgcCx30Xyeoe3ft4BP5t4gHLrN8O9FgeQKVZEOoruWDBApLaHFNFO3soKaf7+jX6JURD2eN2knrFfymXT2mSJZ0Sg9a45gca5xTTU5FVKzYWJzeZQvafPf0iiVc2MK4+cwLw= 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=l8gOfnNb; arc=none smtp.client-ip=209.85.161.49 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="l8gOfnNb" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-67bbea1e090so3240902eaf.3 for ; Tue, 24 Mar 2026 13:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774385592; x=1774990392; 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=QV9GcPB3CgMH11snwri74jW6U7GqWaCu+8vUwZySiUA=; b=l8gOfnNbJKIFBeQ/BPo23ak2J4hM+ICAT4sm/uxpT18Lcxio6Doqdrh1D0e5AsXlG5 kKrMd0Fv2fpp+DtJgqAIvWZpFgwx8tRlALGUahnfVRwHfeE6FIjPxw7emClgpusR3IeU 5h2k1iPWf2uanaOWijx0D8G2QzMGrcTUgywreZXp8ZCGWsPlR+Gsv13jSxDowsLHAt1r DrXv0eP+SbdTGM4R3XvUsIQ9jZU+ACrhY5JmYBDXgO9qvjbIAOxHTSzlMQ+4YlKUo3M2 zPlZRYa6TDaeRQvDwOCRopTh1f8OsGIJ344wTzYpSeerbpxdrYHPqAUE9TY8vXKXL/OD tD+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774385592; x=1774990392; 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=QV9GcPB3CgMH11snwri74jW6U7GqWaCu+8vUwZySiUA=; b=A61l0YRzDn2BxZaMBsbiW9ZRuNSRoPo/+xe+6gzpgClFHCI79TYLQuyK6ytTmYkIY3 BziNjEMZ94LspebTdgrvosRBws8CGfKWfito38YoIcKUL+iyFP404hV1RWDvMs9tfe0n q+HPd4DP00I4siyG29NamM7qZxSrnm94G55s5caiYO7fIxT5EkVzKxv8Msa7ax3rGYFj uSI8GQlRao3W+48AtDEXw9ojQRShpF0AtoraTTHjFVH0MYpFUAG8KD1eF4wZCqWBhH/c xqTyZNVkyOlK60MQqxJCCJl/KL7/wnkgsM2EfojcozwrgY0ebLKvjjMGPi26pEtIS1RD gCbg== X-Forwarded-Encrypted: i=1; AJvYcCVPLeSrtTl1tW9HL6mIM5GLWdCZ5aoPO5cdiAjusb+ORK3F8UR5T7ypFSMDCIQFbGQRTbB5fUDjNzyDl4Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzkbKzQsF3LKwYFSSdVwr0WFL175DdbDntk8qhg9vh/5jKirLDR lwuFQAe6qt6Vdr8aDBC/F662yz6UgLhNeAZYsu6rP+e+zQrLgVBM2ZKR X-Gm-Gg: ATEYQzyNniW8I4bqTSdsL3vCF4sUve+UwUn7UyoUMxi/FvjICkpNw3mtxgrLBa+EaLZ AtPZfpDz91g1jIGYMPNgG11tCh4+M6h3eC5ClHesmYDocYygI82l1URzkBNqP1hEkAM8tThI13F pBwVu9S5j1BI8Bx6RneB9xgbp+kl99mv7Pw6yn0ASvw10dzoWF0Q6GHluvydxVdiBF9EED2oX0C BjWJqnk2L1Y2gtiTaWrjkuRQ0ocrl7yKeimXTsxivqEjkuqKy4bpfVBsFms+JuSoXdxHkXzZ3u4 USFKKbktMbLCs9u6SuoqzDDGTFtROjAfQPc7EYQM4oNtWpHttsA7fW0XAHhMbTIwSwm6MKVvLwl OfFv3EK/3G7+T2aZ7PBJWqz7l/BENWMljC61vaRIdA/gbDH5a6ZRE+hMa6EfxMb+9GYUBbCZvaL g3xIDRwF99O9bgUQcD2Isz2zWnUANjKte1VPBi4WJsjnVEdBV4Jgtskc6YW0lbirUtEv6xBAOhg elzR1Ewe6oZfzd82fHgZtYjK/BoeF5Fc2eyHrTa7w== X-Received: by 2002:a05:6820:3108:b0:679:88aa:7531 with SMTP id 006d021491bc7-67dff566397mr657706eaf.62.1774385592564; Tue, 24 Mar 2026 13:53:12 -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 006d021491bc7-67c252c91d0sm9125161eaf.5.2026.03.24.13.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 13:53:12 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Eric Dumazet , Neal Cardwell , Kuniyuki Iwashima , David Ahern , Simon Horman , Simon Baatz , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Wesley Atwell Subject: [PATCH net-next v3 3/3] selftests: packetdrill: cover scaled rwnd quantization slack Date: Tue, 24 Mar 2026 14:53:01 -0600 Message-ID: <20260324205301.1361608-4-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324205301.1361608-1-atwellwea@gmail.com> References: <20260324205301.1361608-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" Add a packetdrill reproducer for the free_space-limited scaled no-shrink quantization case. Grow rcv_ssthresh with in-order data, then queue tiny OOO skbs so receive memory drives raw free_space just below rcv_ssthresh without advancing rcv_nxt. The final ACK reaches the case where raw free_space sits just above 84 scaled units while rcv_ssthresh stays slightly larger. Old code rounds that final free_space value up and advertises 85. With the fix, the ACK stays at 84. This gives fail-before/pass-after coverage for the actual raw free_space bug rather than the separate rcv_ssthresh-limited ALIGN-up behavior. Signed-off-by: Wesley Atwell --- v2: - replace the old rcv_ssthresh-limited sequence with an OOO-memory reproducer for the raw free_space case - drop the follow-on ACK transition and keep the final free_space failure case that proves the bug - drop the IPv4-only restriction after verifying the test passes for ipv4, ipv6, and ipv4-mapped-ipv6 - reword the in-file comments to describe the observed behavior without referring to a removed path as "buggy" .../packetdrill/tcp_rcv_quantization_credit.pkt | 62 ++++++++++++++++++= ++++ 1 file changed, 62 insertions(+) create mode 100644 tools/testing/selftests/net/packetdrill/tcp_rcv_quantiz= ation_credit.pkt diff --git a/tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_c= redit.pkt b/tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_cr= edit.pkt new file mode 100644 index 0000000000000000000000000000000000000000..bb4f63772326fb1146574ad3f43= d59082ee49c18 --- /dev/null +++ b/tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_credit.p= kt @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0 + +--mss=3D1000 + +`./defaults.sh +sysctl -q net.ipv4.tcp_moderate_rcvbuf=3D0 +sysctl -q net.ipv4.tcp_shrink_window=3D0 +sysctl -q net.ipv4.tcp_rmem=3D"4096 131072 $((32*1024*1024))"` + +// Exercise the scaled no-shrink path when raw backed free_space, not +// rcv_ssthresh, limits the post-ACK window in __tcp_select_window(). +// +// Grow rcv_ssthresh with in-order data, then queue tiny OOO skbs so recei= ve +// memory drops raw free_space to just over 84 scaled units while the curr= ent +// rcv_ssthresh stays slightly larger. The final OOO ACK should keep the +// sender-visible window at 84 rather than reopening it to 85. + +0 socket(..., SOCK_STREAM, IPPROTO_TCP) =3D 3 + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) =3D 0 + +0 bind(3, ..., ...) =3D 0 + +0 listen(3, 1) =3D 0 + + +0 < S 0:0(0) win 32792 + +0 > S. 0:0(0) ack 1 + +0 < . 1:1(0) ack 1 win 257 + + +0 accept(3, ..., ...) =3D 4 + + +0 < P. 1:10001(10000) ack 1 win 257 + * > . 1:1(0) ack 10001 + + +0 < P. 10001:11024(1023) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 12024:12025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 13024:13025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 14024:14025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 15024:15025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 16024:16025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 17024:17025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 18024:18025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + + +0 < P. 19024:19025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 + +// The last tiny OOO skb pushes raw free_space just below rcv_ssthresh +// without crossing the next lower scaled unit. + +0 < P. 20024:20025(1) ack 1 win 257 + * > . 1:1(0) ack 11024 win 84 + +0 %{ assert (tcpi_rcv_wnd >> 10) =3D=3D 84, tcpi_rcv_wnd }% --=20 2.43.0