From: Frédéric Lécaille Date: Thu, 21 Apr 2022 16:26:22 +0000 (+0200) Subject: MINOR: quic: process_timer() rework X-Git-Tag: v2.6-dev8~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ef729a64386c2787f954e9741ed8bafa4a3b2fd;p=thirdparty%2Fhaproxy.git MINOR: quic: process_timer() rework Add QUIC_FL_CONN_RETRANS_NEEDED connection flag definition to mark a quic_conn struct as needing a retranmission. Add QUIC_FL_PKTNS_PROBE_NEEDED to mark a packet number space as needing a datagram probing. Set these flags from process_timer() to trigger datagram probings. Do not initiate anymore datagrams probing from any quic encryption level. This will be done from the I/O handlers (quic_conn_io_cb() during handshakes and quic_conn_app_io_cb() after handshakes). --- diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index a7ee4e856b..9346dae84a 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -393,6 +393,8 @@ struct quic_arngs { #define QUIC_FL_PKTNS_PKT_RECEIVED (1UL << 0) /* Flag the packet number space as requiring an ACK frame to be sent. */ #define QUIC_FL_PKTNS_ACK_REQUIRED (1UL << 1) +/* Flag the packet number space as needing probing */ +#define QUIC_FL_PKTNS_PROBE_NEEDED (1UL << 2) /* The maximum number of dgrams which may be sent upon PTO expirations. */ #define QUIC_MAX_NB_PTO_DGRAMS 2 @@ -666,6 +668,7 @@ enum qc_mux_state { #define QUIC_FL_CONN_LISTENER (1U << 3) #define QUIC_FL_CONN_ACCEPT_REGISTERED (1U << 4) #define QUIC_FL_CONN_IDLE_TIMER_RESTARTED_AFTER_READ (1U << 6) +#define QUIC_FL_CONN_RETRANS_NEEDED (1U << 7) #define QUIC_FL_CONN_NOTIFY_CLOSE (1U << 27) /* MUX notified about quic-conn imminent closure (idle-timeout or CONNECTION_CLOSE emission/reception) */ #define QUIC_FL_CONN_EXP_TIMER (1U << 28) /* timer has expired, quic-conn can be freed */ #define QUIC_FL_CONN_CLOSING (1U << 29) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index b1ffc12fc5..75c9050986 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -3949,7 +3949,6 @@ static struct task *process_timer(struct task *task, void *ctx, unsigned int sta struct ssl_sock_ctx *conn_ctx; struct quic_conn *qc; struct quic_pktns *pktns; - int i; conn_ctx = task->context; qc = conn_ctx->qc; @@ -3968,14 +3967,12 @@ static struct task *process_timer(struct task *task, void *ctx, unsigned int sta } if (qc->path->in_flight) { + qc->flags |= QUIC_FL_CONN_RETRANS_NEEDED; pktns = quic_pto_pktns(qc, qc->state >= QUIC_HS_ST_COMPLETE, NULL); + pktns->flags |= QUIC_FL_PKTNS_PROBE_NEEDED; if (pktns == &qc->pktns[QUIC_TLS_PKTNS_INITIAL]) { - pktns->tx.pto_probe = 1; if (qc->pktns[QUIC_TLS_PKTNS_HANDSHAKE].tx.in_flight) - qc->pktns[QUIC_TLS_PKTNS_HANDSHAKE].tx.pto_probe = 1; - } - else { - pktns->tx.pto_probe = 2; + qc->pktns[QUIC_TLS_PKTNS_HANDSHAKE].flags |= QUIC_FL_PKTNS_PROBE_NEEDED; } } else if (!qc_is_listener(qc) && qc->state <= QUIC_HS_ST_COMPLETE) { @@ -3988,13 +3985,6 @@ static struct task *process_timer(struct task *task, void *ctx, unsigned int sta iel->pktns->tx.pto_probe = 1; } - for (i = QUIC_TLS_ENC_LEVEL_INITIAL; i < QUIC_TLS_ENC_LEVEL_MAX; i++) { - if (i == QUIC_TLS_ENC_LEVEL_APP && !quic_peer_validated_addr(qc)) - continue; - - qc_prep_fast_retrans(&qc->els[i], qc); - } - tasklet_wakeup(conn_ctx->wait_event.tasklet); qc->path->loss.pto_count++;