]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: quic/receiver: remove the now unused tx_qring list
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Oct 2022 06:36:21 +0000 (08:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Oct 2022 06:40:38 +0000 (08:40 +0200)
The tx_qrings[] and tx_qring_list in the receiver are not used
anymore since commit f2476053f ("MINOR: quic: replace custom buf on Tx
by default struct buffer"), the only place where they're referenced
was in quic_alloc_tx_rings_listener(), which by the way implies that
these were not even freed on exit.

Let's just remove them. This should be backported to 2.6 since the
commit above also was.

include/haproxy/receiver-t.h
src/proto_quic.c

index 274339d401f369b1ab7c0af9800742956ca5601d..5b16770aff74eed888d4a7c83258c585a74770b4 100644 (file)
@@ -65,9 +65,6 @@ struct receiver {
        struct rx_settings *settings;    /* points to the settings used by this receiver */
        struct list proto_list;          /* list in the protocol header */
 #ifdef USE_QUIC
-       struct qring **tx_qrings;         /* Array of rings (one by thread) */
-       struct mt_list tx_qring_list;    /* The same as ->tx_qrings but arranged in a list */
-
        struct rxbuf **rxbufs;           /* Array of buffers for RX (one by thread) */
        struct mt_list rxbuf_list;       /* The same as ->rxbufs but arranged in a list */
 #endif
index 0e96498b27f39e2136c5a6630670ea85ca79ab35..34e22b8dc838b2d3cd136794358b7e46882513f8 100644 (file)
@@ -532,56 +532,6 @@ static void quic_add_listener(struct protocol *proto, struct listener *listener)
        default_add_listener(proto, listener);
 }
 
-/* Allocate the TX ring buffers for <l> listener.
- * Return 1 if succeeded, 0 if not.
- */
-static int quic_alloc_tx_rings_listener(struct listener *l)
-{
-       struct qring *qr;
-       int i;
-
-       l->rx.tx_qrings = calloc(global.nbthread, sizeof *l->rx.tx_qrings);
-       if (!l->rx.tx_qrings)
-               return 0;
-
-       MT_LIST_INIT(&l->rx.tx_qring_list);
-       for (i = 0; i < global.nbthread; i++) {
-               unsigned char *buf;
-               struct qring *qr;
-
-               qr = calloc(1, sizeof *qr);
-               if (!qr)
-                       goto err;
-
-               buf = pool_alloc(pool_head_quic_tx_ring);
-               if (!buf) {
-                       free(qr);
-                       goto err;
-               }
-
-               qr->cbuf = cbuf_new(buf, QUIC_TX_RING_BUFSZ);
-               if (!qr->cbuf) {
-                       pool_free(pool_head_quic_tx_ring, buf);
-                       free(qr);
-                       goto err;
-               }
-
-        l->rx.tx_qrings[i] = qr;
-               MT_LIST_APPEND(&l->rx.tx_qring_list, &qr->mt_list);
-       }
-
-       return 1;
-
- err:
-       while ((qr = MT_LIST_POP(&l->rx.tx_qring_list, typeof(qr), mt_list))) {
-               pool_free(pool_head_quic_tx_ring, qr->cbuf->buf);
-               cbuf_free(qr->cbuf);
-               free(qr);
-       }
-       free(l->rx.tx_qrings);
-       return 0;
-}
-
 /* Allocate the RX buffers for <l> listener.
  * Return 1 if succeeded, 0 if not.
  */
@@ -657,8 +607,7 @@ static int quic_bind_listener(struct listener *listener, char *errmsg, int errle
                goto udp_return;
        }
 
-       if (!quic_alloc_tx_rings_listener(listener) ||
-           !quic_alloc_rxbufs_listener(listener)) {
+       if (!quic_alloc_rxbufs_listener(listener)) {
                msg = "could not initialize tx/rx rings";
                err |= ERR_WARN;
                goto udp_return;