From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.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 CD03B3AC0C2 for ; Tue, 24 Mar 2026 06:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332266; cv=none; b=rjVhWTXhJH//XfKZWDrvpzlj+4t1zr8TK4YWS6qQOsoNc17ZLb1TQfDQ1k/rjGD5AhvrVWRGWw4VWaEUqAAzELLT3tesIuX1W04cLpQjgYH4j3sm9k4J+cObt0Qh5A0vnoYii3j3t/Bg+hafxiOVyXGQUmaQMmMmGD1sdyRxH2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774332266; c=relaxed/simple; bh=26i1VlGHPVJPO2ACFKcL2SsSaS2lRM1qcERjVWdSklM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BIPba6Vsdiz1Prb8fR3i4qEtD/tGTPVKa01B9sU9F4J/9RvZj547t2IWd8FUts7YK17Ytsdh/ZovGPtUF64yrZZbFiOXX/GliOlyLlIbgsH7tT2GoLjyZFc9SINe6QI2tV0IOBk4cg3UDvUFiatYcegO0c//tk5HPyYnhc5NQjU= 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=DNUZPI81; arc=none smtp.client-ip=209.85.210.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="DNUZPI81" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-7d7e565c877so2006431a34.3 for ; Mon, 23 Mar 2026 23:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774332263; x=1774937063; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=eXxXF6JthqgVazDRt0dSHWifir8Ryp7bwwT8LqL/1Pc=; b=DNUZPI814vvOqSP6oHM1c6Vdxeze9ClyuecM/lPFExXJd9zWf9rfEdsFFFJ/zEU4ti woWF0QP24I+KGCXk9A/H7k7cIQ6TzceEsw2qs7hTyNQQkriIkjX5a7zugceNF7d3s3W3 t4hbJPxSAV1d6KO0gC4WOuk70ROmjlsAA5PL47GTT7qCS1KtKDId1C8pa+wZpJsiF71s 4Ih3swUYSA9hk+tIlQaCvl0ZwjWxQ0XNrPMp+3iEhHyFQp2u+Gr0vLOsP6mWVymO+5tV Hjyx/l6d/vjak84Nt0nNneH8wKlZUTp58XywtNbueSd956U8tq6+X30g9Nuq2W+lXuPL GQ+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774332263; x=1774937063; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eXxXF6JthqgVazDRt0dSHWifir8Ryp7bwwT8LqL/1Pc=; b=ftIc0WLs72JYDUD+cCbp+ytV0H6g9zpnXAI3RWVWMFktYGvzkLkvTbKXayWjBCs+zm UooFteYQUvCsSWJ+K3wczx1Dbihx3SXxn/TVZXrksaraBxVtQQAhnhb6aiVppyj9SgIy 9sdP2tZa1L5CkUdA9Ij5SX2MBcqgqyFcqxW5MireNtGn8CcUOZlqkCmuAH/8u7ARWfUo 71HjFs4IwbprfpqihQdEUZEn9w8suyRv4LI+CO4zFo0ZXSlMU3KtNVed26Vgr9SjIoMM CKj5pdsSD/vO81M99ihOGTUjl8TvI/eolfSx0ij59ceVLRY3S1RJVGsUwOrueHa8puEn MlUA== X-Forwarded-Encrypted: i=1; AJvYcCXsgSFeJ8eziG3/Ily+QUZfE5Fa81pSsFs7NbMSgESAYQ6V0RpDNHKxiYcNvUK5KNMEIdXGMoY1FbjTE4s=@vger.kernel.org X-Gm-Message-State: AOJu0YyqfWr53HMtT8pb6GJj2RhWz5gyzZlg9rEqs49x4D7O0s7pRj7Z WtgnB8OU7vlJON5YmqDbAbBE4NSO+NzvjsaJ7R87yU1Z0Fd4b+Y+fyXO X-Gm-Gg: ATEYQzxe32JAFrdgAnz/IXHEfw58AGgc0R+lRXc0QF6TrIIaE2ESCesWIfPdSePYb+t CmpbPMASOhfIBcoeNePdHF+je2vGvWK/cH/0dTEkkHkXTwsyQBErsRR+uROBdqMInNgNa5Cli8e cZWRNaS14AVMtubx8ID0hZQGYUj1ReFzuk4GXP8Vx3SYdV9vpSgrhsUmvysYkEbme8Q3N64/YMZ 8iZw3S1rJEHHUYup4TunNBeQZnSq7An5wabMd2jDTzZjtmiFQrhfGWh+tOjBIujWir+LhoCdu2A pcQbr1CdaLYN3ADSOdayp/EQ22a6A+dCOixU/+KWf+A3DFhcf4H89jw4lW+q6NkFrsa1rD168bn O1EY2GYsNMhmP6IBrxH3OMHINhwQrvoiGIpcG/u78EEyvsGRDbOEa8ElvxKtFo5PI9MGQ/2KP1N x6ZsBWLSm2jkx3csQQhAharRcWglrVMU84/jY5OXJMUQqryRsTlhEpHcJH3YXtf1tlCoxXWMgT8 CPwCUsHtf39boDo9OeJ8/NDdDI3vTYGeFuBi1V1Tw== X-Received: by 2002:a05:6830:4118:b0:7d9:ad99:9ff0 with SMTP id 46e09a7af769-7d9ad99a072mr6395542a34.30.1774332262611; Mon, 23 Mar 2026 23:04:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 23:04:22 -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 0/3] tcp: fix scaled no-shrink rwnd quantization slack Date: Tue, 24 Mar 2026 00:04:07 -0600 Message-ID: <20260324060410.1137199-1-atwellwea@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, this v2 addresses the review on the earlier quantization series. Simon was right that the original 3/3 only showed the explicit rcv_ssthresh-limited ALIGN-up behavior. For v2, 3/3 is replaced with an OOO-memory-based reproducer that first grows rcv_ssthresh with in-order data and then drives raw backed free_space below rcv_ssthresh without advancing rcv_nxt. In the instrumented old-behavior run that shaped this test, the critical ACK reached free_space=86190, rcv_ssthresh=86286, and still advertised 87040 (85 << 10). With 2/3 applied, the same ACK stays at 84. That follow-up also clarified why the broader 2/3 change is required. A narrower variant that preserved the old rcv_ssthresh-limited ALIGN-up behavior was not sufficient: earlier ACKs still stored 85 in tp->rcv_wnd, and tcp_select_window() later preserved that extra unit because shrinking was disallowed. Keeping tp->rcv_wnd representable across the scaled no-shrink path is what lets later ACKs settle at the correct wire-visible edge. Problem ======= In the scaled no-shrink path, __tcp_select_window() rounds free_space up to the receive-window scale quantum: window = ALIGN(free_space, 1 << tp->rx_opt.rcv_wscale); When raw backed free_space sits just below the next quantum, that can expose fresh sender-visible credit that is not actually backed by the current receive-memory state. Approach ======== This repost keeps only the part with a clear fail-before/pass-after story today: - relax one unrelated packetdrill test which was pinning an incidental advertised window - keep tp->rcv_wnd representable in scaled units by rounding larger windows down to the scale quantum - preserve only the small non-zero case that would otherwise scale away to zero; changing that longstanding non-zero-to-zero behavior would be a separate change from the bug proven here - prove the actual raw-free_space case with a packetdrill sequence that reaches free_space < rcv_ssthresh without changing SO_RCVBUF after the handshake Tests ===== Local validation: - git diff --check - checkpatch on the touched diff - local vmksft targeted run of net/packetdrill:tcp_rcv_quantization_credit.pkt passes with this series applied for ipv4, ipv6, and ipv4-mapped-ipv6 - the same packetdrill fails on HEAD without 2/3 with: expected: win 84 actual: win 85 Changes in v2 ============= - leave 1/3 unchanged - rename gran to granularity in 2/3 - clarify in 2/3 why representable tp->rcv_wnd state is required across later no-shrink transitions - clarify in 2/3 that the smaller longstanding non-zero case remains intentionally unchanged in this series - replace 3/3 with the proven OOO-memory reproducer for the raw free_space case - drop the IPv4-only restriction in 3/3 after validating the test on the default packetdrill protocol set Series layout ============= 1/3 selftests: packetdrill: stop pinning rwnd in tcp_ooo_rcv_mss 2/3 tcp: keep scaled no-shrink window representable 3/3 selftests: packetdrill: cover scaled rwnd quantization slack Thanks, Wesley Atwell --- net/ipv4/tcp_output.c | 16 +++++++++++----- .../selftests/net/packetdrill/tcp_ooo_rcv_mss.pkt | 8 +++++--- .../packetdrill/tcp_rcv_quantization_credit.pkt | 62 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 8 deletions(-) -- 2.43.0