CLEANUP: quic: Remove two useless pools a low QUIC connection level

Both "quic_tx_ring" and "quic_rx_crypto_frm" pool are no more used.

Should be backported as far as 2.6.
This commit is contained in:
Frédéric Lécaille 2023-06-22 15:02:38 +02:00 committed by Amaury Denoyelle
parent a5c1a3b774
commit f7749968d6
3 changed files with 50 additions and 3 deletions

View File

@ -252,7 +252,6 @@ enum quic_pkt_type {
#define QUIC_CONN_RX_BUFSZ (1UL << 16)
extern struct trace_source trace_quic;
extern struct pool_head *pool_head_quic_tx_ring;
extern struct pool_head *pool_head_quic_rx_packet;
extern struct pool_head *pool_head_quic_tx_packet;
extern struct pool_head *pool_head_quic_crypto_buf;

View File

@ -184,6 +184,24 @@ static inline struct quic_pktns **ssl_to_quic_pktns(struct quic_conn *qc,
}
}
/* These following functions map TLS implementation encryption level to ours */
static inline struct quic_pktns **qel_to_quic_pktns(struct quic_conn *qc,
enum quic_tls_enc_level level)
{
switch (level) {
case QUIC_TLS_ENC_LEVEL_INITIAL:
return &qc->ipktns;
case QUIC_TLS_ENC_LEVEL_EARLY_DATA:
return &qc->apktns;
case QUIC_TLS_ENC_LEVEL_HANDSHAKE:
return &qc->hpktns;
case QUIC_TLS_ENC_LEVEL_APP:
return &qc->apktns;
default:
return NULL;
}
}
/* Map <level> TLS stack encryption level to our internal QUIC TLS encryption level
* if succeded, or -1 if failed.
*/
@ -224,6 +242,27 @@ static inline struct quic_enc_level **ssl_to_qel_addr(struct quic_conn *qc,
}
}
/* Return the address of the QUIC TLS encryption level associated to <level> internal
* encryption level and attached to <qc> QUIC connection if succeeded, or
* NULL if failed.
*/
static inline struct quic_enc_level **qel_to_qel_addr(struct quic_conn *qc,
enum quic_tls_enc_level level)
{
switch (level) {
case QUIC_TLS_ENC_LEVEL_INITIAL:
return &qc->iel;
case QUIC_TLS_ENC_LEVEL_EARLY_DATA:
return &qc->eel;
case QUIC_TLS_ENC_LEVEL_HANDSHAKE:
return &qc->hel;
case QUIC_TLS_ENC_LEVEL_APP:
return &qc->ael;
default:
return NULL;
}
}
/* Return the QUIC TLS encryption level associated to <level> internal encryption
* level attached to <qc> QUIC connection if succeeded, or NULL if failed.
*/

View File

@ -211,7 +211,6 @@ INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
static BIO_METHOD *ha_quic_meth;
DECLARE_POOL(pool_head_quic_tx_ring, "quic_tx_ring", QUIC_TX_RING_BUFSZ);
DECLARE_POOL(pool_head_quic_conn_rxbuf, "quic_conn_rxbuf", QUIC_CONN_RX_BUFSZ);
DECLARE_STATIC_POOL(pool_head_quic_conn_ctx,
"quic_conn_ctx", sizeof(struct ssl_sock_ctx));
@ -221,7 +220,6 @@ DECLARE_POOL(pool_head_quic_connection_id,
DECLARE_POOL(pool_head_quic_dgram, "quic_dgram", sizeof(struct quic_dgram));
DECLARE_POOL(pool_head_quic_rx_packet, "quic_rx_packet", sizeof(struct quic_rx_packet));
DECLARE_POOL(pool_head_quic_tx_packet, "quic_tx_packet", sizeof(struct quic_tx_packet));
DECLARE_STATIC_POOL(pool_head_quic_rx_crypto_frm, "quic_rx_crypto_frm", sizeof(struct quic_rx_crypto_frm));
DECLARE_POOL(pool_head_quic_crypto_buf, "quic_crypto_buf", sizeof(struct quic_crypto_buf));
DECLARE_STATIC_POOL(pool_head_quic_cstream, "quic_cstream", sizeof(struct quic_cstream));
DECLARE_POOL(pool_head_quic_frame, "quic_frame", sizeof(struct quic_frame));
@ -6051,6 +6049,17 @@ static inline int qc_try_rm_hp(struct quic_conn *qc,
tel = quic_packet_type_enc_level(pkt->type);
qel = qc_quic_enc_level(qc, tel);
if (!qel) {
struct quic_enc_level **qc_qel = qel_to_qel_addr(qc, tel);
struct quic_pktns **qc_pktns = qel_to_quic_pktns(qc, tel);
if (!qc_enc_level_alloc(qc, qc_pktns, qc_qel, quic_to_ssl_enc_level(tel))) {
TRACE_PROTO("Could not allocated an encryption level", QUIC_EV_CONN_ADDDATA, qc);
goto out;
}
qel = *qc_qel;
}
if (qc_qel_may_rm_hp(qc, qel)) {
struct quic_tls_ctx *tls_ctx = qc_select_tls_ctx(qc, qel, pkt);