]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Replace the RX list of packet by a thread safety one.
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 7 Jun 2021 08:28:10 +0000 (10:28 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
This list is shared between the I/O dgram handler and the task responsible
for processing the QUIC packets.

include/haproxy/receiver-t.h
include/haproxy/xprt_quic-t.h
src/proto_quic.c
src/quic_sock.c
src/xprt_quic.c

index 1125be771dda87d10a45723d76be37f85ab44c3d..80e039b95751e661347fc8ad1fdcb294b4a26a70 100644 (file)
@@ -62,7 +62,7 @@ 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 list qpkts;               /* QUIC Initial packets to accept new connections */
+       struct mt_list pkts;             /* QUIC Initial packets to accept new connections */
        struct eb_root odcids;           /* QUIC original destination connection IDs. */
        struct eb_root cids;             /* QUIC connection IDs. */
 #endif
index f7c50c53e167587ce4205e45b65277690106eb3b..9bf5b4004e4fc175cf5cc3d7c83a4d80b1969413 100644 (file)
@@ -395,7 +395,7 @@ extern struct quic_transport_params quic_dflt_transport_params;
 
 struct quic_rx_packet {
        struct list list;
-       struct list rx_list;
+       struct mt_list rx_list;
        struct quic_conn *qc;
        unsigned char type;
        uint32_t version;
index 1cac5ab62f02f79867a7b9fd56b5b2034f3a27c0..3b66ff911e7b84102dd05373de54bf0a1553021c 100644 (file)
@@ -514,7 +514,7 @@ int quic_connect_server(struct connection *conn, int flags)
  */
 static void quic_add_listener(struct protocol *proto, struct listener *listener)
 {
-       LIST_INIT(&listener->rx.qpkts);
+       MT_LIST_INIT(&listener->rx.pkts);
        listener->rx.odcids = EB_ROOT_UNIQUE;
        listener->rx.cids = EB_ROOT_UNIQUE;
        default_add_listener(proto, listener);
index 042c35d97089f64310facb2b46848a9fc46b1818..a2c4becb5b8011fc4be951704fd10f4259ffaccf 100644 (file)
@@ -145,13 +145,12 @@ struct connection *quic_sock_accept_conn(struct listener *l, int *status)
        int ret;
 
        qc = NULL;
-       pkt = LIST_ELEM(l->rx.qpkts.n, struct quic_rx_packet *, rx_list);
+       pkt = MT_LIST_POP(&l->rx.pkts, struct quic_rx_packet *, rx_list);
        /* Should never happen. */
-       if (&pkt->rx_list == &l->rx.qpkts)
+       if (!pkt)
                goto err;
 
        qc = pkt->qc;
-       LIST_DELETE(&pkt->rx_list);
        if (!new_quic_cli_conn(qc, l, &pkt->saddr))
                goto err;
 
index 6a0f9bfacc65b1454ff22cc6b9d1b8af6452ccf9..cb052b4271ab37735c8df3608e8685500cdf99c5 100644 (file)
@@ -3399,7 +3399,7 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
        }
        else if (!found_conn) {
                /* Enqueue this packet. */
-               LIST_APPEND(&l->rx.qpkts, &pkt->rx_list);
+               MT_LIST_APPEND(&l->rx.pkts, &pkt->rx_list);
                /* Try to accept a new connection. */
                listener_accept(l);
        }