Skip to content

Commit 8cc5ca2

Browse files
committed
WIP: quic: quic_rx modifications for BBR
1 parent ef9f832 commit 8cc5ca2

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

src/quic_rx.c

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <haproxy/ncbuf.h>
2020
#include <haproxy/proto_quic.h>
2121
#include <haproxy/quic_ack.h>
22+
#include <haproxy/quic_cc_drs.h>
2223
#include <haproxy/quic_cid.h>
2324
#include <haproxy/quic_retransmit.h>
2425
#include <haproxy/quic_retry.h>
@@ -422,33 +423,52 @@ int qc_handle_frms_of_lost_pkt(struct quic_conn *qc,
422423
* Always succeeds.
423424
*/
424425
static void qc_notify_cc_of_newly_acked_pkts(struct quic_conn *qc,
425-
struct list *newly_acked_pkts)
426+
struct list *newly_acked_pkts,
427+
unsigned int bytes_lost,
428+
unsigned int rtt)
426429
{
427430
struct quic_tx_packet *pkt, *tmp;
428431
struct quic_cc_event ev = { .type = QUIC_CC_EVT_ACK, };
432+
struct quic_cc_path *p = qc->path;
433+
struct quic_cc_drs *drs =
434+
p->cc.algo->get_drs ? p->cc.algo->get_drs(&p->cc) : NULL;
435+
unsigned int bytes_delivered = 0, pkt_delivered = 0;
429436

430437
TRACE_ENTER(QUIC_EV_CONN_PRSAFRM, qc);
431438

432439
list_for_each_entry_safe(pkt, tmp, newly_acked_pkts, list) {
433440
pkt->pktns->tx.in_flight -= pkt->in_flight_len;
434-
qc->path->prep_in_flight -= pkt->in_flight_len;
435-
qc->path->in_flight -= pkt->in_flight_len;
441+
p->prep_in_flight -= pkt->in_flight_len;
442+
p->in_flight -= pkt->in_flight_len;
436443
if (pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING)
437-
qc->path->ifae_pkts--;
444+
p->ifae_pkts--;
438445
/* If this packet contained an ACK frame, proceed to the
439446
* acknowledging of range of acks from the largest acknowledged
440447
* packet number which was sent in an ACK frame by this packet.
441448
*/
442449
if (pkt->largest_acked_pn != -1)
443450
qc_treat_ack_of_ack(qc, &pkt->pktns->rx.arngs, pkt->largest_acked_pn);
451+
bytes_delivered += pkt->len;
452+
pkt_delivered = pkt->rs.delivered;
444453
ev.ack.acked = pkt->in_flight_len;
445454
ev.ack.time_sent = pkt->time_sent;
446455
ev.ack.pn = pkt->pn_node.key;
447-
quic_cc_event(&qc->path->cc, &ev);
456+
/* Note that this event is not emitted for BBR. */
457+
quic_cc_event(&p->cc, &ev);
458+
if (drs && (pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING))
459+
quic_cc_drs_update_rate_sample(drs, pkt);
448460
LIST_DEL_INIT(&pkt->list);
449461
quic_tx_packet_refdec(pkt);
450462
}
451463

464+
if (drs) {
465+
quic_cc_drs_on_ack_recv(drs, p, pkt_delivered);
466+
drs->lost += bytes_lost;
467+
}
468+
if (p->cc.algo->on_ack_rcvd)
469+
p->cc.algo->on_ack_rcvd(&p->cc, bytes_delivered, pkt_delivered,
470+
rtt, bytes_lost, now_ms);
471+
452472
TRACE_LEAVE(QUIC_EV_CONN_PRSAFRM, qc);
453473

454474
}
@@ -552,6 +572,8 @@ static int qc_parse_ack_frm(struct quic_conn *qc,
552572
} while (1);
553573

554574
if (!LIST_ISEMPTY(&newly_acked_pkts)) {
575+
unsigned int bytes_lost = 0;
576+
555577
if (!qc_handle_newly_acked_pkts(qc, &pkt_flags, &newly_acked_pkts))
556578
goto leave;
557579

@@ -561,11 +583,13 @@ static int qc_parse_ack_frm(struct quic_conn *qc,
561583
}
562584

563585
if (!eb_is_empty(&qel->pktns->tx.pkts)) {
564-
qc_packet_loss_lookup(qel->pktns, qc, &lost_pkts);
586+
qc_packet_loss_lookup(qel->pktns, qc, &lost_pkts, &bytes_lost);
565587
if (!qc_release_lost_pkts(qc, qel->pktns, &lost_pkts, now_ms))
566588
goto leave;
567589
}
568-
qc_notify_cc_of_newly_acked_pkts(qc, &newly_acked_pkts);
590+
591+
qc_notify_cc_of_newly_acked_pkts(qc, &newly_acked_pkts,
592+
bytes_lost, *rtt_sample);
569593
if (quic_peer_validated_addr(qc))
570594
qc->path->loss.pto_count = 0;
571595
qc_set_timer(qc);

0 commit comments

Comments
 (0)