From nobody Mon Sep 26 19:13:51 2022 X-Original-To: dev-commits-src-main@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 4Mbsqh0QCjz4cX6V; Mon, 26 Sep 2022 19:13:52 +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 4Mbsqg7102z3WHc; Mon, 26 Sep 2022 19:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664219632; 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=xRX0/6QdAfcnKwSZQErrvpitxuLYx4Ahk6gxOztxG0s=; b=LzOxHR2nG2I7Ss0ntQgy8K6TEbxaXEe5aLqdXzRvVsRh2bNtoR2S8LaPr2sTcLDYfcLMGs 3asw2klRdhHVggG8avP1hmh7O3ehE/h2cGZoBm+XKEKPxnr81M2NDYMYMTRPn7p0YI2Cz1 PcXH9X7H7J9+/x0WJdAwdvaJl1egwt9IHFUXUBvhGq6iIjsdJrr4Sl2OeuA/LkxWIRCjGi 3BDi/ptNSd3AASrsz7bxIZDPG5h1AaNqgE461sepENqJHStJ9ZTtZbv1FhyAd67/od4P5N godsBQb9NZ//HnVyACT9IxIMyotV5SGM8ZLXtcQJy9nSViROtdXU1u3p6lTJAQ== 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 4Mbsqg62s8zsL7; Mon, 26 Sep 2022 19:13:51 +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 28QJDpvg025256; Mon, 26 Sep 2022 19:13:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28QJDpaw025255; Mon, 26 Sep 2022 19:13:51 GMT (envelope-from git) Date: Mon, 26 Sep 2022 19:13:51 GMT Message-Id: <202209261913.28QJDpaw025255@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: e5049a173352 - main - TCP rack does not work properly with cubic. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: e5049a17335248fa1c9219ddaa60bd25563f7f81 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664219632; 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=xRX0/6QdAfcnKwSZQErrvpitxuLYx4Ahk6gxOztxG0s=; b=TrrwcfYty2RitG3CwzQV2gINgz9L4SOm2FAPcXDKrpgjXZtu2CyZMHn+CXnPPKOz8SagIo an693y+AJBPkeAu9RHuMy5qpwEqP8iLJfUVkEBBjuOfkCFMDFQKoreMhrR9Ngv3YlhKD/q mTHvBrkzcNqT9Pr9Aj0c2vemb47WmiFeu9XmvG3IwL/xEMJ1o9JKNQ/4D38GaDwa+JRjny fr/jO32VjyDABeobANyA0xWMhCsem7vTXlsXDpFLxmUnr1OKDDVM+WFg5SB6U6MHqgRm0w So5dN6GnOH88fOu47t961W2IpQw+XzXrXwuZoBBa45JiZuzRvFRrwwz+wg4BPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664219632; a=rsa-sha256; cv=none; b=dIqF1NpeaUi0o6/SIqKWzq+hj9ZMn1uso0S3q7Aqe5wMrs8wFLer9zbszxo+LYTYO6HqVB EtrIg9AAlc6sUYIrxZW+imIKzGRPvf61OI+bhmz7dF9uwSyHasGuIMUFIKMqweR8fSNaKG IrZ/plN6BENNtNgKRORZIZcN1THc8fu4/KOSc9mg/GRoZmpZm6fMmN/mbvN+fpSZrLJRPn BbBRxg5hDDp5C6PWtds/OQGUE6IzhgzpV1BaD13VZRf5vsxdq2mo3pLziceQhUmcWff08T rXwnZVo8q2Ddnn3SAtlz1nT8nk0vPa3krwyoKJrWBI5g7waWPV31amAbM8KGsA== 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=e5049a17335248fa1c9219ddaa60bd25563f7f81 commit e5049a17335248fa1c9219ddaa60bd25563f7f81 Author: Randall Stewart AuthorDate: 2022-09-26 19:12:03 +0000 Commit: Randall Stewart CommitDate: 2022-09-26 19:12:03 +0000 TCP rack does not work properly with cubic. Right now if you use rack with cubic (the new default cc) you will have improper results. This is because rack uses different variables than the base stack (or bbr) and thus tcp_compute_pipe() always returns so that cubic will choose a 30% backoff not the 50% backoff it should when it is newreno compatibility mode. The fix is to allow a stack (rack) to override its own compute_pipe. Reviewed by: tuexen, rscheff Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D36711 --- sys/netinet/tcp_input.c | 10 +++++++--- sys/netinet/tcp_stacks/rack.c | 17 ++++++++++++++++- sys/netinet/tcp_var.h | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index ac2944a94e36..03941e2bb9a7 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -4060,9 +4060,13 @@ tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) int tcp_compute_pipe(struct tcpcb *tp) { - return (tp->snd_max - tp->snd_una + - tp->sackhint.sack_bytes_rexmit - - tp->sackhint.sacked_bytes); + if (tp->t_fb->tfb_compute_pipe == NULL) { + return (tp->snd_max - tp->snd_una + + tp->sackhint.sack_bytes_rexmit - + tp->sackhint.sacked_bytes); + } else { + return((*tp->t_fb->tfb_compute_pipe)(tp)); + } } uint32_t diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 6e323350100a..de88e47e5e41 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -9397,6 +9397,20 @@ skip_dsack_round: return (was_tlp); } +static uint32_t +do_rack_compute_pipe(struct tcpcb *tp, struct tcp_rack *rack, uint32_t snd_una) +{ + return (((tp->snd_max - snd_una) - rack->r_ctl.rc_sacked) + rack->r_ctl.rc_holes_rxt); +} + +static int32_t +rack_compute_pipe(struct tcpcb *tp) +{ + return ((int32_t)do_rack_compute_pipe(tp, + (struct tcp_rack *)tp->t_fb_ptr, + tp->snd_una)); +} + static void rack_update_prr(struct tcpcb *tp, struct tcp_rack *rack, uint32_t changed, tcp_seq th_ack) { @@ -9421,7 +9435,7 @@ rack_update_prr(struct tcpcb *tp, struct tcp_rack *rack, uint32_t changed, tcp_s } else { snd_una = th_ack; } - pipe = ((tp->snd_max - snd_una) - rack->r_ctl.rc_sacked) + rack->r_ctl.rc_holes_rxt; + pipe = do_rack_compute_pipe(tp, rack, snd_una); if (pipe > tp->snd_ssthresh) { long sndcnt; @@ -20317,6 +20331,7 @@ static struct tcp_function_block __tcp_rack = { .tfb_tcp_mtu_chg = rack_mtu_change, .tfb_pru_options = rack_pru_options, .tfb_hwtls_change = rack_hw_tls_change, + .tfb_compute_pipe = rack_compute_pipe, .tfb_flags = TCP_FUNC_OUTPUT_CANDROP, }; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 1b7e25099ced..b3284d338b83 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -375,6 +375,7 @@ struct tcp_function_block { void (*tfb_tcp_mtu_chg)(struct tcpcb *); int (*tfb_pru_options)(struct tcpcb *, int); void (*tfb_hwtls_change)(struct tcpcb *, int); + int (*tfb_compute_pipe)(struct tcpcb *tp); volatile uint32_t tfb_refcnt; uint32_t tfb_flags; uint8_t tfb_id;