Add a new BDP method on QUIC BBRv2 that doesn't take any arguments and always uses MaxBandwidth() and use it where MaxBandwidth() is being used. No functional change, not flag protected. PiperOrigin-RevId: 345018169 Change-Id: Idfefa6d595ece3322c8743c4f59b5f06e347a127
diff --git a/quic/core/congestion_control/bbr2_drain.cc b/quic/core/congestion_control/bbr2_drain.cc index 6022639..924127b 100644 --- a/quic/core/congestion_control/bbr2_drain.cc +++ b/quic/core/congestion_control/bbr2_drain.cc
@@ -25,22 +25,21 @@ if (congestion_event.bytes_in_flight <= drain_target) { QUIC_DVLOG(3) << sender_ << " Exiting DRAIN. bytes_in_flight:" << congestion_event.bytes_in_flight - << ", bdp:" << model_->BDP(model_->MaxBandwidth()) + << ", bdp:" << model_->BDP() << ", drain_target:" << drain_target << " @ " << congestion_event.event_time; return Bbr2Mode::PROBE_BW; } QUIC_DVLOG(3) << sender_ << " Staying in DRAIN. bytes_in_flight:" - << congestion_event.bytes_in_flight - << ", bdp:" << model_->BDP(model_->MaxBandwidth()) + << congestion_event.bytes_in_flight << ", bdp:" << model_->BDP() << ", drain_target:" << drain_target << " @ " << congestion_event.event_time; return Bbr2Mode::DRAIN; } QuicByteCount Bbr2DrainMode::DrainTarget() const { - QuicByteCount bdp = model_->BDP(model_->MaxBandwidth()); + QuicByteCount bdp = model_->BDP(); return std::max<QuicByteCount>(bdp, sender_->GetMinimumCongestionWindow()); }
diff --git a/quic/core/congestion_control/bbr2_misc.h b/quic/core/congestion_control/bbr2_misc.h index 5cf0579..2134bd6 100644 --- a/quic/core/congestion_control/bbr2_misc.h +++ b/quic/core/congestion_control/bbr2_misc.h
@@ -345,6 +345,9 @@ void OnApplicationLimited() { bandwidth_sampler_.OnAppLimited(); } + // Calculates BDP using the current MaxBandwidth. + QuicByteCount BDP() const { return BDP(MaxBandwidth()); } + QuicByteCount BDP(QuicBandwidth bandwidth) const { return bandwidth * MinRtt(); }
diff --git a/quic/core/congestion_control/bbr2_probe_bw.cc b/quic/core/congestion_control/bbr2_probe_bw.cc index f76b5f4..1b01d9d 100644 --- a/quic/core/congestion_control/bbr2_probe_bw.cc +++ b/quic/core/congestion_control/bbr2_probe_bw.cc
@@ -178,7 +178,7 @@ } // Transition to PROBE_CRUISE iff we've drained to target. - QuicByteCount bdp = model_->BDP(model_->MaxBandwidth()); + QuicByteCount bdp = model_->BDP(); QUIC_DVLOG(3) << sender_ << " Checking if drained to target. bytes_in_flight:" << bytes_in_flight << ", bdp:" << bdp; if (bytes_in_flight < bdp) { @@ -450,7 +450,7 @@ // TCP uses min_rtt instead of a full round: // HasPhaseLasted(model_->MinRtt(), congestion_event) } else if (cycle_.rounds_in_phase > 0) { - const QuicByteCount bdp = model_->BDP(model_->MaxBandwidth()); + const QuicByteCount bdp = model_->BDP(); QuicByteCount queuing_threshold_extra_bytes = 2 * kDefaultTCPMSS; if (Params().add_ack_height_to_queueing_threshold) { queuing_threshold_extra_bytes += model_->MaxAckHeight();
diff --git a/quic/core/congestion_control/bbr2_startup.cc b/quic/core/congestion_control/bbr2_startup.cc index 5c47adb..eb0dc08 100644 --- a/quic/core/congestion_control/bbr2_startup.cc +++ b/quic/core/congestion_control/bbr2_startup.cc
@@ -107,7 +107,7 @@ // At the end of a round trip. Check if loss is too high in this round. if (model_->IsInflightTooHigh(congestion_event, Params().startup_full_loss_count)) { - QuicByteCount new_inflight_hi = model_->BDP(model_->MaxBandwidth()); + QuicByteCount new_inflight_hi = model_->BDP(); if (Params().startup_loss_exit_use_max_delivered_for_inflight_hi) { if (new_inflight_hi < model_->max_bytes_delivered_in_round()) { QUIC_RELOADABLE_FLAG_COUNT_N(