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

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

Issue 2130103002: Landing Recent QUIC changes until 2016-07-02 02:45 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void TcpCubicSenderPackets::SetMinCongestionWindowInPackets( 71 void TcpCubicSenderPackets::SetMinCongestionWindowInPackets(
72 QuicPacketCount congestion_window) { 72 QuicPacketCount congestion_window) {
73 min_congestion_window_ = congestion_window; 73 min_congestion_window_ = congestion_window;
74 } 74 }
75 75
76 void TcpCubicSenderPackets::SetNumEmulatedConnections(int num_connections) { 76 void TcpCubicSenderPackets::SetNumEmulatedConnections(int num_connections) {
77 TcpCubicSenderBase::SetNumEmulatedConnections(num_connections); 77 TcpCubicSenderBase::SetNumEmulatedConnections(num_connections);
78 cubic_.SetNumConnections(num_connections_); 78 cubic_.SetNumConnections(num_connections_);
79 } 79 }
80 80
81 void TcpCubicSenderPackets::SetMaxCongestionWindow(
82 QuicByteCount max_congestion_window) {
83 DCHECK(!FLAGS_quic_ignore_srbf);
84 max_tcp_congestion_window_ = max_congestion_window / kDefaultTCPMSS;
85 }
86
87 void TcpCubicSenderPackets::ExitSlowstart() { 81 void TcpCubicSenderPackets::ExitSlowstart() {
88 slowstart_threshold_ = congestion_window_; 82 slowstart_threshold_ = congestion_window_;
89 } 83 }
90 84
91 void TcpCubicSenderPackets::OnPacketLost(QuicPacketNumber packet_number, 85 void TcpCubicSenderPackets::OnPacketLost(QuicPacketNumber packet_number,
92 QuicByteCount lost_bytes, 86 QuicByteCount lost_bytes,
93 QuicByteCount bytes_in_flight) { 87 QuicByteCount bytes_in_flight) {
94 // TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets 88 // TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets
95 // already sent should be treated as a single loss event, since it's expected. 89 // already sent should be treated as a single loss event, since it's expected.
96 if (packet_number <= largest_sent_at_last_cutback_) { 90 if (packet_number <= largest_sent_at_last_cutback_) {
(...skipping 21 matching lines...) Expand all
118 ++stats_->slowstart_packets_lost; 112 ++stats_->slowstart_packets_lost;
119 } 113 }
120 114
121 if (!no_prr_) { 115 if (!no_prr_) {
122 prr_.OnPacketLost(bytes_in_flight); 116 prr_.OnPacketLost(bytes_in_flight);
123 } 117 }
124 118
125 // TODO(jri): Separate out all of slow start into a separate class. 119 // TODO(jri): Separate out all of slow start into a separate class.
126 if (slow_start_large_reduction_ && InSlowStart()) { 120 if (slow_start_large_reduction_ && InSlowStart()) {
127 DCHECK_LT(1u, congestion_window_); 121 DCHECK_LT(1u, congestion_window_);
128 if (FLAGS_quic_sslr_limit_reduction && 122 if (congestion_window_ >= 2 * initial_tcp_congestion_window_) {
129 congestion_window_ >= 2 * initial_tcp_congestion_window_) {
130 min_slow_start_exit_window_ = congestion_window_ / 2; 123 min_slow_start_exit_window_ = congestion_window_ / 2;
131 } 124 }
132 congestion_window_ = congestion_window_ - 1; 125 congestion_window_ = congestion_window_ - 1;
133 } else if (reno_) { 126 } else if (reno_) {
134 congestion_window_ = congestion_window_ * RenoBeta(); 127 congestion_window_ = congestion_window_ * RenoBeta();
135 } else { 128 } else {
136 congestion_window_ = 129 congestion_window_ =
137 cubic_.CongestionWindowAfterPacketLoss(congestion_window_); 130 cubic_.CongestionWindowAfterPacketLoss(congestion_window_);
138 } 131 }
139 // Enforce a minimum congestion window. 132 // Enforce a minimum congestion window.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 congestion_window_ = initial_tcp_congestion_window_; 209 congestion_window_ = initial_tcp_congestion_window_;
217 slowstart_threshold_ = initial_max_tcp_congestion_window_; 210 slowstart_threshold_ = initial_max_tcp_congestion_window_;
218 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; 211 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_;
219 } 212 }
220 213
221 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const { 214 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const {
222 return reno_ ? kReno : kCubic; 215 return reno_ ? kReno : kCubic;
223 } 216 }
224 217
225 } // namespace net 218 } // 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