From 28f413d0332c923f1a4a7a05359d90116cbcb4a3 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 3 Dec 2025 20:13:05 +0100 Subject: tcp: Don't clear ACK_TO_TAP_DUE if we're advertising a zero-sized window We correctly avoid doing that at the beginning of tcp_prepare_flags(), but we might clear the flag later on if we actually end up sending a "flag" segment. Make sure we don't, otherwise we might delay window updates after a zero-window condition significantly, and significantly affect throughput. In some cases, we're forcing peers to send zero-window probes or keep-alive segments. Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --- tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcp.c b/tcp.c index 4a886ae..d91db22 100644 --- a/tcp.c +++ b/tcp.c @@ -1282,7 +1282,8 @@ int tcp_prepare_flags(const struct ctx *c, struct tcp_tap_conn *conn, th->fin = !!(flags & FIN); if (th->ack) { - if (SEQ_GE(conn->seq_ack_to_tap, conn->seq_from_tap)) + if (SEQ_GE(conn->seq_ack_to_tap, conn->seq_from_tap) && + conn->wnd_to_tap) conn_flag(c, conn, ~ACK_TO_TAP_DUE); else conn_flag(c, conn, ACK_TO_TAP_DUE); -- cgit v1.2.3