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=202508 header.b=ugQAXa+T; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id D1A7E5A026F for ; Thu, 02 Oct 2025 05:00:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1759374025; bh=LrMAuiFXojdAlcdrnWg+hSXKDF4jpjjhUHDqBKQw32M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ugQAXa+TnMkHJXGfl8NDmBOBDh7Hmme310YrE9bDft04R01P7kvoKIlNcQkIB5wfM sg5Y0FJU5W5Lax2Qe2iggva+OUt8jZgo4AlgzqPueuAyzvgIm1svOEUhY2kzJTgx20 HpUw+kmzBSaqseNygn/f3e5Kchoa2OY0XLHbHMRxSsIUjXI2fHTks0/dvFriai7fw8 lJaFsEM4ryLqYyHn0iRaRHSVlKigiI/fSndZQ7qdYM07YrhARwXsf/vqcA9d7sW3fh P0iQ5WAUyuEUXN4MUeTBE6iWKpuDOTUYVoq9EW8TbXcqpRMA+c6KaxUERJjmv3kEFr i46kIyVOabINQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ccc3s4ztMz4wC3; Thu, 2 Oct 2025 13:00:25 +1000 (AEST) Date: Thu, 2 Oct 2025 13:00:21 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 4/4] tcp: On partial send (incomplete sendmsg()), request a retransmission right away Message-ID: References: <20251002000646.2136202-1-sbrivio@redhat.com> <20251002000646.2136202-5-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ts4nB43NCjUNTZA/" Content-Disposition: inline In-Reply-To: <20251002000646.2136202-5-sbrivio@redhat.com> Message-ID-Hash: 2B2WUXV6UEPF3KUTLSHPCHZEDCBS3L55 X-Message-ID-Hash: 2B2WUXV6UEPF3KUTLSHPCHZEDCBS3L55 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 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: --ts4nB43NCjUNTZA/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 02, 2025 at 02:06:46AM +0200, Stefano Brivio wrote: > ...possibly with an updated window value. As we're discarding the > remaining data, we'll need to receive it again. If we don't request > a retransmission immediately, we'll see an apparent gap in the > sequence, and request a retransmission on the next data batch or > segment, but we're just wasting time like that. In packets: >=20 > 28686 0.000007 88.198.0.164 =E2=86=92 93.235.151.95 16118 TCP 55414 =E2= =86=92 47080 [ACK] Seq=3D80501 Ack=3D141 Win=3D65536 Len=3D16064 [TCP segme= nt of a reassembled PDU] > 28687 0.000012 88.198.0.164 =E2=86=92 93.235.151.95 16118 TCP [TCP Wind= ow Full] 55414 =E2=86=92 47080 [ACK] Seq=3D96565 Ack=3D141 Win=3D65536 Len= =3D16064 [TCP segment of a reassembled PDU] >=20 > on this second data segment, we have a short sendmsg(), and >=20 > 28688 0.000026 93.235.151.95 =E2=86=92 88.198.0.164 54 TCP 47080 =E2=86= =92 55414 [ACK] Seq=3D141 Ack=3D90721 Win=3D32128 Len=3D0 >=20 > consequently acknowledge it, without requesting a retransmission, >=20 > 28689 0.000006 88.198.0.164 =E2=86=92 93.235.151.95 8866 HTTP HTTP/1.1 = 200 ok (text/css) >=20 > so the server proceeds sending a bit more, but >=20 > 28690 0.000016 93.235.151.95 =E2=86=92 88.198.0.164 54 TCP [TCP Dup ACK= 28688#1] 47080 =E2=86=92 55414 [ACK] Seq=3D141 Ack=3D90721 Win=3D32128 Len= =3D0 > 28691 0.000000 93.235.151.95 =E2=86=92 88.198.0.164 54 TCP [TCP Dup ACK= 28688#2] 47080 =E2=86=92 55414 [ACK] Seq=3D141 Ack=3D90721 Win=3D32128 Len= =3D0 >=20 > we'll throw that data (from frame #28689) away, and finally request > a retransmission as we spotted the gap now. >=20 > Request a retransmission as soon as we know we'll need it, instead. >=20 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > tcp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/tcp.c b/tcp.c > index 5a7a607..ae5e7a1 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -1876,7 +1876,7 @@ eintr: > } > =20 > out: > - if (keep !=3D -1) { > + if (keep !=3D -1 || partial_send) { > /* We use an 8-bit approximation here: the associated risk is > * that we skip a duplicate ACK on 8-bit sequence number > * collision. Fast retransmit is a SHOULD in RFC 5681, 3.2. > --=20 > 2.43.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 --ts4nB43NCjUNTZA/ Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjd6sQACgkQzQJF27ox 2GdhaxAAnhWP4t+9IUmWT+LRdVq6zMKWtO1Ut+Ip2dSU2Fz8aAYhRqxRy7NTWsA3 POInyZVMKDidKnPrYhPlNXfQ5+ZRm86fv8BDBR+SAztpluqghyhgnqaHn1czxn8D M7kbPUFQSMR0SUtRePqlmJkdE8gcen+y+ZIOC//omEoMbj3lwVUhSYT9XkgEv7F+ PHhYm/7ok2JTd07qljodKuYkK93pAc+V/6xlwLRWJnQQQCfMxFjorv6XhafJvusf pQq99sYZMu3kW8591UXfjLFGkGfXG8Uk6S4Did1cd17XghC6JpVPYLGM79HYDBKQ eDZivw2Xsr3XNPkp5TRJVdVNeXLSG7idscTqwZ5HmRtu8gjwPy+Dxw0VwPa9w23Y mQCo/K4lBz6s4RFu61Z8/QlNb/kOBTqf7bT8Bz6BIkiRBr+DCpyPQ4rMCdpTIXfx QH/lh3geLdk4lnqKoi14Obbsf8jUHdCZbZrLpu4MvbyUdZ0zINgTO1rICHBhQjIy BW/tLJw3q7kJGUangPDHV5Lk0RvbzaPWOJZsbDtj2bhHyNg1C/jkfwY4mrHM8pdr gyiq72GcK3xIeGOrk/ZHQkwVoqhb1/tQBCOGUuiJa5q0fysCv1iFnCQO+TN6GqRP vbn1iRg9hK2fSHyO4e4138qFG6GZqoQ4jm0bgA92CZidqtJim9M= =mJ0e -----END PGP SIGNATURE----- --ts4nB43NCjUNTZA/--