From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id CE25F5A061E; Thu, 04 Dec 2025 08:45:42 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 5/8] tcp: Don't limit window to less-than-MSS values, use zero instead Date: Thu, 4 Dec 2025 08:45:38 +0100 Message-ID: <20251204074542.2156548-6-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251204074542.2156548-1-sbrivio@redhat.com> References: <20251204074542.2156548-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: AI5DXDXRGJFA4CR3USGWEFT4NDOFYR4B X-Message-ID-Hash: AI5DXDXRGJFA4CR3USGWEFT4NDOFYR4B X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Max Chernoff , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If the sender uses data clumping (including Nagle's algorithm) for Silly Window Syndrome (SWS) avoidance, advertising less than a MSS means the sender might stop sending altogether, and window updates after a low window condition are just as important as they are in a zero-window condition. For simplicity, approximate that limit to zero, as we have an implementation forcing window updates after zero-sized windows. Signed-off-by: Stefano Brivio --- tcp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tcp.c b/tcp.c index fbf97a0..2220059 100644 --- a/tcp.c +++ b/tcp.c @@ -1140,6 +1140,18 @@ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn, else limit = SNDBUF_GET(conn) - (int)sendq; + /* If the sender uses Nagle's algorithm to prevent Silly Window + * Syndrome (SWS, RFC 813 Section 3) it's critical that, should + * the window ever become less than the MSS, we advertise a new + * value once it increases again to be above it. + * + * To this end, for simplicity, approximate a window value below + * the MSS to zero, as we already have mechanisms in place to + * force updates after the window becomes zero. + */ + if (limit < MSS_GET(conn)) + limit = 0; + new_wnd_to_tap = MIN((int)tinfo->tcpi_snd_wnd, limit); } -- 2.43.0