diff --git a/doc/configuration.txt b/doc/configuration.txt index 5beab0579..2dfbf902e 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -1892,6 +1892,7 @@ The following keywords are supported in the "global" section : - tune.quic.be.cc.hystart - tune.quic.be.cc.max-frame-loss - tune.quic.be.cc.reorder-ratio + - tune.quic.be.max-idle-timeout - tune.quic.be.sec.glitches-threshold - tune.quic.be.tx.pacing - tune.quic.be.tx.udp-gso @@ -1903,13 +1904,14 @@ The following keywords are supported in the "global" section : - tune.quic.fe.cc.hystart - tune.quic.fe.cc.max-frame-loss - tune.quic.fe.cc.reorder-ratio + - tune.quic.fe.max-idle-timeout - tune.quic.fe.sec.glitches-threshold - tune.quic.fe.sec.retry-threshold - tune.quic.fe.sock-per-conn - tune.quic.fe.tx.pacing - tune.quic.fe.tx.udp-gso - tune.quic.frontend.max-data-size - - tune.quic.frontend.max-idle-timeout + - tune.quic.frontend.max-idle-timeout (deprecated) - tune.quic.frontend.max-streams-bidi - tune.quic.frontend.max-tx-mem (deprecated) - tune.quic.frontend.stream-data-ratio @@ -4763,6 +4765,24 @@ tune.quic.reorder-ratio <0..100, in percent> (deprecated) part of the streamlining process apply on QUIC configuration. If used, this setting will only be applied on frontend connections. +tune.quic.be.max-idle-timeout +tune.quic.fe.max-idle-timeout + Sets the QUIC max_idle_timeout transport parameters on either frontend or + backend side. It follows the HAProxy time format and is expressed in + milliseconds. This determines the period of time after which a connection is + silently closed if it has remained inactive during an effective period of + time. Both endpoints relies on the same negotiated value : + - the minimum of the two parameters if both are not null, + - the maximum if only one of them is not null, + - if both parameters are null, this feature is disabled. + + The default value is 30s. + +tune.quic.frontend.max-idle-timeout (deprecated) + This keyword has been deprecated in 3.3 and will be removed in 3.5. It is + part of the streamlining process apply on QUIC configuration. If used, this + setting will only be applied on frontend connections. + tune.quic.be.sec.glitches-threshold tune.quic.fe.sec.glitches-threshold Sets the threshold for the number of glitches per connection either on @@ -4881,17 +4901,6 @@ tune.quic.frontend.max-data-size See also: "tune.quic.frontend.max-streams-bidi", "tune.quic.frontend.stream-data-ratio" -tune.quic.frontend.max-idle-timeout - Sets the QUIC max_idle_timeout transport parameters in milliseconds for - frontends which determines the period of time after which a connection silently - closes if it has remained inactive during an effective period of time deduced - from the two max_idle_timeout values announced by the two endpoints: - - the minimum of the two values if both are not null, - - the maximum if only one of them is not null, - - if both values are null, this feature is disabled. - - The default value is 30000. - tune.quic.frontend.max-streams-bidi Sets the QUIC initial_max_streams_bidi transport parameter for frontends. This is the initial maximum number of bidirectional streams the remote peer diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h index e44cacda5..2b0bbae21 100644 --- a/include/haproxy/global-t.h +++ b/include/haproxy/global-t.h @@ -215,8 +215,6 @@ struct global { uint ring_queues; /* if >0, #ring queues, otherwise equals #thread groups */ enum threadgroup_takeover tg_takeover; /* Policy for threadgroup takeover */ #ifdef USE_QUIC - unsigned int quic_backend_max_idle_timeout; - unsigned int quic_frontend_max_idle_timeout; unsigned int quic_frontend_max_data; unsigned int quic_frontend_max_streams_bidi; size_t quic_frontend_max_window_size; diff --git a/include/haproxy/quic_tp-t.h b/include/haproxy/quic_tp-t.h index 3c9ae3846..24c0f1560 100644 --- a/include/haproxy/quic_tp-t.h +++ b/include/haproxy/quic_tp-t.h @@ -41,9 +41,7 @@ struct tp_version_information { /* These ones are our implementation default values when not set * by configuration */ -#define QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ #define QUIC_TP_DFLT_FRONT_MAX_STREAMS_BIDI 100 -#define QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ #define QUIC_TP_DFLT_FRONT_STREAM_DATA_RATIO 90 /* Types of QUIC transport parameters */ diff --git a/include/haproxy/quic_tune-t.h b/include/haproxy/quic_tune-t.h index 0ccb8d50e..42f239f94 100644 --- a/include/haproxy/quic_tune-t.h +++ b/include/haproxy/quic_tune-t.h @@ -11,6 +11,9 @@ #define QUIC_DFLT_CC_MAX_FRAME_LOSS 10 /* Default ratio value applied to a dynamic Packet reorder threshold. */ #define QUIC_DFLT_CC_REORDER_RATIO 50 /* in percent */ +/* Default max-idle-timeout advertised via TP */ +#define QUIC_DFLT_FE_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ +#define QUIC_DFLT_BE_MAX_IDLE_TIMEOUT 30000 /* milliseconds */ /* Default Retry threshold */ #define QUIC_DFLT_SEC_RETRY_THRESHOLD 100 /* in connection openings */ @@ -27,6 +30,7 @@ struct quic_tune { uint cc_cubic_min_losses; uint cc_max_frame_loss; uint cc_reorder_ratio; + uint max_idle_timeout; uint sec_glitches_threshold; uint sec_retry_threshold; uint opts; /* QUIC_TUNE_FE_* options specific to FE side */ @@ -37,6 +41,7 @@ struct quic_tune { uint cc_cubic_min_losses; uint cc_max_frame_loss; uint cc_reorder_ratio; + uint max_idle_timeout; uint sec_glitches_threshold; uint fb_opts; /* QUIC_TUNE_FB_* options shared by both side */ } be; diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index f16660f16..757f5ce36 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -27,6 +27,7 @@ struct quic_tune quic_tune = { .fe = { .cc_max_frame_loss = QUIC_DFLT_CC_MAX_FRAME_LOSS, .cc_reorder_ratio = QUIC_DFLT_CC_REORDER_RATIO, + .max_idle_timeout = QUIC_DFLT_FE_MAX_IDLE_TIMEOUT, .sec_retry_threshold = QUIC_DFLT_SEC_RETRY_THRESHOLD, .fb_opts = QUIC_TUNE_FB_TX_PACING|QUIC_TUNE_FB_TX_UDP_GSO, .opts = QUIC_TUNE_FE_SOCK_PER_CONN, @@ -34,6 +35,7 @@ struct quic_tune quic_tune = { .be = { .cc_max_frame_loss = QUIC_DFLT_CC_MAX_FRAME_LOSS, .cc_reorder_ratio = QUIC_DFLT_CC_REORDER_RATIO, + .max_idle_timeout = QUIC_DFLT_BE_MAX_IDLE_TIMEOUT, .fb_opts = QUIC_TUNE_FB_TX_PACING|QUIC_TUNE_FB_TX_UDP_GSO, }, .mem_tx_max = QUIC_MAX_TX_MEM, @@ -276,9 +278,11 @@ static int cfg_parse_quic_time(char **args, int section_type, const struct proxy *defpx, const char *file, int line, char **err) { + int ret = 0; unsigned int time; const char *res, *name, *value; - int prefix_len = strlen("tune.quic."); + const int prefix_len = strlen("tune.quic."); + const char *suffix; if (too_many_args(1, args, err, NULL)) return -1; @@ -301,16 +305,26 @@ static int cfg_parse_quic_time(char **args, int section_type, return -1; } - if (strcmp(name + prefix_len, "frontend.max-idle-timeout") == 0) - global.tune.quic_frontend_max_idle_timeout = time; - else if (strcmp(name + prefix_len, "backend.max-idle-timeout") == 0) - global.tune.quic_backend_max_idle_timeout = time; + suffix = name + prefix_len; + if (strcmp(suffix, "be.max-idle-timeout") == 0 || + strcmp(suffix, "fe.max-idle-timeout") == 0) { + uint *ptr = (suffix[0] == 'b') ? &quic_tune.be.max_idle_timeout : + &quic_tune.fe.max_idle_timeout; + *ptr = time; + } + /* legacy options */ + else if (strcmp(name + prefix_len, "frontend.max-idle-timeout") == 0) { + memprintf(err, "'%s' is deprecated in 3.3 and will be removed in 3.5. " + "Please use the newer keyword syntax 'tune.quic.fe.max-idle-timeout'.", args[0]); + quic_tune.fe.max_idle_timeout = time; + ret = 1; + } else { memprintf(err, "'%s' keyword not unhandled (please report this bug).", args[0]); - return -1; + ret = -1; } - return 0; + return ret; } /* Parse any tune.quic.* setting with strictly positive integer values. @@ -582,7 +596,6 @@ static struct cfg_kw_list cfg_kws = {ILH, { { CFG_GLOBAL, "tune.quic.mem.tx-max", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.frontend.max-data-size", 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.frontend.default-max-window-size", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.frontend.stream-data-ratio", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.zero-copy-fwd-send", cfg_parse_quic_tune_on_off }, @@ -591,6 +604,7 @@ static struct cfg_kw_list cfg_kws = {ILH, { { CFG_GLOBAL, "tune.quic.fe.cc.hystart", cfg_parse_quic_tune_on_off }, { CFG_GLOBAL, "tune.quic.fe.cc.max-frame-loss", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.fe.cc.reorder-ratio", cfg_parse_quic_tune_setting }, + { CFG_GLOBAL, "tune.quic.fe.max-idle-timeout", cfg_parse_quic_time }, { CFG_GLOBAL, "tune.quic.fe.sec.glitches-threshold", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.fe.sec.retry-threshold", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.fe.sock-per-conn", cfg_parse_quic_tune_sock_per_conn }, @@ -601,6 +615,7 @@ static struct cfg_kw_list cfg_kws = {ILH, { { CFG_GLOBAL, "tune.quic.be.cc.hystart", cfg_parse_quic_tune_on_off }, { CFG_GLOBAL, "tune.quic.be.cc.max-frame-loss", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.be.cc.reorder-ratio", cfg_parse_quic_tune_setting }, + { CFG_GLOBAL, "tune.quic.be.max-idle-timeout", cfg_parse_quic_time }, { CFG_GLOBAL, "tune.quic.be.sec.glitches-threshold", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.be.tx.pacing", cfg_parse_quic_tune_on_off }, { CFG_GLOBAL, "tune.quic.be.tx.udp-gso", cfg_parse_quic_tune_on_off }, @@ -611,6 +626,7 @@ static struct cfg_kw_list cfg_kws = {ILH, { { CFG_GLOBAL, "tune.quic.disable-tx-pacing", cfg_parse_quic_tune_setting0 }, { CFG_GLOBAL, "tune.quic.disable-udp-gso", cfg_parse_quic_tune_setting0 }, { CFG_GLOBAL, "tune.quic.frontend.glitches-threshold", cfg_parse_quic_tune_setting }, + { CFG_GLOBAL, "tune.quic.frontend.max-idle-timeout", cfg_parse_quic_time }, { CFG_GLOBAL, "tune.quic.frontend.max-tx-mem", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.max-frame-loss", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.reorder-ratio", cfg_parse_quic_tune_setting }, diff --git a/src/haproxy.c b/src/haproxy.c index da4f63228..87a62d9de 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -199,8 +199,6 @@ struct global global = { .nb_stk_ctr = MAX_SESS_STKCTR, .default_shards = -2, /* by-group */ #ifdef USE_QUIC - .quic_backend_max_idle_timeout = QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT, - .quic_frontend_max_idle_timeout = QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT, .quic_frontend_max_data = 0, .quic_frontend_max_streams_bidi = QUIC_TP_DFLT_FRONT_MAX_STREAMS_BIDI, .quic_frontend_max_window_size = QUIC_DFLT_MAX_WINDOW_SIZE, diff --git a/src/quic_tp.c b/src/quic_tp.c index bc33664d4..e85705eee 100644 --- a/src/quic_tp.c +++ b/src/quic_tp.c @@ -58,10 +58,9 @@ void quic_transport_params_init(struct quic_transport_params *p, int server) * QUIC_TP_DFLT_MAX_UDP_PAYLOAD_SIZE */ p->max_udp_payload_size = QUIC_MAX_UDP_PAYLOAD_SIZE; - if (server) - p->max_idle_timeout = global.tune.quic_frontend_max_idle_timeout; - else - p->max_idle_timeout = global.tune.quic_backend_max_idle_timeout; + + p->max_idle_timeout = server ? quic_tune.fe.max_idle_timeout : + quic_tune.be.max_idle_timeout; /* Set limit on number of concurrently opened streams. */ p->initial_max_streams_bidi = max_streams_bidi;