From owner-svn-src-all@freebsd.org Thu Apr 30 11:11:29 2020 Return-Path: Delivered-To: svn-src-all@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 0D6912B847C; Thu, 30 Apr 2020 11:11:29 +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) server-signature RSA-PSS (4096 bits) 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 49CXkm6SLRz4Zn2; Thu, 30 Apr 2020 11:11:28 +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 D8F211DE85; Thu, 30 Apr 2020 11:11:28 +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 03UBBSu3018669; Thu, 30 Apr 2020 11:11:28 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UBBS6i018668; Thu, 30 Apr 2020 11:11:28 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202004301111.03UBBS6i018668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Thu, 30 Apr 2020 11:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360491 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 360491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 11:11:29 -0000 Author: rscheff Date: Thu Apr 30 11:11:28 2020 New Revision: 360491 URL: https://svnweb.freebsd.org/changeset/base/360491 Log: Introduce a lower bound of 2 MSS to TCP Cubic. Running TCP Cubic together with ECN could end up reducing cwnd down to 1 byte, if the receiver continously sets the ECE flag, resulting in very poor transmission speeds. In line with RFC6582 App. B, a lower bound of 2 MSS is introduced, as well as a typecast to prevent any potential integer overflows during intermediate calculation steps of the adjusted cwnd. Reported by: Cheng Cui Reviewed by: tuexen (mentor) Approved by: tuexen (mentor) MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D23353 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Thu Apr 30 06:34:34 2020 (r360490) +++ head/sys/netinet/cc/cc_cubic.c Thu Apr 30 11:11:28 2020 (r360491) @@ -366,8 +366,9 @@ cubic_post_recovery(struct cc_var *ccv) CCV(ccv, t_maxseg); else /* Update cwnd based on beta and adjusted max_cwnd. */ - CCV(ccv, snd_cwnd) = max(1, ((CUBIC_BETA * - cubic_data->max_cwnd) >> CUBIC_SHIFT)); + CCV(ccv, snd_cwnd) = max(((uint64_t)cubic_data->max_cwnd * + CUBIC_BETA) >> CUBIC_SHIFT, + 2 * CCV(ccv, t_maxseg)); } cubic_data->t_last_cong = ticks; @@ -433,6 +434,7 @@ static void cubic_ssthresh_update(struct cc_var *ccv) { struct cubic *cubic_data; + uint32_t ssthresh; cubic_data = ccv->cc_data; @@ -441,10 +443,11 @@ cubic_ssthresh_update(struct cc_var *ccv) * subsequent congestion events, set it to cwnd * beta. */ if (cubic_data->num_cong_events == 0) - CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd) >> 1; + ssthresh = CCV(ccv, snd_cwnd) >> 1; else - CCV(ccv, snd_ssthresh) = ((u_long)CCV(ccv, snd_cwnd) * + ssthresh = ((uint64_t)CCV(ccv, snd_cwnd) * CUBIC_BETA) >> CUBIC_SHIFT; + CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * CCV(ccv, t_maxseg)); }