Refactor BBR2/BBR3 initialization and inline some methods. Bbr2NetworkModel now initializes its gains from Bbr2Params' startup values, removing redundant constructor arguments. PiperOrigin-RevId: 903383815
diff --git a/quiche/quic/core/congestion_control/bbr2_misc.cc b/quiche/quic/core/congestion_control/bbr2_misc.cc index 123dd1d..2ec5df5 100644 --- a/quiche/quic/core/congestion_control/bbr2_misc.cc +++ b/quiche/quic/core/congestion_control/bbr2_misc.cc
@@ -84,7 +84,6 @@ Bbr2NetworkModel::Bbr2NetworkModel(const Bbr2Params* params, QuicTime::Delta initial_rtt, QuicTime initial_rtt_timestamp, - float cwnd_gain, float pacing_gain, const BandwidthSampler* old_sampler) : params_(params), bandwidth_sampler_([](QuicRoundTripCount max_height_tracker_window_length, @@ -96,8 +95,8 @@ max_height_tracker_window_length); }(params->initial_max_ack_height_filter_window, old_sampler)), min_rtt_filter_(initial_rtt, initial_rtt_timestamp), - cwnd_gain_(cwnd_gain), - pacing_gain_(pacing_gain) {} + cwnd_gain_(params->startup_cwnd_gain), + pacing_gain_(params->startup_pacing_gain) {} void Bbr2NetworkModel::OnPacketSent(QuicTime sent_time, QuicByteCount bytes_in_flight,
diff --git a/quiche/quic/core/congestion_control/bbr2_misc.h b/quiche/quic/core/congestion_control/bbr2_misc.h index 17f3c3c..3da0471 100644 --- a/quiche/quic/core/congestion_control/bbr2_misc.h +++ b/quiche/quic/core/congestion_control/bbr2_misc.h
@@ -361,8 +361,8 @@ class QUICHE_EXPORT Bbr2NetworkModel { public: Bbr2NetworkModel(const Bbr2Params* params, QuicTime::Delta initial_rtt, - QuicTime initial_rtt_timestamp, float cwnd_gain, - float pacing_gain, const BandwidthSampler* old_sampler); + QuicTime initial_rtt_timestamp, + const BandwidthSampler* old_sampler); void OnPacketSent(QuicTime sent_time, QuicByteCount bytes_in_flight, QuicPacketNumber packet_number, QuicByteCount bytes,
diff --git a/quiche/quic/core/congestion_control/bbr2_sender.cc b/quiche/quic/core/congestion_control/bbr2_sender.cc index 30170a6..730a781 100644 --- a/quiche/quic/core/congestion_control/bbr2_sender.cc +++ b/quiche/quic/core/congestion_control/bbr2_sender.cc
@@ -67,8 +67,6 @@ max_cwnd_in_packets * kDefaultTCPMSS), model_(¶ms_, rtt_stats->SmoothedOrInitialRtt(), rtt_stats->last_update_time(), - /*cwnd_gain=*/1.0, - /*pacing_gain=*/kInitialPacingGain, old_sender ? &old_sender->sampler_ : nullptr), initial_cwnd_(cwnd_limits().ApplyLimits( (old_sender) ? old_sender->GetCongestionWindow() @@ -339,7 +337,7 @@ } if (congestion_event.bytes_in_flight == 0 && params().avoid_unnecessary_probe_rtt) { - OnEnterQuiescence(event_time); + last_quiescence_start_ = event_time; } QUIC_DVLOG(3) @@ -459,8 +457,7 @@ } bool Bbr2Sender::CanSend(QuicByteCount bytes_in_flight) { - const bool result = bytes_in_flight < GetCongestionWindow(); - return result; + return bytes_in_flight < GetCongestionWindow(); } QuicByteCount Bbr2Sender::GetCongestionWindow() const { @@ -492,10 +489,6 @@ stats->num_ack_aggregation_epochs = model_.num_ack_aggregation_epochs(); } -void Bbr2Sender::OnEnterQuiescence(QuicTime now) { - last_quiescence_start_ = now; -} - void Bbr2Sender::OnExitQuiescence(QuicTime now) { if (last_quiescence_start_ != QuicTime::Zero()) { Bbr2Mode next_mode = BBR2_MODE_DISPATCH(
diff --git a/quiche/quic/core/congestion_control/bbr2_sender.h b/quiche/quic/core/congestion_control/bbr2_sender.h index f625919..d73a702 100644 --- a/quiche/quic/core/congestion_control/bbr2_sender.h +++ b/quiche/quic/core/congestion_control/bbr2_sender.h
@@ -124,7 +124,6 @@ void UpdatePacingRate(QuicByteCount bytes_acked); void UpdateCongestionWindow(QuicByteCount bytes_acked); QuicByteCount GetTargetCongestionWindow(float gain) const; - void OnEnterQuiescence(QuicTime now); void OnExitQuiescence(QuicTime now); // Helper function for BBR2_MODE_DISPATCH.
diff --git a/quiche/quic/core/congestion_control/bbr3_sender.cc b/quiche/quic/core/congestion_control/bbr3_sender.cc index cc3d570..e80e03e 100644 --- a/quiche/quic/core/congestion_control/bbr3_sender.cc +++ b/quiche/quic/core/congestion_control/bbr3_sender.cc
@@ -42,8 +42,6 @@ max_cwnd_in_packets * kDefaultTCPMSS), model_(¶ms_, rtt_stats->SmoothedOrInitialRtt(), rtt_stats->last_update_time(), - /*cwnd_gain=*/1.0, - /*pacing_gain=*/kInitialPacingGain, old_sender ? &old_sender->sampler_ : nullptr), initial_cwnd_(params_.cwnd_limits.ApplyLimits( (old_sender) ? old_sender->GetCongestionWindow() @@ -371,7 +369,7 @@ } if (congestion_event.bytes_in_flight == 0 && params_.avoid_unnecessary_probe_rtt) { - OnEnterQuiescence(event_time); + last_quiescence_start_ = event_time; } QUIC_DVLOG(3) @@ -491,8 +489,7 @@ } bool Bbr3Sender::CanSend(QuicByteCount bytes_in_flight) { - const bool result = bytes_in_flight < GetCongestionWindow(); - return result; + return bytes_in_flight < GetCongestionWindow(); } QuicByteCount Bbr3Sender::GetCongestionWindow() const { @@ -524,10 +521,6 @@ stats->num_ack_aggregation_epochs = model_.num_ack_aggregation_epochs(); } -void Bbr3Sender::OnEnterQuiescence(QuicTime now) { - last_quiescence_start_ = now; -} - void Bbr3Sender::LeaveStartup(QuicTime now) { connection_stats_->slowstart_duration.Stop(now); // Clear bandwidth_lo if it's set during STARTUP. @@ -801,7 +794,7 @@ return; } - if (HasStayedLongEnoughInProbeDown(congestion_event)) { + if (HasPhaseLasted(model_.MinRtt(), congestion_event)) { QUIC_DVLOG(3) << this << " Proportional time based PROBE_DOWN exit"; EnterProbeCruise(congestion_event.event_time); return; @@ -918,11 +911,6 @@ return false; } -bool Bbr3Sender::HasStayedLongEnoughInProbeDown( - const Bbr2CongestionEvent& congestion_event) const { - return HasPhaseLasted(model_.MinRtt(), congestion_event); -} - bool Bbr3Sender::HasCycleLasted( QuicTime::Delta duration, const Bbr2CongestionEvent& congestion_event) const {
diff --git a/quiche/quic/core/congestion_control/bbr3_sender.h b/quiche/quic/core/congestion_control/bbr3_sender.h index 1b4666f..f6e0f9e 100644 --- a/quiche/quic/core/congestion_control/bbr3_sender.h +++ b/quiche/quic/core/congestion_control/bbr3_sender.h
@@ -129,7 +129,6 @@ Bbr2Mode OnCongestionEventDrain(const Bbr2CongestionEvent& congestion_event); QuicByteCount DrainTarget() const; - void OnEnterQuiescence(QuicTime now); void OnExitQuiescence(QuicTime now); Bbr2Mode OnCongestionEventProbeBw( @@ -161,8 +160,6 @@ bool IsTimeToProbeBandwidth( const Bbr2CongestionEvent& congestion_event) const; - bool HasStayedLongEnoughInProbeDown( - const Bbr2CongestionEvent& congestion_event) const; bool HasCycleLasted(QuicTime::Delta duration, const Bbr2CongestionEvent& congestion_event) const; bool HasPhaseLasted(QuicTime::Delta duration,