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 */
153154void 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