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

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

Issue 1918953003: Landing Recent QUIC changes until 4/22/2016 14:55 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deleted SpdyFramerTests missed while mergeing 120451808 Created 4 years, 7 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) 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_packets.h" 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "net/quic/congestion_control/prr_sender.h" 10 #include "net/quic/congestion_control/prr_sender.h"
(...skipping 23 matching lines...) Expand all
34 QuicPacketCount max_tcp_congestion_window, 34 QuicPacketCount max_tcp_congestion_window,
35 QuicConnectionStats* stats) 35 QuicConnectionStats* stats)
36 : TcpCubicSenderBase(clock, rtt_stats, reno, stats), 36 : TcpCubicSenderBase(clock, rtt_stats, reno, stats),
37 cubic_(clock), 37 cubic_(clock),
38 congestion_window_count_(0), 38 congestion_window_count_(0),
39 congestion_window_(initial_tcp_congestion_window), 39 congestion_window_(initial_tcp_congestion_window),
40 min_congestion_window_(kDefaultMinimumCongestionWindow), 40 min_congestion_window_(kDefaultMinimumCongestionWindow),
41 slowstart_threshold_(max_tcp_congestion_window), 41 slowstart_threshold_(max_tcp_congestion_window),
42 max_tcp_congestion_window_(max_tcp_congestion_window), 42 max_tcp_congestion_window_(max_tcp_congestion_window),
43 initial_tcp_congestion_window_(initial_tcp_congestion_window), 43 initial_tcp_congestion_window_(initial_tcp_congestion_window),
44 initial_max_tcp_congestion_window_(max_tcp_congestion_window) {} 44 initial_max_tcp_congestion_window_(max_tcp_congestion_window),
45 min_slow_start_exit_window_(min_congestion_window_) {}
45 46
46 TcpCubicSenderPackets::~TcpCubicSenderPackets() {} 47 TcpCubicSenderPackets::~TcpCubicSenderPackets() {}
47 48
48 void TcpCubicSenderPackets::SetCongestionWindowFromBandwidthAndRtt( 49 void TcpCubicSenderPackets::SetCongestionWindowFromBandwidthAndRtt(
49 QuicBandwidth bandwidth, 50 QuicBandwidth bandwidth,
50 QuicTime::Delta rtt) { 51 QuicTime::Delta rtt) {
51 // Make sure CWND is in appropriate range (in case of bad data).
52 QuicPacketCount new_congestion_window = 52 QuicPacketCount new_congestion_window =
53 bandwidth.ToBytesPerPeriod(rtt) / kDefaultTCPMSS; 53 bandwidth.ToBytesPerPeriod(rtt) / kDefaultTCPMSS;
54 congestion_window_ = max(min(new_congestion_window, kMaxCongestionWindow), 54 if (FLAGS_quic_no_lower_bw_resumption_limit) {
55 kMinCongestionWindowForBandwidthResumption); 55 // Limit new CWND to be in the range [1, kMaxCongestionWindow].
56 congestion_window_ = max(min_congestion_window_,
57 min(new_congestion_window, kMaxCongestionWindow));
58 } else {
59 congestion_window_ = max(min(new_congestion_window, kMaxCongestionWindow),
60 kMinCongestionWindowForBandwidthResumption);
61 }
56 } 62 }
57 63
58 void TcpCubicSenderPackets::SetCongestionWindowInPackets( 64 void TcpCubicSenderPackets::SetCongestionWindowInPackets(
59 QuicPacketCount congestion_window) { 65 QuicPacketCount congestion_window) {
60 congestion_window_ = congestion_window; 66 congestion_window_ = congestion_window;
61 } 67 }
62 68
63 void TcpCubicSenderPackets::SetMinCongestionWindowInPackets( 69 void TcpCubicSenderPackets::SetMinCongestionWindowInPackets(
64 QuicPacketCount congestion_window) { 70 QuicPacketCount congestion_window) {
65 min_congestion_window_ = congestion_window; 71 min_congestion_window_ = congestion_window;
(...skipping 21 matching lines...) Expand all
87 if (packet_number <= largest_sent_at_last_cutback_) { 93 if (packet_number <= largest_sent_at_last_cutback_) {
88 if (last_cutback_exited_slowstart_) { 94 if (last_cutback_exited_slowstart_) {
89 ++stats_->slowstart_packets_lost; 95 ++stats_->slowstart_packets_lost;
90 stats_->slowstart_bytes_lost += lost_bytes; 96 stats_->slowstart_bytes_lost += lost_bytes;
91 if (slow_start_large_reduction_) { 97 if (slow_start_large_reduction_) {
92 if (stats_->slowstart_packets_lost == 1 || 98 if (stats_->slowstart_packets_lost == 1 ||
93 (stats_->slowstart_bytes_lost / kDefaultTCPMSS) > 99 (stats_->slowstart_bytes_lost / kDefaultTCPMSS) >
94 (stats_->slowstart_bytes_lost - lost_bytes) / kDefaultTCPMSS) { 100 (stats_->slowstart_bytes_lost - lost_bytes) / kDefaultTCPMSS) {
95 // Reduce congestion window by 1 for every mss of bytes lost. 101 // Reduce congestion window by 1 for every mss of bytes lost.
96 congestion_window_ = 102 congestion_window_ =
97 max(congestion_window_ - 1, min_congestion_window_); 103 max(congestion_window_ - 1, min_slow_start_exit_window_);
98 } 104 }
99 slowstart_threshold_ = congestion_window_; 105 slowstart_threshold_ = congestion_window_;
100 } 106 }
101 } 107 }
102 DVLOG(1) << "Ignoring loss for largest_missing:" << packet_number 108 DVLOG(1) << "Ignoring loss for largest_missing:" << packet_number
103 << " because it was sent prior to the last CWND cutback."; 109 << " because it was sent prior to the last CWND cutback.";
104 return; 110 return;
105 } 111 }
106 ++stats_->tcp_loss_events; 112 ++stats_->tcp_loss_events;
107 last_cutback_exited_slowstart_ = InSlowStart(); 113 last_cutback_exited_slowstart_ = InSlowStart();
108 if (InSlowStart()) { 114 if (InSlowStart()) {
109 ++stats_->slowstart_packets_lost; 115 ++stats_->slowstart_packets_lost;
110 } 116 }
111 117
112 prr_.OnPacketLost(bytes_in_flight); 118 prr_.OnPacketLost(bytes_in_flight);
113 119
114 // TODO(jri): Separate out all of slow start into a separate class. 120 // TODO(jri): Separate out all of slow start into a separate class.
115 if (slow_start_large_reduction_ && InSlowStart()) { 121 if (slow_start_large_reduction_ && InSlowStart()) {
116 DCHECK_LT(1u, congestion_window_); 122 DCHECK_LT(1u, congestion_window_);
123 if (FLAGS_quic_sslr_limit_reduction &&
124 congestion_window_ >= 2 * initial_tcp_congestion_window_) {
125 min_slow_start_exit_window_ = congestion_window_ / 2;
126 }
117 congestion_window_ = congestion_window_ - 1; 127 congestion_window_ = congestion_window_ - 1;
118 } else if (reno_) { 128 } else if (reno_) {
119 congestion_window_ = congestion_window_ * RenoBeta(); 129 congestion_window_ = congestion_window_ * RenoBeta();
120 } else { 130 } else {
121 congestion_window_ = 131 congestion_window_ =
122 cubic_.CongestionWindowAfterPacketLoss(congestion_window_); 132 cubic_.CongestionWindowAfterPacketLoss(congestion_window_);
123 } 133 }
124 // Enforce a minimum congestion window. 134 // Enforce a minimum congestion window.
125 if (congestion_window_ < min_congestion_window_) { 135 if (congestion_window_ < min_congestion_window_) {
126 congestion_window_ = min_congestion_window_; 136 congestion_window_ = min_congestion_window_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 congestion_window_ = initial_tcp_congestion_window_; 211 congestion_window_ = initial_tcp_congestion_window_;
202 slowstart_threshold_ = initial_max_tcp_congestion_window_; 212 slowstart_threshold_ = initial_max_tcp_congestion_window_;
203 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; 213 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_;
204 } 214 }
205 215
206 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const { 216 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const {
207 return reno_ ? kReno : kCubic; 217 return reno_ ? kReno : kCubic;
208 } 218 }
209 219
210 } // namespace net 220 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_packets.h ('k') | net/quic/congestion_control/tcp_cubic_sender_packets_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698