From nobody Tue Apr 7 01:01:18 2026 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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 950FB347FDF for ; Tue, 17 Mar 2026 06:51:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730311; cv=none; b=kVUYNjn3kG7cE5J7fJXfD6UVatbBA//iXjJ/l9S5u4fA59bgi5Qy9YfhmUuum5hEogMEXFnEN3cD+I4wirUr07loUID6X+nk+VdDP/RQKA0ZjDAsPT7bMflKA48osPdT5FogAgJ9KG7PXsTbQQeqtzKD7xClJ8jfVo2KHuWdSBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730311; c=relaxed/simple; bh=ImbWQoR+dgm8+9dV9PXvczLRAxo2SxKksFr3fwuIhLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RbpJVtYD/AQas94CziBGenJr8BWmnAfBUfN9qnjMiInKYymMqZsl0aWbCnLo+alYSA8pecZF44iKUMi1W9dR8gjZBoRpDJ/YvIKH++mV7rxvh0faYEWDal2hJyq+4EjnqHaPK/J5sVfd6wKo8V5BDD9uS96LCsbykaD7iarwB7o= 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=VEttchVN; arc=none smtp.client-ip=209.85.210.52 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="VEttchVN" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-7d74dbfe84cso3714721a34.1 for ; Mon, 16 Mar 2026 23:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773730309; x=1774335109; 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=j+IJ2HT7GzgVpfj7oyAsWSh4v8318zxK4LdAKWsY7NU=; b=VEttchVNmTAHva0Ips9bn6B3mdor+xxVQf0380ZUVMKtJtDtfk/gyhYG7XLoFWKkPw 6etKYvToF3rOsEG49LUZbO369awuHZec7IBpfrx2ITkKnfDMo/jp57EMC4blBav62+7C dkSuoB4EL9fD1eCFQGT96caDptfve5+p2WuKUz7QSfY1diQyndBSkphZ/yL7UP2O7xs1 paQ0V9pLgewZ6DggzyTaN330Ruy56PqJgXT+dh2CQfNF8KbZqdMgwPB6he8jb2U4tdvm akiXfYAAULVp0jqVV17GwqNpHDP6QiQDFCPT+nPGwNu6jlg1cWXYwdfu2QxnmLLGjgoe bPyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773730309; x=1774335109; 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=j+IJ2HT7GzgVpfj7oyAsWSh4v8318zxK4LdAKWsY7NU=; b=gtDpktHg9Uw9Zjj2WjUBzrg6n77AOxoLJ299KS53j6/3thagNSxMxc5+PEPsbN+ne3 6A1c8caQNyTYJY73ihrFtGRrQ7PO7f6kf3ZqyqjZbq5mGBExOr32LmoA/mRq10uIQAIQ tkDv2R0ti1JKOMMcTooNiElA0lLDKDuGkZah9wqIQ8scJuaQosjnqWCuiWCr1/wb7V9N tEvYEr6VwSgtyvHODNSs6MgFYPT2/nyJLb0oov90w5Xzf+JiMgfSIAvTHDj3LfYJzYmn GsTAA39GNq5lcTiEFOQC0C8aVBd1oXP7Q6yu9lIT5eFdmphTaIbC3txBd49IG0ADtPnZ oIbQ== X-Gm-Message-State: AOJu0YyTJI15CEoYVJ1IXTNmnlEgjgUmT7C15xJ/FcjF3rikYPoQgCoO Zay2LpWC4qY+39wQ0eTcFqpU43sKsQh3oNS9caDNbEp9s/9QCWCX2C5GhArX15p8To0= X-Gm-Gg: ATEYQzxx47AJf8JsgibBxQcwYomSzyOIiSqB4hPV5x7VNLbZsXiPVE3zdEvmQchv69L fdIXEdIhPc2kiBYZ0W3MC5fqO10UAitqvxoUkF84yF8iEyD78M2zqeLOpz7EeZm9bsl8RNyH93h b1REOc4LtFvdunclWGJfgjr++KSwuobHbThXMngSeasZUAfv8bhXfDNJK5Ub63+Nhm5DKSjcIHD nGULWilPNFAew9TV92LUntvjE9GH2jw80puSOxAl/Xzm3cesGFGB87ep68/JX5Eab6IBJG+H9E/ LszmfkrzgfHy6hBJwRisKdjAONwrlv3g7zcMB6esBr8zkzvy7myazcpF7YwvVixg3JCsvoq7iTl NMPeY9lpM4xlfXRJ7d/MaS1qJk9UrD7SNU59xqhxrRGU7B9Gdnley6kwj7Wi5SUCqeax5O/dbL4 WKDy/Kr5mclkFgw8iPkgu3wLKflNjiMpF8hZNPtrQRTnY964de7RmbQbUPaHifyXkYv0juiuZMl q0WY3nEN1wBgZ7iilJaKpLvY38OE+7H77nA7nKpJg== X-Received: by 2002:a05:6830:3686:b0:7d7:4721:9a56 with SMTP id 46e09a7af769-7d78260bee6mr11651705a34.32.1773730309488; Mon, 16 Mar 2026 23:51:49 -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-7d76ae68a4bsm14058432a34.19.2026.03.16.23.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 23:51:48 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, horms@kernel.org, kuba@kernel.org, kuniyu@google.com, ncardwell@google.com, pabeni@redhat.com, shuah@kernel.org, Wesley Atwell Subject: [PATCH net-next 1/3] selftests: packetdrill: stop pinning rwnd in tcp_ooo_rcv_mss Date: Tue, 17 Mar 2026 00:51:35 -0600 Message-ID: <20260317065137.1533226-2-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260317065137.1533226-1-atwellwea@gmail.com> References: <20260317065137.1533226-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 7e6bc5fb0c8d78f36dc3d18842ff11d938c4e41b..0b19de9f9307b3d0ee579bc9e3a= 2b9219a88cd8a 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 Tue Apr 7 01:01:18 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 BC517349AE8 for ; Tue, 17 Mar 2026 06:51:51 +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=1773730313; cv=none; b=PfILwIOyh2BqLzeIo80l2zdsrZI942mwcGUxPKfJp+lzHR/0PNIAx35wWybMEisNxbLMP8Mhw8ho7qqTJ0aNC5dDLLnRNR4TG+/0BdWViJO/NiB17iVOuA+e3Mhqek8LojzrZf42tIXjOHi8gqTtxS8rufghUWKUNPOFv/pE0as= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730313; c=relaxed/simple; bh=evB/X8tNk78bHrQ/MFYt8wsGBWuU1gJMZqIau8s3uvk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qUU/+OTlEtMjeqA0+xujPcF6gZmrPo53w5+RSDhm3Wb9X9TvyCAY4rz9SkqH/ZTdSFC2tsK3hE6of0jJ2jV0JUyopU5Mh721I2sMlvLWdOEf5Kqp6d0b1E1ap8tz9qXqj0j9bOHFBLEdHnu69/FJTslXn5+vBK47dnChD1P3HDw= 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=edP9a+/P; 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="edP9a+/P" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-7d77b179b52so4638011a34.2 for ; Mon, 16 Mar 2026 23:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773730311; x=1774335111; 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=+Nu5fdG7ljOunxtDElL00N3RnG2qS7orERGCqEegHO8=; b=edP9a+/PyTUTASdPoNDae9hEmSrVrYiE3pYK+ouU7XZYN1Uoz8hmzs3m8hFmfksg9L PsMf8Zr8y8zP50ENDvqudplXcgjFFma/vRm0koa/UVv2O19db83cOReSAukJi1QLKsqr I4bnkrCHkMc/uVs9YI2Y4PCXYlgqJTIQN2w2zoxVYI6Bp7eW/cuT45+/HG55DRviOqVH 6vvpjRye3yvNvgOTWlAcwRXIFDcyqWKHgTPyoH8Xu26VNXH8LiY61QysGfmk6YSAnyu2 JPRsAM6pPyd/qpgxf7OtYuQ56lN7gtJnFZ+1NImZMeFckZNFTxYKNADZJslJ+aWlHYE1 jbAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773730311; x=1774335111; 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=+Nu5fdG7ljOunxtDElL00N3RnG2qS7orERGCqEegHO8=; b=LQegxuLAzFWhkSAhPq9lu3kgEyrqZttg2/7JSI/MKvbSaDW1CfbnVhRxBVQj1pbJfY gZrwsmMhALxZNjGrhS90muNPBeXtf4Kbnt25qNT64YagUJBVx/c1Bgfl/e/z4Kzg056u zIJ0F0qB9kfRIbeYovCsnkI30uu3wzjinjLpxCdVZ4GNVyhkXlp+wpiK5B9f4wHizKHT 44sS6YLUqmsB7KurYnf6CFbme91oC2cvFl1p52yNkKY+/MuY9cN4mqmouai97XITiYhu lJMOghXK6xDIsgWUaUlaCTRYggfd/WqJghj68/N6FzyA7xgYNQbhv7b001bRDieS0Jvm xhRw== X-Gm-Message-State: AOJu0YyKSNwH/spzvoTy5iFC6IH4m0CrVoR8uLeT286mQ3JFUr4S40ZI CNYg+y5reyXSoy2R9AV+5Kfwv3EyZQcUq/QpA/982YwWJ01fEi8QVy2c X-Gm-Gg: ATEYQzwzPDtzbhFn+GvFcvjmsTcjV4JUcYIVmw/jHPWi1NrIZM2VZq4Kr0Wrdmc8jTQ mOjJj16kkz6zRMYG2s3YABySMPhG8M7co2yXsArsgWT1TcsXbvAbkqsCyfDfumrMs6iVed1eQ5b 1L+tGVlkbk4zlWp9Crh0Nj9Ti/dYDJ/x7WHgq3V0/J0ctwZ4FMUZtQ/nuclUBU8mFKCFTsAra6I exXGBhybQTraTNDm+JF/eaVl8y9OHng3kmmm4DRE8gJCZq2lhA44JuC4MNADzR0pmP18xN5Ut4c X4fJJRBQ/CS++eLoML+X6eIoDuQyyQRbuLhlMNg2ehTTuP+xoX/rAYk3ABGdmq+h2h5taLyKOfw YcBoybq8Dd3pEINhgdoX06KklPaX81IkABpsPvhoZOKFvk4rF73cUeDmc299MAahKoNGn3qfoF2 cZ+/Lse23aK/S0UIiCmpklT7YyY76NCTqgSRoDyOrU7MHyG0GAJimV3YRTz4DdXWUtxBtSzYr2t E12p25NQ5hSLgX1hwU9kkzE3xAoL4+m2Pa92ImxRQ== X-Received: by 2002:a05:6830:6619:b0:7d7:466f:b2fd with SMTP id 46e09a7af769-7d78246af9bmr10197156a34.2.1773730310733; Mon, 16 Mar 2026 23:51:50 -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-7d76ae68a4bsm14058432a34.19.2026.03.16.23.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 23:51:50 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, horms@kernel.org, kuba@kernel.org, kuniyu@google.com, ncardwell@google.com, pabeni@redhat.com, shuah@kernel.org, Wesley Atwell Subject: [PATCH net-next 2/3] tcp: keep scaled no-shrink window representable Date: Tue, 17 Mar 2026 00:51:36 -0600 Message-ID: <20260317065137.1533226-3-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260317065137.1533226-1-atwellwea@gmail.com> References: <20260317065137.1533226-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. That can expose fresh sender-visible credit beyond the currently backed free space. Fix this without changing the meaning of the stored receive-window state. Keep tp->rcv_wnd representable in scaled units by rounding larger windows down to the scale quantum and preserving only the small non-zero case that would otherwise scale away to zero. tcp_select_window() already preserves the no-shrink guarantee from the currently offered window, so later no-shrink decisions continue to reason from a right edge the peer actually saw on the wire. This removes the larger-window quantization slack from rounding free_space up, while preserving the small non-zero case needed to avoid scaling away to zero. Signed-off-by: Wesley Atwell --- 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..bd3a43148a87e891bc632a47ffb= 5b82c475e8f6f 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 gran =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 gran) + window =3D round_down(free_space, gran); + else if (free_space > 0) + window =3D gran; + 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 Tue Apr 7 01:01:18 2026 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 B2C0534A794 for ; Tue, 17 Mar 2026 06:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730315; cv=none; b=cvgiLZPIgPaw/C/JOLzFdj8DrwK0KO6ASwzknokPE+JmnrrOOmw3XhS0xmg90AVLtXluYd+G5lsBnoUJrm0Zg3YIPqbDX321jCdFVLlV7TppjyWt8oHVsxFSgSX5tMObMw5FBvsW9xi4ZklQX+bW0sq+2lNdG0KrTOczT+X8S+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773730315; c=relaxed/simple; bh=r4HeCz/IRpYcOhG+YpKz/qws21aUNL7YkGF4PVZ+KWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UnJaX8PA9axhg/71K+DUOKPzuEC9nGzDvHa4G3kmc0gAj41zTdZwL1ad2eexsz4YYl0TRcm/brL45UG4veQuodh5OkhFvDH+Jkdq3K48Y6DnlH2woyy98UVN2d6Me4zi9oNdRCw6GbeTUGG7He62WNlPubjHTKhhW8k9R668Rmk= 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=FDk4M7Iv; arc=none smtp.client-ip=209.85.210.46 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="FDk4M7Iv" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-7d744d9acbeso2043865a34.1 for ; Mon, 16 Mar 2026 23:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773730312; x=1774335112; 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=iyJZWPy0C8gtfPznUNGUjC3oIzSMZL+cyuAhRIUmyqg=; b=FDk4M7IvGbZ1eMBOfUi2JkSo/tHUAPn3aufZgz33Kvau7n1EoHmeK1mpHVazOmZERW LeoA9oY3CpQAovTZNpmdzct0hWKsBVbYHs9EBJ7K8sSJVn8ttOu1lTGevSUXKj+VQID7 VDqMo8iVoMKdMU/CBcjf+8TX6ceS+hBCNhE2jxXj9zbgm9sS/d03sR1Jy+stbI3YUBhI v1tf98JP2QMw/YCjqxJvVj+8kPL0lJTen7MgyRSxUhqE9ui63KQcMkRnctmGMd5ZrFiM +Wz/M6CX1BTKOwEp2CFlSBgbKcxcZgCP4VQWydRbAh4Qn9JoyG9SKEiCtwTbcK/Cn16l GEsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773730312; x=1774335112; 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=iyJZWPy0C8gtfPznUNGUjC3oIzSMZL+cyuAhRIUmyqg=; b=JubTi1qFWqjPqvX3Iu1Y390CApxCHDDgY65K6VtJh/x/nBu8aXZJFvuBdf2wg5poJq swYGoOVInCJ7Fuh8+sm6q5Fk/cnuKceVpVP2OrfpAGChy4AYvqHtIxCiex0fbmClhT/n 1x3dmAciMsqrW4Ogj0w9/T89Eos9qGnteidQj7GxxLAbhqHVnMWWFwJyhzbOJWtZuYbJ aLCcg3n8Etrq+mFYeM40YQZ1VsaKlEQFdemBaiYLIC4gJyi67nqqWMENld9VH+Mv8IA/ bMB7UvMFStJeNX7ZRy0KoKD0DLGpgYsuP0okpS8yWbTgIbAzlloaIBVUf5VHL+Bm6WCF PjtQ== X-Gm-Message-State: AOJu0YxHIMhOpX+01hnz+M1AKo5N4j8PeIHC3c/D91ZccLnNQfhVJvuA AWqNa7wUUH6Tj+5p7uarAXcrHTNkoHBztaxb7BUTXRaSa65I9ltYzHvw X-Gm-Gg: ATEYQzzBIZLezePUUttPQpP///oNfOjcKqaoFWS6mam6xWs5rWuUD02uAg96ZZn+EsR LBk/hqPtmSfkCljlNshbxlBUvm9u5uVH3Brun5AZTpU9BL9tRI/AiC3LV/dvqHIeXjkmHt+TEvK y0eGpWJrQsvV/VM/zWmWizQVh546PVJ7v1+Xyk/ZAVW6M0OXcb+zWVEEpVpXqQCyT9JomfB97Co +0pgI+zsAZ8RtR3IFScE/MFScVXT6YnLK1yTn4S8tksRfyuzzf3gR8M0MTEY7VOyNQHtXV1GYtM yDv6ela3aT3QioysTd3RF4DlbFYSxSBOyvkZY1boHpoNk+GytoAXMwEhDoBf0U0w1usQI67Bp4x 4VPsUlsPdDoNByWec9orZ3e1od7UXDdxgWk8d+F+GLJiJIZdA+d7+hMHDuTYiKbZKhmACv21zaY +Pr48rNJ/u/Gk8Q7gfXA9OPmuvtspHyGhlTBeyAgYBUVhXh99v/jWxN5fbP7OMCEKbaSJ7ljJLX A0aMBf+d4IbltPLcelHkDYm5MEGEubKFZP8lXrpsg== X-Received: by 2002:a05:6830:700c:b0:7d7:5405:193d with SMTP id 46e09a7af769-7d7825696d4mr10566630a34.24.1773730311701; Mon, 16 Mar 2026 23:51:51 -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-7d76ae68a4bsm14058432a34.19.2026.03.16.23.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 23:51:51 -0700 (PDT) From: Wesley Atwell To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, horms@kernel.org, kuba@kernel.org, kuniyu@google.com, ncardwell@google.com, pabeni@redhat.com, shuah@kernel.org, Wesley Atwell Subject: [PATCH net-next 3/3] selftests: packetdrill: cover scaled rwnd quantization slack Date: Tue, 17 Mar 2026 00:51:37 -0600 Message-ID: <20260317065137.1533226-4-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260317065137.1533226-1-atwellwea@gmail.com> References: <20260317065137.1533226-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 scaled no-shrink quantization case. The sequence leaves slightly more than 84 scaled units of backed credit after one skb is drained. The buggy ALIGN() path rounds that up and exposes a fresh extra unit, so the wire-visible window becomes 85. Then queue a tiny OOO skb so the next ACK re-runs the no-shrink path after a small receive-memory change without advancing rcv_nxt. With the fix in place, both ACKs keep the sender-visible window at 84. This provides fail-before/pass-after coverage for both the immediate quantization bug and the follow-on ACK transition that reuses the stored window state. Signed-off-by: Wesley Atwell --- .../packetdrill/tcp_rcv_quantization_credit.pkt | 45 ++++++++++++++++++= ++++ 1 file changed, 45 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..8ea96281b601f2d161cfd84967c= ad91cedb03151 --- /dev/null +++ b/tools/testing/selftests/net/packetdrill/tcp_rcv_quantization_credit.p= kt @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0 + +--ip_version=3Dipv4 +--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 in __tcp_select_window(). +// The sequence below leaves slightly more than 84 scaled units of backed +// credit after one skb is drained. The buggy ALIGN() path rounds that up = and +// exposes a fresh extra unit; the fixed path keeps the sender-visible win= dow +// at 84. Then queue a tiny OOO skb so the next ACK re-runs the no-shrink +// path after a small receive-memory change without advancing rcv_nxt. + +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 + +// Free one skb, then force an outbound packet so the current advertised +// window is observable both on the wire and via TCP_INFO. + +0 read(4, ..., 10000) =3D 10000 + +0 write(4, ..., 1) =3D 1 + * > P. 1:2(1) ack 11024 win 84 + +0 %{ assert (tcpi_rcv_wnd >> 10) =3D=3D 84, tcpi_rcv_wnd }% + +// Queue a tiny OOO skb. This should not create fresh sender-visible credit +// on the next ACK after the first post-drain window update. + +0 < P. 12024:12025(1) ack 2 win 257 + * > . 2:2(0) ack 11024 win 84 + +0 %{ assert (tcpi_rcv_wnd >> 10) =3D=3D 84, tcpi_rcv_wnd }% --=20 2.43.0