Skip to content

Commit 5f6f517

Browse files
committed
WIP: quic: quic_cc modifications for BBR
1 parent c891829 commit 5f6f517

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

include/haproxy/quic_cc-t.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include <haproxy/buf-t.h>
3333
#include <haproxy/quic_loss-t.h>
34+
#include <haproxy/quic_tx-t.h>
3435

3536
#define QUIC_CC_INFINITE_SSTHESH ((uint32_t)-1)
3637

@@ -70,7 +71,9 @@ struct quic_cc_event {
7071
struct ack {
7172
uint64_t acked;
7273
uint64_t pn;
74+
unsigned int bytes_lost;
7375
unsigned int time_sent;
76+
unsigned int rtt;
7477
} ack;
7578
struct loss {
7679
unsigned int time_sent;
@@ -90,7 +93,7 @@ struct quic_cc {
9093
/* <conn> is there only for debugging purpose. */
9194
struct quic_conn *qc;
9295
struct quic_cc_algo *algo;
93-
uint32_t priv[116];
96+
uint32_t priv[158];
9497
};
9598

9699
struct quic_cc_path {
@@ -129,6 +132,16 @@ struct quic_cc_algo {
129132
void (*state_trace)(struct buffer *buf, const struct quic_cc *cc);
130133
void (*state_cli)(struct buffer *buf, const struct quic_cc_path *path);
131134
void (*hystart_start_round)(struct quic_cc *cc, uint64_t pn);
135+
struct quic_cc_drs *(*get_drs)(struct quic_cc *cc);
136+
void (*on_transmit)(struct quic_cc *cc);
137+
void (*drs_on_transmit)(struct quic_cc *cc, struct quic_tx_packet *pkt);
138+
void (*on_ack_rcvd)(struct quic_cc *cc, uint32_t acked, uint32_t delivered,
139+
uint32_t ack_rtt, uint32_t bytes_lost,
140+
unsigned int largest_pkt_sent_ts);
141+
void (*on_pkt_lost)(struct quic_cc *cc,
142+
struct quic_tx_packet *pkt, uint32_t lost_bytes);
143+
void (*congestion_event)(struct quic_cc *cc, uint32_t ts);
144+
unsigned long long (*pacing_delay_ns)(const struct quic_cc *cc, int *max_dgram);
132145
};
133146

134147
#endif /* USE_QUIC */

include/haproxy/quic_cc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
void quic_cc_init(struct quic_cc *cc, struct quic_cc_algo *algo, struct quic_conn *qc);
3737
void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev);
38+
unsigned long long quic_cc_pacing_delay_ns(const struct quic_cc *cc, int *max_dgram);
3839
void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc);
3940

4041
static inline const char *quic_cc_state_str(enum quic_cc_algo_state_type state)
@@ -95,7 +96,7 @@ static inline void quic_cc_path_init(struct quic_cc_path *path, int ipv4, unsign
9596
path->ifae_pkts = 0;
9697
quic_cc_init(&path->cc, algo, qc);
9798
path->delivery_rate = 0;
98-
path->send_quantum = path->mtu * 10;
99+
path->send_quantum = 64 * 1024;
99100
}
100101

101102
/* Return the remaining <room> available on <path> QUIC path for prepared data

src/quic_cc.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
#include <haproxy/quic_cc.h>
24+
#include <haproxy/quic_pacing.h>
2425

2526
struct quic_cc_algo *default_quic_cc_algo = &quic_cc_algo_cubic;
2627

@@ -40,7 +41,18 @@ void quic_cc_init(struct quic_cc *cc,
4041
/* Send <ev> event to <cc> congestion controller. */
4142
void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev)
4243
{
43-
cc->algo->event(cc, ev);
44+
if (cc->algo->event)
45+
cc->algo->event(cc, ev);
46+
}
47+
48+
unsigned long long quic_cc_pacing_delay_ns(const struct quic_cc *cc, int *max_dgram)
49+
{
50+
int ns_pkts;
51+
52+
ns_pkts = quic_pacing_ns_pkt(&cc->qc->qcc->tx.pacer);
53+
*max_dgram = global.tune.quic_frontend_max_tx_burst * 1000000 / (ns_pkts + 1) + 1;
54+
55+
return ns_pkts;
4456
}
4557

4658
void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc)

src/quic_cc_cubic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ struct quic_cc_algo quic_cc_algo_cubic = {
678678
.event = quic_cc_cubic_event,
679679
.slow_start = quic_cc_cubic_slow_start,
680680
.hystart_start_round = quic_cc_cubic_hystart_start_round,
681+
.pacing_delay_ns = quic_cc_pacing_delay_ns,
681682
.state_trace = quic_cc_cubic_state_trace,
682683
.state_cli = quic_cc_cubic_state_cli,
683684
};

src/quic_cc_newreno.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ struct quic_cc_algo quic_cc_algo_nr = {
220220
.event = quic_cc_nr_event,
221221
.slow_start = quic_cc_nr_slow_start,
222222
.hystart_start_round = quic_cc_nr_hystart_start_round,
223+
.pacing_delay_ns = quic_cc_pacing_delay_ns,
223224
.state_trace = quic_cc_nr_state_trace,
224225
};
225226

0 commit comments

Comments
 (0)