]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
doq: add congestion control algorithm configuration option
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 22 Sep 2023 15:01:41 +0000 (17:01 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 9 Oct 2023 11:37:59 +0000 (13:37 +0200)
.github/actions/spell-check/allow.txt
pdns/dnsdist-lua.cc
pdns/dnsdistdist/docs/reference/config.rst
pdns/dnsdistdist/doq.cc
pdns/dnsdistdist/doq.hh

index a902870fb4cbc1fa6dc45c00a16699b558b957b6..6575c877b885372f8ac51abb559ef64aa2b9da37 100644 (file)
@@ -240,6 +240,7 @@ batchmode
 baz
 bbnew
 bbold
+bbr
 bbsv
 bccaf
 bdr
index c3aa3c52f9d1ca1dbdcb01e7a4f3bdefd952cd2e..2c794ec9b55fc14122d2274332f86b8ca9f2edae 100644 (file)
@@ -2515,7 +2515,17 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
       }
       getOptionalValue<int>(vars, "internalPipeBufferSize", frontend->d_internalPipeBufferSize);
       getOptionalValue<int>(vars, "idleTimeout", frontend->d_idleTimeout);
-
+      {
+        std::string valueStr;
+        if (getOptionalValue<std::string>(vars, "congestionControlAlgo", valueStr) > 0) {
+          if (DOQFrontend::s_available_cc_algorithms.count(valueStr)) {
+            frontend->d_ccAlgo = valueStr;
+          }
+          else {
+            warnlog("Ignoring unknown value '%s' for 'congestionControlAlgo' on 'addDOQLocal'", valueStr);
+          }
+        }
+      }
       parseTLSConfig(frontend->d_tlsConfig, "addDOQLocal", vars);
 
       bool ignoreTLSConfigurationErrors = false;
index f6ad305783048dfea729f7a4ebedddbca692f8a0..354f477f00d0d216f4d1a0234b2f6945dec7b9ce 100644 (file)
@@ -191,6 +191,7 @@ Listen Sockets
   * ``idleTimeout=5``: int - Set the idle timeout, in seconds.
   * ``internalPipeBufferSize=0``: int - Set the size in bytes of the internal buffer of the pipes used internally to pass queries and responses between threads. Requires support for ``F_SETPIPE_SZ`` which is present in Linux since 2.6.35. The actual size might be rounded up to a multiple of a page size. 0 means that the OS default size is used. The default value is 0, except on Linux where it is 1048576 since 1.6.0.
   * ``maxInFlight=0``: int - Maximum number of in-flight queries. The default is 0, which disables out-of-order processing.
+  * ``congestionControlAlgo="reno"``: str - The congestion control algorithm to be chosen between ``reno``, ``cubic`` and ``bbr``
 
 .. function:: addTLSLocal(address, certFile(s), keyFile(s) [, options])
 
index 784c7c03ea1e4ac66ca81e3a4799b1605f571ee2..ed1548ce7a742fd1a73b517fca065f57447fd839 100644 (file)
 
 static std::string s_quicRetryTokenKey = newKey(false);
 
+std::map<const string, int> DOQFrontend::s_available_cc_algorithms = {
+  {"reno", QUICHE_CC_RENO},
+  {"cubic", QUICHE_CC_CUBIC},
+  {"bbr", QUICHE_CC_BBR},
+};
+
 using QuicheConnection = std::unique_ptr<quiche_conn, decltype(&quiche_conn_free)>;
 using QuicheConfig = std::unique_ptr<quiche_config, decltype(&quiche_config_free)>;
 
@@ -322,7 +328,10 @@ void DOQFrontend::setup()
   // https://docs.rs/quiche/latest/quiche/struct.Config.html#method.set_initial_max_data
   quiche_config_set_initial_max_data(config.get(), 8192 * d_maxInFlight);
 
-  quiche_config_set_cc_algorithm(config.get(), QUICHE_CC_RENO);
+  auto algo = DOQFrontend::s_available_cc_algorithms.find(d_ccAlgo);
+  if (algo != DOQFrontend::s_available_cc_algorithms.end()) {
+    quiche_config_set_cc_algorithm(config.get(), static_cast<enum quiche_cc_algorithm>(algo->second));
+  }
 
   {
     PacketBuffer resetToken;
index 72d276892bf2d6593692f8fac344e839ae9e1339..9d318c9aacfeac98ff0867620eb178a8c95acdc4 100644 (file)
@@ -59,6 +59,8 @@ struct DOQFrontend
 #endif
   uint64_t d_idleTimeout{5};
   uint64_t d_maxInFlight{65535};
+  std::string d_ccAlgo{"reno"};
+  static std::map<const string, int> s_available_cc_algorithms;
 };
 
 struct DOQUnit