gfe-relnote: In QUIC, do not inject bandwidth in BbrSender::AdjustNetworkParameters. Also use min rtt instead of srtt when calculating new cwnd. Protected by gfe2_reloadable_flag_quic_bbr_donot_inject_bandwidth. PiperOrigin-RevId: 279119475 Change-Id: I6bca045fd27926321e1984b41849dd406f6fe6ab
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc index b9a259a..478339a 100644 --- a/quic/core/congestion_control/bbr_sender.cc +++ b/quic/core/congestion_control/bbr_sender.cc
@@ -332,7 +332,9 @@ void BbrSender::AdjustNetworkParameters(QuicBandwidth bandwidth, QuicTime::Delta rtt, bool allow_cwnd_to_decrease) { - if (!bandwidth.IsZero()) { + if (GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) { + QUIC_RELOADABLE_FLAG_COUNT(quic_bbr_donot_inject_bandwidth); + } else if (!bandwidth.IsZero()) { max_bandwidth_.Update(bandwidth, round_trip_count_); } if (!rtt.IsZero() && (min_rtt_ > rtt || min_rtt_.IsZero())) { @@ -346,10 +348,13 @@ 3); return; } - const QuicByteCount new_cwnd = - std::max(kMinInitialCongestionWindow * kDefaultTCPMSS, - std::min(kMaxInitialCongestionWindow * kDefaultTCPMSS, - bandwidth * rtt_stats_->SmoothedOrInitialRtt())); + const QuicByteCount new_cwnd = std::max( + kMinInitialCongestionWindow * kDefaultTCPMSS, + std::min( + kMaxInitialCongestionWindow * kDefaultTCPMSS, + bandwidth * (GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth) + ? GetMinRtt() + : rtt_stats_->SmoothedOrInitialRtt()))); if (!rtt_stats_->smoothed_rtt().IsZero()) { QUIC_CODE_COUNT(quic_smoothed_rtt_available); } else if (rtt_stats_->initial_rtt() !=
diff --git a/quic/core/congestion_control/bbr_sender_test.cc b/quic/core/congestion_control/bbr_sender_test.cc index 9403c57..9120ea8 100644 --- a/quic/core/congestion_control/bbr_sender_test.cc +++ b/quic/core/congestion_control/bbr_sender_test.cc
@@ -1251,8 +1251,15 @@ bbr_sender_.connection()->AdjustNetworkParameters(kTestLinkBandwidth, kTestRtt, false); - EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); - EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); + if (!GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) { + EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); + EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); + } + EXPECT_EQ(kTestLinkBandwidth * kTestRtt, + sender_->ExportDebugState().congestion_window); + if (GetQuicReloadableFlag(quic_bbr_fix_pacing_rate)) { + EXPECT_EQ(kTestLinkBandwidth, sender_->PacingRate(/*bytes_in_flight=*/0)); + } EXPECT_APPROX_EQ(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); DriveOutOfStartup(); @@ -1327,8 +1334,10 @@ // Bootstrap cwnd. bbr_sender_.connection()->AdjustNetworkParameters( kTestLinkBandwidth, QuicTime::Delta::Zero(), false); - EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); - EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); + if (!GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) { + EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); + EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); + } EXPECT_LT(previous_cwnd, sender_->ExportDebugState().congestion_window); if (GetQuicReloadableFlag(quic_bbr_fix_pacing_rate)) { @@ -1354,8 +1363,10 @@ // Bootstrap cwnd. bbr_sender_.connection()->AdjustNetworkParameters( kTestLinkBandwidth, QuicTime::Delta::Zero(), false); - EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); - EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); + if (!GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) { + EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); + EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); + } EXPECT_LT(kInitialCongestionWindowPackets * kDefaultTCPMSS, sender_->ExportDebugState().congestion_window); // No Rtt sample is available.