From: Willy Tarreau Date: Tue, 11 Oct 2022 06:36:21 +0000 (+0200) Subject: CLEANUP: quic/receiver: remove the now unused tx_qring list X-Git-Tag: v2.7-dev8~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cab054bbf9908f3732648e5236d889650a6e33f7;p=thirdparty%2Fhaproxy.git CLEANUP: quic/receiver: remove the now unused tx_qring list 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. --- diff --git a/include/haproxy/receiver-t.h b/include/haproxy/receiver-t.h index 274339d401..5b16770aff 100644 --- a/include/haproxy/receiver-t.h +++ b/include/haproxy/receiver-t.h @@ -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 diff --git a/src/proto_quic.c b/src/proto_quic.c index 0e96498b27..34e22b8dc8 100644 --- a/src/proto_quic.c +++ b/src/proto_quic.c @@ -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 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 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;