From 26740985694e9890c69831f45fe98afc11a66c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Mon, 23 May 2022 17:28:01 +0200 Subject: [PATCH] MINOR: quic: Tunable "initial_max_streams_bidi" transport parameter Add tunable "tune.quic.frontend.max_streams_bidi" setting for QUIC frontends to set the "initial_max_streams_bidi" transport parameter. Add some documentation for this new setting. --- doc/configuration.txt | 12 ++++++++++++ include/haproxy/global-t.h | 1 + include/haproxy/quic_tp-t.h | 1 + src/cfgparse-quic.c | 9 +++++++-- src/haproxy.c | 1 + src/quic_tp.c | 2 +- 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index d95b0f348d..9846e8bfeb 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -1120,6 +1120,7 @@ The following keywords are supported in the "global" section : - tune.pool-low-fd-ratio - tune.quic.conn-buf-limit - tune.quic.frontend.max-idle-timeout + - tune.quic.frontend.max-streams-bidi - tune.quic.retry-threshold - tune.rcvbuf.client - tune.rcvbuf.server @@ -2954,6 +2955,17 @@ tune.quic.frontend.max-idle-timeout The default value is 30000. +tune.quic.frontend.max-streams-bidi + Warning: QUIC support in HAProxy is currently experimental. Configuration may + change without deprecation in the future. + + Sets the QUIC initial_max_streams_bidi transport parameter for frontends. + This is the initial maximum number of bidirectional streams the remote peer + will be authorized to open. This determines the number of concurrent client + requests. + + The default value is 100. + tune.quic.retry-threshold Warning: QUIC support in HAProxy is currently experimental. Configuration may change without deprecation in the future. diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h index b32950a7e3..dc18fa9875 100644 --- a/include/haproxy/global-t.h +++ b/include/haproxy/global-t.h @@ -160,6 +160,7 @@ struct global { #ifdef USE_QUIC unsigned int quic_backend_max_idle_timeout; unsigned int quic_frontend_max_idle_timeout; + unsigned int quic_frontend_max_streams_bidi; unsigned int quic_retry_threshold; unsigned int quic_streams_buf; #endif /* USE_QUIC */ diff --git a/include/haproxy/quic_tp-t.h b/include/haproxy/quic_tp-t.h index 6648c6cf92..1c5fc54cbc 100644 --- a/include/haproxy/quic_tp-t.h +++ b/include/haproxy/quic_tp-t.h @@ -31,6 +31,7 @@ struct tp_preferred_address { #define QUIC_DFLT_ACK_DELAY_COMPONENT 3 /* milliseconds */ #define QUIC_DFLT_MAX_ACK_DELAY 25 /* milliseconds */ #define QUIC_DFLT_FRONT_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ +#define QUIC_DFLT_FRONT_MAX_STREAMS_BIDI 100 #define QUIC_DFLT_BACK_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ #define QUIC_ACTIVE_CONNECTION_ID_LIMIT 2 /* number of connections */ diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index f4ded90d5a..e89b5a2e6f 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -76,6 +76,7 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type, { unsigned int arg = 0; int prefix_len = strlen("tune.quic."); + const char *suffix; if (too_many_args(1, args, err, NULL)) return -1; @@ -88,9 +89,12 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type, return -1; } - if (strcmp(args[0] + prefix_len, "conn-buf-limit") == 0) + suffix = args[0] + prefix_len; + if (strcmp(suffix, "conn-buf-limit") == 0) global.tune.quic_streams_buf = arg; - else if (strcmp(args[0] + prefix_len, "retry-threshold") == 0) + else if (strcmp(suffix, "frontend.max-streams-bidi") == 0) + global.tune.quic_frontend_max_streams_bidi = arg; + else if (strcmp(suffix, "retry-threshold") == 0) global.tune.quic_retry_threshold = arg; else { memprintf(err, "'%s' keyword not unhandled (please report this bug).", args[0]); @@ -103,6 +107,7 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type, static struct cfg_kw_list cfg_kws = {ILH, { { CFG_GLOBAL, "tune.quic.backend.max-idle-timeou", cfg_parse_quic_time }, { CFG_GLOBAL, "tune.quic.conn-buf-limit", cfg_parse_quic_tune_setting }, + { CFG_GLOBAL, "tune.quic.frontend.max-streams-bidi", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.frontend.max-idle-timeout", cfg_parse_quic_time }, { CFG_GLOBAL, "tune.quic.retry-threshold", cfg_parse_quic_tune_setting }, { 0, NULL, NULL } diff --git a/src/haproxy.c b/src/haproxy.c index a112c233a4..e2a7d729d0 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -208,6 +208,7 @@ struct global global = { #ifdef USE_QUIC .quic_backend_max_idle_timeout = QUIC_DFLT_BACK_MAX_IDLE_TIMEOUT, .quic_frontend_max_idle_timeout = QUIC_DFLT_FRONT_MAX_IDLE_TIMEOUT, + .quic_frontend_max_streams_bidi = QUIC_DFLT_FRONT_MAX_STREAMS_BIDI, .quic_retry_threshold = QUIC_DFLT_RETRY_THRESHOLD, .quic_streams_buf = 30, #endif /* USE_QUIC */ diff --git a/src/quic_tp.c b/src/quic_tp.c index c1e8437f7f..e97c3a4df6 100644 --- a/src/quic_tp.c +++ b/src/quic_tp.c @@ -45,7 +45,7 @@ static void quic_dflt_transport_params_cpy(struct quic_transport_params *dst) void quic_transport_params_init(struct quic_transport_params *p, int server) { const uint64_t ncb_size = global.tune.bufsize - NCB_RESERVED_SZ; - const int max_streams_bidi = 100; + const int max_streams_bidi = global.tune.quic_frontend_max_streams_bidi; const int max_streams_uni = 3; /* Set RFC default values for unspecified parameters. */