| OLD | NEW |
| 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> |
| 11 #include <ostream> | 11 #include <ostream> |
| 12 | 12 |
| 13 #include "net/quic/core/congestion_control/bandwidth_sampler.h" | 13 #include "net/quic/core/congestion_control/bandwidth_sampler.h" |
| 14 #include "net/quic/core/congestion_control/send_algorithm_interface.h" | 14 #include "net/quic/core/congestion_control/send_algorithm_interface.h" |
| 15 #include "net/quic/core/congestion_control/windowed_filter.h" | 15 #include "net/quic/core/congestion_control/windowed_filter.h" |
| 16 #include "net/quic/core/crypto/quic_random.h" | 16 #include "net/quic/core/crypto/quic_random.h" |
| 17 #include "net/quic/core/quic_bandwidth.h" | 17 #include "net/quic/core/quic_bandwidth.h" |
| 18 #include "net/quic/core/quic_packets.h" | 18 #include "net/quic/core/quic_packets.h" |
| 19 #include "net/quic/core/quic_time.h" | 19 #include "net/quic/core/quic_time.h" |
| 20 #include "net/quic/core/quic_unacked_packet_map.h" | 20 #include "net/quic/core/quic_unacked_packet_map.h" |
| 21 #include "net/quic/platform/api/quic_export.h" |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 | 24 |
| 24 class RttStats; | 25 class RttStats; |
| 25 | 26 |
| 26 typedef uint64_t QuicRoundTripCount; | 27 typedef uint64_t QuicRoundTripCount; |
| 27 | 28 |
| 28 // BbrSender implements BBR congestion control algorithm. BBR aims to estimate | 29 // BbrSender implements BBR congestion control algorithm. BBR aims to estimate |
| 29 // the current available Bottleneck Bandwidth and RTT (hence the name), and | 30 // the current available Bottleneck Bandwidth and RTT (hence the name), and |
| 30 // regulates the pacing rate and the size of the congestion window based on | 31 // regulates the pacing rate and the size of the congestion window based on |
| 31 // those signals. | 32 // those signals. |
| 32 // | 33 // |
| 33 // BBR relies on pacing in order to function properly. Do not use BBR when | 34 // BBR relies on pacing in order to function properly. Do not use BBR when |
| 34 // pacing is disabled. | 35 // pacing is disabled. |
| 35 // | 36 // |
| 36 // TODO(vasilvv): implement traffic policer (long-term sampling) mode. | 37 // TODO(vasilvv): implement traffic policer (long-term sampling) mode. |
| 37 // | 38 // |
| 38 // TODO(vasilvv): implement packet conservation. | 39 // TODO(vasilvv): implement packet conservation. |
| 39 class NET_EXPORT_PRIVATE BbrSender : public SendAlgorithmInterface { | 40 class QUIC_EXPORT_PRIVATE BbrSender : public SendAlgorithmInterface { |
| 40 public: | 41 public: |
| 41 enum Mode { | 42 enum Mode { |
| 42 // Startup phase of the connection. | 43 // Startup phase of the connection. |
| 43 STARTUP, | 44 STARTUP, |
| 44 // After achieving the highest possible bandwidth during the startup, lower | 45 // After achieving the highest possible bandwidth during the startup, lower |
| 45 // the pacing rate in order to drain the queue. | 46 // the pacing rate in order to drain the queue. |
| 46 DRAIN, | 47 DRAIN, |
| 47 // Cruising mode. | 48 // Cruising mode. |
| 48 PROBE_BW, | 49 PROBE_BW, |
| 49 // Temporarily slow down sending in order to empty the buffer and measure | 50 // Temporarily slow down sending in order to empty the buffer and measure |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // A window used to limit the number of bytes in flight during loss recovery. | 271 // A window used to limit the number of bytes in flight during loss recovery. |
| 271 QuicByteCount recovery_window_; | 272 QuicByteCount recovery_window_; |
| 272 | 273 |
| 273 // Indicates whether to always only increase the pacing rate during startup. | 274 // Indicates whether to always only increase the pacing rate during startup. |
| 274 // Latches |FLAGS_quic_bbr_faster_startup|. | 275 // Latches |FLAGS_quic_bbr_faster_startup|. |
| 275 bool enforce_startup_pacing_rate_increase_; | 276 bool enforce_startup_pacing_rate_increase_; |
| 276 | 277 |
| 277 DISALLOW_COPY_AND_ASSIGN(BbrSender); | 278 DISALLOW_COPY_AND_ASSIGN(BbrSender); |
| 278 }; | 279 }; |
| 279 | 280 |
| 280 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 281 QUIC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
| 281 const BbrSender::Mode& mode); | 282 const BbrSender::Mode& mode); |
| 282 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 283 QUIC_EXPORT_PRIVATE std::ostream& operator<<( |
| 283 const BbrSender::DebugState& state); | 284 std::ostream& os, |
| 285 const BbrSender::DebugState& state); |
| 284 | 286 |
| 285 } // namespace net | 287 } // namespace net |
| 286 | 288 |
| 287 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_ | 289 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BBR_SENDER_H_ |
| OLD | NEW |