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.
This commit is contained in:
Frederic Lecaille 2024-10-22 19:00:25 +02:00
parent d04adf44dc
commit af75665cb7
2 changed files with 14 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include <haproxy/buf-t.h> #include <haproxy/buf-t.h>
#include <haproxy/quic_loss-t.h> #include <haproxy/quic_loss-t.h>
#include <haproxy/quic_tx-t.h>
#define QUIC_CC_INFINITE_SSTHESH ((uint32_t)-1) #define QUIC_CC_INFINITE_SSTHESH ((uint32_t)-1)
@ -136,6 +137,16 @@ struct quic_cc_algo {
/* Defined only if pacing is used. */ /* Defined only if pacing is used. */
uint (*pacing_rate)(const struct quic_cc *cc); uint (*pacing_rate)(const struct quic_cc *cc);
uint (*pacing_burst)(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 */ #endif /* USE_QUIC */

View File

@ -21,6 +21,7 @@
*/ */
#include <haproxy/quic_cc.h> #include <haproxy/quic_cc.h>
#include <haproxy/quic_pacing.h>
struct quic_cc_algo *default_quic_cc_algo = &quic_cc_algo_cubic; struct quic_cc_algo *default_quic_cc_algo = &quic_cc_algo_cubic;
@ -40,6 +41,7 @@ void quic_cc_init(struct quic_cc *cc,
/* Send <ev> event to <cc> congestion controller. */ /* Send <ev> event to <cc> congestion controller. */
void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev) void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev)
{ {
if (cc->algo->event)
cc->algo->event(cc, ev); cc->algo->event(cc, ev);
} }