Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender_test.cc

Issue 1566853002: relnote: Adds Slow Start with Large Reduction (SSLR) option in QUIC to do a large reduction of the … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_CL_111385311
Patch Set: git pull Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/crypto_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/congestion_control/tcp_cubic_sender.h" 5 #include "net/quic/congestion_control/tcp_cubic_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 AckNPackets(1); 233 AckNPackets(1);
234 expected_send_window += kDefaultTCPMSS; 234 expected_send_window += kDefaultTCPMSS;
235 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 235 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
236 236
237 // Now RTO and ensure slow start gets reset. 237 // Now RTO and ensure slow start gets reset.
238 EXPECT_TRUE(sender_->hybrid_slow_start().started()); 238 EXPECT_TRUE(sender_->hybrid_slow_start().started());
239 sender_->OnRetransmissionTimeout(true); 239 sender_->OnRetransmissionTimeout(true);
240 EXPECT_FALSE(sender_->hybrid_slow_start().started()); 240 EXPECT_FALSE(sender_->hybrid_slow_start().started());
241 } 241 }
242 242
243 TEST_F(TcpCubicSenderTest, SlowStartPacketLossWithLargeReduction) {
244 QuicConfig config;
245 QuicTagVector options;
246 options.push_back(kSSLR);
247 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
248 sender_->SetFromConfig(config, Perspective::IS_SERVER);
249
250 sender_->SetNumEmulatedConnections(1);
251 const int kNumberOfAcks = 10;
252 for (int i = 0; i < kNumberOfAcks; ++i) {
253 // Send our full send window.
254 SendAvailableSendWindow();
255 AckNPackets(2);
256 }
257 SendAvailableSendWindow();
258 QuicByteCount expected_send_window =
259 kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
260 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
261
262 // Lose a packet to exit slow start. We should now have fallen out of
263 // slow start with a window reduced by 1.
264 LoseNPackets(1);
265 expected_send_window -= kDefaultTCPMSS;
266 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
267
268 // Lose 5 packets in recovery and verify that congestion window is reduced
269 // further.
270 LoseNPackets(5);
271 expected_send_window -= 5 * kDefaultTCPMSS;
272 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
273
274 size_t packets_in_recovery_window = expected_send_window / kDefaultTCPMSS;
275
276 // Recovery phase. We need to ack every packet in the recovery window before
277 // we exit recovery.
278 size_t number_of_packets_in_window = expected_send_window / kDefaultTCPMSS;
279 DVLOG(1) << "number_packets: " << number_of_packets_in_window;
280 AckNPackets(packets_in_recovery_window);
281 SendAvailableSendWindow();
282 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
283
284 // We need to ack the rest of the window before cwnd increases by 1.
285 AckNPackets(number_of_packets_in_window - 1);
286 SendAvailableSendWindow();
287 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
288
289 // Next ack should increase cwnd by 1.
290 AckNPackets(1);
291 expected_send_window += kDefaultTCPMSS;
292 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
293
294 // Now RTO and ensure slow start gets reset.
295 EXPECT_TRUE(sender_->hybrid_slow_start().started());
296 sender_->OnRetransmissionTimeout(true);
297 EXPECT_FALSE(sender_->hybrid_slow_start().started());
298 }
299
243 TEST_F(TcpCubicSenderTest, NoPRRWhenLessThanOnePacketInFlight) { 300 TEST_F(TcpCubicSenderTest, NoPRRWhenLessThanOnePacketInFlight) {
244 SendAvailableSendWindow(); 301 SendAvailableSendWindow();
245 LoseNPackets(kInitialCongestionWindowPackets - 1); 302 LoseNPackets(kInitialCongestionWindowPackets - 1);
246 AckNPackets(1); 303 AckNPackets(1);
247 // PRR will allow 2 packets for every ack during recovery. 304 // PRR will allow 2 packets for every ack during recovery.
248 EXPECT_EQ(2, SendAvailableSendWindow()); 305 EXPECT_EQ(2, SendAvailableSendWindow());
249 // Simulate abandoning all packets by supplying a bytes_in_flight of 0. 306 // Simulate abandoning all packets by supplying a bytes_in_flight of 0.
250 // PRR should now allow a packet to be sent, even though prr's state 307 // PRR should now allow a packet to be sent, even though prr's state
251 // variables believe it has sent enough packets. 308 // variables believe it has sent enough packets.
252 EXPECT_EQ(QuicTime::Delta::Zero(), 309 EXPECT_EQ(QuicTime::Delta::Zero(),
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 878
822 // Resets cwnd and slow start threshold on connection migrations. 879 // Resets cwnd and slow start threshold on connection migrations.
823 sender_->OnConnectionMigration(); 880 sender_->OnConnectionMigration();
824 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); 881 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
825 EXPECT_EQ(kMaxCongestionWindow, sender_->slowstart_threshold()); 882 EXPECT_EQ(kMaxCongestionWindow, sender_->slowstart_threshold());
826 EXPECT_FALSE(sender_->hybrid_slow_start().started()); 883 EXPECT_FALSE(sender_->hybrid_slow_start().started());
827 } 884 }
828 885
829 } // namespace test 886 } // namespace test
830 } // namespace net 887 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/crypto_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698