Skip to content

Commit ef9f832

Browse files
committed
WIP: quic: quic_loss modifications for BBR
1 parent 005c07a commit ef9f832

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

include/haproxy/quic_loss.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct quic_pktns *quic_pto_pktns(struct quic_conn *qc,
8585
unsigned int *pto);
8686

8787
void qc_packet_loss_lookup(struct quic_pktns *pktns, struct quic_conn *qc,
88-
struct list *lost_pkts);
88+
struct list *lost_pkts, uint32_t *bytes_lost);
8989
int qc_release_lost_pkts(struct quic_conn *qc, struct quic_pktns *pktns,
9090
struct list *pkts, uint64_t now_us);
9191
#endif /* USE_QUIC */

src/quic_conn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ struct task *qc_process_timer(struct task *task, void *ctx, unsigned int state)
931931
if (tick_isset(pktns->tx.loss_time)) {
932932
struct list lost_pkts = LIST_HEAD_INIT(lost_pkts);
933933

934-
qc_packet_loss_lookup(pktns, qc, &lost_pkts);
934+
qc_packet_loss_lookup(pktns, qc, &lost_pkts, NULL);
935935
if (!LIST_ISEMPTY(&lost_pkts))
936936
tasklet_wakeup(qc->wait_event.tasklet);
937937
if (qc_release_lost_pkts(qc, pktns, &lost_pkts, now_ms))

src/quic_loss.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <import/eb64tree.h>
22

3+
#include <haproxy/quic_cc-t.h>
34
#include <haproxy/quic_conn-t.h>
45
#include <haproxy/quic_loss.h>
56
#include <haproxy/quic_tls.h>
@@ -151,7 +152,7 @@ struct quic_pktns *quic_pto_pktns(struct quic_conn *qc,
151152
* Always succeeds.
152153
*/
153154
void qc_packet_loss_lookup(struct quic_pktns *pktns, struct quic_conn *qc,
154-
struct list *lost_pkts)
155+
struct list *lost_pkts, uint32_t *bytes_lost)
155156
{
156157
struct eb_root *pkts;
157158
struct eb64_node *node;
@@ -213,8 +214,14 @@ void qc_packet_loss_lookup(struct quic_pktns *pktns, struct quic_conn *qc,
213214
ql->nb_reordered_pkt++;
214215

215216
if (tick_is_le(loss_time_limit, now_ms) || reordered) {
217+
struct quic_cc *cc = &qc->path->cc;
218+
219+
if (cc->algo->on_pkt_lost)
220+
cc->algo->on_pkt_lost(cc, pkt, pkt->rs.lost);
216221
eb64_delete(&pkt->pn_node);
217222
LIST_APPEND(lost_pkts, &pkt->list);
223+
if (bytes_lost)
224+
*bytes_lost += pkt->len;
218225
ql->nb_lost_pkt++;
219226
}
220227
else {
@@ -276,14 +283,17 @@ int qc_release_lost_pkts(struct quic_conn *qc, struct quic_pktns *pktns,
276283

277284
if (!close) {
278285
if (newest_lost) {
286+
struct quic_cc *cc = &qc->path->cc;
279287
/* Sent a congestion event to the controller */
280288
struct quic_cc_event ev = { };
281289

282290
ev.type = QUIC_CC_EVT_LOSS;
283291
ev.loss.time_sent = newest_lost->time_sent;
284292
ev.loss.count = tot_lost;
285293

286-
quic_cc_event(&qc->path->cc, &ev);
294+
quic_cc_event(cc, &ev);
295+
if (cc->algo->congestion_event)
296+
cc->algo->congestion_event(cc, newest_lost->time_sent);
287297
}
288298

289299
/* If an RTT have been already sampled, <rtt_min> has been set.
@@ -295,7 +305,8 @@ int qc_release_lost_pkts(struct quic_conn *qc, struct quic_pktns *pktns,
295305
unsigned int period = newest_lost->time_sent - oldest_lost->time_sent;
296306

297307
if (quic_loss_persistent_congestion(&qc->path->loss, period,
298-
now_ms, qc->max_ack_delay))
308+
now_ms, qc->max_ack_delay) &&
309+
qc->path->cc.algo->slow_start)
299310
qc->path->cc.algo->slow_start(&qc->path->cc);
300311
}
301312
}

0 commit comments

Comments
 (0)