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
This commit is contained in:
Randall Stewart 2022-09-26 15:12:03 -04:00
parent 6914ffef4e
commit e5049a1733
3 changed files with 24 additions and 4 deletions

View File

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

View File

@ -9397,6 +9397,20 @@ rack_note_dsack(struct tcp_rack *rack, tcp_seq start, tcp_seq end)
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,
};

View File

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