MINOR: quic: Remove useless lock for RX packets

This lock was there be able to handle the RX packets for a connetion
from several threads. This is no more needed since a QUIC connection
is always handled by the same thread.

May be backported to 2.6
This commit is contained in:
Frdric Lcaille 2022-08-11 11:40:01 +02:00 committed by Willy Tarreau
parent 6a378d1677
commit a6920a25d9
3 changed files with 0 additions and 15 deletions

View File

@ -517,8 +517,6 @@ struct quic_enc_level {
/* The packets received by the listener I/O handler
with header protection removed. */
struct eb_root pkts;
/* <pkts> root must be protected from concurrent accesses */
__decl_thread(HA_RWLOCK_T pkts_rwlock);
/* Liste of QUIC packets with protected header. */
struct mt_list pqpkts;
/* Crypto frames */

View File

@ -667,9 +667,7 @@ static inline int qc_el_rx_pkts(struct quic_enc_level *qel)
{
int ret;
HA_RWLOCK_RDLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
ret = !eb_is_empty(&qel->rx.pkts);
HA_RWLOCK_RDUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
return ret;
}
@ -728,7 +726,6 @@ static inline void qc_el_rx_pkts_del(struct quic_enc_level *qel)
{
struct eb64_node *node;
HA_RWLOCK_WRLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
node = eb64_first(&qel->rx.pkts);
while (node) {
struct quic_rx_packet *pkt =
@ -738,14 +735,12 @@ static inline void qc_el_rx_pkts_del(struct quic_enc_level *qel)
eb64_delete(&pkt->pn_node);
quic_rx_packet_refdec(pkt);
}
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
}
static inline void qc_list_qel_rx_pkts(struct quic_enc_level *qel)
{
struct eb64_node *node;
HA_RWLOCK_RDLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
node = eb64_first(&qel->rx.pkts);
while (node) {
struct quic_rx_packet *pkt;
@ -755,7 +750,6 @@ static inline void qc_list_qel_rx_pkts(struct quic_enc_level *qel)
pkt, pkt->type, (ull)pkt->pn_node.key);
node = eb64_next(node);
}
HA_RWLOCK_RDUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
}
static inline void qc_list_all_rx_pkts(struct quic_conn *qc)

View File

@ -3697,10 +3697,8 @@ static inline void qc_rm_hp_pkts(struct quic_conn *qc, struct quic_enc_level *el
pqpkt->aad_len = pqpkt->pn_offset + pqpkt->pnl;
/* Store the packet into the tree of packets to decrypt. */
pqpkt->pn_node.key = pqpkt->pn;
HA_RWLOCK_WRLOCK(QUIC_LOCK, &el->rx.pkts_rwlock);
eb64_insert(&el->rx.pkts, &pqpkt->pn_node);
quic_rx_packet_refinc(pqpkt);
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &el->rx.pkts_rwlock);
TRACE_DEVEL("hp removed", QUIC_EV_CONN_ELRMHP, qc, pqpkt);
}
MT_LIST_DELETE_SAFE(pkttmp1);
@ -3769,7 +3767,6 @@ int qc_treat_rx_pkts(struct quic_enc_level *cur_el, struct quic_enc_level *next_
if (!qel)
goto out;
HA_RWLOCK_WRLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
node = eb64_first(&qel->rx.pkts);
while (node) {
struct quic_rx_packet *pkt;
@ -3811,7 +3808,6 @@ int qc_treat_rx_pkts(struct quic_enc_level *cur_el, struct quic_enc_level *next_
eb64_delete(&pkt->pn_node);
quic_rx_packet_refdec(pkt);
}
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
if (largest_pn != -1 && largest_pn > qel->pktns->rx.largest_pn) {
/* Update the largest packet number. */
@ -4325,7 +4321,6 @@ static int quic_conn_enc_level_init(struct quic_conn *qc,
qel->tls_ctx.flags = 0;
qel->rx.pkts = EB_ROOT;
HA_RWLOCK_INIT(&qel->rx.pkts_rwlock);
MT_LIST_INIT(&qel->rx.pqpkts);
qel->rx.crypto.offset = 0;
qel->rx.crypto.frms = EB_ROOT_UNIQUE;
@ -4931,9 +4926,7 @@ static void qc_pkt_insert(struct quic_conn *qc,
pkt->pn_node.key = pkt->pn;
quic_rx_packet_refinc(pkt);
HA_RWLOCK_WRLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
eb64_insert(&qel->rx.pkts, &pkt->pn_node);
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
TRACE_LEAVE(QUIC_EV_CONN_RXPKT, qc);
}