Skip to content

Commit 96fdd6f

Browse files
committed
WIP: quic: quic_loss modifications for BBR
1 parent 260b27e commit 96fdd6f

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

include/haproxy/quic_loss.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ 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,
90-
struct list *pkts, uint64_t now_us);
90+
struct list *pkts, uint64_t now_us,
91+
unsigned int *largest_pkt_sent_ts);
9192
#endif /* USE_QUIC */
9293
#endif /* _PROTO_QUIC_LOSS_H */

src/quic_conn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,10 +931,10 @@ 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);
937-
if (qc_release_lost_pkts(qc, pktns, &lost_pkts, now_ms))
937+
if (qc_release_lost_pkts(qc, pktns, &lost_pkts, now_ms, NULL))
938938
qc_set_timer(qc);
939939
goto out;
940940
}

src/quic_loss.c

Lines changed: 19 additions & 4 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 {
@@ -239,7 +246,8 @@ void qc_packet_loss_lookup(struct quic_pktns *pktns, struct quic_conn *qc,
239246
* CONNECTION_CLOSE was prepared to close the connection ASAP.
240247
*/
241248
int qc_release_lost_pkts(struct quic_conn *qc, struct quic_pktns *pktns,
242-
struct list *pkts, uint64_t now_us)
249+
struct list *pkts, uint64_t now_us,
250+
uint32_t *largest_pkt_sent_ts)
243251
{
244252
struct quic_tx_packet *pkt, *tmp, *oldest_lost, *newest_lost;
245253
uint tot_lost = 0;
@@ -276,14 +284,20 @@ int qc_release_lost_pkts(struct quic_conn *qc, struct quic_pktns *pktns,
276284

277285
if (!close) {
278286
if (newest_lost) {
287+
struct quic_cc *cc = &qc->path->cc;
279288
/* Sent a congestion event to the controller */
280289
struct quic_cc_event ev = { };
281290

282291
ev.type = QUIC_CC_EVT_LOSS;
283292
ev.loss.time_sent = newest_lost->time_sent;
284293
ev.loss.count = tot_lost;
285294

286-
quic_cc_event(&qc->path->cc, &ev);
295+
quic_cc_event(cc, &ev);
296+
if (cc->algo->congestion_event) {
297+
if (largest_pkt_sent_ts)
298+
*largest_pkt_sent_ts = newest_lost->time_sent;
299+
cc->algo->congestion_event(cc, newest_lost->time_sent);
300+
}
287301
}
288302

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

297311
if (quic_loss_persistent_congestion(&qc->path->loss, period,
298-
now_ms, qc->max_ack_delay))
312+
now_ms, qc->max_ack_delay) &&
313+
qc->path->cc.algo->slow_start)
299314
qc->path->cc.algo->slow_start(&qc->path->cc);
300315
}
301316
}

0 commit comments

Comments
 (0)