]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Remove an RX buffer useless lock
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 2 Feb 2022 09:51:50 +0000 (10:51 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 14 Feb 2022 14:20:54 +0000 (15:20 +0100)
This lock is no more useful: the RX buffer for a connection is always handled
by the same thread.

include/haproxy/xprt_quic-t.h
src/xprt_quic.c

index 0f1004fd8428373c8db99966ded779c7075b9b1f..66912ef482d6a361f02836130ff6afea6ae35b2e 100644 (file)
@@ -734,8 +734,6 @@ struct quic_conn {
                struct quic_transport_params params;
                /* RX buffer */
                struct buffer buf;
-               /* RX buffer read/write lock */
-               __decl_thread(HA_RWLOCK_T buf_rwlock);
                struct list pkt_list;
        } rx;
        struct {
index 361a6431fb5a0b261c0f356e3800ccb3079582c2..ddbe031476080f7c0989d5cdba7a2b0ed78bdbfd 100644 (file)
@@ -3650,7 +3650,6 @@ static struct quic_conn *qc_new_conn(unsigned int version, int ipv4,
        qc->rx.bytes = 0;
        qc->rx.nb_ack_eliciting = 0;
        qc->rx.buf = b_make(buf_area, QUIC_CONN_RX_BUFSZ, 0, 0);
-       HA_RWLOCK_INIT(&qc->rx.buf_rwlock);
        LIST_INIT(&qc->rx.pkt_list);
        if (!quic_tls_ku_init(qc)) {
                TRACE_PROTO("Key update initialization failed", QUIC_EV_CONN_INIT, qc);
@@ -4467,7 +4466,6 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
        }
 
        pkt->raw_len = pkt->len;
-       HA_RWLOCK_WRLOCK(QUIC_LOCK, &qc->rx.buf_rwlock);
        quic_rx_pkts_del(qc);
        b_cspace = b_contig_space(&qc->rx.buf);
        if (b_cspace < pkt->len) {
@@ -4478,7 +4476,6 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
                }
                b_add(&qc->rx.buf, b_cspace);
                if (b_contig_space(&qc->rx.buf) < pkt->len) {
-                       HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qc->rx.buf_rwlock);
                        TRACE_PROTO("Too big packet", QUIC_EV_CONN_LPKT, qc, pkt, &pkt->len);
                        qc_list_all_rx_pkts(qc);
                        goto err;
@@ -4486,12 +4483,10 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
        }
 
        if (!qc_try_rm_hp(qc, pkt, payload, beg, end, &qel)) {
-               HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qc->rx.buf_rwlock);
                TRACE_PROTO("Packet dropped", QUIC_EV_CONN_LPKT, qc);
                goto err;
        }
 
-       HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qc->rx.buf_rwlock);
        TRACE_PROTO("New packet", QUIC_EV_CONN_LPKT, qc, pkt);
        if (pkt->aad_len)
                qc_pkt_insert(pkt, qel);