]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Make use of the last cbuf API when initializing TX ring buffers
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 4 Aug 2021 13:10:32 +0000 (15:10 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
Initialize the circular buffer internal buffer from a specific pool for TX ring
buffers named "pool_head_quic_tx_ring".

src/proto_quic.c

index 1e2ca5786bbe794db3dc47b0c28fe3a6f37640e8..257a49204b74a52f0cc49fbbdf77bf214ba5dcfb 100644 (file)
@@ -537,20 +537,29 @@ static int quic_alloc_rings_listener(struct listener *l)
 
        MT_LIST_INIT(&l->rx.tx_qrings);
        for (i = 0; i < global.nbthread; i++) {
+               unsigned char *buf;
                struct qring *qr = &l->rx.qrings[i];
 
-               qr->cbuf = cbuf_new();
-               if (!qr->cbuf)
+               buf = pool_alloc(pool_head_quic_tx_ring);
+               if (!buf)
                        goto err;
 
+               qr->cbuf = cbuf_new(buf, QUIC_TX_RING_BUFSZ);
+               if (!qr->cbuf) {
+                       pool_free(pool_head_quic_tx_ring, buf);
+                       goto err;
+               }
+
                MT_LIST_APPEND(&l->rx.tx_qrings, &qr->mt_list);
        }
 
        return 1;
 
  err:
-       while ((qr = MT_LIST_POP(&l->rx.tx_qrings, typeof(qr), mt_list)))
+       while ((qr = MT_LIST_POP(&l->rx.tx_qrings, typeof(qr), mt_list))) {
+               pool_free(pool_head_quic_tx_ring, qr->cbuf->buf);
                cbuf_free(qr->cbuf);
+       }
        free(l->rx.qrings);
        return 0;
 }