Internal QUICHE change
PiperOrigin-RevId: 321842082
Change-Id: I8ce37df10715dfc7d58343538a680888f0be5ca4
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc
index b70bb333a..05d62ea 100644
--- a/quic/core/congestion_control/bbr_sender.cc
+++ b/quic/core/congestion_control/bbr_sender.cc
@@ -319,6 +319,10 @@
auto cwnd_bootstrapping_rtt = params.quic_bbr_donot_inject_bandwidth
? GetMinRtt()
: rtt_stats_->SmoothedOrInitialRtt();
+ if (params.max_initial_congestion_window > 0) {
+ max_congestion_window_with_network_parameters_adjusted_ =
+ params.max_initial_congestion_window * kDefaultTCPMSS;
+ }
const QuicByteCount new_cwnd = std::max(
kMinInitialCongestionWindow * kDefaultTCPMSS,
std::min(max_congestion_window_with_network_parameters_adjusted_,
diff --git a/quic/core/congestion_control/bbr_sender_test.cc b/quic/core/congestion_control/bbr_sender_test.cc
index ce2d969..eb0f189 100644
--- a/quic/core/congestion_control/bbr_sender_test.cc
+++ b/quic/core/congestion_control/bbr_sender_test.cc
@@ -1212,6 +1212,28 @@
EXPECT_GT(1024 * kTestLinkBandwidth, sender_->PacingRate(0));
}
+TEST_F(BbrSenderTest, 100InitialCongestionWindowFromNetworkParameter) {
+ CreateDefaultSetup();
+
+ bbr_sender_.AddBytesToTransfer(1 * 1024 * 1024);
+ // Wait until an ACK comes back.
+ const QuicTime::Delta timeout = QuicTime::Delta::FromSeconds(5);
+ bool simulator_result = simulator_.RunUntilOrTimeout(
+ [this]() { return !sender_->ExportDebugState().min_rtt.IsZero(); },
+ timeout);
+ ASSERT_TRUE(simulator_result);
+
+ // Bootstrap cwnd by a overly large bandwidth sample.
+ SendAlgorithmInterface::NetworkParams network_params(
+ 1024 * kTestLinkBandwidth, QuicTime::Delta::Zero(), false);
+ network_params.max_initial_congestion_window = 100;
+ bbr_sender_.connection()->AdjustNetworkParameters(network_params);
+ // Verify cwnd is capped at 100.
+ EXPECT_EQ(100 * kDefaultTCPMSS,
+ sender_->ExportDebugState().congestion_window);
+ EXPECT_GT(1024 * kTestLinkBandwidth, sender_->PacingRate(0));
+}
+
TEST_F(BbrSenderTest, 100InitialCongestionWindowWithNetworkParameterAdjusted) {
SetConnectionOption(kICW1);
CreateDefaultSetup();
diff --git a/quic/core/congestion_control/send_algorithm_interface.h b/quic/core/congestion_control/send_algorithm_interface.h
index b794940..e3fc5e6 100644
--- a/quic/core/congestion_control/send_algorithm_interface.h
+++ b/quic/core/congestion_control/send_algorithm_interface.h
@@ -45,6 +45,8 @@
bool operator==(const NetworkParams& other) const {
return bandwidth == other.bandwidth && rtt == other.rtt &&
+ max_initial_congestion_window ==
+ other.max_initial_congestion_window &&
allow_cwnd_to_decrease == other.allow_cwnd_to_decrease &&
quic_fix_bbr_cwnd_in_bandwidth_resumption ==
other.quic_fix_bbr_cwnd_in_bandwidth_resumption &&
@@ -55,6 +57,7 @@
QuicBandwidth bandwidth;
QuicTime::Delta rtt;
+ int max_initial_congestion_window = 0;
bool allow_cwnd_to_decrease;
// Code changes that are controlled by flags.
// TODO(b/131899599): Remove after impact of fix is measured.