Save the current TCP pacing rate in t_pacing_rate.

Reviewed by:	gallatin, gnn
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D26875
This commit is contained in:
jhb 2020-10-29 00:03:19 +00:00
parent ff92cddcc1
commit a4b446b418
3 changed files with 11 additions and 0 deletions

View File

@ -1220,6 +1220,8 @@ tcp_set_pacing_rate(struct tcpcb *tp, struct ifnet *ifp,
{
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 *ifp,
*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_table *crte,
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 @@ tcp_chg_pacing_rate(const struct tcp_hwrate_limit_table *crte,
}
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_table *crte, struct tcpcb *tp)
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

View File

@ -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);

View File

@ -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;