Refactor and simplify BBR3. This change removes unused members and flattens the StartupState struct. PiperOrigin-RevId: 902620356
diff --git a/quiche/quic/core/congestion_control/bbr3_sender.cc b/quiche/quic/core/congestion_control/bbr3_sender.cc index 71f4352..dbfad1d 100644 --- a/quiche/quic/core/congestion_control/bbr3_sender.cc +++ b/quiche/quic/core/congestion_control/bbr3_sender.cc
@@ -41,7 +41,6 @@ QuicPacketCount max_cwnd_in_packets, QuicRandom* random, QuicConnectionStats* stats, BbrSender* old_sender) : mode_(Bbr2Mode::STARTUP), - rtt_stats_(rtt_stats), unacked_packets_(unacked_packets), random_(random), connection_stats_(stats), @@ -56,7 +55,7 @@ (old_sender) ? old_sender->GetCongestionWindow() : (initial_cwnd_in_packets * kDefaultTCPMSS))), cwnd_(initial_cwnd_), - pacing_rate_(kInitialPacingGain * + pacing_rate_(params_.startup_pacing_gain * QuicBandwidth::FromBytesAndTimeDelta( cwnd_, rtt_stats->SmoothedOrInitialRtt())), last_sample_is_app_limited_(false) { @@ -678,11 +677,11 @@ if (!congestion_event.last_packet_send_state.is_app_limited) { // Multiply by startup_pacing_gain, so if the bandwidth doubles, // the pacing gain will be the full startup_pacing_gain. - if (startup_.max_bw_at_round_beginning > QuicBandwidth::Zero()) { + if (startup_max_bw_at_round_beginning_ > QuicBandwidth::Zero()) { const float bandwidth_ratio = std::max( 1., model_.MaxBandwidth().ToBitsPerSecond() / static_cast<double>( - startup_.max_bw_at_round_beginning.ToBitsPerSecond())); + startup_max_bw_at_round_beginning_.ToBitsPerSecond())); // Even when bandwidth isn't increasing, use a gain large enough to // cause a full_bw_threshold increase. const float new_gain = @@ -699,7 +698,7 @@ model_.clear_bandwidth_lo(); } } - startup_.max_bw_at_round_beginning = model_.MaxBandwidth(); + startup_max_bw_at_round_beginning_ = model_.MaxBandwidth(); } } @@ -1195,7 +1194,6 @@ params_.probe_bw_probe_max_rand_duration.ToMicroseconds())); probe_bw_.probe_up_bytes = std::numeric_limits<QuicByteCount>::max(); - probe_bw_.probe_up_app_limited_since_inflight_hi_limited_ = false; probe_bw_.has_advanced_max_bw = false; model_.RestartRoundEarly(); }
diff --git a/quiche/quic/core/congestion_control/bbr3_sender.h b/quiche/quic/core/congestion_control/bbr3_sender.h index 6f61233..722df9b 100644 --- a/quiche/quic/core/congestion_control/bbr3_sender.h +++ b/quiche/quic/core/congestion_control/bbr3_sender.h
@@ -232,7 +232,6 @@ Bbr2Mode mode_; - const RttStats* const rtt_stats_; const QuicUnackedPacketMap* const unacked_packets_; QuicRandom* random_; QuicConnectionStats* connection_stats_; @@ -256,9 +255,7 @@ kMaxInitialCongestionWindow * kDefaultTCPMSS; // Startup state. - struct StartupState { - QuicBandwidth max_bw_at_round_beginning = QuicBandwidth::Zero(); - } startup_; + QuicBandwidth startup_max_bw_at_round_beginning_ = QuicBandwidth::Zero(); // Probe BW state. struct ProbeBWState { @@ -271,7 +268,6 @@ uint64_t probe_up_rounds = 0; QuicByteCount probe_up_bytes = std::numeric_limits<QuicByteCount>::max(); QuicByteCount probe_up_acked = 0; - bool probe_up_app_limited_since_inflight_hi_limited_ = false; // Whether max bandwidth filter window has advanced in this cycle. It is // advanced once per cycle. bool has_advanced_max_bw = false;