From 0c558381df41f68aad67656fce599b4a13994fc3 Mon Sep 17 00:00:00 2001 From: Frederic Lecaille Date: Tue, 22 Oct 2024 19:03:52 +0200 Subject: [PATCH] WIP: quic: quic_tx modifications for BBR. --- include/haproxy/quic_pacing.h | 2 +- src/quic_pacing.c | 4 ++-- src/quic_tx.c | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/haproxy/quic_pacing.h b/include/haproxy/quic_pacing.h index ee536fb2e..26c4cca9c 100644 --- a/include/haproxy/quic_pacing.h +++ b/include/haproxy/quic_pacing.h @@ -39,6 +39,6 @@ int quic_pacing_expired(const struct quic_pacer *pacer); enum quic_tx_err quic_pacing_send(struct quic_pacer *pacer, struct quic_conn *qc); -void quic_pacing_sent_done(struct quic_pacer *pacer, int sent); +void quic_pacing_sent_done(struct quic_pacer *pacer, int sent, ullong ns_pkts); #endif /* _HAPROXY_QUIC_PACING_H */ diff --git a/src/quic_pacing.c b/src/quic_pacing.c index 8a1e33f23..30898afa6 100644 --- a/src/quic_pacing.c +++ b/src/quic_pacing.c @@ -23,7 +23,7 @@ enum quic_tx_err quic_pacing_send(struct quic_pacer *pacer, struct quic_conn *qc return ret; } -void quic_pacing_sent_done(struct quic_pacer *pacer, int sent) +void quic_pacing_sent_done(struct quic_pacer *pacer, int sent, ullong ns_pkts) { - pacer->next = now_mono_time() + quic_pacing_ns_pkt(pacer) * sent; + pacer->next = now_mono_time() + sent * ns_pkts; } diff --git a/src/quic_tx.c b/src/quic_tx.c index c06f51caa..77a7dbb74 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -396,6 +396,10 @@ static int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx) qc->path->ifae_pkts++; if (qc->flags & QUIC_FL_CONN_IDLE_TIMER_RESTARTED_AFTER_READ) qc_idle_timer_rearm(qc, 0, 0); + if (cc->algo->on_transmit) + cc->algo->on_transmit(cc); + if (cc->algo->drs_on_transmit) + cc->algo->drs_on_transmit(cc, pkt); } if (!(qc->flags & QUIC_FL_CONN_CLOSING) && (pkt->flags & QUIC_FL_TX_PACKET_CC)) { @@ -476,6 +480,7 @@ enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms, struct list send_list = LIST_HEAD_INIT(send_list); enum quic_tx_err ret = QUIC_TX_ERR_NONE; int max_dgram = 0, sent; + ullong ns_pkts; TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc); BUG_ON(qc->mux_state != QC_MUX_READY); /* Only MUX can uses this function so it must be ready. */ @@ -495,8 +500,9 @@ enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms, } if (pacer) { - const ullong ns_pkts = quic_pacing_ns_pkt(pacer); - max_dgram = global.tune.quic_frontend_max_tx_burst * 1000000 / (ns_pkts + 1) + 1; + struct quic_cc *cc = &qc->path->cc; + + ns_pkts = cc->algo->pacing_delay_ns(cc, &max_dgram); } TRACE_STATE("preparing data (from MUX)", QUIC_EV_CONN_TXPKT, qc); @@ -508,7 +514,7 @@ enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms, else if (pacer) { if (max_dgram && max_dgram == sent && !LIST_ISEMPTY(frms)) ret = QUIC_TX_ERR_AGAIN; - quic_pacing_sent_done(pacer, sent); + quic_pacing_sent_done(pacer, sent, ns_pkts); } TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc);