]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: quic_cc modifications to support BBR
authorFrederic Lecaille <flecaille@haproxy.com>
Tue, 22 Oct 2024 17:00:25 +0000 (19:00 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 20 Nov 2024 16:34:22 +0000 (17:34 +0100)
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
src/quic_cc.c

index a4a43cadc3206fc8223169a234b4933b120db0b6..173e0fb684e2d8254f4f944599125b78304c6d54 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <haproxy/buf-t.h>
 #include <haproxy/quic_loss-t.h>
+#include <haproxy/quic_tx-t.h>
 
 #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 */
index b6bfa86a771b228dfef9f2f6d2b2916f915f7af8..9c5a8f69374412e06522f982ecd7a870e3f45bb2 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <haproxy/quic_cc.h>
+#include <haproxy/quic_pacing.h>
 
 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 <ev> event to <cc> 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)