public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Jon Maloy <jmaloy@redhat.com>
To: passt-dev@passt.top
Subject: Re: [PATCH v3] tcp: Limit fast retransmit to one per loss event
Date: Fri, 20 Nov 2026 14:48:48 -0500	[thread overview]
Message-ID: <7875d8c3-7d95-4986-a2f5-2c4a8618f328@redhat.com> (raw)
In-Reply-To: <20261120173756.2000624-1-anskuma@redhat.com>



On 2026-11-20 12:37, Anshu Kumari wrote:
> Every duplicate ACK unconditionally triggered a fast retransmit,
> even when the ACK sequence hadn't advanced.
> 
> Guard fast retransmit on !conn->retries, and increment retries
> after the first retransmit. This is a quick fix to stop the
> amplification storm. Full compliance with RFC 5681 Section 3.2
> (three duplicate ACKs) is left to a later patch.
> 
> Link: https://bugs.passt.top/show_bug.cgi?id=224
> Signed-off-by: Anshu Kumari <anskuma@redhat.com>
> ---
>   tcp.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tcp.c b/tcp.c
> index 95f4f3e1..d3d65f76 100644
> --- a/tcp.c
> +++ b/tcp.c
> @@ -2082,7 +2082,9 @@ static int tcp_data_from_tap(const struct ctx *c, struct tcp_tap_conn *conn,
>   
>   	tcp_tap_window_update(c, conn, max_ack_seq_wnd, now);
>   
> -	if (retr) {
> +	if (retr && !conn->retries) {
> +		conn->retries++;
> +
>   		flow_trace(conn,
>   			   "fast re-transmit, ACK: %u, previous sequence: %u",
>   			   conn->seq_ack_from_tap, conn->seq_to_tap);
> @@ -2443,7 +2445,9 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af,
>   			tcp_update_seqack_from_tap(c, conn, ntohl(th->ack_seq),
>   						   now);
>   
> -		if (retr) {
> +		if (retr && !conn->retries) {
> +			conn->retries++;
> +
>   			flow_trace(conn,
>   				   "fast re-transmit, ACK: %u, previous sequence: %u",
>   				   ntohl(th->ack_seq), conn->seq_to_tap);

This looks correct to me, and matches what Stefano suggested for v2.
Two minor things:

- Missing changelog for v3 below the '---' line.

- In the TAP_FIN_RCVD path, tcp_data_from_sock() is still called if
   'retr' is set but we skip the retransmission because conn->retries
   is non-zero. It's probably harmless (no rewind, so we just send
   what the window allows), but it might be cleaner to fold the
   !conn->retries check into 'retr' there, so that both uses agree.

It might also be worth mentioning in the commit message that, as we
now account a fast retransmit in conn->retries, the next RTO is
doubled (tcp_timer_ctl() uses it as backoff exponent), and the
retransmission counts towards TCP_MAX_RETRIES.

With or without those changes:

Reviewed-by: Jon Maloy <jmaloy@redhat.com>


  reply	other threads:[~2026-11-20 19:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 17:37 Anshu Kumari
2026-11-20 19:48 ` Jon Maloy [this message]
2026-11-20 20:18 ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7875d8c3-7d95-4986-a2f5-2c4a8618f328@redhat.com \
    --to=jmaloy@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).