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=202510 header.b=qNu1RAWC; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 9AAE15A026F for ; Wed, 22 Oct 2025 03:19:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1761095976; bh=vfcBmzG2Vps1pOhJ8T3iLDdfO3pG1rHLlzfPurxG3VE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qNu1RAWCVAC9FNP/YcOHRiqfXdsrFyRA++OKVbhN/NEDcz8J/GAEXMx9xn1ccIAlZ p3b/SRJ7YlTX2IsbFkYkeDz9DnRJEo3D82gq7a4+N5F1p99YiQR05x0CBkDs6k74rX dEAVjyidGnZ1cYb2LqQvnSNC+FsW94Gw4SR9tYaifykKTDGwp5y2GpIk5lEX7w5FpT pM9g2f2JBnSkTeF73KSAVyEASDAgW3I8YwriiyT71MfUvnOfa0relXEUa0UqZZ94U8 4sLDz0wBiY289s70BDvvbKFnWDdsO/Y7Tp5RpN+522E6owDfriojmW6ycMpo6CkNnC b2bdSPDZOnq6g== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4crrtJ3qH6z4wB8; Wed, 22 Oct 2025 12:19:36 +1100 (AEDT) Date: Wed, 22 Oct 2025 12:19:30 +1100 From: David Gibson To: Yumei Huang Subject: Re: [PATCH v6 4/4] tcp: Update data retransmission timeout Message-ID: References: <20251017062838.21041-1-yuhuang@redhat.com> <20251017062838.21041-5-yuhuang@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ET+4cyLCxPtJ53Nq" Content-Disposition: inline In-Reply-To: <20251017062838.21041-5-yuhuang@redhat.com> Message-ID-Hash: PJYGKDCZL6PP4M3K4LT5VRYMGFMULEZ5 X-Message-ID-Hash: PJYGKDCZL6PP4M3K4LT5VRYMGFMULEZ5 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: passt-dev@passt.top, sbrivio@redhat.com 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: --ET+4cyLCxPtJ53Nq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 17, 2025 at 02:28:38PM +0800, Yumei Huang wrote: > Use an exponential backoff timeout for data retransmission according > to RFC 2988 and RFC 6298. Set the initial RTO to one second as discussed > in Appendix A of RFC 6298. >=20 > Also combine the macros defining the initial RTO for both SYN and ACK. >=20 > Signed-off-by: Yumei Huang > Reviewed-by: David Gibson Still LGTM. Stefano has more or less convinced me that clamping the maximum backoff time is worthwhile, but that can easily be a later patch rather than respinning. > --- > tcp.c | 27 ++++++++++++--------------- > 1 file changed, 12 insertions(+), 15 deletions(-) >=20 > diff --git a/tcp.c b/tcp.c > index 9385132..dc0ec6c 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -179,16 +179,14 @@ > * > * Timeouts are implemented by means of timerfd timers, set based on fla= gs: > * > - * - SYN_TIMEOUT_INIT: if no ACK is received from tap/guest during hands= hake > - * (flag ACK_FROM_TAP_DUE without ESTABLISHED event) within this time,= resend > - * SYN. It's the starting timeout for the first SYN retry. If this per= sists > - * for more than TCP_MAX_RETRIES or (tcp_syn_retries + > - * tcp_syn_linear_timeouts) times in a row, reset the connection > - * > - * - ACK_TIMEOUT: if no ACK segment was received from tap/guest, after s= ending > - * data (flag ACK_FROM_TAP_DUE with ESTABLISHED event), re-send data f= rom the > - * socket and reset sequence to what was acknowledged. If this persist= s for > - * more than TCP_MAX_RETRIES times in a row, reset the connection > + * - RTO_INIT: if no ACK segment was received from tap/guest, either dur= ing > + * handshake (flag ACK_FROM_TAP_DUE without ESTABLISHED event) or after > + * sending data (flag ACK_FROM_TAP_DUE with ESTABLISHED event), re-sen= d data > + * from the socket and reset sequence to what was acknowledged. This i= s the > + * timeout for the first retry, in seconds. If this persists too many = times > + * in a row, reset the connection: TCP_MAX_RETRIES for established > + * connections, or (tcp_syn_retries + tcp_syn_linear_timeouts) during = the > + * handshake. > * > * - FIN_TIMEOUT: if a FIN segment was sent to tap/guest (flag ACK_FROM_= TAP_DUE > * with TAP_FIN_SENT event), and no ACK is received within this time, = reset > @@ -342,8 +340,7 @@ enum { > #define WINDOW_DEFAULT 14600 /* RFC 6928 */ > =20 > #define ACK_INTERVAL 10 /* ms */ > -#define SYN_TIMEOUT_INIT 1 /* s */ > -#define ACK_TIMEOUT 2 > +#define RTO_INIT 1 /* s, RFC 6298 */ > #define FIN_TIMEOUT 60 > #define ACT_TIMEOUT 7200 > =20 > @@ -588,13 +585,13 @@ static void tcp_timer_ctl(const struct ctx *c, stru= ct tcp_tap_conn *conn) > } else if (conn->flags & ACK_FROM_TAP_DUE) { > if (!(conn->events & ESTABLISHED)) { > if (conn->retries < c->tcp.syn_linear_timeouts) > - it.it_value.tv_sec =3D SYN_TIMEOUT_INIT; > + it.it_value.tv_sec =3D RTO_INIT; > else > - it.it_value.tv_sec =3D SYN_TIMEOUT_INIT << > + it.it_value.tv_sec =3D RTO_INIT << > (conn->retries - c->tcp.syn_linear_timeouts); > } > else > - it.it_value.tv_sec =3D ACK_TIMEOUT; > + it.it_value.tv_sec =3D RTO_INIT << conn->retries; > } else if (CONN_HAS(conn, SOCK_FIN_SENT | TAP_FIN_ACKED)) { > it.it_value.tv_sec =3D FIN_TIMEOUT; > } else { > --=20 > 2.47.0 >=20 --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --ET+4cyLCxPtJ53Nq Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmj4MSIACgkQzQJF27ox 2GeSIw/9HpZrQDUxfKs1BLmkciH0viHGee5xhi5H+7IVVg9NtUE+iJcDTRtDepH/ 79ht238ioH8C6RMRPzFu/dcwXVAfe0qpgcEOaE+IsELQtx4ttAlpAygJNVUrbUwV FXKYKZLiRobb/lSWz/7P7H0I0Zrl/w00+jWe7fubVpj8cJ/I8M5VnllJ//maez1y sFTkbZqtonS3nEWuZ9kdou5B4nYRFRTt/jfCp6Ta3mFHvSfiphKLDRYzOFRqIwUR c1CKJ/J+HEjLR+u0fMydETnRk/RYcksrHU+11crqL5TJkAkWeqyp9ZId/n42b1xp /1K5mjjGzyg0LpDB21HzG1ls2ziLHGS2hkTWxbKlrPaPZYtoLDjisgePqGMp9BEb GA6C0Tl5wMCxgHzXKno5Su8zm4OrJOH6jrOEeHUPPU0Gi7N7QyibnOPz2tK98C1n RQgBSa4JVNQVIyGSH2OflHqBVbKpy6Du9XGQpjJErjS26Hp/s3vlTSDCsaG7CzMe 5f2P7OZ5MyYtbLC9FCMrzCCtL0iWxrQu6H/QCDh1C1iXigqWSM+Q+lRKL6x4rTUk 54JX4ZVGLKqQifLK+PWQvMDsqviZo59f4vW5DQKi3oe1g+y0gbwePvIVZwU6ClBx Ff6jdi6jlKfnrieQYKkzod+4aARHETcSynM1o3uk7ohD2MNv3k4= =yLwx -----END PGP SIGNATURE----- --ET+4cyLCxPtJ53Nq--