Add GetInitialCongestionWindowInPackets to SendAlgorithmInterface and its implementations. PiperOrigin-RevId: 980180608
diff --git a/quiche/quic/core/congestion_control/bbr2_sender.cc b/quiche/quic/core/congestion_control/bbr2_sender.cc index 730a781..f2c946b 100644 --- a/quiche/quic/core/congestion_control/bbr2_sender.cc +++ b/quiche/quic/core/congestion_control/bbr2_sender.cc
@@ -261,6 +261,10 @@ } } +QuicPacketCount Bbr2Sender::GetInitialCongestionWindowInPackets() const { + return initial_cwnd_ / kDefaultTCPMSS; +} + void Bbr2Sender::SetApplicationDrivenPacingRate( QuicBandwidth application_bandwidth_target) { QUIC_CODE_COUNT(quic_bbr2_set_app_driven_pacing_rate);
diff --git a/quiche/quic/core/congestion_control/bbr2_sender.h b/quiche/quic/core/congestion_control/bbr2_sender.h index d73a702..597b64f 100644 --- a/quiche/quic/core/congestion_control/bbr2_sender.h +++ b/quiche/quic/core/congestion_control/bbr2_sender.h
@@ -52,6 +52,8 @@ void SetInitialCongestionWindowInPackets( QuicPacketCount congestion_window) override; + QuicPacketCount GetInitialCongestionWindowInPackets() const override; + void SetApplicationDrivenPacingRate( QuicBandwidth application_bandwidth_target) override;
diff --git a/quiche/quic/core/congestion_control/bbr3_sender.cc b/quiche/quic/core/congestion_control/bbr3_sender.cc index 4fe8829..916d737 100644 --- a/quiche/quic/core/congestion_control/bbr3_sender.cc +++ b/quiche/quic/core/congestion_control/bbr3_sender.cc
@@ -246,6 +246,10 @@ } } +QuicPacketCount Bbr3Sender::GetInitialCongestionWindowInPackets() const { + return initial_cwnd_ / kDefaultTCPMSS; +} + void Bbr3Sender::SetApplicationDrivenPacingRate( QuicBandwidth application_bandwidth_target) { QUIC_CODE_COUNT(quic_bbr2_set_app_driven_pacing_rate);
diff --git a/quiche/quic/core/congestion_control/bbr3_sender.h b/quiche/quic/core/congestion_control/bbr3_sender.h index ab4243d..b1b60e2 100644 --- a/quiche/quic/core/congestion_control/bbr3_sender.h +++ b/quiche/quic/core/congestion_control/bbr3_sender.h
@@ -48,6 +48,8 @@ void SetInitialCongestionWindowInPackets( QuicPacketCount congestion_window) override; + QuicPacketCount GetInitialCongestionWindowInPackets() const override; + void SetApplicationDrivenPacingRate( QuicBandwidth application_bandwidth_target) override;
diff --git a/quiche/quic/core/congestion_control/bbr_sender.cc b/quiche/quic/core/congestion_control/bbr_sender.cc index 0178c5b..57b9a5f 100644 --- a/quiche/quic/core/congestion_control/bbr_sender.cc +++ b/quiche/quic/core/congestion_control/bbr_sender.cc
@@ -162,6 +162,10 @@ } } +QuicPacketCount BbrSender::GetInitialCongestionWindowInPackets() const { + return initial_congestion_window_ / kDefaultTCPMSS; +} + bool BbrSender::InSlowStart() const { return mode_ == STARTUP; } void BbrSender::OnPacketSent(QuicTime sent_time, QuicByteCount bytes_in_flight,
diff --git a/quiche/quic/core/congestion_control/bbr_sender.h b/quiche/quic/core/congestion_control/bbr_sender.h index eb887eb..eea3fec 100644 --- a/quiche/quic/core/congestion_control/bbr_sender.h +++ b/quiche/quic/core/congestion_control/bbr_sender.h
@@ -113,6 +113,7 @@ void AdjustNetworkParameters(const NetworkParams& params) override; void SetInitialCongestionWindowInPackets( QuicPacketCount congestion_window) override; + QuicPacketCount GetInitialCongestionWindowInPackets() const override; void SetApplicationDrivenPacingRate( QuicBandwidth /*application_bandwidth_target*/) override {} void OnCongestionEvent(bool rtt_updated, QuicByteCount prior_in_flight,
diff --git a/quiche/quic/core/congestion_control/send_algorithm_interface.h b/quiche/quic/core/congestion_control/send_algorithm_interface.h index 41a4114..ee215dc 100644 --- a/quiche/quic/core/congestion_control/send_algorithm_interface.h +++ b/quiche/quic/core/congestion_control/send_algorithm_interface.h
@@ -93,6 +93,11 @@ // if called after the initial congestion window is no longer relevant. virtual void SetInitialCongestionWindowInPackets(QuicPacketCount packets) = 0; + // Returns the initial congestion window in number of packets. + // Assumes a packet size of kDefaultTCPMSS (1460 bytes), + // not kDefaultMaxPacketSize (1250 bytes) for historical reasons. + virtual QuicPacketCount GetInitialCongestionWindowInPackets() const = 0; + // [Experimental] Sets the application driven pacing rate. This is only used // by an experimental feature for bbr2_sender. virtual void SetApplicationDrivenPacingRate(
diff --git a/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.cc b/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.cc index 610bce7..e1a562a 100644 --- a/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.cc +++ b/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
@@ -234,6 +234,11 @@ congestion_window_ = congestion_window * kDefaultTCPMSS; } +QuicPacketCount TcpCubicSenderBytes::GetInitialCongestionWindowInPackets() + const { + return initial_tcp_congestion_window_ / kDefaultTCPMSS; +} + void TcpCubicSenderBytes::SetMinCongestionWindowInPackets( QuicPacketCount congestion_window) { min_congestion_window_ = congestion_window * kDefaultTCPMSS;
diff --git a/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h b/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h index c2150b4..84af2e1 100644 --- a/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h +++ b/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h
@@ -50,6 +50,7 @@ void SetNumEmulatedConnections(int num_connections); void SetInitialCongestionWindowInPackets( QuicPacketCount congestion_window) override; + QuicPacketCount GetInitialCongestionWindowInPackets() const override; void SetApplicationDrivenPacingRate( QuicBandwidth /*application_bandwidth_target*/) override {} void OnConnectionMigration() override;
diff --git a/quiche/quic/test_tools/quic_test_utils.h b/quiche/quic/test_tools/quic_test_utils.h index fd8cbf1..750329c 100644 --- a/quiche/quic/test_tools/quic_test_utils.h +++ b/quiche/quic/test_tools/quic_test_utils.h
@@ -1235,6 +1235,8 @@ (const QuicTagVector& connection_options), (override)); MOCK_METHOD(void, SetInitialCongestionWindowInPackets, (QuicPacketCount packets), (override)); + MOCK_METHOD(QuicPacketCount, GetInitialCongestionWindowInPackets, (), + (const, override)); MOCK_METHOD(void, SetApplicationDrivenPacingRate, (QuicBandwidth application_bandwidth_target), (override)); MOCK_METHOD(void, OnCongestionEvent,