]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: New "quic-cc-algo" bind keyword
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 11 Jul 2022 08:24:21 +0000 (10:24 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 29 Jul 2022 15:32:05 +0000 (17:32 +0200)
As it could be interesting to be able to choose the QUIC control congestion
algorithm to be used by listener, add "quic-cc-algo" new keyword to do so.
Update the documentation consequently.

Must be backported to 2.6.

doc/configuration.txt
include/haproxy/listener-t.h
src/cfgparse-quic.c
src/xprt_quic.c

index c348a08de34af00af0fb4facfc9f5fe4ea8c3bda..36046d569c56f56f499fa38ba96834e13b5086e5 100644 (file)
@@ -14457,6 +14457,15 @@ proto <name>
   instance, it is possible to force the http/2 on clear TCP by specifying "proto
   h2" on the bind line.
 
+quic-cc-algo [ cubic | newreno ]
+  Warning: QUIC support in HAProxy is currently experimental. Configuration may
+
+  This is a QUIC specific setting to select the congestion control algorithm
+  for any connection attempts to the configured QUIC listeners. They are similar
+  to those used by TCP.
+
+  Default value: cubic
+
 quic-force-retry
   Warning: QUIC support in HAProxy is currently experimental. Configuration may
   change without deprecation in the future.
index c712504c4d4af79504e8fbc8ad66a0995f2201cf..c8e4b74c0a651adef5ff3ff1920c9c731c20a01a 100644 (file)
@@ -181,6 +181,7 @@ struct bind_conf {
 #endif
 #ifdef USE_QUIC
        struct quic_transport_params quic_params; /* QUIC transport parameters. */
+       struct quic_cc_algo *quic_cc_algo; /* QUIC control congestion algorithm */
 #endif
        struct proxy *frontend;    /* the frontend all these listeners belong to, or NULL */
        const struct mux_proto_list *mux_proto; /* the mux to use for all incoming connections (specified by the "proto" keyword) */
index 8ccb83bab61d8689d328ac507bff83c2dd165534..5268e9adafebf860705c0b019e85d1d1536114a8 100644 (file)
@@ -2,9 +2,11 @@
 
 #include <haproxy/api.h>
 #include <haproxy/cfgparse.h>
+#include <haproxy/errors.h>
 #include <haproxy/global-t.h>
 #include <haproxy/listener.h>
 #include <haproxy/proxy-t.h>
+#include <haproxy/quic_cc-t.h>
 #include <haproxy/tools.h>
 
 static int bind_parse_quic_force_retry(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
@@ -13,8 +15,33 @@ static int bind_parse_quic_force_retry(char **args, int cur_arg, struct proxy *p
        return 0;
 }
 
+/* parse "quic-cc-algo" bind keyword */
+static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
+                                   struct bind_conf *conf, char **err)
+{
+       struct quic_cc_algo *cc_algo;
+
+       if (!*args[cur_arg + 1]) {
+               memprintf(err, "'%s' : missing control congestion algorith", args[cur_arg]);
+               return ERR_ALERT | ERR_FATAL;
+       }
+
+       if (!strcmp(args[cur_arg + 1], "newreno"))
+           cc_algo = &quic_cc_algo_nr;
+       else if (!strcmp(args[cur_arg + 1], "cubic"))
+           cc_algo = &quic_cc_algo_cubic;
+       else {
+               memprintf(err, "'%s' : unknown control congestion algorithm", args[cur_arg]);
+               return ERR_ALERT | ERR_FATAL;
+       }
+
+       conf->quic_cc_algo = cc_algo;
+       return 0;
+}
+
 static struct bind_kw_list bind_kws = { "QUIC", { }, {
        { "quic-force-retry", bind_parse_quic_force_retry, 0 },
+       { "quic-cc-algo", bind_parse_quic_cc_algo, 1 },
        { NULL, NULL, 0 },
 }};
 
index 57c1e6bf2918cda88f03c0c4db8023a36272ce5c..2c66058732ed420c0e5fa1a59909175964240c07 100644 (file)
@@ -4293,6 +4293,7 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
        struct quic_connection_id *icid;
        char *buf_area = NULL;
        struct listener *l = NULL;
+       struct quic_cc_algo *cc_algo = NULL;
 
        TRACE_ENTER(QUIC_EV_CONN_INIT);
        qc = pool_zalloc(pool_head_quic_conn);
@@ -4314,6 +4315,7 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
 
                l = owner;
                prx = l->bind_conf->frontend;
+               cc_algo = l->bind_conf->quic_cc_algo;
 
                qc->prx_counters = EXTRA_COUNTERS_GET(prx->extra_counters_fe,
                                                      &quic_stats_module);
@@ -4393,7 +4395,7 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
 
        /* XXX TO DO: Only one path at this time. */
        qc->path = &qc->paths[0];
-       quic_path_init(qc->path, ipv4, default_quic_cc_algo, qc);
+       quic_path_init(qc->path, ipv4, cc_algo ? cc_algo : default_quic_cc_algo, qc);
 
        /* required to use MTLIST_IN_LIST */
        MT_LIST_INIT(&qc->accept_list);