From ba9db40b07a0ffe4f44a026a3e0e2bfe27f7c00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Tue, 1 Mar 2022 17:06:50 +0100 Subject: [PATCH] CLEANUP: quic: Remove QUIC path manipulations out of the congestion controller QUIC connection path in flight bytes is a variable which should not be manipulated by the congestion controller. This latter aim is to compute the congestion window. So, we pass it as less as parameters as possible to do so. --- src/quic_cc_newreno.c | 4 ---- src/xprt_quic.c | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/quic_cc_newreno.c b/src/quic_cc_newreno.c index a9b505741..f11a2fee0 100644 --- a/src/quic_cc_newreno.c +++ b/src/quic_cc_newreno.c @@ -48,7 +48,6 @@ static void quic_cc_nr_ss_cb(struct quic_cc *cc, struct quic_cc_event *ev) path = container_of(cc, struct quic_path, cc); switch (ev->type) { case QUIC_CC_EVT_ACK: - path->in_flight -= ev->ack.acked; /* Do not increase the congestion window in recovery period. */ if (ev->ack.time_sent <= cc->algo_state.nr.recovery_start_time) return; @@ -61,7 +60,6 @@ static void quic_cc_nr_ss_cb(struct quic_cc *cc, struct quic_cc_event *ev) break; case QUIC_CC_EVT_LOSS: - path->in_flight -= ev->loss.lost_bytes; cc->algo_state.nr.cwnd = QUIC_MAX(cc->algo_state.nr.cwnd >> 1, path->min_cwnd); path->cwnd = cc->algo_state.nr.ssthresh = cc->algo_state.nr.cwnd; /* Exit to congestion avoidance. */ @@ -84,7 +82,6 @@ static void quic_cc_nr_ca_cb(struct quic_cc *cc, struct quic_cc_event *ev) path = container_of(cc, struct quic_path, cc); switch (ev->type) { case QUIC_CC_EVT_ACK: - path->in_flight -= ev->ack.acked; /* Do not increase the congestion window in recovery period. */ if (ev->ack.time_sent <= cc->algo_state.nr.recovery_start_time) goto out; @@ -98,7 +95,6 @@ static void quic_cc_nr_ca_cb(struct quic_cc *cc, struct quic_cc_event *ev) break; case QUIC_CC_EVT_LOSS: - path->in_flight -= ev->loss.lost_bytes; if (ev->loss.newest_time_sent > cc->algo_state.nr.recovery_start_time) { cc->algo_state.nr.recovery_start_time = ev->loss.now_ms; cc->algo_state.nr.cwnd = QUIC_MAX(cc->algo_state.nr.cwnd >> 1, path->min_cwnd); diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 900b2bebe..555041089 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -1595,6 +1595,7 @@ static inline void qc_treat_newly_acked_pkts(struct quic_conn *qc, list_for_each_entry_safe(pkt, tmp, newly_acked_pkts, list) { pkt->pktns->tx.in_flight -= pkt->in_flight_len; qc->path->prep_in_flight -= pkt->in_flight_len; + qc->path->in_flight -= pkt->in_flight_len; if (pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING) qc->path->ifae_pkts--; ev.ack.acked = pkt->in_flight_len; @@ -1641,6 +1642,7 @@ static inline void qc_release_lost_pkts(struct quic_conn *qc, lost_bytes += pkt->in_flight_len; pkt->pktns->tx.in_flight -= pkt->in_flight_len; qc->path->prep_in_flight -= pkt->in_flight_len; + qc->path->in_flight -= pkt->in_flight_len; if (pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING) qc->path->ifae_pkts--; /* Treat the frames of this lost packet. */