]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add a counter for reordered packets
authorFrederic Lecaille <flecaille@haproxy.com>
Tue, 13 Feb 2024 20:24:40 +0000 (21:24 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 14 Feb 2024 10:32:29 +0000 (11:32 +0100)
A packet is considered as reordered when it is detected as lost because its packet
number is above the largest acknowledeged packet number by at least the
packet reordering threshold value.

Add ->nb_reordered_pkt new quic_loss struct member at the same location that
the number of lost packets to count such packets.

Should be backported to 2.6.

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

index d1fea9f7e113e09cfacd03a9b30923259a1343e6..0f07ddc00a63e166d0aa5268e3a4846320b8e08a 100644 (file)
@@ -55,6 +55,7 @@ struct quic_loss {
        /* Number of NACKed sent PTO. */
        unsigned int pto_count;
        unsigned long nb_lost_pkt;
+       unsigned long nb_reordered_pkt;
 };
 
 #endif /* USE_QUIC */
index d2a0e776ba3016869d57aaebd19659d0cddbe663..fc713ca07d02340aa18a1b49e9abfe89492dc98c 100644 (file)
@@ -40,6 +40,7 @@ static inline void quic_loss_init(struct quic_loss *ql)
        ql->rtt_min = 0;
        ql->pto_count = 0;
        ql->nb_lost_pkt = 0;
+       ql->nb_reordered_pkt = 0;
 }
 
 /* Return 1 if a persistent congestion is observed for a list of
index 07a32f6cb57a29410f3fa4ab6a97dd97192ac614..56301fa848e1bb6e80e81cfe4478b76307314fa5 100644 (file)
@@ -204,10 +204,10 @@ static void dump_quic_full(struct show_quic_ctx *ctx, struct quic_conn *qc)
        }
 
        chunk_appendf(&trash, "  srtt=%-4u rttvar=%-4u rttmin=%-4u ptoc=%-4u cwnd=%-6llu"
-                             " mcwnd=%-6llu sentpkts=%-6llu lostpkts=%-6llu\n",
+                             " mcwnd=%-6llu sentpkts=%-6llu lostpkts=%-6llu\n reorderedpkts=%-6llu",
                      qc->path->loss.srtt, qc->path->loss.rtt_var,
                      qc->path->loss.rtt_min, qc->path->loss.pto_count, (ullong)qc->path->cwnd,
-                     (ullong)qc->path->mcwnd, (ullong)qc->cntrs.sent_pkt, (ullong)qc->path->loss.nb_lost_pkt);
+                     (ullong)qc->path->mcwnd, (ullong)qc->cntrs.sent_pkt, (ullong)qc->path->loss.nb_lost_pkt, (ullong)qc->path->loss.nb_reordered_pkt);
 
        if (qc->cntrs.dropped_pkt) {
                chunk_appendf(&trash, " droppkts=%-6llu", qc->cntrs.dropped_pkt);
index fa0e4ba575f31cab34109a4654fa038b9000381f..fd9568a50a535a95efe22c061508db4ed341d278 100644 (file)
@@ -197,6 +197,7 @@ void qc_packet_loss_lookup(struct quic_pktns *pktns, struct quic_conn *qc,
                struct quic_tx_packet *pkt;
                int64_t largest_acked_pn;
                unsigned int loss_time_limit, time_sent;
+               int reordered;
 
                pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node);
                largest_acked_pn = pktns->rx.largest_acked_pn;
@@ -206,8 +207,12 @@ void qc_packet_loss_lookup(struct quic_pktns *pktns, struct quic_conn *qc,
 
                time_sent = pkt->time_sent;
                loss_time_limit = tick_add(time_sent, loss_delay);
-               if (tick_is_le(loss_time_limit, now_ms) ||
-                       (int64_t)largest_acked_pn >= pkt->pn_node.key + pktthresh) {
+
+               reordered = (int64_t)largest_acked_pn >= pkt->pn_node.key + pktthresh;
+               if (reordered)
+                       ql->nb_reordered_pkt++;
+
+               if (tick_is_le(loss_time_limit, now_ms) || reordered) {
                        eb64_delete(&pkt->pn_node);
                        LIST_APPEND(lost_pkts, &pkt->list);
                        ql->nb_lost_pkt++;