From: Frédéric Lécaille Date: Wed, 4 Aug 2021 13:10:32 +0000 (+0200) Subject: MINOR: quic: Make use of the last cbuf API when initializing TX ring buffers X-Git-Tag: v2.5-dev8~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b19a9f162a66205b802ced4feae6ee46021e87c;p=thirdparty%2Fhaproxy.git MINOR: quic: Make use of the last cbuf API when initializing TX ring buffers Initialize the circular buffer internal buffer from a specific pool for TX ring buffers named "pool_head_quic_tx_ring". --- diff --git a/src/proto_quic.c b/src/proto_quic.c index 1e2ca5786b..257a49204b 100644 --- a/src/proto_quic.c +++ b/src/proto_quic.c @@ -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; }