From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 861AB5A026E for ; Fri, 27 Nov 2026 22:07:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795813650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=utzirkpV3wn73/aaCO9b7C52+gXw1GSQZS+XEOaQG9o=; b=W0ztDg6ibH/UdnMIWbB5ZHJkgIEz+GxiAPnO55/j3K/3WfXKQ5w/l9O1DY62uaa+1EkuOM BDasiS+clZ6kMgXZmgdcQLUUFsCK6xP5Npzvvj2Jj4lBxzzRjJ1YnQSFDhHTR/X15gSYA+ 0uzxwBlYEEq87SN2B05xa/E+O49LeZk= Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-djLgDZlmMDWmi56gCnniRA-1; Fri, 27 Nov 2026 21:07:28 +0000 X-MC-Unique: djLgDZlmMDWmi56gCnniRA-1 X-Mimecast-MFC-AGG-ID: djLgDZlmMDWmi56gCnniRA_1795813648 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-8b3ad09ad82so109993667b3.3 for ; Fri, 27 Nov 2026 13:07:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795813648; x=1796418448; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=utz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Tg76/HuKgFX ncdBA8UuolLd4MqqeONlGjiO6Z4euBpf564mBpnlTZLp26z51tIpMntYR5EYcjHEIZsS41/gaSR gaGbgtfPI7x6D+Vq2RVrkEfEhoJMYOIj5L60rmFxNA X-Received: by 2002:a05:690c:905:b0:8b4:dfc2:bea3 with SMTP id 00721157ae682-8b5204e9094mr127277417b3.50.1795813647891; Fri, 27 Nov 2026 13:07:27 -0800 (PST) X-Received: by 2002:a05:690c:905:b0:8b4:dfc2:bea3 with SMTP id 00721157ae682-8b5204e9094mr127277217b3.50.1795813647325; Fri, 27 Nov 2026 13:07:27 -0800 (PST) Received: from [192.168.2.15] (lnsm6-montreal02-142-122-43-105.internet.virginmobile.ca. [142.122.43.105]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b5202fb08csm97130987b3.24.2026.11.27.13.07.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Nov 2026 13:07:26 -0800 (PST) Message-ID: <6a6f9609-1fa7-4c51-971b-04133373d1c7@redhat.com> Date: Fri, 27 Nov 2026 16:07:25 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] tcp: Limit fast retransmit to one per loss event To: Anshu Kumari , passt-dev@passt.top, sbrivio@redhat.com, ada.urbaniec+bugzilla@gmail.com References: <20261127175848.664310-1-anskuma@redhat.com> From: Jon Maloy In-Reply-To: <20261127175848.664310-1-anskuma@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: _M7LioX64ToXqW9NdrTM__g12W4jGOLjaEOR8yuKKUo_1795813648 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: USCLNIKMWEHCW3C477T4MJIN34ETQARJ X-Message-ID-Hash: USCLNIKMWEHCW3C477T4MJIN34ETQARJ X-MailFrom: jmaloy@redhat.com 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: Ada Urbaniec 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: On 2026-11-27 12:58, 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. > > As a fast retransmit is now accounted in conn->retries, the next > retransmission timeout is doubled (tcp_timer_ctl() uses conn->retries > as backoff exponent). > > Link: https://bugs.passt.top/show_bug.cgi?id=224 > Reported-by: Ada Urbaniec > Signed-off-by: Anshu Kumari > --- > v4: > - Move !conn->retries into the retr check in TAP_FIN_RCVD > - Add previous ACK/window snapshots in TAP_FIN_RCVD > - includes Reported-by > > --- > tcp.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/tcp.c b/tcp.c > index 95f4f3e1..f327e62e 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); > @@ -2417,6 +2419,8 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, > > /* Established connections not accepting data from tap */ > if (conn->events & TAP_FIN_RCVD) { > + uint32_t prev_ack = conn->seq_ack_from_tap; > + uint16_t prev_wnd = conn->wnd_from_tap; > bool fin_only, retr; > size_t dlen; > > @@ -2432,7 +2436,7 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, > fin_only = (conn->events & TAP_FIN_SENT) && > conn->seq_to_tap == conn->seq_ack_from_tap + 1; > > - retr = th->ack && !th->fin && !fin_only && > + retr = th->ack && !th->fin && !fin_only && !conn->retries && > ntohl(th->ack_seq) == conn->seq_ack_from_tap && > ntohs(th->window) == conn->wnd_from_tap; > > @@ -2444,6 +2448,8 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, > now); > > if (retr) { > + conn->retries++; > + > flow_trace(conn, > "fast re-transmit, ACK: %u, previous sequence: %u", > ntohl(th->ack_seq), conn->seq_to_tap); > @@ -2452,8 +2458,10 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, > return -1; > } > > - if (tcp_tap_window_update(c, conn, ntohs(th->window), now) || > - retr) > + if (tcp_tap_window_update(c, conn, ntohs(th->window), now) && > + (retr || > + prev_ack != conn->seq_ack_from_tap || > + prev_wnd != conn->wnd_from_tap)) > tcp_data_from_sock(c, conn, now); This looks correct to me: tcp_tap_window_update() updates wnd_from_tap before the comparison, and seq_ack_from_tap was already updated above. But the reason for this change isn't obvious from the code, nor from the commit message. It fixes the half-close case Ada reported, because tcp_data_from_sock() re-arms the retransmission timer via conn_flag(), so periodic duplicate ACKs would delay retransmissions indefinitely. I suggest you add a short comment about this here, a well as paragraph about it in commit message. With the comment and commit message updated: Reviewed-by: Jon Maloy