| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // TCP cubic send side congestion algorithm, emulates the behavior of TCP cubic. | |
| 6 | |
| 7 #ifndef NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_BYTES_H_ | |
| 8 #define NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_BYTES_H_ | |
| 9 | |
| 10 #include <stdint.h> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "net/base/net_export.h" | |
| 14 #include "net/quic/congestion_control/cubic_bytes.h" | |
| 15 #include "net/quic/congestion_control/hybrid_slow_start.h" | |
| 16 #include "net/quic/congestion_control/prr_sender.h" | |
| 17 #include "net/quic/congestion_control/tcp_cubic_sender_base.h" | |
| 18 #include "net/quic/quic_bandwidth.h" | |
| 19 #include "net/quic/quic_connection_stats.h" | |
| 20 #include "net/quic/quic_protocol.h" | |
| 21 #include "net/quic/quic_time.h" | |
| 22 | |
| 23 namespace net { | |
| 24 | |
| 25 class RttStats; | |
| 26 | |
| 27 namespace test { | |
| 28 class TcpCubicSenderBytesPeer; | |
| 29 } // namespace test | |
| 30 | |
| 31 class NET_EXPORT_PRIVATE TcpCubicSenderBytes : public TcpCubicSenderBase { | |
| 32 public: | |
| 33 TcpCubicSenderBytes(const QuicClock* clock, | |
| 34 const RttStats* rtt_stats, | |
| 35 bool reno, | |
| 36 QuicPacketCount initial_tcp_congestion_window, | |
| 37 QuicPacketCount max_congestion_window, | |
| 38 QuicConnectionStats* stats); | |
| 39 ~TcpCubicSenderBytes() override; | |
| 40 | |
| 41 // Start implementation of SendAlgorithmInterface. | |
| 42 void SetNumEmulatedConnections(int num_connections) override; | |
| 43 void OnConnectionMigration() override; | |
| 44 QuicByteCount GetCongestionWindow() const override; | |
| 45 QuicByteCount GetSlowStartThreshold() const override; | |
| 46 CongestionControlType GetCongestionControlType() const override; | |
| 47 // End implementation of SendAlgorithmInterface. | |
| 48 | |
| 49 QuicByteCount min_congestion_window() const { return min_congestion_window_; } | |
| 50 | |
| 51 protected: | |
| 52 // TcpCubicSenderBase methods | |
| 53 void SetCongestionWindowFromBandwidthAndRtt(QuicBandwidth bandwidth, | |
| 54 QuicTime::Delta rtt) override; | |
| 55 void SetCongestionWindowInPackets(QuicPacketCount congestion_window) override; | |
| 56 void SetMinCongestionWindowInPackets( | |
| 57 QuicPacketCount congestion_window) override; | |
| 58 void ExitSlowstart() override; | |
| 59 void OnPacketLost(QuicPacketNumber largest_loss, | |
| 60 QuicByteCount lost_bytes, | |
| 61 QuicByteCount bytes_in_flight) override; | |
| 62 void MaybeIncreaseCwnd(QuicPacketNumber acked_packet_number, | |
| 63 QuicByteCount acked_bytes, | |
| 64 QuicByteCount bytes_in_flight) override; | |
| 65 void HandleRetransmissionTimeout() override; | |
| 66 | |
| 67 private: | |
| 68 friend class test::TcpCubicSenderBytesPeer; | |
| 69 | |
| 70 CubicBytes cubic_; | |
| 71 | |
| 72 // ACK counter for the Reno implementation. | |
| 73 uint64_t num_acked_packets_; | |
| 74 | |
| 75 // Congestion window in bytes. | |
| 76 QuicByteCount congestion_window_; | |
| 77 | |
| 78 // Minimum congestion window in bytes. | |
| 79 QuicByteCount min_congestion_window_; | |
| 80 | |
| 81 // Maximum congestion window in bytes. | |
| 82 QuicByteCount max_congestion_window_; | |
| 83 | |
| 84 // Slow start congestion window in bytes, aka ssthresh. | |
| 85 QuicByteCount slowstart_threshold_; | |
| 86 | |
| 87 // Initial TCP congestion window in bytes. This variable can only be set when | |
| 88 // this algorithm is created. | |
| 89 const QuicByteCount initial_tcp_congestion_window_; | |
| 90 | |
| 91 // Initial maximum TCP congestion window in bytes. This variable can only be | |
| 92 // set when this algorithm is created. | |
| 93 const QuicByteCount initial_max_tcp_congestion_window_; | |
| 94 | |
| 95 // The minimum window when exiting slow start with large reduction. | |
| 96 QuicByteCount min_slow_start_exit_window_; | |
| 97 | |
| 98 DISALLOW_COPY_AND_ASSIGN(TcpCubicSenderBytes); | |
| 99 }; | |
| 100 | |
| 101 } // namespace net | |
| 102 | |
| 103 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_BYTES_SENDER_H_ | |
| OLD | NEW |