gfe-relnote: Allow connection option LRTT to be set for BBRv1 and BBQ2 to be set set for BBRv1 and BBRv2. Refactor only, not protected. PiperOrigin-RevId: 309735417 Change-Id: I7c111a10ad3e7fcd3e319e8b3fd202176f0fde2b
diff --git a/quic/core/congestion_control/bbr2_sender.cc b/quic/core/congestion_control/bbr2_sender.cc index 65c4f16..8c0171b 100644 --- a/quic/core/congestion_control/bbr2_sender.cc +++ b/quic/core/congestion_control/bbr2_sender.cc
@@ -108,13 +108,6 @@ if (config.HasClientRequestedIndependentOption(kB2RP, perspective)) { params_.avoid_unnecessary_probe_rtt = false; } - if (GetQuicReloadableFlag(quic_bbr2_lower_startup_cwnd_gain) && - config.HasClientRequestedIndependentOption(kBBQ2, perspective)) { - QUIC_RELOADABLE_FLAG_COUNT(quic_bbr2_lower_startup_cwnd_gain); - // 2 is the lower, derived gain for CWND. - params_.startup_cwnd_gain = 2; - params_.drain_cwnd_gain = 2; - } if (GetQuicReloadableFlag(quic_bbr2_avoid_too_low_probe_bw_cwnd) && config.HasClientRequestedIndependentOption(kB2CL, perspective)) { params_.avoid_too_low_probe_bw_cwnd = false; @@ -134,6 +127,18 @@ QUIC_RELOADABLE_FLAG_COUNT(quic_bbr2_ignore_inflight_lo); params_.ignore_inflight_lo = true; } + + ApplyConnectionOptions(config.ClientRequestedIndependentOptions(perspective)); +} + +void Bbr2Sender::ApplyConnectionOptions( + const QuicTagVector& connection_options) { + if (GetQuicReloadableFlag(quic_bbr2_lower_startup_cwnd_gain) && + ContainsQuicTag(connection_options, kBBQ2)) { + // 2 is the lower, derived gain for CWND. + params_.startup_cwnd_gain = 2; + params_.drain_cwnd_gain = 2; + } } Limits<QuicByteCount> Bbr2Sender::GetCwndLimitsByMode() const {
diff --git a/quic/core/congestion_control/bbr2_sender.h b/quic/core/congestion_control/bbr2_sender.h index d68a6a1..60824cd 100644 --- a/quic/core/congestion_control/bbr2_sender.h +++ b/quic/core/congestion_control/bbr2_sender.h
@@ -50,6 +50,8 @@ void SetFromConfig(const QuicConfig& config, Perspective perspective) override; + void ApplyConnectionOptions(const QuicTagVector& connection_options) override; + void AdjustNetworkParameters(const NetworkParams& params) override; void SetInitialCongestionWindowInPackets( @@ -173,8 +175,8 @@ QuicRandom* random_; QuicConnectionStats* connection_stats_; - // Don't use it directly outside of SetFromConfig. Instead, use params() to - // get read-only access. + // Don't use it directly outside of SetFromConfig and ApplyConnectionOptions. + // Instead, use params() to get read-only access. Bbr2Params params_; Bbr2NetworkModel model_;
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc index ec51dee..f150ec1 100644 --- a/quic/core/congestion_control/bbr_sender.cc +++ b/quic/core/congestion_control/bbr_sender.cc
@@ -259,9 +259,6 @@ void BbrSender::SetFromConfig(const QuicConfig& config, Perspective perspective) { - if (config.HasClientRequestedIndependentOption(kLRTT, perspective)) { - exit_startup_on_loss_ = true; - } if (config.HasClientRequestedIndependentOption(k1RTT, perspective)) { num_startup_rtts_ = 1; } @@ -303,9 +300,6 @@ set_high_cwnd_gain(kDerivedHighGain); set_drain_gain(1.f / kDerivedHighGain); } - if (config.HasClientRequestedIndependentOption(kBBQ2, perspective)) { - set_high_cwnd_gain(kDerivedHighCWNDGain); - } if (config.HasClientRequestedIndependentOption(kBBQ3, perspective)) { enable_ack_aggregation_during_startup_ = true; } @@ -326,6 +320,18 @@ quic_avoid_overestimate_bandwidth_with_aggregation, 3, 4); sampler_.EnableOverestimateAvoidance(); } + + ApplyConnectionOptions(config.ClientRequestedIndependentOptions(perspective)); +} + +void BbrSender::ApplyConnectionOptions( + const QuicTagVector& connection_options) { + if (ContainsQuicTag(connection_options, kLRTT)) { + exit_startup_on_loss_ = true; + } + if (ContainsQuicTag(connection_options, kBBQ2)) { + set_high_cwnd_gain(kDerivedHighCWNDGain); + } } void BbrSender::AdjustNetworkParameters(const NetworkParams& params) {
diff --git a/quic/core/congestion_control/bbr_sender.h b/quic/core/congestion_control/bbr_sender.h index 8000f17..c7285d7 100644 --- a/quic/core/congestion_control/bbr_sender.h +++ b/quic/core/congestion_control/bbr_sender.h
@@ -106,6 +106,7 @@ void SetFromConfig(const QuicConfig& config, Perspective perspective) override; + void ApplyConnectionOptions(const QuicTagVector& connection_options) override; void AdjustNetworkParameters(const NetworkParams& params) override; void SetInitialCongestionWindowInPackets(
diff --git a/quic/core/congestion_control/send_algorithm_interface.h b/quic/core/congestion_control/send_algorithm_interface.h index 2bfc2df..ea0c375 100644 --- a/quic/core/congestion_control/send_algorithm_interface.h +++ b/quic/core/congestion_control/send_algorithm_interface.h
@@ -86,6 +86,9 @@ virtual void SetFromConfig(const QuicConfig& config, Perspective perspective) = 0; + virtual void ApplyConnectionOptions( + const QuicTagVector& connection_options) = 0; + // Sets the initial congestion window in number of packets. May be ignored // if called after the initial congestion window is no longer relevant. virtual void SetInitialCongestionWindowInPackets(QuicPacketCount packets) = 0;
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.h b/quic/core/congestion_control/tcp_cubic_sender_bytes.h index 7a36f76..59ca7f8 100644 --- a/quic/core/congestion_control/tcp_cubic_sender_bytes.h +++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.h
@@ -46,6 +46,8 @@ // Start implementation of SendAlgorithmInterface. void SetFromConfig(const QuicConfig& config, Perspective perspective) override; + void ApplyConnectionOptions( + const QuicTagVector& /*connection_options*/) override {} void AdjustNetworkParameters(const NetworkParams& params) override; void SetNumEmulatedConnections(int num_connections); void SetInitialCongestionWindowInPackets(
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc index a06e698..5cd0061 100644 --- a/quic/core/quic_config.cc +++ b/quic/core/quic_config.cc
@@ -590,6 +590,19 @@ ContainsQuicTag(client_connection_options_.GetSendValues(), tag)); } +const QuicTagVector& QuicConfig::ClientRequestedIndependentOptions( + Perspective perspective) const { + static const QuicTagVector* no_options = new QuicTagVector; + if (perspective == Perspective::IS_SERVER) { + return HasReceivedConnectionOptions() ? ReceivedConnectionOptions() + : *no_options; + } + + return client_connection_options_.HasSendValues() + ? client_connection_options_.GetSendValues() + : *no_options; +} + void QuicConfig::SetIdleNetworkTimeout(QuicTime::Delta idle_network_timeout) { idle_network_timeout_seconds_.set( static_cast<uint32_t>(idle_network_timeout.ToSeconds()),
diff --git a/quic/core/quic_config.h b/quic/core/quic_config.h index 0009cda..4caba41 100644 --- a/quic/core/quic_config.h +++ b/quic/core/quic_config.h
@@ -333,6 +333,9 @@ bool HasClientRequestedIndependentOption(QuicTag tag, Perspective perspective) const; + const QuicTagVector& ClientRequestedIndependentOptions( + Perspective perspective) const; + void SetIdleNetworkTimeout(QuicTime::Delta idle_network_timeout); QuicTime::Delta IdleNetworkTimeout() const;
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index 45ce52a..a3dc325 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -482,6 +482,11 @@ } } +void QuicConnection::ApplyConnectionOptions( + const QuicTagVector& connection_options) { + sent_packet_manager_.ApplyConnectionOptions(connection_options); +} + void QuicConnection::OnSendConnectionState( const CachedNetworkParameters& cached_network_params) { if (debug_visitor_ != nullptr) {
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h index 82c354d..f516e52 100644 --- a/quic/core/quic_connection.h +++ b/quic/core/quic_connection.h
@@ -383,6 +383,12 @@ // Sets connection parameters from the supplied |config|. void SetFromConfig(const QuicConfig& config); + // Apply |connection_options| for this connection. Unlike SetFromConfig, this + // can happen at anytime in the life of a connection. + // Note there is no guarantee that all options can be applied. Components will + // only apply cherrypicked options that make sense at the time of the call. + void ApplyConnectionOptions(const QuicTagVector& connection_options); + // Called by the session when sending connection state to the client. virtual void OnSendConnectionState( const CachedNetworkParameters& cached_network_params);
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc index 512632d..108fbf3 100644 --- a/quic/core/quic_sent_packet_manager.cc +++ b/quic/core/quic_sent_packet_manager.cc
@@ -295,6 +295,11 @@ } } +void QuicSentPacketManager::ApplyConnectionOptions( + const QuicTagVector& connection_options) { + send_algorithm_->ApplyConnectionOptions(connection_options); +} + void QuicSentPacketManager::ResumeConnectionState( const CachedNetworkParameters& cached_network_params, bool max_bandwidth_resumption) {
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h index 54cf737..8407fbb 100644 --- a/quic/core/quic_sent_packet_manager.h +++ b/quic/core/quic_sent_packet_manager.h
@@ -120,6 +120,8 @@ virtual void SetFromConfig(const QuicConfig& config); + void ApplyConnectionOptions(const QuicTagVector& connection_options); + // Pass the CachedNetworkParameters to the send algorithm. void ResumeConnectionState( const CachedNetworkParameters& cached_network_params,
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h index c4976b0..9c81412 100644 --- a/quic/test_tools/quic_test_utils.h +++ b/quic/test_tools/quic_test_utils.h
@@ -1202,6 +1202,10 @@ (const QuicConfig& config, Perspective perspective), (override)); MOCK_METHOD(void, + ApplyConnectionOptions, + (const QuicTagVector& connection_options), + (override)); + MOCK_METHOD(void, SetInitialCongestionWindowInPackets, (QuicPacketCount packets), (override));