1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-03-31 23:58:16 +00:00

CLEANUP: quic: Remove useless inline functions

We want to track the packet reference counting more easily, so without
inline functions.
This commit is contained in:
Frédéric Lécaille 2021-09-22 08:34:21 +02:00 committed by Amaury Denoyelle
parent 8526f14acd
commit ebc3fc1509
2 changed files with 9 additions and 41 deletions
include/haproxy
src

View File

@ -1038,42 +1038,6 @@ static inline void quic_rx_packet_refdec(struct quic_rx_packet *pkt)
pool_free(pool_head_quic_rx_packet, pkt);
}
/* Add <pkt> RX packet to <list>, incrementing its reference counter. */
static inline void quic_rx_packet_list_addq(struct mt_list *list,
struct quic_rx_packet *pkt)
{
MT_LIST_APPEND(list, &pkt->list);
quic_rx_packet_refinc(pkt);
}
/* Remove <pkt> RX packet from <list>, decrementing its reference counter. */
static inline void quic_rx_packet_list_del(struct quic_rx_packet *pkt)
{
MT_LIST_DELETE(&pkt->list);
quic_rx_packet_refdec(pkt);
}
/* Add <pkt> RX packet to <root> tree, incrementing its reference counter. */
static inline void quic_rx_packet_eb64_insert(struct eb_root *root,
struct eb64_node *node)
{
eb64_insert(root, node);
quic_rx_packet_refinc(eb64_entry(node, struct quic_rx_packet, pn_node));
}
/* Delete <pkt> RX packet from <root> tree, decrementing its reference counter. */
static inline void quic_rx_packet_eb64_delete(struct eb64_node *node)
{
eb64_delete(node);
quic_rx_packet_refdec(eb64_entry(node, struct quic_rx_packet, pn_node));
}
/* Release the memory allocated for <pkt> RX packet. */
static inline void free_quic_rx_packet(struct quic_rx_packet *pkt)
{
quic_rx_packet_refdec(pkt);
}
/* Increment the reference counter of <pkt> */
static inline void quic_tx_packet_refinc(struct quic_tx_packet *pkt)
{

View File

@ -2594,7 +2594,8 @@ static inline void qc_rm_hp_pkts(struct quic_enc_level *el, struct ssl_sock_ctx
/* Store the packet into the tree of packets to decrypt. */
pqpkt->pn_node.key = pqpkt->pn;
HA_RWLOCK_WRLOCK(QUIC_LOCK, &el->rx.pkts_rwlock);
quic_rx_packet_eb64_insert(&el->rx.pkts, &pqpkt->pn_node);
eb64_insert(&el->rx.pkts, &pqpkt->pn_node);
quic_rx_packet_refinc(pqpkt);
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &el->rx.pkts_rwlock);
TRACE_PROTO("hp removed", QUIC_EV_CONN_ELRMHP, ctx->conn, pqpkt);
}
@ -2693,7 +2694,8 @@ int qc_treat_rx_pkts(struct quic_enc_level *cur_el, struct quic_enc_level *next_
}
}
node = eb64_next(node);
quic_rx_packet_eb64_delete(&pkt->pn_node);
eb64_delete(&pkt->pn_node);
quic_rx_packet_refdec(pkt);
}
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
@ -3166,13 +3168,15 @@ static inline int qc_try_rm_hp(struct quic_rx_packet *pkt,
/* Store the packet */
pkt->pn_node.key = pkt->pn;
HA_RWLOCK_WRLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
quic_rx_packet_eb64_insert(&qel->rx.pkts, &pkt->pn_node);
eb64_insert(&qel->rx.pkts, &pkt->pn_node);
quic_rx_packet_refinc(pkt);
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
}
else if (qel) {
TRACE_PROTO("hp not removed", QUIC_EV_CONN_TRMHP, ctx ? ctx->conn : NULL, pkt);
pkt->pn_offset = pn - beg;
quic_rx_packet_list_addq(&qel->rx.pqpkts, pkt);
MT_LIST_APPEND(&qel->rx.pqpkts, &pkt->list);
quic_rx_packet_refinc(pkt);
}
memcpy(pkt->data, beg, pkt->len);
@ -4601,7 +4605,7 @@ static ssize_t quic_dgram_read(char *buf, size_t len, void *owner,
size_t pkt_len;
pkt_len = pkt->len;
free_quic_rx_packet(pkt);
quic_rx_packet_refdec(pkt);
/* If the packet length could not be found, we cannot continue. */
if (!pkt_len)
break;