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

Side by Side Diff: net/quic/core/congestion_control/bbr_sender.h

Issue 2487613002: Landing Recent QUIC changes until 12:43 PM, Nov 5, 2016 UTC+8 (Closed)
Patch Set: Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // BBR (Bottleneck Bandwidth and RTT) congestion control algorithm. 5 // BBR (Bottleneck Bandwidth and RTT) congestion control algorithm.
6 6
7 #ifndef NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_ 7 #ifndef NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_
8 #define NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_ 8 #define NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_
9 9
10 #include <cstdint> 10 #include <cstdint>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // After achieving the highest possible bandwidth during the startup, lower 44 // After achieving the highest possible bandwidth during the startup, lower
45 // the pacing rate in order to drain the queue. 45 // the pacing rate in order to drain the queue.
46 DRAIN, 46 DRAIN,
47 // Cruising mode. 47 // Cruising mode.
48 PROBE_BW, 48 PROBE_BW,
49 // Temporarily slow down sending in order to empty the buffer and measure 49 // Temporarily slow down sending in order to empty the buffer and measure
50 // the real minimum RTT. 50 // the real minimum RTT.
51 PROBE_RTT, 51 PROBE_RTT,
52 }; 52 };
53 53
54 // Indicates how the congestion control limits the amount of bytes in flight.
55 enum RecoveryState {
56 // Do not limit.
57 NOT_IN_RECOVERY,
58 // Allow an extra outstanding byte for each byte acknowledged.
59 CONSERVATION,
60 // Allow two extra outstanding bytes for each byte acknowledged (slow
61 // start).
62 GROWTH
63 };
64
54 // Debug state can be exported in order to troubleshoot potential congestion 65 // Debug state can be exported in order to troubleshoot potential congestion
55 // control issues. 66 // control issues.
56 struct DebugState { 67 struct DebugState {
57 explicit DebugState(const BbrSender& sender); 68 explicit DebugState(const BbrSender& sender);
58 DebugState(const DebugState& state); 69 DebugState(const DebugState& state);
59 70
60 Mode mode; 71 Mode mode;
61 QuicBandwidth max_bandwidth; 72 QuicBandwidth max_bandwidth;
62 QuicRoundTripCount round_trip_count; 73 QuicRoundTripCount round_trip_count;
63 int gain_cycle_index; 74 int gain_cycle_index;
64 QuicByteCount congestion_window; 75 QuicByteCount congestion_window;
65 76
66 bool is_at_full_bandwidth; 77 bool is_at_full_bandwidth;
67 QuicBandwidth bandwidth_at_last_round; 78 QuicBandwidth bandwidth_at_last_round;
68 QuicRoundTripCount rounds_without_bandwidth_gain; 79 QuicRoundTripCount rounds_without_bandwidth_gain;
69 80
70 QuicTime::Delta min_rtt; 81 QuicTime::Delta min_rtt;
71 QuicTime min_rtt_timestamp; 82 QuicTime min_rtt_timestamp;
72 83
84 RecoveryState recovery_state;
85 QuicByteCount recovery_window;
86
73 bool last_sample_is_app_limited; 87 bool last_sample_is_app_limited;
74 }; 88 };
75 89
76 BbrSender(const QuicClock* clock, 90 BbrSender(const QuicClock* clock,
77 const RttStats* rtt_stats, 91 const RttStats* rtt_stats,
78 const QuicUnackedPacketMap* unacked_packets, 92 const QuicUnackedPacketMap* unacked_packets,
79 QuicPacketCount initial_tcp_congestion_window, 93 QuicPacketCount initial_tcp_congestion_window,
80 QuicPacketCount max_tcp_congestion_window, 94 QuicPacketCount max_tcp_congestion_window,
81 QuicRandom* random); 95 QuicRandom* random);
82 ~BbrSender() override; 96 ~BbrSender() override;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Tracks for how many round-trips the bandwidth has not increased 167 // Tracks for how many round-trips the bandwidth has not increased
154 // significantly. 168 // significantly.
155 void CheckIfFullBandwidthReached(); 169 void CheckIfFullBandwidthReached();
156 // Transitions from STARTUP to DRAIN and from DRAIN to PROBE_BW if 170 // Transitions from STARTUP to DRAIN and from DRAIN to PROBE_BW if
157 // appropriate. 171 // appropriate.
158 void MaybeExitStartupOrDrain(QuicTime now); 172 void MaybeExitStartupOrDrain(QuicTime now);
159 // Decides whether to enter or exit PROBE_RTT. 173 // Decides whether to enter or exit PROBE_RTT.
160 void MaybeEnterOrExitProbeRtt(QuicTime now, 174 void MaybeEnterOrExitProbeRtt(QuicTime now,
161 bool is_round_start, 175 bool is_round_start,
162 bool min_rtt_expired); 176 bool min_rtt_expired);
177 // Determines whether BBR needs to enter, exit or advance state of the
178 // recovery.
179 void UpdateRecoveryState(QuicPacketNumber last_acked_packet,
180 bool has_losses,
181 bool is_round_start);
163 182
164 // Determines the appropriate pacing rate for the connection. 183 // Determines the appropriate pacing rate for the connection.
165 void CalculatePacingRate(); 184 void CalculatePacingRate();
166 // Determines the appropriate congestion window for the connection. 185 // Determines the appropriate congestion window for the connection.
167 void CalculateCongestionWindow(QuicByteCount bytes_acked); 186 void CalculateCongestionWindow(QuicByteCount bytes_acked);
187 // Determines the approriate window that constrains the in-flight during
188 // recovery.
189 void CalculateRecoveryWindow(QuicByteCount bytes_acked);
168 190
169 const QuicClock* clock_; 191 const QuicClock* clock_;
170 const RttStats* rtt_stats_; 192 const RttStats* rtt_stats_;
171 const QuicUnackedPacketMap* unacked_packets_; 193 const QuicUnackedPacketMap* unacked_packets_;
172 QuicRandom* random_; 194 QuicRandom* random_;
173 195
174 Mode mode_; 196 Mode mode_;
175 197
176 // Bandwidth sampler provides BBR with the bandwidth measurements at 198 // Bandwidth sampler provides BBR with the bandwidth measurements at
177 // individual points. 199 // individual points.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // that the time is yet unknown as the number of packets in flight has not 255 // that the time is yet unknown as the number of packets in flight has not
234 // reached the required value. 256 // reached the required value.
235 QuicTime exit_probe_rtt_at_; 257 QuicTime exit_probe_rtt_at_;
236 // Indicates whether a round-trip has passed since PROBE_RTT became active. 258 // Indicates whether a round-trip has passed since PROBE_RTT became active.
237 bool probe_rtt_round_passed_; 259 bool probe_rtt_round_passed_;
238 260
239 // Indicates whether the most recent bandwidth sample was marked as 261 // Indicates whether the most recent bandwidth sample was marked as
240 // app-limited. 262 // app-limited.
241 bool last_sample_is_app_limited_; 263 bool last_sample_is_app_limited_;
242 264
265 // Current state of recovery.
266 RecoveryState recovery_state_;
267 // Receiving acknowledgement of a packet after |end_recovery_at_| will cause
268 // BBR to exit the recovery mode.
269 QuicPacketNumber end_recovery_at_;
270 // A window used to limit the number of bytes in flight during loss recovery.
271 QuicByteCount recovery_window_;
272
243 DISALLOW_COPY_AND_ASSIGN(BbrSender); 273 DISALLOW_COPY_AND_ASSIGN(BbrSender);
244 }; 274 };
245 275
246 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, 276 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
247 const BbrSender::Mode& mode); 277 const BbrSender::Mode& mode);
248 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, 278 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
249 const BbrSender::DebugState& state); 279 const BbrSender::DebugState& state);
250 280
251 } // namespace net 281 } // namespace net
252 282
253 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_ 283 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_chromium_client_stream_test.cc ('k') | net/quic/core/congestion_control/bbr_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698