]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: process_timer() rework
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 21 Apr 2022 16:26:22 +0000 (18:26 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 28 Apr 2022 14:22:40 +0000 (16:22 +0200)
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).

include/haproxy/xprt_quic-t.h
src/xprt_quic.c

index a7ee4e856b9899fe7af5011f4e23daa34b73dcdb..9346dae84aa4ccf4fbd816faa84b7aa29ea93abf 100644 (file)
@@ -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)
index b1ffc12fc564879903046ed4a1ed52606caa0aee..75c90509868d0bcd556a7f18b15eef60dc941ed0 100644 (file)
@@ -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++;