CLEANUP: quic: "largest_acked_pn" pktns struc member moving

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.
This commit is contained in:
Frédéric Lécaille 2022-03-15 12:07:41 +01:00 committed by Amaury Denoyelle
parent 302c2b1120
commit 8f3ae0272f
3 changed files with 9 additions and 7 deletions

View 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;
};

View 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;

View 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 */