]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Do not retransmit frames from coalesced packets
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 21 Apr 2022 15:58:46 +0000 (17:58 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 28 Apr 2022 14:22:40 +0000 (16:22 +0200)
Add QUIC_FL_TX_PACKET_COALESCED flag to mark a TX packet as coalesced with others
to build a datagram.
Ensure we do not directly retransmit frames from such coalesced packets. They must
be retransmitted from their packet number spaces to avoid duplications.

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

index 6c4336cc47c0d8db66c7889861e43329cdab8a2e..a7ee4e856b9899fe7af5011f4e23daa34b73dcdb 100644 (file)
@@ -518,6 +518,8 @@ struct quic_rx_strm_frm {
 #define QUIC_FL_TX_PACKET_CC            (1UL << 2)
 /* Flag a sent packet as containg an ACK frame */
 #define QUIC_FL_TX_PACKET_ACK           (1UL << 3)
+/* Flag a sent packet as being coalesced to another one in the same datagram */
+#define QUIC_FL_TX_PACKET_COALESCED     (1UL << 4)
 
 /* Structure to store enough information about TX QUIC packets. */
 struct quic_tx_packet {
index 1ccabd941be961063a1248a5d7cce4c93207a735..4eb4d24088b009c22d52ee4bbc1d69d1ee183e0f 100644 (file)
@@ -2339,7 +2339,7 @@ static void qc_prep_fast_retrans(struct quic_enc_level *qel,
        /* Skip the empty packet (they have already been retransmitted) */
        while (node) {
                pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node);
-               if (!LIST_ISEMPTY(&pkt->frms))
+               if (!LIST_ISEMPTY(&pkt->frms) && !(pkt->flags & QUIC_FL_TX_PACKET_COALESCED))
                        break;
                node = eb64_next(node);
        }
@@ -2395,7 +2395,7 @@ static void qc_prep_hdshk_fast_retrans(struct quic_conn *qc)
        /* Skip the empty packet (they have already been retransmitted) */
        while (node) {
                pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node);
-               if (!LIST_ISEMPTY(&pkt->frms))
+               if (!LIST_ISEMPTY(&pkt->frms) && !(pkt->flags & QUIC_FL_TX_PACKET_COALESCED))
                        break;
                node = eb64_next(node);
        }
@@ -2961,8 +2961,10 @@ static int qc_prep_pkts(struct quic_conn *qc, struct qring *qr,
                if (!first_pkt)
                        first_pkt = cur_pkt;
                /* Attach the current one to the previous one */
-               if (prv_pkt)
+               if (prv_pkt) {
                        prv_pkt->next = cur_pkt;
+                       cur_pkt->flags |= QUIC_FL_TX_PACKET_COALESCED;
+               }
                /* Let's say we have to build a new dgram */
                prv_pkt = NULL;
                dglen += cur_pkt->len;