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=iclj/svc; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 74C165A0619 for ; Fri, 17 Oct 2025 01:59:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1760659157; bh=4y+neWdMwLBXroEVb/2Qfgg99jj0216wDpuIY2n2v8Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iclj/svczy4pmk+aB/ArszqCqp5ZN3Jaht8F1F4+jOrHNoLwE3QOtmHtH/8ulrY4z VTD4yQn4MYIQ9Hpyl3b+7Jk2fW749aK+ft1GMkWdz2Tked+uidt3O8BRKaLnLkh3Bb RAOt3P1iyHkW5d5G1+ncIUicgsoq30gfuSLFxP1KBR+ikt5dZJyGDzJ9gIYaRVzdqO jOIt6rm/+8ZmJUDuDe27NL5j+3mW+KL9wZfI8jtzGo1qUi+lR0UN8E0q4oX3hVtlVp LuEmwjuU1S3rJbMPQRKbDXSye3KQJAO6bvvdA8NLJZdyV99fhJHxiLq2P3H0pAGEln QxygkKJpun0cg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cnlKx3mCRz4wCx; Fri, 17 Oct 2025 10:59:17 +1100 (AEDT) Date: Fri, 17 Oct 2025 10:59:13 +1100 From: David Gibson To: Yumei Huang Subject: Re: [PATCH v4 4/4] tcp: Update data retransmission timeout Message-ID: References: <20251016023423.8923-1-yuhuang@redhat.com> <20251016023423.8923-5-yuhuang@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dQYXmxDzRqVkRzMp" Content-Disposition: inline In-Reply-To: <20251016023423.8923-5-yuhuang@redhat.com> Message-ID-Hash: URJY4WIGWQVUNOISHPU4BUBTAUGRVXR6 X-Message-ID-Hash: URJY4WIGWQVUNOISHPU4BUBTAUGRVXR6 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: --dQYXmxDzRqVkRzMp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 16, 2025 at 10:34:23AM +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 Except for some minor English clarity notes below. > --- > tcp.c | 25 ++++++++++--------------- > 1 file changed, 10 insertions(+), 15 deletions(-) >=20 > diff --git a/tcp.c b/tcp.c > index 3003333..3254d67 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -179,16 +179,12 @@ > * > * 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. It's t= he > + * starting timeout for the first retry. For clarity, I'd suggest: This is the timeout for the first retry, in seconds. > If this persists for more than > + * allowed times in a row, reset the connection I'd suggest: 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 +338,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 > @@ -589,13 +584,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 --dQYXmxDzRqVkRzMp Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjxhtAACgkQzQJF27ox 2Gf0HA/+PB8r9ry43ex9yLPG8AJeagxD015mCNVFv4o/7ZtA0FX5Fr6Gd3MFzp/W OEx3M5pwfpRlj8rHCzsSw0fKqWW7CJ9meaPT6D10K4cgWJ3K+Ad5gB2K2KZjR0P0 S9GpSKkFDc/7U068ZsNK8IKC7PPHkihmepS2EXzoaLngC+/WobJvYz7QXyOunwNC X1DOZxXE9B42K//ReBH/3hgmCfqfaAiFOBBQtwHq5MOtwc87Ke8bbdNHf2t3FkXe A7aNsDUPBR09emWRfVGuM13Xbn+LW+XNIDDLeq8BuuYnWte+/4xjgAOz1iNzvR9z TG8DvMMg7vrUsZbZCh9U3TwkOSABQSoXxMRp+pdb8C8aiTIhTmA5CVuVZ/Jny3lQ vQBX12RmvFAr7hhUKoK/WPodqa7x5jWVNJLoPkM02dqD9XeaMzmx2zSY9sbamysw QHhrVi3n5oY9/mvncEmr5aYygXhSesyi0SZOvy7HJq3uU0jGO8jgSxCHqVTtOB2m o9hh/oQAmEgNQ0v06dzKs67PVBV6MuG/K3MWo71ufCuiBq34UaR1lYK7XEjDqhZY 70J34hQQ6uEJNofrg90LqegeNt4GjSgqv4KhwS80habcqzyTsJ3SCPmVdDeZe/yK UWUWhXGPJR32ABSVysVF0ccwNJ0GQPK12iLcdCPVy3LEcJ/73lc= =cQ2n -----END PGP SIGNATURE----- --dQYXmxDzRqVkRzMp--