]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: refactor transport parameters init
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 9 Feb 2022 09:25:29 +0000 (10:25 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 4 Mar 2022 16:00:12 +0000 (17:00 +0100)
Since QUIC accept handling has been improved, the MUX is initialized
after the handshake completion. Thus its safe to access transport
parameters in qc_init via the quic_conn.

Remove quic_mux_transport_params_update which was called by the
transport for the MUX. This improves the architecture by removing a
direct call from the transport to the MUX.

The deleted function body is not transfered to qc_init because this part
will change heavily in the near future when implementing the
flow-control.

include/haproxy/mux_quic.h
src/mux_quic.c
src/xprt_quic.c

index 0b957e9fcd86feb799e26c434dc641849a420788..4e588bc3e5f755c124085437a1be8fd7d6a8f62a 100644 (file)
@@ -8,8 +8,8 @@
 
 #include <haproxy/api.h>
 #include <haproxy/mux_quic-t.h>
+#include <haproxy/xprt_quic-t.h>
 
-void quic_mux_transport_params_update(struct qcc *qcc);
 struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type);
 void uni_qcs_free(struct qcs *qcs);
 
index 3ae919364c8caa8c42260a7df76f70fa04206bd1..c16e3d2c6124d7c6895cd90e0419f0a50422a076 100644 (file)
 DECLARE_POOL(pool_head_qcc, "qcc", sizeof(struct qcc));
 DECLARE_POOL(pool_head_qcs, "qcs", sizeof(struct qcs));
 
-void quic_mux_transport_params_update(struct qcc *qcc)
-{
-       struct quic_transport_params *clt_params;
-
-       /* Client parameters, params used to TX. */
-       clt_params = &qcc->conn->qc->tx.params;
-
-       qcc->tx.max_data = clt_params->initial_max_data;
-       /* Client initiated streams must respect the server flow control. */
-       qcc->strms[QCS_CLT_BIDI].rx.max_data = clt_params->initial_max_stream_data_bidi_local;
-       qcc->strms[QCS_CLT_UNI].rx.max_data = clt_params->initial_max_stream_data_uni;
-
-       /* Server initiated streams must respect the server flow control. */
-       qcc->strms[QCS_SRV_BIDI].max_streams = clt_params->initial_max_streams_bidi;
-       qcc->strms[QCS_SRV_BIDI].tx.max_data = clt_params->initial_max_stream_data_bidi_remote;
-
-       qcc->strms[QCS_SRV_UNI].max_streams = clt_params->initial_max_streams_uni;
-       qcc->strms[QCS_SRV_UNI].tx.max_data = clt_params->initial_max_stream_data_uni;
-}
-
 /* Allocate a new QUIC streams with id <id> and type <type>. */
 struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type)
 {
@@ -532,7 +512,7 @@ static int qc_init(struct connection *conn, struct proxy *prx,
                    struct session *sess, struct buffer *input)
 {
        struct qcc *qcc;
-       struct quic_transport_params *srv_params;
+       struct quic_transport_params *lparams;
 
        qcc = pool_alloc(pool_head_qcc);
        if (!qcc)
@@ -547,35 +527,35 @@ static int qc_init(struct connection *conn, struct proxy *prx,
        qcc->streams_by_id = EB_ROOT_UNIQUE;
 
        /* Server parameters, params used for RX flow control. */
-       srv_params = &conn->qc->rx.params;
+       lparams = &conn->qc->rx.params;
 
-       qcc->rx.max_data = srv_params->initial_max_data;
+       qcc->rx.max_data = lparams->initial_max_data;
        qcc->tx.max_data = 0;
 
        /* Client initiated streams must respect the server flow control. */
-       qcc->strms[QCS_CLT_BIDI].max_streams = srv_params->initial_max_streams_bidi;
+       qcc->strms[QCS_CLT_BIDI].max_streams = lparams->initial_max_streams_bidi;
        qcc->strms[QCS_CLT_BIDI].nb_streams = 0;
        qcc->strms[QCS_CLT_BIDI].largest_id = -1;
        qcc->strms[QCS_CLT_BIDI].rx.max_data = 0;
-       qcc->strms[QCS_CLT_BIDI].tx.max_data = srv_params->initial_max_stream_data_bidi_remote;
+       qcc->strms[QCS_CLT_BIDI].tx.max_data = lparams->initial_max_stream_data_bidi_remote;
 
-       qcc->strms[QCS_CLT_UNI].max_streams = srv_params->initial_max_streams_uni;
+       qcc->strms[QCS_CLT_UNI].max_streams = lparams->initial_max_streams_uni;
        qcc->strms[QCS_CLT_UNI].nb_streams = 0;
        qcc->strms[QCS_CLT_UNI].largest_id = -1;
        qcc->strms[QCS_CLT_UNI].rx.max_data = 0;
-       qcc->strms[QCS_CLT_UNI].tx.max_data = srv_params->initial_max_stream_data_uni;
+       qcc->strms[QCS_CLT_UNI].tx.max_data = lparams->initial_max_stream_data_uni;
 
        /* Server initiated streams must respect the server flow control. */
        qcc->strms[QCS_SRV_BIDI].max_streams = 0;
        qcc->strms[QCS_SRV_BIDI].nb_streams = 0;
        qcc->strms[QCS_SRV_BIDI].largest_id = -1;
-       qcc->strms[QCS_SRV_BIDI].rx.max_data = srv_params->initial_max_stream_data_bidi_local;
+       qcc->strms[QCS_SRV_BIDI].rx.max_data = lparams->initial_max_stream_data_bidi_local;
        qcc->strms[QCS_SRV_BIDI].tx.max_data = 0;
 
        qcc->strms[QCS_SRV_UNI].max_streams = 0;
        qcc->strms[QCS_SRV_UNI].nb_streams = 0;
        qcc->strms[QCS_SRV_UNI].largest_id = -1;
-       qcc->strms[QCS_SRV_UNI].rx.max_data = srv_params->initial_max_stream_data_uni;
+       qcc->strms[QCS_SRV_UNI].rx.max_data = lparams->initial_max_stream_data_uni;
        qcc->strms[QCS_SRV_UNI].tx.max_data = 0;
 
        qcc->wait_event.tasklet = tasklet_new();
index ddbfe972df044f9356eb6a46525e2deeefa6e953..4849a2338fc6cc92f2c9f9e15131f842937817a8 100644 (file)
@@ -5330,7 +5330,6 @@ static int qc_xprt_start(struct connection *conn, void *ctx)
        struct ssl_sock_ctx *qctx = ctx;
 
        qc = conn->qc;
-       quic_mux_transport_params_update(qc->qcc);
        if (qcc_install_app_ops(qc->qcc, qc->app_ops)) {
                TRACE_PROTO("Cannot install app layer", QUIC_EV_CONN_LPKT, qc);
                return 0;