]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: Add global option to enable/disable zero-copy forwarding
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 4 Dec 2023 14:26:23 +0000 (15:26 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 4 Dec 2023 14:33:52 +0000 (15:33 +0100)
tune.quic.zero-copy-fwd-send can now be used to enable or disable the
zero-copy fast-forwarding for the QUIC mux only, for sends. For now, there
is no option to disable it for receives because it is not supported yet.

It is enabled ('on') by default.

doc/configuration.txt
src/cfgparse-quic.c
src/mux_quic.c

index bcdaae1fa4c392f7e4c2d53580cff0f03663edde..10faa8613f29e2bb9f7352d052a2594914f9bd43 100644 (file)
@@ -1221,6 +1221,7 @@ The following keywords are supported in the "global" section :
    - tune.quic.max-frame-loss
    - tune.quic.retry-threshold
    - tune.quic.socket-owner
+   - tune.quic.zero-copy-fwd-send
    - tune.rcvbuf.backend
    - tune.rcvbuf.client
    - tune.rcvbuf.frontend
@@ -2927,7 +2928,7 @@ tune.disable-zero-copy-forwarding
 
   See also: tune.pt.zero-copy-forwarding,
             tune.h1.zero-copy-fwd-recv, tune.h1.zero-copy-fwd-send,
-            tune.h2.zero-copy-fwd-send
+            tune.h2.zero-copy-fwd-send, tune.quic.zero-copy-fwd-send
 
 tune.events.max-events-at-once <number>
   Sets the number of events that may be processed at once by an asynchronous
@@ -3456,6 +3457,12 @@ tune.quic.socket-owner { connection | listener }
   is used globally, it will be forced on every listener instance, regardless of
   their individual configuration.
 
+tune.quit.zero-copy-fwd-send { on | off }
+  Enables ('on') of disabled ('off') the zero-copy sends of data for the QUIC
+  multiplexer. It is enabled by default.
+
+  See also: tune.disable-zero-copy-forwarding
+
 tune.rcvbuf.backend <number>
 tune.rcvbuf.frontend <number>
   For the kernel socket receive buffer size on non-connected sockets to this
index 80294085030390cba1dd2059d45c8a6958a6a09e..ec2dedacfd4f9953b932629c17602ccf8ce72540 100644 (file)
@@ -248,6 +248,25 @@ static int cfg_parse_quic_tune_setting(char **args, int section_type,
        return 0;
 }
 
+/* config parser for global "tune.quic.zero-copy-fwd-send" */
+static int cfg_parse_quic_zero_copy_fwd_snd(char **args, int section_type, struct proxy *curpx,
+                                           const struct proxy *defpx, const char *file, int line,
+                                           char **err)
+{
+       if (too_many_args(1, args, err, NULL))
+               return -1;
+
+       if (strcmp(args[1], "on") == 0)
+               global.tune.no_zero_copy_fwd &= ~NO_ZERO_COPY_FWD_QUIC_SND;
+       else if (strcmp(args[1], "off") == 0)
+               global.tune.no_zero_copy_fwd |= NO_ZERO_COPY_FWD_QUIC_SND;
+       else {
+               memprintf(err, "'%s' expects 'on' or 'off'.", args[0]);
+               return -1;
+       }
+       return 0;
+}
+
 static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "tune.quic.socket-owner", cfg_parse_quic_tune_socket_owner },
        { CFG_GLOBAL, "tune.quic.backend.max-idle-timeou", cfg_parse_quic_time },
@@ -256,6 +275,7 @@ static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "tune.quic.frontend.max-idle-timeout", cfg_parse_quic_time },
        { CFG_GLOBAL, "tune.quic.max-frame-loss", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.retry-threshold", cfg_parse_quic_tune_setting },
+       { CFG_GLOBAL, "tune.quic.zero-copy-fwd-send", cfg_parse_quic_zero_copy_fwd_snd },
        { 0, NULL, NULL }
 }};
 
index 714bc32f9de685e2771ba14d647c902660d126aa..a4afe9b271ccb3dc47feae5df2f27ba3296d1e22 100644 (file)
@@ -2819,6 +2819,11 @@ static size_t qmux_nego_ff(struct stconn *sc, struct buffer *input, size_t count
        /* stream layer has been detached so no transfer must occur after. */
        BUG_ON_HOT(qcs->flags & QC_SF_DETACH);
 
+       if (global.tune.no_zero_copy_fwd & NO_ZERO_COPY_FWD_QUIC_SND) {
+               qcs->sd->iobuf.flags |= IOBUF_FL_NO_FF;
+               goto end;
+       }
+
        if (!qcs->qcc->app_ops->nego_ff || !qcs->qcc->app_ops->done_ff) {
                /* Fast forwading is not supported by the QUIC application layer */
                qcs->sd->iobuf.flags |= IOBUF_FL_NO_FF;