gfe-relnote: In QUIC, adjust cwnd when doing bandwidth resumption in BBR. Protected by gfe2_reloadable_flag_quic_fix_bbr_cwnd_in_bandwidth_resumption.
PiperOrigin-RevId: 245482154
Change-Id: I0bfa7b414dc369925ab55438894b1579f91d0459
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc
index 1c0d274..163cd22 100644
--- a/quic/core/congestion_control/bbr_sender.cc
+++ b/quic/core/congestion_control/bbr_sender.cc
@@ -352,6 +352,16 @@
if (!rtt.IsZero() && (min_rtt_ > rtt || min_rtt_.IsZero())) {
min_rtt_ = rtt;
}
+ if (GetQuicReloadableFlag(quic_fix_bbr_cwnd_in_bandwidth_resumption) &&
+ mode_ == STARTUP) {
+ const QuicByteCount new_cwnd =
+ std::min(kMaxInitialCongestionWindow * kDefaultTCPMSS,
+ bandwidth * rtt_stats_->SmoothedOrInitialRtt());
+ if (new_cwnd > congestion_window_) {
+ QUIC_RELOADABLE_FLAG_COUNT(quic_fix_bbr_cwnd_in_bandwidth_resumption);
+ }
+ congestion_window_ = std::max(new_cwnd, congestion_window_);
+ }
}
void BbrSender::OnCongestionEvent(bool /*rtt_updated*/,
diff --git a/quic/core/quic_constants.h b/quic/core/quic_constants.h
index 67cd860..a18c07b 100644
--- a/quic/core/quic_constants.h
+++ b/quic/core/quic_constants.h
@@ -57,6 +57,9 @@
// We match SPDY's use of 32 (since we'd compete with SPDY).
const QuicPacketCount kInitialCongestionWindow = 32;
+// Do not allow initial congestion window to be greater than 200 packets.
+const QuicPacketCount kMaxInitialCongestionWindow = 200;
+
// Minimum size of initial flow control window, for both stream and session.
const uint32_t kMinimumFlowControlSendWindow = 16 * 1024; // 16 KB
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index ad5f297..21dbc14 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -267,9 +267,11 @@
if (!rtt.IsZero()) {
SetInitialRtt(rtt);
}
+ const QuicByteCount old_cwnd = send_algorithm_->GetCongestionWindow();
send_algorithm_->AdjustNetworkParameters(bandwidth, rtt);
if (debug_delegate_ != nullptr) {
- debug_delegate_->OnAdjustNetworkParameters(bandwidth, rtt);
+ debug_delegate_->OnAdjustNetworkParameters(
+ bandwidth, rtt, old_cwnd, send_algorithm_->GetCongestionWindow());
}
}
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h
index f2524a1..04fab58 100644
--- a/quic/core/quic_sent_packet_manager.h
+++ b/quic/core/quic_sent_packet_manager.h
@@ -70,7 +70,9 @@
virtual void OnApplicationLimited() {}
virtual void OnAdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt) {}
+ QuicTime::Delta rtt,
+ QuicByteCount old_cwnd,
+ QuicByteCount new_cwnd) {}
};
// Interface which gets callbacks from the QuicSentPacketManager when
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index ec8de8b..6a641fe 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -2372,6 +2372,8 @@
EXPECT_CALL(*send_algorithm_,
AdjustNetworkParameters(QuicBandwidth::Zero(), kRtt));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .Times(testing::AnyNumber());
manager_.ResumeConnectionState(cached_network_params, false);
EXPECT_EQ(kRtt, manager_.GetRttStats()->initial_rtt());
}
diff --git a/quic/core/quic_trace_visitor.cc b/quic/core/quic_trace_visitor.cc
index 5e152ea..8b1b62a 100644
--- a/quic/core/quic_trace_visitor.cc
+++ b/quic/core/quic_trace_visitor.cc
@@ -278,7 +278,9 @@
}
void QuicTraceVisitor::OnAdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt) {
+ QuicTime::Delta rtt,
+ QuicByteCount old_cwnd,
+ QuicByteCount new_cwnd) {
quic_trace::Event* event = trace_.add_events();
event->set_time_us(
ConvertTimestampToRecordedFormat(connection_->clock()->ApproximateNow()));
diff --git a/quic/core/quic_trace_visitor.h b/quic/core/quic_trace_visitor.h
index a70b150..8021865 100644
--- a/quic/core/quic_trace_visitor.h
+++ b/quic/core/quic_trace_visitor.h
@@ -42,7 +42,9 @@
void OnApplicationLimited() override;
void OnAdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt) override;
+ QuicTime::Delta rtt,
+ QuicByteCount old_cwnd,
+ QuicByteCount new_cwnd) override;
// Returns a mutable pointer to the trace. The trace is owned by the
// visitor, but can be moved using Swap() method after the connection is