From owner-dev-commits-src-all@freebsd.org Thu Mar 25 23:35:26 2021 Return-Path: Delivered-To: dev-commits-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 6C22757FBFE; Thu, 25 Mar 2021 23:35:26 +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 4F61gL2cfYz4qbK; Thu, 25 Mar 2021 23:35:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4CBA37E67; Thu, 25 Mar 2021 23:35:26 +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 12PNZQc5087553; Thu, 25 Mar 2021 23:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12PNZQqB087552; Thu, 25 Mar 2021 23:35:26 GMT (envelope-from git) Date: Thu, 25 Mar 2021 23:35:26 GMT Message-Id: <202103252335.12PNZQqB087552@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: eb3a59a83112 - main - tcp: Refactor PRR code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb3a59a83112f5fcd60aab44ac0ac68331b6aedf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2021 23:35:26 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=eb3a59a83112f5fcd60aab44ac0ac68331b6aedf commit eb3a59a83112f5fcd60aab44ac0ac68331b6aedf Author: Richard Scheffenegger AuthorDate: 2021-03-25 22:58:46 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-25 23:01:34 +0000 tcp: Refactor PRR code No functional change intended. MFC after: 2 weeks Reviewed By: #transport, rrs Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29411 --- sys/netinet/tcp_input.c | 58 ++++++++----------------------------------------- sys/netinet/tcp_var.h | 2 +- 2 files changed, 10 insertions(+), 50 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 685a5e020c3b..7c291eaec633 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2576,47 +2576,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, if (V_tcp_do_prr && IN_FASTRECOVERY(tp->t_flags) && (tp->t_flags & TF_SACK_PERMIT)) { - int snd_cnt = 0, limit = 0; - int del_data = 0, pipe = 0; - /* - * In a duplicate ACK del_data is only the - * diff_in_sack. If no SACK is used del_data - * will be 0. Pipe is the amount of data we - * estimate to be in the network. - */ - del_data = tp->sackhint.delivered_data; - if (V_tcp_do_rfc6675_pipe) - pipe = tcp_compute_pipe(tp); - else - pipe = (tp->snd_nxt - tp->snd_fack) + - tp->sackhint.sack_bytes_rexmit; - tp->sackhint.prr_delivered += del_data; - if (pipe >= tp->snd_ssthresh) { - if (tp->sackhint.recover_fs == 0) - tp->sackhint.recover_fs = - imax(1, tp->snd_nxt - tp->snd_una); - snd_cnt = howmany((long)tp->sackhint.prr_delivered * - tp->snd_ssthresh, tp->sackhint.recover_fs) - - tp->sackhint.prr_out; - } else { - if (V_tcp_do_prr_conservative) - limit = tp->sackhint.prr_delivered - - tp->sackhint.prr_out; - else - limit = imax(tp->sackhint.prr_delivered - - tp->sackhint.prr_out, - del_data) + maxseg; - snd_cnt = imin(tp->snd_ssthresh - pipe, limit); - } - snd_cnt = imax(snd_cnt, 0) / maxseg; - /* - * Send snd_cnt new data into the network in - * response to this ACK. If there is a going - * to be a SACK retransmission, adjust snd_cwnd - * accordingly. - */ - tp->snd_cwnd = imax(maxseg, tp->snd_nxt - tp->snd_recover + - tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); + tcp_do_prr_ack(tp, th); } else if ((tp->t_flags & TF_SACK_PERMIT) && (to.to_flags & TOF_SACK) && IN_FASTRECOVERY(tp->t_flags)) { @@ -2814,9 +2774,13 @@ resume_partialack: if (IN_FASTRECOVERY(tp->t_flags)) { if (SEQ_LT(th->th_ack, tp->snd_recover)) { if (tp->t_flags & TF_SACK_PERMIT) - if (V_tcp_do_prr && to.to_flags & TOF_SACK) - tcp_prr_partialack(tp, th); - else + if (V_tcp_do_prr && to.to_flags & TOF_SACK) { + tcp_timer_activate(tp, TT_REXMT, 0); + tp->t_rtttime = 0; + tcp_do_prr_ack(tp, th); + tp->t_flags |= TF_ACKNOW; + (void) tcp_output(tp); + } else tcp_sack_partialack(tp, th); else tcp_newreno_partial_ack(tp, th); @@ -3946,15 +3910,13 @@ tcp_mssopt(struct in_conninfo *inc) } void -tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) +tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th) { int snd_cnt = 0, limit = 0, del_data = 0, pipe = 0; int maxseg = tcp_maxseg(tp); INP_WLOCK_ASSERT(tp->t_inpcb); - tcp_timer_activate(tp, TT_REXMT, 0); - tp->t_rtttime = 0; /* * Compute the amount of data that this ACK is indicating * (del_data) and an estimate of how many bytes are in the @@ -3994,8 +3956,6 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) */ tp->snd_cwnd = imax(maxseg, tp->snd_nxt - tp->snd_recover + tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); - tp->t_flags |= TF_ACKNOW; - (void) tcp_output(tp); } /* diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 8cd0c828ad66..aefec69063e6 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1063,7 +1063,7 @@ void tcp_clean_dsack_blocks(struct tcpcb *tp); void tcp_clean_sackreport(struct tcpcb *tp); void tcp_sack_adjust(struct tcpcb *tp); struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt); -void tcp_prr_partialack(struct tcpcb *, struct tcphdr *); +void tcp_do_prr_ack(struct tcpcb *, struct tcphdr *); void tcp_sack_partialack(struct tcpcb *, struct tcphdr *); void tcp_free_sackholes(struct tcpcb *tp); int tcp_newreno(struct tcpcb *, struct tcphdr *);