From: Frédéric Lécaille Date: Thu, 21 Apr 2022 15:58:46 +0000 (+0200) Subject: MINOR: quic: Do not retransmit frames from coalesced packets X-Git-Tag: v2.6-dev8~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b44cbc68a67f401f0b4cbf2683ea9ca49b3453a5;p=thirdparty%2Fhaproxy.git MINOR: quic: Do not retransmit frames from coalesced packets 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. --- diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index 6c4336cc47..a7ee4e856b 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -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 { diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 1ccabd941b..4eb4d24088 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -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;