Internal QUICHE change PiperOrigin-RevId: 278896047 Change-Id: I0b9f74930e2fd6a50a5a15ba5ddb1227be5f2a89
diff --git a/quic/core/congestion_control/bbr2_sender.cc b/quic/core/congestion_control/bbr2_sender.cc index e8009aa..f176ff6 100644 --- a/quic/core/congestion_control/bbr2_sender.cc +++ b/quic/core/congestion_control/bbr2_sender.cc
@@ -114,6 +114,11 @@ return params_.cwnd_limits; } +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) {
diff --git a/quic/core/congestion_control/bbr2_sender.h b/quic/core/congestion_control/bbr2_sender.h index 74efc89..6d0f338 100644 --- a/quic/core/congestion_control/bbr2_sender.h +++ b/quic/core/congestion_control/bbr2_sender.h
@@ -47,6 +47,7 @@ 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;
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc index 1ba6b42..b9a259a 100644 --- a/quic/core/congestion_control/bbr_sender.cc +++ b/quic/core/congestion_control/bbr_sender.cc
@@ -324,6 +324,11 @@ } } +void BbrSender::AdjustNetworkParameters(const NetworkParams& params) { + AdjustNetworkParameters(params.bandwidth, params.rtt, + params.allow_cwnd_to_decrease); +} + void BbrSender::AdjustNetworkParameters(QuicBandwidth bandwidth, QuicTime::Delta rtt, bool allow_cwnd_to_decrease) {
diff --git a/quic/core/congestion_control/bbr_sender.h b/quic/core/congestion_control/bbr_sender.h index b4baa2f..a128797 100644 --- a/quic/core/congestion_control/bbr_sender.h +++ b/quic/core/congestion_control/bbr_sender.h
@@ -105,6 +105,7 @@ 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;
diff --git a/quic/core/congestion_control/send_algorithm_interface.h b/quic/core/congestion_control/send_algorithm_interface.h index 4f84f13..cde23b1 100644 --- a/quic/core/congestion_control/send_algorithm_interface.h +++ b/quic/core/congestion_control/send_algorithm_interface.h
@@ -31,6 +31,20 @@ class QUIC_EXPORT_PRIVATE SendAlgorithmInterface { public: + // 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; + + QuicBandwidth bandwidth; + QuicTime::Delta rtt; + bool allow_cwnd_to_decrease; + }; + static SendAlgorithmInterface* Create( const QuicClock* clock, const RttStats* rtt_stats, @@ -115,6 +129,9 @@ // Notifies the congestion control algorithm of an external network // 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;
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc index 28f284e..c26656f 100644 --- a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc +++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
@@ -105,6 +105,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,
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.h b/quic/core/congestion_control/tcp_cubic_sender_bytes.h index 50f7981..c78d5d8 100644 --- a/quic/core/congestion_control/tcp_cubic_sender_bytes.h +++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.h
@@ -46,6 +46,7 @@ // Start implementation of SendAlgorithmInterface. 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;
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index adbca34..7258ec5 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -510,6 +510,11 @@ sent_packet_manager_.SetMaxPacingRate(max_pacing_rate); } +void QuicConnection::AdjustNetworkParameters( + const SendAlgorithmInterface::NetworkParams& params) { + sent_packet_manager_.AdjustNetworkParameters(params); +} + void QuicConnection::AdjustNetworkParameters(QuicBandwidth bandwidth, QuicTime::Delta rtt, bool allow_cwnd_to_decrease) {
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h index d858e3a..b5cf6fb 100644 --- a/quic/core/quic_connection.h +++ b/quic/core/quic_connection.h
@@ -362,6 +362,8 @@ // Allows the client to adjust network parameters based on external // information. + void AdjustNetworkParameters( + const SendAlgorithmInterface::NetworkParams& params); void AdjustNetworkParameters(QuicBandwidth bandwidth, QuicTime::Delta rtt, bool allow_cwnd_to_decrease);
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc index deec82f..c8c870b 100644 --- a/quic/core/quic_sent_packet_manager.cc +++ b/quic/core/quic_sent_packet_manager.cc
@@ -312,6 +312,12 @@ } void QuicSentPacketManager::AdjustNetworkParameters( + const SendAlgorithmInterface::NetworkParams& params) { + AdjustNetworkParameters(params.bandwidth, params.rtt, + params.allow_cwnd_to_decrease); +} + +void QuicSentPacketManager::AdjustNetworkParameters( QuicBandwidth bandwidth, QuicTime::Delta rtt, bool allow_cwnd_to_decrease) {
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h index 2c3cf99..95b9ee2 100644 --- a/quic/core/quic_sent_packet_manager.h +++ b/quic/core/quic_sent_packet_manager.h
@@ -151,6 +151,8 @@ void AdjustNetworkParameters(QuicBandwidth bandwidth, QuicTime::Delta rtt, bool allow_cwnd_to_decrease); + void AdjustNetworkParameters( + const SendAlgorithmInterface::NetworkParams& params); // Retransmits the oldest pending packet there is still a tail loss probe // pending. Invoked after OnRetransmissionTimeout.
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h index eb3d2e8..f428e87 100644 --- a/quic/test_tools/quic_test_utils.h +++ b/quic/test_tools/quic_test_utils.h
@@ -948,6 +948,7 @@ MOCK_CONST_METHOD0(GetCongestionControlType, CongestionControlType()); MOCK_METHOD3(AdjustNetworkParameters, void(QuicBandwidth, QuicTime::Delta, bool)); + MOCK_METHOD1(AdjustNetworkParameters, void(const NetworkParams&)); MOCK_METHOD1(OnApplicationLimited, void(QuicByteCount)); };