Change the return value of CheckBandwidthGrowth to an enum from a bool. No functional change. In preparation for cr/347265673 PiperOrigin-RevId: 347706489 Change-Id: I232dea9471e86e7a17904f073e397b22e40e3e5a
diff --git a/quic/core/congestion_control/bbr2_misc.cc b/quic/core/congestion_control/bbr2_misc.cc index eb29983..803d03f 100644 --- a/quic/core/congestion_control/bbr2_misc.cc +++ b/quic/core/congestion_control/bbr2_misc.cc
@@ -369,14 +369,12 @@ return inflight_hi_ > headroom ? inflight_hi_ - headroom : 0; } -bool Bbr2NetworkModel::CheckBandwidthGrowth( +Bbr2NetworkModel::BandwidthGrowth Bbr2NetworkModel::CheckBandwidthGrowth( const Bbr2CongestionEvent& congestion_event) { DCHECK(!full_bandwidth_reached_); DCHECK(congestion_event.end_of_round_trip); if (congestion_event.last_sample_is_app_limited) { - // Return true such that when Params().always_exit_startup_on_excess_loss is - // false, we'll not check excess loss, which is the behavior of QUIC BBRv1. - return true; + return APP_LIMITED; } QuicBandwidth threshold = @@ -388,19 +386,22 @@ << " (Still growing) @ " << congestion_event.event_time; full_bandwidth_baseline_ = MaxBandwidth(); rounds_without_bandwidth_growth_ = 0; - return true; + return GROWTH; } ++rounds_without_bandwidth_growth_; - full_bandwidth_reached_ = - rounds_without_bandwidth_growth_ >= Params().startup_full_bw_rounds; + BandwidthGrowth return_value = NO_GROWTH; + if (rounds_without_bandwidth_growth_ >= Params().startup_full_bw_rounds) { + full_bandwidth_reached_ = true; + return_value = EXIT; + } QUIC_DVLOG(3) << " CheckBandwidthGrowth at end of round. max_bandwidth:" << MaxBandwidth() << ", threshold:" << threshold << " rounds_without_growth:" << rounds_without_bandwidth_growth_ << " full_bw_reached:" << full_bandwidth_reached_ << " @ " << congestion_event.event_time; - return false; + return return_value; } } // namespace quic
diff --git a/quic/core/congestion_control/bbr2_misc.h b/quic/core/congestion_control/bbr2_misc.h index f02e22d..6ee2896 100644 --- a/quic/core/congestion_control/bbr2_misc.h +++ b/quic/core/congestion_control/bbr2_misc.h
@@ -426,12 +426,22 @@ bool IsInflightTooHigh(const Bbr2CongestionEvent& congestion_event, int64_t max_loss_events) const; + enum BandwidthGrowth { + APP_LIMITED = 0, + NO_GROWTH = 1, + GROWTH = 2, + EXIT = 3, // Too many rounds without bandwidth growth. + }; + // Check bandwidth growth in the past round. Must be called at the end of a // round. - // Return true if the bandwidth growed as expected. - // Return false otherwise, if enough rounds have elapsed without expected + // Return APP_LIMITED if the bandwidth sample was app-limited. + // Return GROWTH if the bandwidth grew as expected. + // Return NO_GROWTH if the bandwidth didn't increase enough. + // Return TOO_MANY_ROUNDS_WITH_NO_GROWTH if enough rounds have elapsed without // growth, also sets |full_bandwidth_reached_| to true. - bool CheckBandwidthGrowth(const Bbr2CongestionEvent& congestion_event); + BandwidthGrowth CheckBandwidthGrowth( + const Bbr2CongestionEvent& congestion_event); QuicPacketNumber last_sent_packet() const { return round_trip_counter_.last_sent_packet();
diff --git a/quic/core/congestion_control/bbr2_startup.cc b/quic/core/congestion_control/bbr2_startup.cc index 9486eb1..cd09ad9 100644 --- a/quic/core/congestion_control/bbr2_startup.cc +++ b/quic/core/congestion_control/bbr2_startup.cc
@@ -51,9 +51,12 @@ if (!model_->full_bandwidth_reached() && congestion_event.end_of_round_trip) { // TCP BBR always exits upon excessive losses. QUIC BBRv1 does not exits // upon excessive losses, if enough bandwidth growth is observed. - bool has_enough_bw_growth = model_->CheckBandwidthGrowth(congestion_event); + Bbr2NetworkModel::BandwidthGrowth bw_growth = + model_->CheckBandwidthGrowth(congestion_event); - if (Params().always_exit_startup_on_excess_loss || !has_enough_bw_growth) { + if (Params().always_exit_startup_on_excess_loss || + (bw_growth == Bbr2NetworkModel::NO_GROWTH || + bw_growth == Bbr2NetworkModel::EXIT)) { CheckExcessiveLosses(congestion_event); } }