]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: quic: "largest_acked_pn" pktns struc member moving
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 15 Mar 2022 11:07:41 +0000 (12:07 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 21 Mar 2022 10:29:40 +0000 (11:29 +0100)
This struct member stores the largest acked packet number which was received. It
is used to build (TX) packet. But this is confusing to store it in the tx packet
of the packet number space structure even if it is used to build and transmit
packets.

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

index 0e2d9d8da17de1d5bf769dc6568d9e49f8401570..e9ad9113bd44b355d04c45319e117b1c1ccace38 100644 (file)
@@ -405,8 +405,6 @@ struct quic_pktns {
                struct list frms;
                /* Next packet number to use for transmissions. */
                int64_t next_pn;
-               /* Largest acked sent packet. */
-               int64_t largest_acked_pn;
                /* The packet which has been sent. */
                struct eb_root pkts;
                /* The time the most recent ack-eliciting packer was sent. */
@@ -421,6 +419,8 @@ struct quic_pktns {
        struct {
                /* Largest packet number */
                int64_t largest_pn;
+               /* Largest acked sent packet. */
+               int64_t largest_acked_pn;
                struct quic_arngs arngs;
        } rx;
        unsigned int flags;
@@ -534,6 +534,8 @@ struct quic_tx_packet {
        int refcnt;
        /* Next packet in the same datagram */
        struct quic_tx_packet *next;
+       /* Largest acknowledged packet number if this packet contains an ACK frame */
+       int64_t largest_acked_pn;
        unsigned char type;
 };
 
index 1156912871f49fc564b4f8f0cbf1eff8bde7c139..d95a072e415d464c4b94793f48fec20de08b3f2b 100644 (file)
@@ -978,12 +978,12 @@ static inline void quic_pktns_init(struct quic_pktns *pktns)
        LIST_INIT(&pktns->tx.frms);
        pktns->tx.next_pn = -1;
        pktns->tx.pkts = EB_ROOT_UNIQUE;
-       pktns->tx.largest_acked_pn = -1;
        pktns->tx.time_of_last_eliciting = 0;
        pktns->tx.loss_time = TICK_ETERNITY;
        pktns->tx.in_flight = 0;
 
        pktns->rx.largest_pn = -1;
+       pktns->rx.largest_acked_pn = -1;
        pktns->rx.arngs.root = EB_ROOT_UNIQUE;
        pktns->rx.arngs.sz = 0;
        pktns->rx.arngs.enc_sz = 0;
index d53bb5f058ab2cda587165e89f986d6173582c37..ddd0b01f87de2f877124a6a0cb55abb1bdf8b69b 100644 (file)
@@ -1699,7 +1699,7 @@ static void qc_packet_loss_lookup(struct quic_pktns *pktns,
                unsigned int loss_time_limit, time_sent;
 
                pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node);
-               largest_acked_pn = HA_ATOMIC_LOAD(&pktns->tx.largest_acked_pn);
+               largest_acked_pn = HA_ATOMIC_LOAD(&pktns->rx.largest_acked_pn);
                node = eb64_next(node);
                if ((int64_t)pkt->pn_node.key > largest_acked_pn)
                        break;
@@ -1762,7 +1762,7 @@ static inline int qc_parse_ack_frm(struct quic_conn *qc,
        largest_node = NULL;
        time_sent = 0;
 
-       if ((int64_t)ack->largest_ack > HA_ATOMIC_LOAD(&qel->pktns->tx.largest_acked_pn)) {
+       if ((int64_t)ack->largest_ack > HA_ATOMIC_LOAD(&qel->pktns->rx.largest_acked_pn)) {
                largest_node = eb64_lookup(pkts, largest);
                if (!largest_node) {
                        TRACE_DEVEL("Largest acked packet not found",
@@ -1817,7 +1817,7 @@ static inline int qc_parse_ack_frm(struct quic_conn *qc,
 
        if (time_sent && (pkt_flags & QUIC_FL_TX_PACKET_ACK_ELICITING)) {
                *rtt_sample = tick_remain(time_sent, now_ms);
-               HA_ATOMIC_STORE(&qel->pktns->tx.largest_acked_pn, ack->largest_ack);
+               HA_ATOMIC_STORE(&qel->pktns->rx.largest_acked_pn, ack->largest_ack);
        }
 
        if (!LIST_ISEMPTY(&newly_acked_pkts)) {
@@ -5036,7 +5036,7 @@ static int qc_do_build_pkt(unsigned char *pos, const unsigned char *end,
                goto no_room;
 
        end -= QUIC_TLS_TAG_LEN;
-       largest_acked_pn = HA_ATOMIC_LOAD(&qel->pktns->tx.largest_acked_pn);
+       largest_acked_pn = HA_ATOMIC_LOAD(&qel->pktns->rx.largest_acked_pn);
        /* packet number length */
        *pn_len = quic_packet_number_length(pn, largest_acked_pn);
        /* Build the header */