From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b7+sLDRM; dkim-atps=neutral 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 D70245A0619 for ; Wed, 22 Oct 2025 10:41:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761122464; 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=CnZp03y9XrEnf0wTyyWpPxa0lmeoiuKxZGLT2alYdaE=; b=b7+sLDRMpVX9ljlHYeKnK/EpujrylR2Sw0DGxb+chD9Mj39k6P09fucEJUyCx0a7Ya8C7b JYAV4Jcp0QQ4oYY+nhoCXF3kbiyRUkfQ3EeBJTpI9wOMBHRztkoirCUsbaZ1TuCar+0bO5 J8EhGyv9prlbaWTu7EBtOjExK1XwaUA= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-440-7rMJ9du6PC6671b1wC1kIg-1; Wed, 22 Oct 2025 04:41:03 -0400 X-MC-Unique: 7rMJ9du6PC6671b1wC1kIg-1 X-Mimecast-MFC-AGG-ID: 7rMJ9du6PC6671b1wC1kIg_1761122462 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-634cdb5d528so677423a12.1 for ; Wed, 22 Oct 2025 01:41:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761122462; x=1761727262; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CnZp03y9XrEnf0wTyyWpPxa0lmeoiuKxZGLT2alYdaE=; b=Zsh499hptVFGML5JfrYVecwdCah28TJpDVdqyrQLJkhJXTxuV7FZJOY7R7b3OpZ6Dz SPbS5bPs6jN/jHPAsl+orX8bedFkYJW3Sr322XxrR2PcJb8Ttbt32MnwUuygCsCqejWK tuUpXqOmGFAIttSrDp8o933l93IOP0tQbTorlVw0YlknT15WhcGJ0SNACbBOwkyuTNlj +Dk45W6ge2xWVy+919q2JwpWWqlxcHNUToDKUCPW8SB/jEHzwiKZPXHDm+EpmfTgsQZC Jn9ZdZj/qVsVFKSgMWtKPhHKerDhlHyXxYsEN+7VC/Ld6QKltklluPuyI26ifp1tnSK6 WZkw== X-Gm-Message-State: AOJu0YwvWcLhPOrgXvrPcCAVuYTBJT4QO2DsZRx7jTzgJNuW/wlAJ3Rk ibFZHKS5mw59WcDmg3np4zGDQaAL0Hur8Rw20lI0mjPhc888G8MdiQ50jljQTyu7FKbP6toYn3w 6FqxEb8DVwS6UcBvC7K9gNT8E1zvXOM6J7FF8jvMugNiTtaeF/MP7X6zAYtTe2Ymrzt7qZwt6lr HWbLed+GJSboeOPjrDZXz3+h6dptDS/+PKC3Yl X-Gm-Gg: ASbGnctyiVAjFlSfwE8IfWHYWYV18bYJYUv0LDV0kJNLSHjSmVft6ieKD35C+pOd9Lv 2brSy/nLN/subB0c8hrmqq0JTE1psZGhiAbtw2TCji6BtJEhR6TB5188scmFfupeJVMkqKInjt9 VwIvj2VqxieoWJeMv2CI0WubwLRUS9QLF/3RSTwKbPQFwJTcXugf2iyPTg X-Received: by 2002:a05:6402:51c7:b0:63b:ec3c:ee32 with SMTP id 4fb4d7f45d1cf-63e172c2654mr2704802a12.11.1761122461825; Wed, 22 Oct 2025 01:41:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7b2Sxpa3GRN3uV3UNeCkbNm2eBSoC1Ko4POR5fHqLm/dWrrrwCpQX56yqI4O5IciXEzD2Agq4prA1H654JOQ= X-Received: by 2002:a05:6402:51c7:b0:63b:ec3c:ee32 with SMTP id 4fb4d7f45d1cf-63e172c2654mr2704788a12.11.1761122461408; Wed, 22 Oct 2025 01:41:01 -0700 (PDT) MIME-Version: 1.0 References: <20251017062838.21041-1-yuhuang@redhat.com> <20251017062838.21041-5-yuhuang@redhat.com> In-Reply-To: From: Yumei Huang Date: Wed, 22 Oct 2025 16:40:50 +0800 X-Gm-Features: AS18NWA-kUv3mg9FGrwq5KOv1o_pmDCkck7sTpIFP8nbuk1hgORMiIg-5CDdpd4 Message-ID: Subject: Re: [PATCH v6 4/4] tcp: Update data retransmission timeout To: David Gibson X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: kfnmtkxdLKtKntUUzNauNXcx4Yhbtd-6qa8TwHt07r8_1761122462 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2N4HZCXC3ZBVMB6YI2CSF5K7UE4VCTHS X-Message-ID-Hash: 2N4HZCXC3ZBVMB6YI2CSF5K7UE4VCTHS X-MailFrom: yuhuang@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: 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: On Wed, Oct 22, 2025 at 9:19=E2=80=AFAM David Gibson wrote: > > On Fri, Oct 17, 2025 at 02:28:38PM +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 discusse= d > > in Appendix A of RFC 6298. > > > > Also combine the macros defining the initial RTO for both SYN and ACK. > > > > Signed-off-by: Yumei Huang > > Reviewed-by: David Gibson > > Still LGTM. Stefano has more or less convinced me that clamping the > maximum backoff time is worthwhile, but that can easily be a later > patch rather than respinning. Thank you. Either way, I need to respin for the doc string thing. Once Stefano finishes the review for v6, I can send v7 with clamping the maximum timeout. > > > --- > > tcp.c | 27 ++++++++++++--------------- > > 1 file changed, 12 insertions(+), 15 deletions(-) > > > > diff --git a/tcp.c b/tcp.c > > index 9385132..dc0ec6c 100644 > > --- a/tcp.c > > +++ b/tcp.c > > @@ -179,16 +179,14 @@ > > * > > * Timeouts are implemented by means of timerfd timers, set based on f= lags: > > * > > - * - SYN_TIMEOUT_INIT: if no ACK is received from tap/guest during han= dshake > > - * (flag ACK_FROM_TAP_DUE without ESTABLISHED event) within this tim= e, resend > > - * SYN. It's the starting timeout for the first SYN retry. If this p= ersists > > - * 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= sending > > - * data (flag ACK_FROM_TAP_DUE with ESTABLISHED event), re-send data= from the > > - * socket and reset sequence to what was acknowledged. If this persi= sts 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 d= uring > > + * handshake (flag ACK_FROM_TAP_DUE without ESTABLISHED event) or af= ter > > + * sending data (flag ACK_FROM_TAP_DUE with ESTABLISHED event), re-s= end data > > + * from the socket and reset sequence to what was acknowledged. This= is the > > + * timeout for the first retry, in seconds. If this persists too man= y times > > + * in a row, reset the connection: TCP_MAX_RETRIES for established > > + * connections, or (tcp_syn_retries + tcp_syn_linear_timeouts) durin= g the > > + * handshake. > > * > > * - FIN_TIMEOUT: if a FIN segment was sent to tap/guest (flag ACK_FRO= M_TAP_DUE > > * with TAP_FIN_SENT event), and no ACK is received within this time= , reset > > @@ -342,8 +340,7 @@ enum { > > #define WINDOW_DEFAULT 14600 /* RFC 69= 28 */ > > > > #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 > > > > @@ -588,13 +585,13 @@ static void tcp_timer_ctl(const struct ctx *c, st= ruct 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_linea= r_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 { > > -- > > 2.47.0 > > > > -- > 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 wa= y > | around. > http://www.ozlabs.org/~dgibson --=20 Thanks, Yumei Huang