From owner-svn-src-all@freebsd.org Mon Jul 29 08:50:36 2019 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 2D69BA31F0; Mon, 29 Jul 2019 08:50:36 +0000 (UTC) (envelope-from tuexen@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 10EFC6EC22; Mon, 29 Jul 2019 08:50:36 +0000 (UTC) (envelope-from tuexen@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 D7AC625A4D; Mon, 29 Jul 2019 08:50:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6T8oZRj077687; Mon, 29 Jul 2019 08:50:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6T8oZIO077686; Mon, 29 Jul 2019 08:50:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201907290850.x6T8oZIO077686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 29 Jul 2019 08:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350403 - in head: share/man/man4 sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet/cc X-SVN-Commit-Revision: 350403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 10EFC6EC22 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_SHORT(-0.94)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] 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: Mon, 29 Jul 2019 08:50:36 -0000 Author: tuexen Date: Mon Jul 29 08:50:35 2019 New Revision: 350403 URL: https://svnweb.freebsd.org/changeset/base/350403 Log: * Improve input validation of sysctl parameters for DCTPC. * Initialize the alpha parameter to a conservative value (like Linux) * Improve handling of arithmetic. * Improve man-page Obtained from: Richard Scheffenegger MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D20549 Modified: head/share/man/man4/cc_dctcp.4 head/sys/netinet/cc/cc_dctcp.c Modified: head/share/man/man4/cc_dctcp.4 ============================================================================== --- head/share/man/man4/cc_dctcp.4 Mon Jul 29 08:23:15 2019 (r350402) +++ head/share/man/man4/cc_dctcp.4 Mon Jul 29 08:50:35 2019 (r350403) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2015 +.Dd July 29, 2019 .Dt CC_DCTCP 4 .Os .Sh NAME @@ -60,7 +60,7 @@ In addition, when classic ECN is used as sender and DC receiver, DCTCP avoids to mirror back ACKs only when the CWR flag is set in the incoming packet. .Pp -The other specifications are based on the paper and Internet Draft referenced +The other specifications are based on the paper and the RFC referenced in the .Sx SEE ALSO section below. @@ -70,16 +70,27 @@ The algorithm exposes the following tunable variables branch of the .Xr sysctl 3 MIB: -.Bl -tag -width ".Va alpha" +.Bl -tag -width ".Va slowstart" .It Va alpha -An initial estimator of the congestion on the link. -Default is 0. -.It Va dctcp_shift_g -An estimation gain in the alpha calculation. -Default is 16. +The initial value to estimate the congestion on the link. +The valid range is from 0 to 1024, where 1024 reduces the congestion +window to half, if a CE is observed in the first window and +.Va alpha +could not yet adjust to the congestion level on that path. +Default is 1024. +.It Va shift_g +An estimation gain in the +.Va alpha +calculation. +This influences the responsiveness when adjusting alpha +to the most recent observed window. +Valid range from 0 to 10, the default is 4, resulting in an effective +gain of 1 / ( 2 ^ +.Va shift_g +), or 1/16th. .It Va slowstart -A trigger to halve congestion window after slow start. -Default does nothing to halve window. +A flag if the congestion window should be reduced by one half after slow start. +Valid settings 0 and 1, default 0. .El .Sh SEE ALSO .Xr cc_chd 4 , @@ -108,10 +119,12 @@ Default does nothing to halve window. .Re .Rs .%A "Stephen Bensley" -.%A "Lars Eggert" .%A "Dave Thaler" -.%T "Microsoft's Datacenter TCP (DCTCP): TCP Congestion Control for Datacenters" -.%U "http://tools.ietf.org/html/draft-bensley-tcpm-dctcp-01" +.%A "Praveen Balasubramanian" +.%A "Lars Eggert" +.%A "Glenn Judd" +.%T "Data Center TCP (DCTCP): TCP Congestion Control for Data Centers" +.%U "https://tools.ietf.org/html/rfc8257" .Re .Sh HISTORY The Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Mon Jul 29 08:23:15 2019 (r350402) +++ head/sys/netinet/cc/cc_dctcp.c Mon Jul 29 08:50:35 2019 (r350403) @@ -56,8 +56,9 @@ __FBSDID("$FreeBSD$"); #include #include -#define MAX_ALPHA_VALUE 1024 -VNET_DEFINE_STATIC(uint32_t, dctcp_alpha) = 0; +#define DCTCP_SHIFT 10 +#define MAX_ALPHA_VALUE (1<bytes_total = max(dctcp_data->bytes_total, 1); /* - * Update alpha: alpha = (1 - g) * alpha + g * F. + * Update alpha: alpha = (1 - g) * alpha + g * M. * Here: * g is weight factor * recommaded to be set to 1/16 * small g = slow convergence between competitive DCTCP flows * large g = impacts low utilization of bandwidth at switches - * F is fraction of marked segments in last RTT + * M is fraction of marked segments in last RTT * updated every RTT * Alpha must be round to 0 - MAX_ALPHA_VALUE. */ - dctcp_data->alpha = min(alpha_prev - (alpha_prev >> V_dctcp_shift_g) + - (dctcp_data->bytes_ecn << (10 - V_dctcp_shift_g)) / + dctcp_data->alpha = ulmin(alpha_prev - (alpha_prev >> V_dctcp_shift_g) + + ((uint64_t)dctcp_data->bytes_ecn << (DCTCP_SHIFT - V_dctcp_shift_g)) / dctcp_data->bytes_total, MAX_ALPHA_VALUE); /* Initialize internal parameters for next alpha calculation */ @@ -398,14 +399,10 @@ dctcp_alpha_handler(SYSCTL_HANDLER_ARGS) new = V_dctcp_alpha; error = sysctl_handle_int(oidp, &new, 0, req); if (error == 0 && req->newptr != NULL) { - if (new > 1) + if (new > MAX_ALPHA_VALUE) error = EINVAL; - else { - if (new > MAX_ALPHA_VALUE) - V_dctcp_alpha = MAX_ALPHA_VALUE; - else - V_dctcp_alpha = new; - } + else + V_dctcp_alpha = new; } return (error); @@ -420,7 +417,7 @@ dctcp_shift_g_handler(SYSCTL_HANDLER_ARGS) new = V_dctcp_shift_g; error = sysctl_handle_int(oidp, &new, 0, req); if (error == 0 && req->newptr != NULL) { - if (new > 1) + if (new > DCTCP_SHIFT) error = EINVAL; else V_dctcp_shift_g = new; @@ -454,7 +451,7 @@ SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, dctcp, CTLFLAG SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, alpha, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_alpha), 0, &dctcp_alpha_handler, - "IU", "dctcp alpha parameter"); + "IU", "dctcp alpha parameter at start of session"); SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, shift_g, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_shift_g), 4,