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=KLCocAq8; 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 BE2E85A026F for ; Fri, 31 Oct 2025 06:57:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761890252; 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=jVQatVhMJqHnFaC98/WEg2+uvj9AGjt6pXg+Jue9YGI=; b=KLCocAq8DsJzZ5EwwoPd+UtlRtlTclyI1GYRcjGRiOyYXTfR4HwHfMHrwD2XcROR0uz4nK y91GPu7SG41w3nmIc7ddqLQjJZphX+Fv0A4gsFr8OVnxI+8ksJwdQMP9fhiKCGpQDqGMsG C5ARfuOS6yaavQXCe4Iz4+NU6b0FgmA= 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-296-SN41HsF_NR-z6NZfW-1J2Q-1; Fri, 31 Oct 2025 01:57:30 -0400 X-MC-Unique: SN41HsF_NR-z6NZfW-1J2Q-1 X-Mimecast-MFC-AGG-ID: SN41HsF_NR-z6NZfW-1J2Q_1761890250 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-63c55116bdfso1444275a12.3 for ; Thu, 30 Oct 2025 22:57:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761890249; x=1762495049; 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=jVQatVhMJqHnFaC98/WEg2+uvj9AGjt6pXg+Jue9YGI=; b=dGbQUUNsFAOcqWtQ1+AI14yLR7/Z7NO1B/Ta7juRYJpkrI1X8DQSeleEYP3GLw3BSl 2bEdODpzauFuia74+KPG4y+X2ro1IJQe0bh8i4jCsGO/hJqGUmgyMnfOe9Ul5XqvNM24 RRbZoNmEQLX7xxr5FYehrO7IljPyapawhV7NZ6J8ArUfcoXPYer2sevbqmszhxFoOSUc nFGgEZT6zjegLkw/p0ozCrgFkUaS+o/rFtn5FgIjuJAXjLimy/btSr2e6ErlUZbxeueJ EsuqGMHJZCUHwSeA/rxJBguk10SrGHr7moVMqa9ojc8/uxGMjV6Ai9Io12XziPm4t6n8 mEKA== X-Gm-Message-State: AOJu0YwijsSnosupZD3IrxQ6TWp8nLClatBe+LFI/mcOzaIAkgyFz1Zs u1VsiQXliPBewt4P7hj+IyvLYrM4jaTGuFNeTAVtMu3v1UiKZqN9JLFKgb/5OBW4XFtq/aIzAOp iAw8gBRhOWO3ghTRa5qr56BsVlEQq9KcP/fTwUJsy8r3QNaBqrVCQ9ZOlNiKC0yNiYGXl1UjaUV 22ZxYgS3G+YDUwVMvmK8wwTBgttPYfsxgpADL6 X-Gm-Gg: ASbGncu4gQb23FY8YixMZ4xZzD7YzUyXs7SsEgPT3F2z1fQqRpOSB5DWnqi345l6alx gXivr5A7fWphCASDqtU/qRae2r8JciHrAXSsFKF1naO1cINlntEVhZT9geb9KgopMXKKJurslrz ekUL/pv3ActYx7mEty/gIedWpVx3fnmd4TFpAn0nGqsuwsQvdTR9IH6+0q X-Received: by 2002:a05:6402:24d2:b0:63c:4d42:993d with SMTP id 4fb4d7f45d1cf-64077060eddmr1304685a12.31.1761890249312; Thu, 30 Oct 2025 22:57:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEV9d7xzhGc1qihaWUHAv/B8DR0xB1sxm0dgsjaCvOtpj5Rrv/vAj5QrSolzqN+8T95xORapCS6np70jdGJXDI= X-Received: by 2002:a05:6402:24d2:b0:63c:4d42:993d with SMTP id 4fb4d7f45d1cf-64077060eddmr1304675a12.31.1761890248885; Thu, 30 Oct 2025 22:57:28 -0700 (PDT) MIME-Version: 1.0 References: <20251031054242.7334-1-yuhuang@redhat.com> <20251031054242.7334-5-yuhuang@redhat.com> In-Reply-To: <20251031054242.7334-5-yuhuang@redhat.com> From: Yumei Huang Date: Fri, 31 Oct 2025 13:56:41 +0800 X-Gm-Features: AWmQ_blPfc6pro8fyPqQm_YkAuWGaSEqP9Mm_tOJpai6dXWpnMFzeMIPtK4Ak5c Message-ID: Subject: Re: [PATCH v7 4/5] tcp: Update data retransmission timeout To: passt-dev@passt.top, sbrivio@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8Kfs6iQkoio5o4gOrny8fB999b6knYfO7X0-xkRuRUk_1761890250 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KF7KVLOZBMBNI3J2IMIYOY5DG3D3UWWC X-Message-ID-Hash: KF7KVLOZBMBNI3J2IMIYOY5DG3D3UWWC 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: david@gibson.dropbear.id.au 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, Oct 31, 2025 at 1:43=E2=80=AFPM Yumei Huang wr= ote: > > Use an exponential backoff timeout for data retransmission according > to RFC 2988 and RFC 6298. Set the initial RTO to one second as discussed > 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 I probably should have removed the reviewed-by since there are some code changes. > --- > tcp.c | 30 ++++++++++++------------------ > 1 file changed, 12 insertions(+), 18 deletions(-) > > diff --git a/tcp.c b/tcp.c > index bada88a..96ee56a 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -179,16 +179,13 @@ > * > * Timeouts are implemented by means of timerfd timers, set based on fla= gs: > * > - * - SYN_TIMEOUT_INIT: if no ACK is received from tap/guest during hands= hake > - * (flag ACK_FROM_TAP_DUE without ESTABLISHED event) within this time,= resend > - * SYN. It's the starting timeout for the first SYN retry. Retry for > - * TCP_MAX_RETRIES or (tcp_syn_retries + tcp_syn_linear_timeouts) time= s, > - * reset the connection > - * > - * - ACK_TIMEOUT: if no ACK segment was received from tap/guest, after s= ending > - * data (flag ACK_FROM_TAP_DUE with ESTABLISHED event), re-send data f= rom the > - * socket and reset sequence to what was acknowledged. If this persist= s 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 dur= ing > + * handshake (flag ACK_FROM_TAP_DUE without ESTABLISHED event) or afte= r > + * sending data (flag ACK_FROM_TAP_DUE with ESTABLISHED event), re-sen= d data > + * from the socket and reset sequence to what was acknowledged. This i= s the > + * timeout for the first retry, in seconds. Retry for TCP_MAX_RETRIES = times > + * for established connections, or (tcp_syn_retries + > + * tcp_syn_linear_timeouts) times during the handshake, reset the conn= ection > * > * - FIN_TIMEOUT: if a FIN segment was sent to tap/guest (flag ACK_FROM_= TAP_DUE > * with TAP_FIN_SENT event), and no ACK is received within this time, = reset > @@ -342,8 +339,7 @@ enum { > #define WINDOW_DEFAULT 14600 /* RFC 6928 */ > > #define ACK_INTERVAL 10 /* ms */ > -#define SYN_TIMEOUT_INIT 1 /* s, RFC 6928 */ > -#define ACK_TIMEOUT 2 > +#define RTO_INIT 1 /* s, RFC 6298 */ > #define FIN_TIMEOUT 60 > #define ACT_TIMEOUT 7200 > > @@ -589,12 +585,10 @@ static void tcp_timer_ctl(const struct ctx *c, stru= ct tcp_tap_conn *conn) > if (conn->flags & ACK_TO_TAP_DUE) { > it.it_value.tv_nsec =3D (long)ACK_INTERVAL * 1000 * 1000; > } else if (conn->flags & ACK_FROM_TAP_DUE) { > - if (!(conn->events & ESTABLISHED)) { > - int exp =3D conn->retries - c->tcp.syn_linear_tim= eouts; > - it.it_value.tv_sec =3D SYN_TIMEOUT_INIT << MAX(ex= p, 0); > - } > - else > - it.it_value.tv_sec =3D ACK_TIMEOUT; > + int exp =3D conn->retries; > + if (!(conn->events & ESTABLISHED)) > + exp -=3D c->tcp.syn_linear_timeouts; > + it.it_value.tv_sec =3D RTO_INIT << MAX(exp, 0); > } else if (CONN_HAS(conn, SOCK_FIN_SENT | TAP_FIN_ACKED)) { > it.it_value.tv_sec =3D FIN_TIMEOUT; > } else { > -- > 2.49.0 > --=20 Thanks, Yumei Huang