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.129.124]) by passt.top (Postfix) with ESMTPS id 6481C5A0269 for ; Fri, 20 Nov 2026 10:07:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795165637; 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=/5nnR0h63fRpt7fgjBsIdNY+nsysE2jFepyOUndVbmM=; b=N6Ja0cBw0ysI8nuhckmI2qfZJNNTeKkS/vHR6rlVweFYygDmtWwv9htOMUqgR7Bq6To1cn IaiQt+f7tFlq1jIdhz2bdC89XKnU6Au/SWICgwDbhAD23sJITDLw7vtKGo6hjvETGmB2n3 cMJRswhcwIOHFQqSVa29PdHvJcL1Yuc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-641-VP8FmckAOYqRKGCWa2jzgA-1; Fri, 20 Nov 2026 09:07:15 +0000 X-MC-Unique: VP8FmckAOYqRKGCWa2jzgA-1 X-Mimecast-MFC-AGG-ID: VP8FmckAOYqRKGCWa2jzgA_1795165634 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4ab855a8c21so526242f8f.1 for ; Fri, 20 Nov 2026 01:07:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795165634; x=1795770434; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=/5nnR0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HYuE5SrqMCs3K9XOko809KhHq1rgtv1t4jiWlpKbmhMdl9T+YxiWbWx8vBaT0khK1+kuQYnn IuwBbX7l6W X-Received: by 2002:a05:600c:3b88:b0:4a1:e672:5721 with SMTP id 5b1f17b1804b1-4bb8880789dmr54187275e9.13.1795165633986; Fri, 20 Nov 2026 01:07:13 -0800 (PST) X-Received: by 2002:a05:600c:3b88:b0:4a1:e672:5721 with SMTP id 5b1f17b1804b1-4bb8880789dmr54186565e9.13.1795165633363; Fri, 20 Nov 2026 01:07:13 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884b8429sm100760765e9.14.2026.11.20.01.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 01:07:12 -0800 (PST) From: Stefano Brivio To: Anshu Kumari Subject: Re: [PATCH v2] tcp: Limit fast retransmit to one per loss event Message-ID: <20261120100711.6df974db@elisabeth> In-Reply-To: <20261120074304.1698961-1-anskuma@redhat.com> References: <20261120074304.1698961-1-anskuma@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Fri, 20 Nov 2026 10:07:12 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: uZLoJUj2I7c8cjXIgAPFsUTAsEFq7cKXFedmMHg8h2U_1795165634 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: JF5R4FIX544HSGWOU5ULMQX5WX3L7EGD X-Message-ID-Hash: JF5R4FIX544HSGWOU5ULMQX5WX3L7EGD X-MailFrom: sbrivio@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+bugzilla@gmail.com, 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: On Fri, 20 Nov 2026 13:13:04 +0530 Anshu Kumari wrote: > Every duplicate ACK unconditionally triggered a fast retransmit, > even when the ACK sequence hadn't advanced. > > Add a dup_acks counter (as a union with retries) to > tcp_tap_conn and tcp_tap_transfer that gets incremented on the > first fast retransmit and cleared when the ACK sequence > advances. I still can't understand this part. Why do we need to do this in this patch? That is, in detail: > > 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 > --- > v2: > - added union for retries and dup_acks. > - removed retransmitting flag. > --- > tcp.c | 12 ++++++++---- > tcp_conn.h | 16 ++++++++++++---- > 2 files changed, 20 insertions(+), 8 deletions(-) > > diff --git a/tcp.c b/tcp.c > index 95f4f3e1..d205cd41 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -242,7 +242,7 @@ > * - consume buffer by difference between new ack_seq and @seq_ack_from_tap > * - update @seq_ack_from_tap from ack_seq in header > * - on two duplicated ACKs, reset @seq_to_tap to @seq_ack_from_tap, and > - * resend with steps listed above > + * resend with steps listed above, once per loss event > * > * - from tap/guest to socket: > * - on packet from tap/guest: > @@ -1263,7 +1263,7 @@ static void tcp_update_seqack_from_tap(const struct ctx *c, > if (SEQ_LT(seq, conn->seq_to_tap)) > conn_flag(c, conn, ACK_FROM_TAP_DUE, now); > > - conn->retries = 0; > + conn->dup_acks = 0; We're not actually counting them, so this isn't entirely true (and in any case not needed in this patch). > conn->seq_ack_from_tap = seq; > } > } > @@ -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->dup_acks) { This isn't about the number of duplicate ACKs. What I was suggesting in my draft patch on https://bugs.passt.top/show_bug.cgi?id=224 is: if (retr && !conn->retries) meaning: we have a request for fast retransmit, and we didn't retransmit yet. > + conn->dup_acks++; This isn't true either. We can't count them yet, with this patch. I think this should be conn->retries++ (or conn->retries = 1). > + > 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->dup_acks) { Same as above, I think this should be if (retr && !conn->retries). > + conn->dup_acks++; Same as above, I think this should be conn->retries++. > + > flow_trace(conn, > "fast re-transmit, ACK: %u, previous sequence: %u", > ntohl(th->ack_seq), conn->seq_to_tap); > diff --git a/tcp_conn.h b/tcp_conn.h > index 3173ddb9..ba175a3e 100644 > --- a/tcp_conn.h > +++ b/tcp_conn.h > @@ -16,7 +16,8 @@ > /** > * struct tcp_tap_conn - Descriptor for a TCP connection (not spliced) > * @f: Generic flow information > - * @retries: Number of retries occurred due to timeouts > + * @retries: Number of retries due to timeouts > + * @dup_acks: Number of duplicate ACKs (union with @retries) Not true, at the moment. This is simply @retries with this patch. This change is not needed. > * @ws_from_tap: Window scaling factor advertised from tap/guest > * @ws_to_tap: Window scaling factor advertised to tap/guest > * @tap_mss: MSS advertised by tap/guest, rounded to 2 ^ TCP_MSS_BITS > @@ -41,7 +42,10 @@ struct tcp_tap_conn { > struct flow_common f; > > #define TCP_RETRIES_BITS 3 > - unsigned int retries :TCP_RETRIES_BITS; > + union { > + unsigned int retries :TCP_RETRIES_BITS; > + unsigned int dup_acks :TCP_RETRIES_BITS; > + }; Same here, I don't think this part is needed at this stage. > #define TCP_MAX_RETRIES MAX_FROM_BITS(TCP_RETRIES_BITS) > > #define TCP_WS_BITS 4 /* RFC 7323 */ > @@ -122,7 +126,8 @@ struct tcp_tap_conn { > * struct tcp_tap_transfer - Migrated TCP data, flow table part, network order > * @pif: Interfaces for each side of the flow > * @side: Addresses and ports for each side of the flow > - * @retries: Number of retries occurred due to timeouts > + * @retries: Number of retries due to timeouts > + * @dup_acks: Number of duplicate ACKs (union with @retries) Same here (not needed). > * @ws_from_tap: Window scaling factor advertised from tap/guest > * @ws_to_tap: Window scaling factor advertised to tap/guest > * @events: Connection events, implying connection states > @@ -142,7 +147,10 @@ struct tcp_tap_transfer { > uint8_t pif[SIDES]; > struct flowside side[SIDES]; > > - uint8_t retries; > + union { > + uint8_t retries; > + uint8_t dup_acks; > + }; And here (not needed). > uint8_t ws_from_tap; > uint8_t ws_to_tap; > uint8_t events; -- Stefano