From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202408 header.b=DfCqjKvp; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id AFC995A0281 for ; Fri, 13 Sep 2024 06:32:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1726201936; bh=bQqCeF269NDcBlHwT+7Zt/jNNHVKinjLNQe7VbI8+xE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DfCqjKvpXjyPNEft7iCJFkQadF5N7j9lM3wTXXeJRCld4DzWsGCiLTsOzw5v/VkpS jviWZ9o7M7TiIl9GgvrBox71TQHkf8/BoyHcRdjbzvAh0HOBB9zB4ED7EJc94VpZxM 74sScSWGmoWATJmRxvTbHqC05+CZ6OB2TR2ygOcfHiFt5AX5evswqki7GCc4ZIJcdL Jp5RGX7EN3EL6JKG579hefVCsbhHQZ0eiquJw5IZEezSMwvtCmCPivbve7qW3kgwjs xf5g8KGV+DtuexVZRylmaTsgDreI7wbzzA0cjxVOljeNu6BSiBXqbW09Vw0DwxHvXp t+m9sua3qbryA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4X4hH45lGQz4xQP; Fri, 13 Sep 2024 14:32:16 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 05/10] tcp: On socket EPOLLOUT, send new ACK to tap immediately Date: Fri, 13 Sep 2024 14:32:09 +1000 Message-ID: <20240913043214.1753014-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240913043214.1753014-1-david@gibson.dropbear.id.au> References: <20240913043214.1753014-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: CIGMXZGFWUUNCO36R324Q635YL52DHXA X-Message-ID-Hash: CIGMXZGFWUUNCO36R324Q635YL52DHXA X-MailFrom: dgibson@gandalf.ozlabs.org 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: 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: When the guest sends data on a TCP connection, it's possible that we run out of buffer space on the socket side. If that happens we'll advertise a zero window to the guest stopping it from sending. When the socket side buffer clears again, which is signalled by an EPOLLOUT, we recalculate the ack and window with tcp_update_seqack_wnd(). tcp_update_seqack_wnd() only calculates the new values, it doesn't actually send out the ack - that will typically happen some milliseconds later on the ACK_TO_TAP_DUE timer. AFAICT, there's not really any point delaying this ack though, we might as well send it and get the guest sending again ASAP. So, instead of calling tcp_update_seqack_wnd() call tcp_send_flag() to send an immediate ACK if needed. Signed-off-by: David Gibson --- tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp.c b/tcp.c index ee894c5c..32e45e09 100644 --- a/tcp.c +++ b/tcp.c @@ -2240,7 +2240,7 @@ void tcp_sock_handler(const struct ctx *c, union epoll_ref ref, tcp_data_from_sock(c, conn); if (events & EPOLLOUT) - tcp_update_seqack_wnd(c, conn, false, NULL); + tcp_send_flag(c, conn, ACK_IF_NEEDED); return; } -- 2.46.0