From nobody Sun Apr 5 13:11:57 2026 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 8568E3AB265 for ; Tue, 24 Mar 2026 06:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332268; cv=none; b=BDY/Kqbg5Jf9aJM7/iWIuabI1T+nzJN2+apQWzwq+QaES+mlAJpH4Ev+dAeeDeh/lEXNTQhO5oT+1tRLwCX4ddRdGoVGl3YGOTF9ntXjK2VSkAWSN7VCmYXKPQYZw5L89+/wiYXypAQwAo6LdJFLn/Zr02RjYlHc/lyUsvb5PcM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332268; c=relaxed/simple; bh=2LpObmm0KAIiKn6ecbNp9DXCoG8E4+h39lkWKLmCI2k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DEKhr4S0usJZ/NI19o3j98PyYn9wIyOff/6amwzXqkS4reo7FRZWz1y9BLVi3Xa9I171Sx5Idndvs1wiUrRyguRZE8Y4l3W84E49Gp72mNHvmkJKdpwU0Nq+fbNGyH66iQsmkNR0BlXGkQ9Tguo7qYggQLgCC2Co/kZz/Jeref0= 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=T5ka94dG; arc=none smtp.client-ip=209.85.210.53 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="T5ka94dG" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-7d75ed779bfso685722a34.2 for ; Mon, 23 Mar 2026 23:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774332264; x=1774937064; 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=N/zbf91aM6LypdywPhicgkAJndZ/EFSfnS9FO2u56Vg=; b=T5ka94dGtnA4sHjcmIg2RoVWZniyqrGQE/AcDSKyAUwHdMapHi0QAhEPRkEawqCE58 zGzHJcxah8raueTT28DsWPKT/Y0f9UnjQmsowXx/FnrteSjlGKAWiGDbgUlJJuzUdy5A BUQlNbPSMK76wHhR+QaK/7Z/TCnyAj4bK5pXruSPiJW8nVVOAU/gc9Ksg6qUIJLgoBdz U8+Y5tX8Pau6LQyafT0fMiLll4Fs8R/hIhePNdlvaXHnqmNv0Lqg+n6jMUsQrlLpFJy9 1jc239h9jAnTikeEKUfXHsOWQaibOQciBCrhHAwVhvu+7uFcj4Q/arZnvV6gIAFzoqHS W9ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774332264; x=1774937064; 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=N/zbf91aM6LypdywPhicgkAJndZ/EFSfnS9FO2u56Vg=; b=oJVZeeCrqgQ5wHupItUbqduJi30GNcqkq2T/WWEp/+1r5HUB5ZVmPdw6H79elmxfli ISSkCokioeWnnMAgyLI8u4bYmbZ1Lbi77Xuu+ExmjvcLmrlEtWU5oYaSEv3Hf6jL1Om9 y9/V2bOlfnXFegnRMIwr8snUt7KfYzM/3FhUx/Se5jXzxAxkoA20KPDw17BmCrqgVM30 w74AvzJmI8h0//TaTiSlIBVk7vZAVNNeUi5CIeUAG6vKkGpLiXJx0p+GA4n9//plGp9l WERwHDsLAAlmjkktFdgBNdpRNHGqJyrpeJDLfnOxErMMX1wTgFDP7MsUAGRJ8ig6aLlb G/dw== X-Forwarded-Encrypted: i=1; AJvYcCXrqG+JSVCBYYYyf+ethc9MG0t/Sn+4bvvSIwr5pKpCV4/V6ltjP9kqoaLsXWjXuqSrd3rGiglszHObkTI=@vger.kernel.org X-Gm-Message-State: AOJu0YxnhQpwedu/gLy0wqrK4wZu3q2GfMdTGNzSJ9rSM5Owq2OFiuZs 0bxBhftjXjL32GKyodAWDdepziyFkAEDCSdC6/C3Wcf6G8VTutgdVEtl X-Gm-Gg: ATEYQzxs4YnWUq/CD5ItWHjl3uDWHCTACHHR+yErKBeq2jTlT7WdCrwAB+j9F9/Mly1 u0f1i/bpiUMpdvt+qOTgnYu6taVs3oOWa8pNfFso/o/hHNKm/96gjVwDp4GALrHUBZRwi97TXyK ndb4PZa/Cqr3nGUz4rIThE5U96zCQbVHY277l5IQAsZTrsi2IOjSfcelMT4NFG00EYaG94tvbYy rQiUZ45vn2peWstqy3G//lt0hifA8krJeGwMfLM0xVZwVZsr15KBwGCSUHkVh9/8qA4aW9W3Ksr nay6MoRjE5rkGKUxBC8XXeg/Ck9XbPA1u8yEGd8E0MPxeUcHxfwAVKJ91nOvKGGwrs4RF1dul5l rdWTmME8ZYPBWMFE1l7U9RSnEHDA3bE+7NEpLLs565tsTasaiWAbW5z0DCOn+FgYsh4b1R6rjmU yJ/krVGd2bdWlPG6/al4A4+hHem7eco4XHJpkghf1tbojEyOZuZpakUAtl2rpFf5P3IPK8pxufl SLef4LhPCy1eIig9v7H6uU/tQ9Q7wZvfC/kxN/sFA== X-Received: by 2002:a05:6830:81cd:b0:7d7:f15b:e399 with SMTP id 46e09a7af769-7d7f15be572mr9244399a34.16.1774332264220; Mon, 23 Mar 2026 23:04:24 -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 46e09a7af769-7d7eadcb757sm11429957a34.15.2026.03.23.23.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 23:04:23 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, ncardwell@google.com, kuniyu@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, gmbnomis@gmail.com, Wesley Atwell Subject: [PATCH net-next v2 1/3] selftests: packetdrill: stop pinning rwnd in tcp_ooo_rcv_mss Date: Tue, 24 Mar 2026 00:04:08 -0600 Message-ID: <20260324060410.1137199-2-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324060410.1137199-1-atwellwea@gmail.com> References: <20260324060410.1137199-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 --- tools/testing/selftests/net/packetdrill/tcp_ooo_rcv_mss.pkt | 8 +++++--- 1 file changed, 5 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 7e6bc5fb0c8d..0b19de9f9307 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,13 @@ 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 +// This test cares about the OOO SACK state and the resulting tcpi_rcv_mss. +// Keep the ACK/SACK shape exact, but do not pin the precise advertised +// receive window here because unrelated rwnd accounting changes can adjus= t it. + +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 Sun Apr 5 13:11:57 2026 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.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 606AE3ACA73 for ; Tue, 24 Mar 2026 06:04:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332270; cv=none; b=ofjk0R1O0KqQR/BCyxJFli1rAhwxjgQjI/ZeTOPSgZjIxDul1O1qe6+MZ+tsoKN4bKgCUUFNoUhUKGiKBzSdWmMBsw4g8heBnr8zBoMU/5Ty6n/iMOpKenGmew1rIpw1qGNUoV3aD2qkhi0a2tJQ2oAe4+3t4TCFucaxWNJWxOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332270; c=relaxed/simple; bh=vDPZKHBUYge/g17hzmq5toRf4WT7oxJcyJZTa2pK1Pg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N3mt0L342IK7jx0fRWh8f+80ndwJUt60A15I2gxTnal6fyMNsl+epDC8MbiNF6x5FyN5j1O9eTVq8s+IIFgchTVWrW4jyYNbA8cmfw1ZH/L1KoCQS4g+O+yqMPt/3/dtlI3Q1yaevZq5p68dDe0D2hAZxMFvqRIgsmfg4s+m9gA= 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=hcpDzhpv; arc=none smtp.client-ip=209.85.210.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="hcpDzhpv" Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-7d7eb85fb81so1006728a34.0 for ; Mon, 23 Mar 2026 23:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774332266; x=1774937066; 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=VdUAuQeuJDXiY6t8B3u7gtUDmCHorI1qmUGWnWOYpWU=; b=hcpDzhpvPmhdFAl6MmhNCFrPgkhxrY1TUjfNMCVwhdI5v0o2XjqDHLuWXWhSux81T5 phGLX1MQMrM4L3NDqBFcvfJds1JrpdWystuOuA0EQXaa2MSzUcdy/m7//32QJns2Ih1/ 7MJZ9ZS+YugO2rk4fFM+oHn/kc3xwqBy7Q5jyfBNvpUDnhGPsU/631hFoPsfBBK0c8Jb m97U2c8hmQw/Q7XNF+Dr7EoI9UF4Bp23LLKxiWDXt3/vK+WKUCoGbyEARIomzAo4iSei 7OPCk+mYMINIO94vnpa8K7HBOEdl4TyzX8SgsOQxUYYB1MlCAD0QGtHz8st8NiIo+lt0 ek2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774332266; x=1774937066; 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=VdUAuQeuJDXiY6t8B3u7gtUDmCHorI1qmUGWnWOYpWU=; b=NGWKpwgoo2ehNZOD76n0WMm2atePbjI3xas8aT6mcrI/KVTLeuy8+E4MAGypFfhD2l njWI7XjoeL1AjVNq5IjKm5Al8fqf70g69c2vbksQn4DTAiyqdmMJDoit9vaBfkWFN3F1 8PiUBCFytAdlc2tHfgPx+rfu8io1TBNw7V3wRB200Yr+HubStbVkTRJK2o2d2IlHgEAj f+hoAC4/zp9Xw2sUjKqw+Oi2HtYb5stARN0o3bw9bLgAYWFXAnQR3II+xmEXVDmKshdD K8IkhcZOqrpIRckSVdInFWv5yXojOQ4DRWSursUk7occHfOQt5OcaWiIfQPrESLj4u9S lb1A== X-Forwarded-Encrypted: i=1; AJvYcCX0VqkJSVfiJZWwz4Q6MgOogTlPGkUEhCqWUMkOCllZkcF4cwJSo4nuNfLvhKor/rlwL/717w8PzH0NshQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxhEgmPagDQJymO3Ixm796Xuh1wqSfQxKpzShcxJm26iEB/LtpV WKYhCeG+R9VbC5t2fwh4FpC1jS5ShGjcKqtrC66pQBEtl141wmDOLuQd X-Gm-Gg: ATEYQzzZ7n4yxBKASQrE29duke+rFBDfy6Ocg7DpibieEsqpj1zhrtj5Iu1JdbOtTOa KttUln/DVAAgObP+XFY5/7HewkQRac0H/TWwhXIEDB+G8lye1FqdR/8WKt30sCyp5u6IifTfQc9 D9WE/ZVZF3dWULi/VUfeyD017ngQMo49nyuNL/0fmGWwHtVRaXRTXAY7HQ5dwp4Nz+VV9me/tsF AsSBjsXe/fQ+ODP0pfcrlLjr29OySJbkMqFLinATHAro70qpbnhHPp5I5MzzWcxMQvzW0/NWZAy txih5DxcXHQefYcSoCzaTfsTYuYbdWub8NOzk9ehVERD98lW7T1eeyJNzKHykaPt/X1VCLEPdir t8W2ynKxZqWTjk9rtNy6oGbJXr7y6Oqyu7lYctnOkeu6CRFSuwcW9m+qY9hKHp39P8MmXv9ATpk m2Dg0MvZQ2rFKiI+KHDtskSFUrugA7Hi3feVs7iW5Vy8D2EDkORzIegiK0ujjfsX9Z8SKOelkrx ygZWOlhASysnZuboKfBawGtqKucU7LxjMmdKKv7Zw== X-Received: by 2002:a05:6830:82e6:b0:7d9:b0d7:ffda with SMTP id 46e09a7af769-7d9b0d80e91mr5744843a34.11.1774332265864; Mon, 23 Mar 2026 23:04:25 -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 46e09a7af769-7d7eadcb757sm11429957a34.15.2026.03.23.23.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 23:04:25 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, ncardwell@google.com, kuniyu@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, gmbnomis@gmail.com, Wesley Atwell Subject: [PATCH net-next v2 2/3] tcp: keep scaled no-shrink window representable Date: Tue, 24 Mar 2026 00:04:09 -0600 Message-ID: <20260324060410.1137199-3-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324060410.1137199-1-atwellwea@gmail.com> References: <20260324060410.1137199-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 --- 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 35c3b0ab5a0c..e5c4c09101be 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; + u32 granularity =3D 1U << 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 Sun Apr 5 13:11:57 2026 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 46A3A3AE6E2 for ; Tue, 24 Mar 2026 06:04:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332273; cv=none; b=pK+cRNmC+F7NTCveME44mWZ3uN8UcqOoD05Q3D+WGFRgWLsPHYuxPy39TgtzhU+4VaQgevBxgSknjfcOR/5qFW9ZzcL/oP5Qin0RJ8YSuHqGncZEx6eYnUdTIDlnTwrCkCRRtcavquJA4iSgcjOVWkcBL7ITe1XR/UbWiiuH0Kk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332273; c=relaxed/simple; bh=eYCwzFxY2qGj3pCgqVAMjLFFIbI4v5MvL64DV7JicQ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nU231w9oyOyb1ecISaB7rtAxsk1DrEKmTwK+NWDROd4R0Lk0pUx5WQGi7wgX5ZfCkzqQqi4YNXT1944oP/+oOcHdCZJYYgcS3Kbihny4YQCLonBITofQIhBwY14IUH7t3uJ3KN2zYH8+2jD/i1Rddz3/sO0SU4EVUBZHbBd/EbA= 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=cmL3Jayq; arc=none smtp.client-ip=209.85.210.48 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="cmL3Jayq" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-7d7f09aa39fso3799132a34.0 for ; Mon, 23 Mar 2026 23:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774332268; x=1774937068; 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=b2bTKYrz6TONuhlNDgy7SEn2xSoQ5Qqb0S20rvcw5Ho=; b=cmL3JayqeggRQV89G8Km3o8QnjpYMytrPcff4Jxqdar2vr0hzREkEgAqy1RlfqsB3y uzagKgFCZspeHJIJfO9xSTkvTxy67i+VvP60inqbFm35IimacAs1nEf7SHhpapWDq6EV pdlWswsgojz22h0PWPxGjVr8aiJENMmvpLab7I1LxcZXi9/iCKmYGBvxHO6bT5mfOzJV 8bKLJJ/LWXKxK+yGSy5arTCHYZtlBFsUQOhJdwtHTV+Ssm1g4eS74bzHvKjzQrrXFMg3 4uRdCOG8AiDhTyAq8/T7igSEO8TUnLwp9hh+iD1GGRKjs8tdmElkxSdV01iEFfyjVXcS zfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774332268; x=1774937068; 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=b2bTKYrz6TONuhlNDgy7SEn2xSoQ5Qqb0S20rvcw5Ho=; b=LiMhPcl32rSt4wPEOcC7Y5vlWCz4lCOELPq77FlYGMO6CtY9mcO0n5BFTI5Bk1wguq qAIiKdw/E412KlZ/pBSsuznPHZpY+484XrvcJ8bhbEz2XqZi4UHu+AyyM4miip1FOgen gp4ZOfXmiUpfZV9cRdlfQvwq0fjU364EuhfhzldjrNnnIfWk7hkmT0TvzZGvx7hqeGEC Ow1BozR7JmdiACAxtQD+OPkAZpfcqxF7VJj+YUFJGdJsStTN5vo1X+mPxD4gtTFhSB5E mXI2voR0Htf56p6CspF9WKPBwtUfSGsMskZKJkoRJ5XZWXw+eIebKOEyXb2WGkNrB+l2 1zPw== X-Forwarded-Encrypted: i=1; AJvYcCVQa3FiCf8a9O64oeQhkm9wC64MkOziYzKjTny0KNq90D7//4Ix+2ymaVnH007N+voqN8qwGJdYf5S7KPw=@vger.kernel.org X-Gm-Message-State: AOJu0Yzm+ZbmzD/5ZjozllJYYDTLjen1MndT7FM6BTE4vwYyKWSGBFVb eUjNW2Zqu8Vz68n8ni1bLoWpn66t1dD349TltC5ke2+wAaPvKtfY5y6O X-Gm-Gg: ATEYQzyp25qIEcjXzc8jcurXaxeVhrG9N7OfNXetiTcvHKVW3NS35NQFi0eCyUmo6Su ph1f3bDbEc1+NY8GxWSeoiqBk4QOGI07e1LNv70MT2iVAX0HJuKKO7Rh+hX2BP3QX9OBzlVh+8M kgAVp9vrRBNCoI+b9TDmJu7vnmTFzey7NZeUGsNdBtrmAVuRR1bNAWyYR8Q5mT839kghnSeYHL4 UwfhGtfqwKBrl5HQ6ScThr/FL1qELU+oF2L/ZEottW+DltikPKmPVqXdzUtyDfBVGiDUy8kTyTh 4MPcTl64el7MkXiSjuXRHLeRK8GhPoLhYFRWdtYd/LXoM2bdk1FFMeT5Cpw9TnuccM2RPn/rRRv XAv0Mm7yR7t0x7F6kCly4Enu4UpkLRDVeuC3FlPNUoHXnaIIN7Ud6bOb/yxcm20Y56bW9IAmj4W Manajwu3d49PckylmvX4j53tgdxTkUFB/mc7EuCiEnPGebqgZIOfKHnCRkRVre8g1CFM76yWp1q bmlcNmdPNMy/N+XCbeHc7Zass47oV+djuIUaqLblw== X-Received: by 2002:a05:6830:6f88:b0:7d7:45eb:4e22 with SMTP id 46e09a7af769-7d7eaffb87cmr9661028a34.26.1774332267560; Mon, 23 Mar 2026 23:04:27 -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 46e09a7af769-7d7eadcb757sm11429957a34.15.2026.03.23.23.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 23:04:27 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, ncardwell@google.com, kuniyu@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, gmbnomis@gmail.com, Wesley Atwell Subject: [PATCH net-next v2 3/3] selftests: packetdrill: cover scaled rwnd quantization slack Date: Tue, 24 Mar 2026 00:04:10 -0600 Message-ID: <20260324060410.1137199-4-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324060410.1137199-1-atwellwea@gmail.com> References: <20260324060410.1137199-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 000000000000..bb4f63772326 --- /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