From owner-svn-src-all@freebsd.org Wed Jul 1 09:35:34 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 7D54D348EFD; Wed, 1 Jul 2020 09:35:34 +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 49xbgV2kx0z4CMN; Wed, 1 Jul 2020 09:35:34 +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 2742D27482; Wed, 1 Jul 2020 09:35:34 +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 0619ZX8B073312; Wed, 1 Jul 2020 09:35:33 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0619ZXRe073311; Wed, 1 Jul 2020 09:35:33 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202007010935.0619ZXRe073311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Wed, 1 Jul 2020 09:35:33 +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: r362832 - stable/12/sys/netinet/cc X-SVN-Group: stable-12 X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: stable/12/sys/netinet/cc X-SVN-Commit-Revision: 362832 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.33 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: Wed, 01 Jul 2020 09:35:34 -0000 Author: rscheff Date: Wed Jul 1 09:35:33 2020 New Revision: 362832 URL: https://svnweb.freebsd.org/changeset/base/362832 Log: MFC r362006: Prevent TCP Cubic to abruptly increase cwnd after app-limited Cubic calculates the new cwnd based on absolute time elapsed since the start of an epoch. A cubic epoch is started on congestion events, or once the congestion avoidance phase is started, after slow-start has completed. When a sender is application limited for an extended amount of time and subsequently a larger volume of data becomes ready for sending, Cubic recalculates cwnd with a lingering cubic epoch. This recalculation of the cwnd can induce a massive increase in cwnd, causing a burst of data to be sent at line rate by the sender. This adds a flag to reset the cubic epoch once a session transitions from app-limited to cwnd-limited to prevent the above effect. Reviewed by: chengc_netapp.com, tuexen (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D25065 Modified: stable/12/sys/netinet/cc/cc_cubic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/12/sys/netinet/cc/cc_cubic.c Wed Jul 1 09:32:17 2020 (r362831) +++ stable/12/sys/netinet/cc/cc_cubic.c Wed Jul 1 09:35:33 2020 (r362832) @@ -92,6 +92,7 @@ struct cubic { uint32_t flags; #define CUBICFLAG_CONG_EVENT 0x00000001 /* congestion experienced */ #define CUBICFLAG_IN_SLOWSTART 0x00000002 /* in slow start */ +#define CUBICFLAG_IN_APPLIMIT 0x00000004 /* application limited */ /* Minimum observed rtt in ticks. */ int min_rtt_ticks; /* Mean observed rtt between congestion epochs. */ @@ -143,8 +144,10 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) } else { ticks_since_cong = ticks - cubic_data->t_last_cong; - if (cubic_data->flags & CUBICFLAG_IN_SLOWSTART) { - cubic_data->flags &= ~CUBICFLAG_IN_SLOWSTART; + if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | + CUBICFLAG_IN_APPLIMIT)) { + cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART | + CUBICFLAG_IN_APPLIMIT); cubic_data->t_last_cong = ticks; cubic_data->K = 0; } @@ -197,6 +200,9 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) cubic_data->max_cwnd = CCV(ccv, snd_cwnd); } + } else if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && + !(ccv->flags & CCF_CWND_LIMITED)) { + cubic_data->flags |= CUBICFLAG_IN_APPLIMIT; } }