From owner-svn-src-head@freebsd.org Thu Oct 29 00:03:20 2020 Return-Path: Delivered-To: svn-src-head@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 8815F452F30; Thu, 29 Oct 2020 00:03:20 +0000 (UTC) (envelope-from jhb@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 4CM5Hr332tz3VJX; Thu, 29 Oct 2020 00:03:20 +0000 (UTC) (envelope-from jhb@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 31BAE246AE; Thu, 29 Oct 2020 00:03:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09T03JCb047380; Thu, 29 Oct 2020 00:03:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09T03Jcx047376; Thu, 29 Oct 2020 00:03:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010290003.09T03Jcx047376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 29 Oct 2020 00:03:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367122 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 367122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2020 00:03:20 -0000 Author: jhb Date: Thu Oct 29 00:03:19 2020 New Revision: 367122 URL: https://svnweb.freebsd.org/changeset/base/367122 Log: Save the current TCP pacing rate in t_pacing_rate. Reviewed by: gallatin, gnn Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D26875 Modified: head/sys/netinet/tcp_ratelimit.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_ratelimit.c ============================================================================== --- head/sys/netinet/tcp_ratelimit.c Wed Oct 28 23:10:54 2020 (r367121) +++ head/sys/netinet/tcp_ratelimit.c Thu Oct 29 00:03:19 2020 (r367122) @@ -1220,6 +1220,8 @@ tcp_set_pacing_rate(struct tcpcb *tp, struct ifnet *if { const struct tcp_hwrate_limit_table *rte; + INP_WLOCK_ASSERT(tp->t_inpcb); + if (tp->t_inpcb->inp_snd_tag == NULL) { /* * We are setting up a rate for the first time. @@ -1250,6 +1252,7 @@ tcp_set_pacing_rate(struct tcpcb *tp, struct ifnet *if *error = EINVAL; rte = NULL; } + tp->t_pacing_rate = rte->rate; *error = 0; return (rte); } @@ -1264,6 +1267,8 @@ tcp_chg_pacing_rate(const struct tcp_hwrate_limit_tabl int is_indirect = 0; int err; + INP_WLOCK_ASSERT(tp->t_inpcb); + if ((tp->t_inpcb->inp_snd_tag == NULL) || (crte == NULL)) { /* Wrong interface */ @@ -1330,6 +1335,7 @@ re_rate: } if (error) *error = 0; + tp->t_pacing_rate = nrte->rate; return (nrte); } @@ -1340,6 +1346,9 @@ tcp_rel_pacing_rate(const struct tcp_hwrate_limit_tabl struct tcp_rate_set *rs; uint64_t pre; + INP_WLOCK_ASSERT(tp->t_inpcb); + + tp->t_pacing_rate = -1; crs = crte->ptbl; /* * Now we must break the const Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed Oct 28 23:10:54 2020 (r367121) +++ head/sys/netinet/tcp_subr.c Thu Oct 29 00:03:19 2020 (r367122) @@ -1783,6 +1783,7 @@ tcp_newtcpcb(struct inpcb *inp) /* Initialize the per-TCPCB log data. */ tcp_log_tcpcbinit(tp); #endif + tp->t_pacing_rate = -1; if (tp->t_fb->tfb_tcp_fb_init) { if ((*tp->t_fb->tfb_tcp_fb_init)(tp)) { refcount_release(&tp->t_fb->tfb_refcnt); Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Wed Oct 28 23:10:54 2020 (r367121) +++ head/sys/netinet/tcp_var.h Thu Oct 29 00:03:19 2020 (r367122) @@ -246,6 +246,7 @@ struct tcpcb { int t_dupacks; /* consecutive dup acks recd */ int t_lognum; /* Number of log entries */ int t_loglimit; /* Maximum number of log entries */ + int64_t t_pacing_rate; /* bytes / sec, -1 => unlimited */ struct tcp_log_stailq t_logs; /* Log buffer */ struct tcp_log_id_node *t_lin; struct tcp_log_id_bucket *t_lib;