Internal QUICHE change
PiperOrigin-RevId: 280413308
Change-Id: I8410ce56a42272fc8cfb46048dba36a75d3971fc
diff --git a/quic/core/congestion_control/bbr2_sender.cc b/quic/core/congestion_control/bbr2_sender.cc
index f176ff6..c90decd 100644
--- a/quic/core/congestion_control/bbr2_sender.cc
+++ b/quic/core/congestion_control/bbr2_sender.cc
@@ -115,14 +115,7 @@
}
void Bbr2Sender::AdjustNetworkParameters(const NetworkParams& params) {
- AdjustNetworkParameters(params.bandwidth, params.rtt,
- params.allow_cwnd_to_decrease);
-}
-
-void Bbr2Sender::AdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
- bool allow_cwnd_to_decrease) {
- model_.UpdateNetworkParameters(bandwidth, rtt);
+ model_.UpdateNetworkParameters(params.bandwidth, params.rtt);
if (mode_ == Bbr2Mode::STARTUP) {
const QuicByteCount prior_cwnd = cwnd_;
@@ -132,7 +125,7 @@
// we are reducing the number of updates needed to arrive at the target.
cwnd_ = model_.BDP(model_.BandwidthEstimate());
UpdateCongestionWindow(0);
- if (!allow_cwnd_to_decrease) {
+ if (!params.allow_cwnd_to_decrease) {
cwnd_ = std::max(cwnd_, prior_cwnd);
}
}
diff --git a/quic/core/congestion_control/bbr2_sender.h b/quic/core/congestion_control/bbr2_sender.h
index 6d0f338..bff38f6 100644
--- a/quic/core/congestion_control/bbr2_sender.h
+++ b/quic/core/congestion_control/bbr2_sender.h
@@ -48,9 +48,6 @@
Perspective perspective) override;
void AdjustNetworkParameters(const NetworkParams& params) override;
- void AdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
- bool allow_cwnd_to_decrease) override;
void SetInitialCongestionWindowInPackets(
QuicPacketCount congestion_window) override;
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc
index a734c03..93ee5cb 100644
--- a/quic/core/congestion_control/bbr_sender.cc
+++ b/quic/core/congestion_control/bbr_sender.cc
@@ -325,13 +325,9 @@
}
void BbrSender::AdjustNetworkParameters(const NetworkParams& params) {
- AdjustNetworkParameters(params.bandwidth, params.rtt,
- params.allow_cwnd_to_decrease);
-}
+ const QuicBandwidth& bandwidth = params.bandwidth;
+ const QuicTime::Delta& rtt = params.rtt;
-void BbrSender::AdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
- bool allow_cwnd_to_decrease) {
if (GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) {
QUIC_RELOADABLE_FLAG_COUNT(quic_bbr_donot_inject_bandwidth);
} else if (!bandwidth.IsZero()) {
@@ -340,12 +336,10 @@
if (!rtt.IsZero() && (min_rtt_ > rtt || min_rtt_.IsZero())) {
min_rtt_ = rtt;
}
- if (GetQuicReloadableFlag(quic_fix_bbr_cwnd_in_bandwidth_resumption) &&
- mode_ == STARTUP) {
+
+ if (params.quic_fix_bbr_cwnd_in_bandwidth_resumption && mode_ == STARTUP) {
if (bandwidth.IsZero()) {
// Ignore bad bandwidth samples.
- QUIC_RELOADABLE_FLAG_COUNT_N(quic_fix_bbr_cwnd_in_bandwidth_resumption, 3,
- 3);
return;
}
const QuicByteCount new_cwnd = std::max(
@@ -363,14 +357,7 @@
} else {
QUIC_CODE_COUNT(quic_default_initial_rtt);
}
- if (new_cwnd > congestion_window_) {
- QUIC_RELOADABLE_FLAG_COUNT_N(quic_fix_bbr_cwnd_in_bandwidth_resumption, 1,
- 3);
- } else {
- QUIC_RELOADABLE_FLAG_COUNT_N(quic_fix_bbr_cwnd_in_bandwidth_resumption, 2,
- 3);
- }
- if (new_cwnd < congestion_window_ && !allow_cwnd_to_decrease) {
+ if (new_cwnd < congestion_window_ && !params.allow_cwnd_to_decrease) {
// Only decrease cwnd if allow_cwnd_to_decrease is true.
return;
}
@@ -382,8 +369,7 @@
set_high_cwnd_gain(kDerivedHighCWNDGain);
}
congestion_window_ = new_cwnd;
- if (GetQuicReloadableFlag(quic_bbr_fix_pacing_rate)) {
- QUIC_RELOADABLE_FLAG_COUNT(quic_bbr_fix_pacing_rate);
+ if (params.quic_bbr_fix_pacing_rate) {
// Pace at the rate of new_cwnd / RTT.
QuicBandwidth new_pacing_rate =
QuicBandwidth::FromBytesAndTimeDelta(congestion_window_, GetMinRtt());
diff --git a/quic/core/congestion_control/bbr_sender.h b/quic/core/congestion_control/bbr_sender.h
index a128797..8c07a40 100644
--- a/quic/core/congestion_control/bbr_sender.h
+++ b/quic/core/congestion_control/bbr_sender.h
@@ -106,9 +106,6 @@
Perspective perspective) override;
void AdjustNetworkParameters(const NetworkParams& params) override;
- void AdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
- bool allow_cwnd_to_decrease) override;
void SetInitialCongestionWindowInPackets(
QuicPacketCount congestion_window) override;
void OnCongestionEvent(bool rtt_updated,
diff --git a/quic/core/congestion_control/bbr_sender_test.cc b/quic/core/congestion_control/bbr_sender_test.cc
index 9120ea8..60b303e 100644
--- a/quic/core/congestion_control/bbr_sender_test.cc
+++ b/quic/core/congestion_control/bbr_sender_test.cc
@@ -1249,8 +1249,9 @@
TEST_F(BbrSenderTest, ResumeConnectionState) {
CreateDefaultSetup();
- bbr_sender_.connection()->AdjustNetworkParameters(kTestLinkBandwidth,
- kTestRtt, false);
+ bbr_sender_.connection()->AdjustNetworkParameters(
+ SendAlgorithmInterface::NetworkParams(kTestLinkBandwidth, kTestRtt,
+ false));
if (!GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) {
EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth);
EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate());
@@ -1333,7 +1334,8 @@
// Bootstrap cwnd.
bbr_sender_.connection()->AdjustNetworkParameters(
- kTestLinkBandwidth, QuicTime::Delta::Zero(), false);
+ SendAlgorithmInterface::NetworkParams(kTestLinkBandwidth,
+ QuicTime::Delta::Zero(), false));
if (!GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) {
EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth);
EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate());
@@ -1362,7 +1364,8 @@
// Bootstrap cwnd.
bbr_sender_.connection()->AdjustNetworkParameters(
- kTestLinkBandwidth, QuicTime::Delta::Zero(), false);
+ SendAlgorithmInterface::NetworkParams(kTestLinkBandwidth,
+ QuicTime::Delta::Zero(), false));
if (!GetQuicReloadableFlag(quic_bbr_donot_inject_bandwidth)) {
EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth);
EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate());
diff --git a/quic/core/congestion_control/send_algorithm_interface.h b/quic/core/congestion_control/send_algorithm_interface.h
index cde23b1..2c183f1 100644
--- a/quic/core/congestion_control/send_algorithm_interface.h
+++ b/quic/core/congestion_control/send_algorithm_interface.h
@@ -34,15 +34,35 @@
// Network Params for AdjustNetworkParameters.
struct QUIC_NO_EXPORT NetworkParams {
NetworkParams()
- : bandwidth(QuicBandwidth::Zero()),
- rtt(QuicTime::Delta::Zero()),
- allow_cwnd_to_decrease(false) {}
- NetworkParams(NetworkParams&& params) = default;
- NetworkParams& operator=(NetworkParams&& params) = default;
+ : NetworkParams(QuicBandwidth::Zero(), QuicTime::Delta::Zero(), false) {
+ }
+ NetworkParams(const QuicBandwidth& bandwidth,
+ const QuicTime::Delta& rtt,
+ bool allow_cwnd_to_decrease)
+ : bandwidth(bandwidth),
+ rtt(rtt),
+ allow_cwnd_to_decrease(allow_cwnd_to_decrease),
+ quic_fix_bbr_cwnd_in_bandwidth_resumption(
+ GetQuicReloadableFlag(quic_fix_bbr_cwnd_in_bandwidth_resumption)),
+ quic_bbr_fix_pacing_rate(
+ GetQuicReloadableFlag(quic_bbr_fix_pacing_rate)) {}
+
+ bool operator==(const NetworkParams& other) const {
+ return bandwidth == other.bandwidth && rtt == other.rtt &&
+ allow_cwnd_to_decrease == other.allow_cwnd_to_decrease &&
+ quic_fix_bbr_cwnd_in_bandwidth_resumption ==
+ other.quic_fix_bbr_cwnd_in_bandwidth_resumption &&
+ quic_bbr_fix_pacing_rate == other.quic_bbr_fix_pacing_rate;
+ }
QuicBandwidth bandwidth;
QuicTime::Delta rtt;
bool allow_cwnd_to_decrease;
+ // Code changes that are controlled by flags.
+ // TODO(b/131899599): Remove when impact of fix is measured.
+ bool quic_fix_bbr_cwnd_in_bandwidth_resumption;
+ // TODO(b/143540157): Remove when impact of fix is measured.
+ bool quic_bbr_fix_pacing_rate;
};
static SendAlgorithmInterface* Create(
@@ -130,11 +150,6 @@
// measurement or prediction. Either |bandwidth| or |rtt| may be zero if no
// sample is available.
virtual void AdjustNetworkParameters(const NetworkParams& params) = 0;
- // TODO(b/143891040): Replace old interface with the new one that uses
- // NetworkParams.
- virtual void AdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
- bool allow_cwnd_to_decrease) = 0;
// Retrieves debugging information about the current state of the
// send algorithm.
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
index c26656f..cf400e5 100644
--- a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
+++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
@@ -106,18 +106,10 @@
}
void TcpCubicSenderBytes::AdjustNetworkParameters(const NetworkParams& params) {
- AdjustNetworkParameters(params.bandwidth, params.rtt,
- params.allow_cwnd_to_decrease);
-}
-void TcpCubicSenderBytes::AdjustNetworkParameters(
- QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
- bool /*allow_cwnd_to_decrease*/) {
- if (bandwidth.IsZero() || rtt.IsZero()) {
+ if (params.bandwidth.IsZero() || params.rtt.IsZero()) {
return;
}
-
- SetCongestionWindowFromBandwidthAndRtt(bandwidth, rtt);
+ SetCongestionWindowFromBandwidthAndRtt(params.bandwidth, params.rtt);
}
float TcpCubicSenderBytes::RenoBeta() const {
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.h b/quic/core/congestion_control/tcp_cubic_sender_bytes.h
index c78d5d8..8e89eaa 100644
--- a/quic/core/congestion_control/tcp_cubic_sender_bytes.h
+++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.h
@@ -47,9 +47,6 @@
void SetFromConfig(const QuicConfig& config,
Perspective perspective) override;
void AdjustNetworkParameters(const NetworkParams& params) override;
- void AdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
- bool allow_cwnd_to_decrease) override;
void SetNumEmulatedConnections(int num_connections);
void SetInitialCongestionWindowInPackets(
QuicPacketCount congestion_window) override;
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes_test.cc b/quic/core/congestion_control/tcp_cubic_sender_bytes_test.cc
index 6a338cb..04c0e8a 100644
--- a/quic/core/congestion_control/tcp_cubic_sender_bytes_test.cc
+++ b/quic/core/congestion_control/tcp_cubic_sender_bytes_test.cc
@@ -677,19 +677,28 @@
const QuicBandwidth kBandwidthEstimate =
QuicBandwidth::FromBytesPerSecond(kNumberOfPackets * kDefaultTCPMSS);
const QuicTime::Delta kRttEstimate = QuicTime::Delta::FromSeconds(1);
- sender_->AdjustNetworkParameters(kBandwidthEstimate, kRttEstimate, false);
+
+ SendAlgorithmInterface::NetworkParams network_param;
+ network_param.bandwidth = kBandwidthEstimate;
+ network_param.rtt = kRttEstimate;
+ sender_->AdjustNetworkParameters(network_param);
EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow());
// Resume with an illegal value of 0 and verify the server ignores it.
- sender_->AdjustNetworkParameters(QuicBandwidth::Zero(), kRttEstimate, false);
+ SendAlgorithmInterface::NetworkParams network_param_no_bandwidth;
+ network_param_no_bandwidth.bandwidth = QuicBandwidth::Zero();
+ network_param_no_bandwidth.rtt = kRttEstimate;
+ sender_->AdjustNetworkParameters(network_param_no_bandwidth);
EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow());
// Resumed CWND is limited to be in a sensible range.
const QuicBandwidth kUnreasonableBandwidth =
QuicBandwidth::FromBytesPerSecond((kMaxResumptionCongestionWindow + 1) *
kDefaultTCPMSS);
- sender_->AdjustNetworkParameters(kUnreasonableBandwidth,
- QuicTime::Delta::FromSeconds(1), false);
+ SendAlgorithmInterface::NetworkParams network_param_large_bandwidth;
+ network_param_large_bandwidth.bandwidth = kUnreasonableBandwidth;
+ network_param_large_bandwidth.rtt = QuicTime::Delta::FromSeconds(1);
+ sender_->AdjustNetworkParameters(network_param_large_bandwidth);
EXPECT_EQ(kMaxResumptionCongestionWindow * kDefaultTCPMSS,
sender_->GetCongestionWindow());
}