]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add traces for in flght ack-eliciting packet counter.
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 16 Dec 2020 16:33:11 +0000 (17:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 23 Dec 2020 10:57:26 +0000 (11:57 +0100)
Add trace for this counter. Also shorten its variable name (->ifae_pkts).

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

index ee7649c533fcc894264d48b8ee4baafc9848c57b..16fe5aa317669233c9da8e3ac98133dba7bcabab 100644 (file)
@@ -109,9 +109,12 @@ static inline struct quic_pktns *quic_loss_pktns(struct quic_conn *qc)
        struct quic_pktns *pktns;
 
        pktns = &qc->pktns[QUIC_TLS_PKTNS_INITIAL];
-       for (i = QUIC_TLS_PKTNS_01RTT; i < QUIC_TLS_PKTNS_MAX; i++)
+       TRACE_PROTO("pktns", QUIC_EV_CONN_SPTO, qc->conn, pktns);
+       for (i = QUIC_TLS_PKTNS_01RTT; i < QUIC_TLS_PKTNS_MAX; i++) {
+               TRACE_PROTO("pktns", QUIC_EV_CONN_SPTO, qc->conn, &qc->pktns[i]);
                if (qc->pktns[i].tx.loss_time < pktns->tx.loss_time)
                        pktns = &qc->pktns[i];
+       }
 
        return pktns;
 }
index 8e240a069eb76e7dacb259a592f362828d4841d6..37cbb46f0aa874153f46d7e964aa1ed31823c7b2 100644 (file)
@@ -569,7 +569,7 @@ struct quic_path {
        /* Outstanding data (in bytes). */
        uint64_t in_flight;
        /* Number of in flight ack-eliciting packets. */
-       uint64_t in_flight_ae_pkts;
+       uint64_t ifae_pkts;
 };
 
 /* The number of buffers for outgoing packets (must be a power of two). */
index 498ddb6109e635af3d97f95ca9fbdce8b3c7fb65..17b325431f0eb1f690373114569e5675589122b7 100644 (file)
@@ -1039,7 +1039,7 @@ static inline void quic_path_init(struct quic_path *path, int ipv4,
        path->min_cwnd = max_dgram_sz << 1;
        path->prep_in_flight = 0;
        path->in_flight = 0;
-       path->in_flight_ae_pkts = 0;
+       path->ifae_pkts = 0;
        quic_cc_init(&path->cc, algo, qc);
 }
 
index 16c8c435277f8e42c1ea7385d59cc13d5afa6237..3ab9328ecccc4a314e91a758b80d1551f87ebd14 100644 (file)
@@ -462,7 +462,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                                              pktns == &qc->pktns[QUIC_TLS_PKTNS_01RTT] ? "01RTT": "H");
                                if (pktns->tx.loss_time)
                                              chunk_appendf(&trace_buf, " loss_time=%dms",
-                                                           TICKS_TO_MS(qc->timer - now_ms));
+                                                           TICKS_TO_MS(tick_remain(now_ms, pktns->tx.loss_time)));
                        }
                        if (lost_pkts && !LIST_ISEMPTY(lost_pkts)) {
                                struct quic_tx_packet *pkt;
@@ -477,7 +477,11 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                        struct quic_conn *qc = conn->qc;
                        const struct quic_pktns *pktns = a2;
                        const int *duration = a3;
+                       const uint64_t *ifae_pkts = a4;
 
+                       if (ifae_pkts)
+                               chunk_appendf(&trace_buf, " ifae_pkts=%llu",
+                                             (unsigned long long)*ifae_pkts);
                        if (pktns) {
                                chunk_appendf(&trace_buf, " pktns=%s pp=%d",
                                              pktns == &qc->pktns[QUIC_TLS_PKTNS_INITIAL] ? "I" :
@@ -569,7 +573,8 @@ static inline void qc_set_timer(struct quic_conn_ctx *ctx)
        struct quic_pktns *pktns;
        unsigned int pto;
 
-       TRACE_ENTER(QUIC_EV_CONN_STIMER, ctx->conn);
+       TRACE_ENTER(QUIC_EV_CONN_STIMER, ctx->conn,
+                   NULL, NULL, &ctx->conn->qc->path->ifae_pkts);
        qc = ctx->conn->qc;
        pktns = quic_loss_pktns(qc);
        if (tick_isset(pktns->tx.loss_time)) {
@@ -581,7 +586,8 @@ static inline void qc_set_timer(struct quic_conn_ctx *ctx)
         * cancelled for a server which reached the anti-amplification limit.
         */
 
-       if (!qc->path->in_flight_ae_pkts && quic_peer_validated_addr(ctx)) {
+       if (!qc->path->ifae_pkts && quic_peer_validated_addr(ctx)) {
+               TRACE_PROTO("timer cancellation", QUIC_EV_CONN_STIMER, ctx->conn);
                /* Timer cancellation. */
                qc->timer = TICK_ETERNITY;
                goto out;
@@ -1202,7 +1208,7 @@ static inline void qc_treat_newly_acked_pkts(struct quic_conn_ctx *ctx,
                pkt->pktns->tx.in_flight -= pkt->in_flight_len;
                qc->path->prep_in_flight -= pkt->in_flight_len;
                if (pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING)
-                       qc->path->in_flight_ae_pkts--;
+                       qc->path->ifae_pkts--;
                ev.ack.acked = pkt->in_flight_len;
                ev.ack.time_sent = pkt->time_sent;
                quic_cc_event(&qc->path->cc, &ev);
@@ -1237,7 +1243,7 @@ static inline void qc_release_lost_pkts(struct quic_pktns *pktns,
                pkt->pktns->tx.in_flight -= pkt->in_flight_len;
                qc->path->prep_in_flight -= pkt->in_flight_len;
                if (pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING)
-                       qc->path->in_flight_ae_pkts--;
+                       qc->path->ifae_pkts--;
                /* Treat the frames of this lost packet. */
                list_for_each_entry_safe(frm, frmbak, &pkt->frms, list)
                        qc_treat_nacked_tx_frm(frm, pktns, ctx);
@@ -1772,7 +1778,7 @@ int qc_send_ppkts(struct quic_conn_ctx *ctx)
                        p->time_sent = time_sent;
                        if (p->flags & QUIC_FL_TX_PACKET_ACK_ELICITING) {
                                p->pktns->tx.time_of_last_eliciting = time_sent;
-                               qc->path->in_flight_ae_pkts++;
+                               qc->path->ifae_pkts++;
                        }
                        qc->path->in_flight += p->in_flight_len;
                        p->pktns->tx.in_flight += p->in_flight_len;
@@ -2401,7 +2407,8 @@ static struct task *process_timer(struct task *task, void *ctx, unsigned short s
 
        conn_ctx = task->context;
        qc = conn_ctx->conn->qc;
-       TRACE_ENTER(QUIC_EV_CONN_PTIMER, conn_ctx->conn);
+       TRACE_ENTER(QUIC_EV_CONN_PTIMER, conn_ctx->conn,
+                   NULL, NULL, &qc->path->ifae_pkts);
        task->expire = TICK_ETERNITY;
        pktns = quic_loss_pktns(qc);
        if (tick_isset(pktns->tx.loss_time)) {