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

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

Issue 1003863006: Rollback of merge internal change: 87346681. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Make_SentPacketManager_remove_pending_88507368
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_bytes_sender.h" 5 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "net/quic/congestion_control/prr_sender.h" 9 #include "net/quic/congestion_control/prr_sender.h"
10 #include "net/quic/congestion_control/rtt_stats.h" 10 #include "net/quic/congestion_control/rtt_stats.h"
(...skipping 13 matching lines...) Expand all
24 const int kMaxBurstLength = 3; 24 const int kMaxBurstLength = 3;
25 const float kRenoBeta = 0.7f; // Reno backoff factor. 25 const float kRenoBeta = 0.7f; // Reno backoff factor.
26 const uint32 kDefaultNumConnections = 2; // N-connection emulation. 26 const uint32 kDefaultNumConnections = 2; // N-connection emulation.
27 } // namespace 27 } // namespace
28 28
29 TcpCubicBytesSender::TcpCubicBytesSender( 29 TcpCubicBytesSender::TcpCubicBytesSender(
30 const QuicClock* clock, 30 const QuicClock* clock,
31 const RttStats* rtt_stats, 31 const RttStats* rtt_stats,
32 bool reno, 32 bool reno,
33 QuicPacketCount initial_tcp_congestion_window, 33 QuicPacketCount initial_tcp_congestion_window,
34 QuicPacketCount max_congestion_window,
34 QuicConnectionStats* stats) 35 QuicConnectionStats* stats)
35 : hybrid_slow_start_(clock), 36 : hybrid_slow_start_(clock),
36 cubic_(clock), 37 cubic_(clock),
37 rtt_stats_(rtt_stats), 38 rtt_stats_(rtt_stats),
38 stats_(stats), 39 stats_(stats),
39 reno_(reno), 40 reno_(reno),
40 num_connections_(kDefaultNumConnections), 41 num_connections_(kDefaultNumConnections),
41 num_acked_packets_(0), 42 num_acked_packets_(0),
42 largest_sent_sequence_number_(0), 43 largest_sent_sequence_number_(0),
43 largest_acked_sequence_number_(0), 44 largest_acked_sequence_number_(0),
44 largest_sent_at_last_cutback_(0), 45 largest_sent_at_last_cutback_(0),
45 congestion_window_(initial_tcp_congestion_window * kMaxSegmentSize), 46 congestion_window_(initial_tcp_congestion_window * kMaxSegmentSize),
46 min_congestion_window_(kDefaultMinimumCongestionWindow), 47 min_congestion_window_(kDefaultMinimumCongestionWindow),
48 max_congestion_window_(max_congestion_window * kMaxSegmentSize),
47 slowstart_threshold_(std::numeric_limits<uint64>::max()), 49 slowstart_threshold_(std::numeric_limits<uint64>::max()),
48 last_cutback_exited_slowstart_(false), 50 last_cutback_exited_slowstart_(false),
49 clock_(clock) { 51 clock_(clock) {
50 } 52 }
51 53
52 TcpCubicBytesSender::~TcpCubicBytesSender() { 54 TcpCubicBytesSender::~TcpCubicBytesSender() {
53 } 55 }
54 56
55 void TcpCubicBytesSender::SetFromConfig(const QuicConfig& config, 57 void TcpCubicBytesSender::SetFromConfig(const QuicConfig& config,
56 Perspective perspective, 58 Perspective perspective,
(...skipping 28 matching lines...) Expand all
85 } 87 }
86 88
87 QuicBandwidth bandwidth = QuicBandwidth::FromBytesPerSecond( 89 QuicBandwidth bandwidth = QuicBandwidth::FromBytesPerSecond(
88 cached_network_params.bandwidth_estimate_bytes_per_second()); 90 cached_network_params.bandwidth_estimate_bytes_per_second());
89 QuicTime::Delta rtt_ms = 91 QuicTime::Delta rtt_ms =
90 QuicTime::Delta::FromMilliseconds(cached_network_params.min_rtt_ms()); 92 QuicTime::Delta::FromMilliseconds(cached_network_params.min_rtt_ms());
91 93
92 // Make sure CWND is in appropriate range (in case of bad data). 94 // Make sure CWND is in appropriate range (in case of bad data).
93 QuicByteCount new_congestion_window = bandwidth.ToBytesPerPeriod(rtt_ms); 95 QuicByteCount new_congestion_window = bandwidth.ToBytesPerPeriod(rtt_ms);
94 congestion_window_ = 96 congestion_window_ =
95 max(min(new_congestion_window, 97 max(min(new_congestion_window, kMaxTcpCongestionWindow * kMaxSegmentSize),
96 kMaxCongestionWindowForBandwidthResumption * kMaxSegmentSize),
97 kMinCongestionWindowForBandwidthResumption * kMaxSegmentSize); 98 kMinCongestionWindowForBandwidthResumption * kMaxSegmentSize);
98 99
99 // TODO(rjshade): Set appropriate CWND when previous connection was in slow 100 // TODO(rjshade): Set appropriate CWND when previous connection was in slow
100 // start at time of estimate. 101 // start at time of estimate.
101 return true; 102 return true;
102 } 103 }
103 104
104 void TcpCubicBytesSender::SetNumEmulatedConnections(int num_connections) { 105 void TcpCubicBytesSender::SetNumEmulatedConnections(int num_connections) {
105 num_connections_ = max(1, num_connections); 106 num_connections_ = max(1, num_connections);
106 cubic_.SetNumConnections(num_connections_); 107 cubic_.SetNumConnections(num_connections_);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 void TcpCubicBytesSender::MaybeIncreaseCwnd( 298 void TcpCubicBytesSender::MaybeIncreaseCwnd(
298 QuicPacketSequenceNumber acked_sequence_number, 299 QuicPacketSequenceNumber acked_sequence_number,
299 QuicByteCount acked_bytes, 300 QuicByteCount acked_bytes,
300 QuicByteCount bytes_in_flight) { 301 QuicByteCount bytes_in_flight) {
301 LOG_IF(DFATAL, InRecovery()) << "Never increase the CWND during recovery."; 302 LOG_IF(DFATAL, InRecovery()) << "Never increase the CWND during recovery.";
302 if (!IsCwndLimited(bytes_in_flight)) { 303 if (!IsCwndLimited(bytes_in_flight)) {
303 // We don't update the congestion window unless we are close to using the 304 // We don't update the congestion window unless we are close to using the
304 // window we have available. 305 // window we have available.
305 return; 306 return;
306 } 307 }
308 if (congestion_window_ >= max_congestion_window_) {
309 return;
310 }
307 if (InSlowStart()) { 311 if (InSlowStart()) {
308 // TCP slow start, exponential growth, increase by one for each ACK. 312 // TCP slow start, exponential growth, increase by one for each ACK.
309 congestion_window_ += kMaxSegmentSize; 313 congestion_window_ += kMaxSegmentSize;
310 DVLOG(1) << "Slow start; congestion window: " << congestion_window_ 314 DVLOG(1) << "Slow start; congestion window: " << congestion_window_
311 << " slowstart threshold: " << slowstart_threshold_; 315 << " slowstart threshold: " << slowstart_threshold_;
312 return; 316 return;
313 } 317 }
314 // Congestion avoidance. 318 // Congestion avoidance.
315 if (reno_) { 319 if (reno_) {
316 // Classic Reno congestion avoidance. 320 // Classic Reno congestion avoidance.
(...skipping 26 matching lines...) Expand all
343 hybrid_slow_start_.Restart(); 347 hybrid_slow_start_.Restart();
344 slowstart_threshold_ = congestion_window_ / 2; 348 slowstart_threshold_ = congestion_window_ / 2;
345 congestion_window_ = min_congestion_window_; 349 congestion_window_ = min_congestion_window_;
346 } 350 }
347 351
348 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const { 352 CongestionControlType TcpCubicBytesSender::GetCongestionControlType() const {
349 return reno_ ? kRenoBytes : kCubicBytes; 353 return reno_ ? kRenoBytes : kCubicBytes;
350 } 354 }
351 355
352 } // namespace net 356 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_bytes_sender.h ('k') | net/quic/congestion_control/tcp_cubic_bytes_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698