]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: quic: Remove useless inline functions
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 22 Sep 2021 06:34:21 +0000 (08:34 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
We want to track the packet reference counting more easily, so without
inline functions.

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

index bcb1d9553ae882eb868084326e474530f9e2c249..aa0331f7b1a7180ee8b4dfbb3d4a7a2d81ddb587 100644 (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)
 {
index d073fb1f36b7d30c9fbf4cd27465d52e5db9a82f..80591e116642743074756828619b8acd627d74e3 100644 (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;