From nobody Tue Oct 04 11:10:18 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MhZk24H98z4d6V7; Tue, 4 Oct 2022 11:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MhZk23pJ2z3QCr; Tue, 4 Oct 2022 11:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664881818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G5pIotc6OvGYMKTYUHoO8rfLvzyY87QuExSh648bNQs=; b=Am0w+zfR3+9HaNcLiIPExvw6j1TKP2mWs3EUrSXBeNuZs2IIdzWbgmAhGfIKqy4ZOire3d asQiPfgaibji+x/B6cSW7T8EtcDT7Ic2uiRC5Ga1hpvKjivmbxtdA80pIalX/01TArDrsR 3pWusB80ImEM3cUTZCJlYyAVcigQxfvbJhjqInkHvAPUc+Qi0KVfRftjx4DNl5jwlqVwFI Xz0jXWx67XW5dvBCqL+QL1c8KmxkwfhuzCQRTHeqIFkpF2uJ61IO/VDbXIwPE00cbIntrv DndIBF1FVwg9UuXBFI4CUtVZVPTwzWulAq+z12y6OVUvVuiapTmLuPMVLrPULg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MhZk22YPmzY4v; Tue, 4 Oct 2022 11:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 294BAIPO055391; Tue, 4 Oct 2022 11:10:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 294BAIq7055381; Tue, 4 Oct 2022 11:10:18 GMT (envelope-from git) Date: Tue, 4 Oct 2022 11:10:18 GMT Message-Id: <202210041110.294BAIq7055381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: cd84e78f09ec - main - tcp idle reduce does not work for a server. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd84e78f09ec55c0ae8339e0e6738452ea4c7424 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664881818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G5pIotc6OvGYMKTYUHoO8rfLvzyY87QuExSh648bNQs=; b=Z4Gp53/kgal0UJPtKty2SYAknHoF00cMfseAs32SpzD19MMO3KWpLk7xQcGfwzQMbgfHh+ mt2OsEbAbVVzIG+eJjvF5HDPw3Ht0qS3s4f/c/dHkkecF76opKJkDULhXFT/EbyxwdQXmy innfQwDZld5oXlHCEOLsp8XsRSB0PnwIkW0+SNCZHz8IuYNH1GKnpanuZx0Mjap789cTvT nWqtZ5LGT5zsVrX7EciUpV3vlwfVWhn3gyhh41XEiU+iN5vGAhBQ/y9wtFdKLbL1zPZUDT UnQJh0+t7QbVn+XtwE/J1FZXryUt0wPJ1ORRBkhF044l9GwBxJ8RUZskOCMrBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664881818; a=rsa-sha256; cv=none; b=UhaF2x4OSJD6xnuSvKlWf5+rBZYfiVA0EJxUqYcFyya1VzvDV0wUoD9tbCBfwFeXvMbMH0 L6F+5iFj8gSfjkmHOXCmmY6k4N77vh4jQJvU1qphFEqHJBzD6vp766yd4HpVdugWDKF2et dRvW8uYui/I+76wpCcnjK7cb5zQgTp5EGusDUV6RHUq8GCsWXagWFgzqN9OHxrdlXWrZ8f Dl+L78g+xgPgs8QwV/AKGbIFWxG9zxIdyFmMoABdIFSZ1tUQWkhleHp0UuHACwtWPZG0ll Ksd2tRxyG2i0NrGdGbSYM+7exRJoRb/fQTox57uPBbwEzhez7TT+jdnWoLbjwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=cd84e78f09ec55c0ae8339e0e6738452ea4c7424 commit cd84e78f09ec55c0ae8339e0e6738452ea4c7424 Author: Randall Stewart AuthorDate: 2022-10-04 11:09:01 +0000 Commit: Randall Stewart CommitDate: 2022-10-04 11:09:01 +0000 tcp idle reduce does not work for a server. TCP has an idle-reduce feature that allows a connection to reduce its cwnd after it has been idle more than an RTT. This feature only works for a sending side connection. It does this by at output checking the idle time (t_rcvtime vs ticks) to see if its more than the RTO timeout. The problem comes if you are a web server. You get a request and then send out all the data.. then go idle. The next time you would send is in response to a request from the peer asking for more data. But the thing is you updated t_rcvtime when the request came in so you never reduce. The fix is to do the idle reduce check also on inbound. Reviewed by: tuexen, rscheff Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D36721 --- sys/netinet/tcp_input.c | 4 ++++ sys/netinet/tcp_output.c | 4 +--- sys/netinet/tcp_var.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 7293fde6c580..7cd9494e5e4f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1614,6 +1614,10 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * XXX: This should be done after segment * validation to ignore broken/spoofed segs. */ + if (tp->t_idle_reduce && + (tp->snd_max == tp->snd_una) && + ((ticks - tp->t_rcvtime) >= tp->t_rxtcur)) + cc_after_idle(tp); tp->t_rcvtime = ticks; if (thflags & TH_FIN) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 885170f626b6..e23c35ce4d81 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -155,8 +155,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, sendbuf_auto_lowat, CTLFLAG_VNET | CTLFLAG_R tcp_timer_active((tp), TT_PERSIST), \ ("neither rexmt nor persist timer is set")) -static void inline cc_after_idle(struct tcpcb *tp); - #ifdef TCP_HHOOK /* * Wrapper for the TCP established output helper hook. @@ -183,7 +181,7 @@ hhook_run_tcp_est_out(struct tcpcb *tp, struct tcphdr *th, /* * CC wrapper hook functions */ -static void inline +void cc_after_idle(struct tcpcb *tp) { INP_WLOCK_ASSERT(tp->t_inpcb); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 3eebbefd9b7f..369dda66b08d 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1206,6 +1206,7 @@ void tcp_hc_get(struct in_conninfo *, struct hc_metrics_lite *); uint32_t tcp_hc_getmtu(struct in_conninfo *); void tcp_hc_updatemtu(struct in_conninfo *, uint32_t); void tcp_hc_update(struct in_conninfo *, struct hc_metrics_lite *); +void cc_after_idle(struct tcpcb *tp); extern struct protosw tcp_protosw; /* shared for TOE */ extern struct protosw tcp6_protosw; /* shared for TOE */