gfe-relnote: (n/a) Add a Bbr2Sender::GetTargetBytesInflight function and use it in Bbr2ProbeBwMode. Refactor only, no behavior change.
PiperOrigin-RevId: 286216495
Change-Id: Ia9185ff0bc707973ed11908aa33d6f4dcce731ea
diff --git a/quic/core/congestion_control/bbr2_probe_bw.cc b/quic/core/congestion_control/bbr2_probe_bw.cc
index 4487cbf..6d5000b 100644
--- a/quic/core/congestion_control/bbr2_probe_bw.cc
+++ b/quic/core/congestion_control/bbr2_probe_bw.cc
@@ -245,11 +245,9 @@
const Bbr2CongestionEvent& /*congestion_event*/) const {
uint64_t rounds = Params().probe_bw_probe_max_rounds;
if (Params().probe_bw_probe_reno_gain > 0.0) {
- QuicByteCount bdp = model_->BDP(model_->BandwidthEstimate());
- QuicByteCount inflight_bytes =
- std::min(bdp, sender_->GetCongestionWindow());
- uint64_t reno_rounds =
- Params().probe_bw_probe_reno_gain * inflight_bytes / kDefaultTCPMSS;
+ QuicByteCount target_bytes_inflight = sender_->GetTargetBytesInflight();
+ uint64_t reno_rounds = Params().probe_bw_probe_reno_gain *
+ target_bytes_inflight / kDefaultTCPMSS;
rounds = std::min(rounds, reno_rounds);
}
bool result = cycle_.rounds_since_probe >= (rounds * probe_wait_fraction);
diff --git a/quic/core/congestion_control/bbr2_sender.cc b/quic/core/congestion_control/bbr2_sender.cc
index 3e707f3..d795ad1 100644
--- a/quic/core/congestion_control/bbr2_sender.cc
+++ b/quic/core/congestion_control/bbr2_sender.cc
@@ -312,6 +312,11 @@
<< ", CWND: " << GetCongestionWindow();
}
+QuicByteCount Bbr2Sender::GetTargetBytesInflight() const {
+ QuicByteCount bdp = model_.BDP(model_.BandwidthEstimate());
+ return std::min(bdp, GetCongestionWindow());
+}
+
void Bbr2Sender::PopulateConnectionStats(QuicConnectionStats* stats) const {
stats->num_ack_aggregation_epochs = model_.num_ack_aggregation_epochs();
}
diff --git a/quic/core/congestion_control/bbr2_sender.h b/quic/core/congestion_control/bbr2_sender.h
index 4cfd34c..2bba285 100644
--- a/quic/core/congestion_control/bbr2_sender.h
+++ b/quic/core/congestion_control/bbr2_sender.h
@@ -97,6 +97,9 @@
return cwnd_limits().Min();
}
+ // Returns the min of BDP and congestion window.
+ QuicByteCount GetTargetBytesInflight() const;
+
struct QUIC_EXPORT_PRIVATE DebugState {
Bbr2Mode mode;