]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: xprt_quic: adjust flow-control according to bufsize
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 13 May 2022 09:27:06 +0000 (11:27 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 13 May 2022 15:22:19 +0000 (17:22 +0200)
Redefine the initial local flow-control to enforce by us. Use bufsize as
the maximum offset allowed to be received.

This change is part of an adjustement on the Rx path. Mux buffer will be
converted to a ncbuf. Flow-control parameters must ensure that we never
receive a frame larger than the buffer. With this, all received frames
will be stored in the MUX buffer.

include/haproxy/xprt_quic.h

index cca985c4483f12c91f1c0f459abd877c3bfcc9ab..967a43d8dda4ae5da6542f5e556f3cb2fb68b67f 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <haproxy/buf.h>
 #include <haproxy/chunk.h>
+#include <haproxy/ncbuf-t.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/openssl-compat.h>
 #include <haproxy/ticks.h>
@@ -463,17 +464,21 @@ static inline void quic_dflt_transport_params_cpy(struct quic_transport_params *
 static inline 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_uni = 3;
+
        /* Default values (when absent) */
        quic_dflt_transport_params_cpy(p);
 
        p->max_idle_timeout                    = 30000;
 
-       p->initial_max_data                    = 1 * 1024 * 1024;
-       p->initial_max_stream_data_bidi_local  = 256 * 1024;
-       p->initial_max_stream_data_bidi_remote = 256 * 1024;
-       p->initial_max_stream_data_uni         = 256 * 1024;
-       p->initial_max_streams_bidi            = 100;
-       p->initial_max_streams_uni             = 3;
+       p->initial_max_streams_bidi            = max_streams_bidi;
+       p->initial_max_streams_uni             = max_streams_uni;
+       p->initial_max_stream_data_bidi_local  = ncb_size;
+       p->initial_max_stream_data_bidi_remote = ncb_size;
+       p->initial_max_stream_data_uni         = ncb_size;
+       p->initial_max_data = (max_streams_bidi + max_streams_uni) * ncb_size;
 
        if (server)
                p->with_stateless_reset_token      = 1;