From af75665cb7cd30505ed4aa59d2113a3a69543cd1 Mon Sep 17 00:00:00 2001 From: Frederic Lecaille Date: Tue, 22 Oct 2024 19:00:25 +0200 Subject: [PATCH] MINOR: quic: quic_cc modifications to support BBR Add several callbacks to quic_cc_algo struct which are only called by BBR. ->get_drs() may be used to retrieve the delivery rate sampling information from an congestion algorithm struct (quic_cc). ->on_transmit() must be called before sending any packet a QUIC sender. ->on_ack_rcvd() must be called after having received an ACK. ->on_pkt_lost() must be called after having detected a packet loss. ->congestion_event() must be called after any congestion event detection Modify quic_cc.c to call ->event only if defined. This is not the case for BBR. --- include/haproxy/quic_cc-t.h | 11 +++++++++++ src/quic_cc.c | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/haproxy/quic_cc-t.h b/include/haproxy/quic_cc-t.h index a4a43cadc3..173e0fb684 100644 --- a/include/haproxy/quic_cc-t.h +++ b/include/haproxy/quic_cc-t.h @@ -31,6 +31,7 @@ #include #include +#include #define QUIC_CC_INFINITE_SSTHESH ((uint32_t)-1) @@ -136,6 +137,16 @@ struct quic_cc_algo { /* Defined only if pacing is used. */ uint (*pacing_rate)(const struct quic_cc *cc); uint (*pacing_burst)(const struct quic_cc *cc); + + struct quic_cc_drs *(*get_drs)(struct quic_cc *cc); + void (*on_transmit)(struct quic_cc *cc); + void (*drs_on_transmit)(struct quic_cc *cc, struct quic_tx_packet *pkt); + void (*on_ack_rcvd)(struct quic_cc *cc, uint32_t acked, uint32_t delivered, + uint32_t ack_rtt, uint32_t bytes_lost, + unsigned int largest_pkt_sent_ts); + void (*on_pkt_lost)(struct quic_cc *cc, + struct quic_tx_packet *pkt, uint32_t lost_bytes); + void (*congestion_event)(struct quic_cc *cc, uint32_t ts); }; #endif /* USE_QUIC */ diff --git a/src/quic_cc.c b/src/quic_cc.c index b6bfa86a77..9c5a8f6937 100644 --- a/src/quic_cc.c +++ b/src/quic_cc.c @@ -21,6 +21,7 @@ */ #include +#include struct quic_cc_algo *default_quic_cc_algo = &quic_cc_algo_cubic; @@ -40,7 +41,8 @@ void quic_cc_init(struct quic_cc *cc, /* Send event to congestion controller. */ void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev) { - cc->algo->event(cc, ev); + if (cc->algo->event) + cc->algo->event(cc, ev); } void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc)