From d465a8510ed1cd11a4c40d4565ae33e4b3f07f0e Mon Sep 17 00:00:00 2001 From: Andrew Creskey Date: Thu, 7 Sep 2023 18:51:47 +0000 Subject: [PATCH] Bug 1851908 - Add a preference to specify neqo's congestion control algorithm r=necko-reviewers,kershaw We want to experiment with NewReno so expose this via pref. Differential Revision: https://phabricator.services.mozilla.com/D187602 --- modules/libpref/init/StaticPrefList.yaml | 9 +++++++++ netwerk/socket/neqo_glue/src/lib.rs | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index b2252f564b9b..9cd72bdc442a 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -12417,6 +12417,15 @@ value: false mirror: always +# The congestion control algorithm with which to configure neqo. +# 0 => NewReno +# 1 => Cubic +- name: network.http.http3.cc_algorithm + type: RelaxedAtomicUint32 + value: 1 + mirror: always + rust: true + # When true, a http request will be upgraded to https when HTTPS RR is # available. - name: network.dns.upgrade_with_https_rr diff --git a/netwerk/socket/neqo_glue/src/lib.rs b/netwerk/socket/neqo_glue/src/lib.rs index 02568e69fc91..a159cbdb4f28 100644 --- a/netwerk/socket/neqo_glue/src/lib.rs +++ b/netwerk/socket/neqo_glue/src/lib.rs @@ -124,10 +124,20 @@ impl NeqoHttp3Conn { } else { vec![quic_version] }; + + let cc_algorithm = match static_prefs::pref!("network.http.http3.cc_algorithm") { + 0 => CongestionControlAlgorithm::NewReno, + 1 => CongestionControlAlgorithm::Cubic, + _ => { + // Unknown preferences; default to Cubic + CongestionControlAlgorithm::Cubic + } + }; + #[allow(unused_mut)] let mut params = ConnectionParameters::default() .versions(quic_version, version_list) - .cc_algorithm(CongestionControlAlgorithm::Cubic) + .cc_algorithm(cc_algorithm) .max_data(max_data) .max_stream_data(StreamType::BiDi, false, max_stream_data) .grease(static_prefs::pref!("security.tls.grease_http3_enable")); @@ -1338,9 +1348,9 @@ pub extern "C" fn neqo_http3conn_webtransport_set_sendorder( ) -> nsresult { match conn .conn - .webtransport_set_sendorder(StreamId::from(stream_id), sendorder) + .webtransport_set_sendorder(StreamId::from(stream_id), sendorder) { - Ok(()) => NS_OK, - Err(_) => NS_ERROR_UNEXPECTED, + Ok(()) => NS_OK, + Err(_) => NS_ERROR_UNEXPECTED, } }