From nobody Tue Apr 7 02:40:31 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