| OLD | NEW |
| 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_sender_bytes.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender_bytes.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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void TcpCubicSenderBytes::SetMinCongestionWindowInPackets( | 73 void TcpCubicSenderBytes::SetMinCongestionWindowInPackets( |
| 74 QuicPacketCount congestion_window) { | 74 QuicPacketCount congestion_window) { |
| 75 min_congestion_window_ = congestion_window * kDefaultTCPMSS; | 75 min_congestion_window_ = congestion_window * kDefaultTCPMSS; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void TcpCubicSenderBytes::SetNumEmulatedConnections(int num_connections) { | 78 void TcpCubicSenderBytes::SetNumEmulatedConnections(int num_connections) { |
| 79 TcpCubicSenderBase::SetNumEmulatedConnections(num_connections); | 79 TcpCubicSenderBase::SetNumEmulatedConnections(num_connections); |
| 80 cubic_.SetNumConnections(num_connections_); | 80 cubic_.SetNumConnections(num_connections_); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void TcpCubicSenderBytes::SetMaxCongestionWindow( | |
| 84 QuicByteCount max_congestion_window) { | |
| 85 DCHECK(!FLAGS_quic_ignore_srbf); | |
| 86 max_congestion_window_ = max_congestion_window; | |
| 87 } | |
| 88 | |
| 89 void TcpCubicSenderBytes::ExitSlowstart() { | 83 void TcpCubicSenderBytes::ExitSlowstart() { |
| 90 slowstart_threshold_ = congestion_window_; | 84 slowstart_threshold_ = congestion_window_; |
| 91 } | 85 } |
| 92 | 86 |
| 93 void TcpCubicSenderBytes::OnPacketLost(QuicPacketNumber packet_number, | 87 void TcpCubicSenderBytes::OnPacketLost(QuicPacketNumber packet_number, |
| 94 QuicByteCount lost_bytes, | 88 QuicByteCount lost_bytes, |
| 95 QuicByteCount bytes_in_flight) { | 89 QuicByteCount bytes_in_flight) { |
| 96 // TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets | 90 // TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets |
| 97 // already sent should be treated as a single loss event, since it's expected. | 91 // already sent should be treated as a single loss event, since it's expected. |
| 98 if (packet_number <= largest_sent_at_last_cutback_) { | 92 if (packet_number <= largest_sent_at_last_cutback_) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 116 ++stats_->slowstart_packets_lost; | 110 ++stats_->slowstart_packets_lost; |
| 117 } | 111 } |
| 118 | 112 |
| 119 if (!no_prr_) { | 113 if (!no_prr_) { |
| 120 prr_.OnPacketLost(bytes_in_flight); | 114 prr_.OnPacketLost(bytes_in_flight); |
| 121 } | 115 } |
| 122 | 116 |
| 123 // TODO(jri): Separate out all of slow start into a separate class. | 117 // TODO(jri): Separate out all of slow start into a separate class. |
| 124 if (slow_start_large_reduction_ && InSlowStart()) { | 118 if (slow_start_large_reduction_ && InSlowStart()) { |
| 125 DCHECK_LT(kDefaultTCPMSS, congestion_window_); | 119 DCHECK_LT(kDefaultTCPMSS, congestion_window_); |
| 126 if (FLAGS_quic_sslr_limit_reduction && | 120 if (congestion_window_ >= 2 * initial_tcp_congestion_window_) { |
| 127 congestion_window_ >= 2 * initial_tcp_congestion_window_) { | |
| 128 min_slow_start_exit_window_ = congestion_window_ / 2; | 121 min_slow_start_exit_window_ = congestion_window_ / 2; |
| 129 } | 122 } |
| 130 congestion_window_ = congestion_window_ - kDefaultTCPMSS; | 123 congestion_window_ = congestion_window_ - kDefaultTCPMSS; |
| 131 } else if (reno_) { | 124 } else if (reno_) { |
| 132 congestion_window_ = congestion_window_ * RenoBeta(); | 125 congestion_window_ = congestion_window_ * RenoBeta(); |
| 133 } else { | 126 } else { |
| 134 congestion_window_ = | 127 congestion_window_ = |
| 135 cubic_.CongestionWindowAfterPacketLoss(congestion_window_); | 128 cubic_.CongestionWindowAfterPacketLoss(congestion_window_); |
| 136 } | 129 } |
| 137 if (congestion_window_ < min_congestion_window_) { | 130 if (congestion_window_ < min_congestion_window_) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 congestion_window_ = initial_tcp_congestion_window_; | 208 congestion_window_ = initial_tcp_congestion_window_; |
| 216 max_congestion_window_ = initial_max_tcp_congestion_window_; | 209 max_congestion_window_ = initial_max_tcp_congestion_window_; |
| 217 slowstart_threshold_ = initial_max_tcp_congestion_window_; | 210 slowstart_threshold_ = initial_max_tcp_congestion_window_; |
| 218 } | 211 } |
| 219 | 212 |
| 220 CongestionControlType TcpCubicSenderBytes::GetCongestionControlType() const { | 213 CongestionControlType TcpCubicSenderBytes::GetCongestionControlType() const { |
| 221 return reno_ ? kRenoBytes : kCubicBytes; | 214 return reno_ ? kRenoBytes : kCubicBytes; |
| 222 } | 215 } |
| 223 | 216 |
| 224 } // namespace net | 217 } // namespace net |
| OLD | NEW |