From owner-svn-src-stable-12@freebsd.org Tue Nov 17 08:03:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91C382D3EF9; Tue, 17 Nov 2020 08:03:50 +0000 (UTC) (envelope-from rscheff@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CZz3V3lXMz3ph8; Tue, 17 Nov 2020 08:03:50 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73BA71CC81; Tue, 17 Nov 2020 08:03:50 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AH83oUP074119; Tue, 17 Nov 2020 08:03:50 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AH83nug074115; Tue, 17 Nov 2020 08:03:49 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202011170803.0AH83nug074115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Tue, 17 Nov 2020 08:03:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367752 - in stable/12/sys/netinet: . cc X-SVN-Group: stable-12 X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: in stable/12/sys/netinet: . cc X-SVN-Commit-Revision: 367752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Nov 2020 08:03:50 -0000 Author: rscheff Date: Tue Nov 17 08:03:49 2020 New Revision: 367752 URL: https://svnweb.freebsd.org/changeset/base/367752 Log: MFC r367007: tcp: move cwnd and ssthresh updates into cc modules This will pave the way of setting ssthresh differently in TCP CUBIC, according to RFC8312 section 4.7. Use dynamic tcp_maxseg() adjusting for tcp options instead of static t_maxseg. Submitted by: chengc_netapp.com Reviewed by: rrs, tuexen, rscheff Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26807 Modified: stable/12/sys/netinet/cc/cc_cubic.c stable/12/sys/netinet/cc/cc_dctcp.c stable/12/sys/netinet/cc/cc_htcp.c stable/12/sys/netinet/cc/cc_newreno.c stable/12/sys/netinet/tcp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/12/sys/netinet/cc/cc_cubic.c Tue Nov 17 06:04:16 2020 (r367751) +++ stable/12/sys/netinet/cc/cc_cubic.c Tue Nov 17 08:03:49 2020 (r367752) @@ -265,8 +265,10 @@ static void cubic_cong_signal(struct cc_var *ccv, uint32_t type) { struct cubic *cubic_data; + u_int mss; cubic_data = ccv->cc_data; + mss = tcp_maxseg(ccv->ccvc.tcp); switch (type) { case CC_NDUPACK: @@ -293,6 +295,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) break; case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; /* * Grab the current time and record it so we know when the * most recent congestion event was. Only record it when the Modified: stable/12/sys/netinet/cc/cc_dctcp.c ============================================================================== --- stable/12/sys/netinet/cc/cc_dctcp.c Tue Nov 17 06:04:16 2020 (r367751) +++ stable/12/sys/netinet/cc/cc_dctcp.c Tue Nov 17 08:03:49 2020 (r367752) @@ -235,7 +235,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) if (CCV(ccv, t_flags) & TF_ECN_PERMIT) { dctcp_data = ccv->cc_data; cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); + mss = tcp_maxseg(ccv->ccvc.tcp); switch (type) { case CC_NDUPACK: @@ -282,6 +282,10 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) dctcp_data->ece_curr = 1; break; case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; Modified: stable/12/sys/netinet/cc/cc_htcp.c ============================================================================== --- stable/12/sys/netinet/cc/cc_htcp.c Tue Nov 17 06:04:16 2020 (r367751) +++ stable/12/sys/netinet/cc/cc_htcp.c Tue Nov 17 08:03:49 2020 (r367752) @@ -271,8 +271,10 @@ static void htcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct htcp *htcp_data; + u_int mss; htcp_data = ccv->cc_data; + mss = tcp_maxseg(ccv->ccvc.tcp); switch (type) { case CC_NDUPACK: @@ -311,6 +313,10 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) break; case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; /* * Grab the current time and record it so we know when the * most recent congestion event was. Only record it when the Modified: stable/12/sys/netinet/cc/cc_newreno.c ============================================================================== --- stable/12/sys/netinet/cc/cc_newreno.c Tue Nov 17 06:04:16 2020 (r367751) +++ stable/12/sys/netinet/cc/cc_newreno.c Tue Nov 17 08:03:49 2020 (r367752) @@ -241,7 +241,7 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) u_int mss; cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); + mss = tcp_maxseg(ccv->ccvc.tcp); nreno = ccv->cc_data; beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; @@ -278,6 +278,12 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) CCV(ccv, snd_cwnd) = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } + break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; break; } } Modified: stable/12/sys/netinet/tcp_input.c ============================================================================== --- stable/12/sys/netinet/tcp_input.c Tue Nov 17 06:04:16 2020 (r367751) +++ stable/12/sys/netinet/tcp_input.c Tue Nov 17 08:03:49 2020 (r367752) @@ -403,8 +403,6 @@ cc_conn_init(struct tcpcb *tp) void inline cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) { - u_int maxseg; - INP_WLOCK_ASSERT(tp->t_inpcb); switch(type) { @@ -430,13 +428,9 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui } break; case CC_RTO: - maxseg = tcp_maxseg(tp); tp->t_dupacks = 0; tp->t_bytes_acked = 0; EXIT_RECOVERY(tp->t_flags); - tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / - maxseg) * maxseg; - tp->snd_cwnd = maxseg; if (tp->t_flags & TF_ECN_PERMIT) tp->t_flags |= TF_ECN_SND_CWR; break;