From: Amaury Denoyelle Date: Thu, 23 Jan 2025 14:24:09 +0000 (+0100) Subject: MINOR: quic: adapt credit based pacing to BBR X-Git-Tag: v3.2-dev4~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=42bac9339cc3e3eed99ae1664a4f3633183ab640;p=thirdparty%2Fhaproxy.git MINOR: quic: adapt credit based pacing to BBR Credit based pacing has been further refined to be able to calculate dynamically burst size based on congestion parameter. However, BBR algorithm already provides pacing rate and burst size (labelled as send_quantum) for 1ms of emission. Adapt quic_pacing_reload() to use BBR values to compute pacing credit. This is done via pacing_burst callback which is now only defined for BBR. For other algorithms, determine the burst size over 1ms with the congestion window size and RTT. This should be backported up to 3.1. --- diff --git a/src/quic_pacing.c b/src/quic_pacing.c index 000c957b2..856c5eebe 100644 --- a/src/quic_pacing.c +++ b/src/quic_pacing.c @@ -22,11 +22,15 @@ int quic_pacing_reload(struct quic_pacer *pacer) const uint64_t task_now_ns = task_mono_time(); const uint64_t inter = pacer->cc->algo->pacing_inter(pacer->cc); uint64_t inc, wakeup_delay; - uint credit_max; + uint credit_max, pkt_ms; + + /* Calculate the amount of packets which could be emitted in 1ms. */ + pkt_ms = pacer->cc->algo->pacing_burst ? + pacer->cc->algo->pacing_burst(pacer->cc) : (1000000 + inter - 1) / inter; if (task_now_ns > pacer->cur) { /* Calculate number of packets which could have been emitted since last emission sequence. Result is rounded up. */ - inc = (task_now_ns - pacer->cur + inter - 1) / inter; + inc = (pkt_ms * (task_now_ns - pacer->cur) + 999999) / 1000000; /* Credit must not exceed a maximal value to guarantee a * smooth emission. This max value represents the number of @@ -40,7 +44,7 @@ int quic_pacing_reload(struct quic_pacer *pacer) /* Convert it to nanoseconds. Use 1.5 factor tolerance to try to cover the imponderable extra system delay until the next wakeup. */ wakeup_delay *= 1500; /* Determine max credit from wakeup_delay and packet rate emission. */ - credit_max = wakeup_delay / inter; + credit_max = (wakeup_delay * pkt_ms + 999999) / 1000000; /* Ensure max credit will never be smaller than 2. */ credit_max = MAX(credit_max, 2); /* Apply max credit on the new value. */