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