OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // TCP cubic send side congestion algorithm, emulates the behavior of | 5 // TCP cubic send side congestion algorithm, emulates the behavior of |
6 // TCP cubic. | 6 // TCP cubic. |
7 | 7 |
8 #ifndef NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 8 #ifndef NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
9 #define NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 9 #define NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 class RttStats; | 26 class RttStats; |
27 | 27 |
28 namespace test { | 28 namespace test { |
29 class TcpCubicSenderPeer; | 29 class TcpCubicSenderPeer; |
30 } // namespace test | 30 } // namespace test |
31 | 31 |
32 class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface { | 32 class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface { |
33 public: | 33 public: |
34 // Reno option and max_tcp_congestion_window are provided for testing. | |
35 TcpCubicSender(const QuicClock* clock, | 34 TcpCubicSender(const QuicClock* clock, |
36 const RttStats* rtt_stats, | 35 const RttStats* rtt_stats, |
37 bool reno, | 36 bool reno, |
38 QuicPacketCount initial_tcp_congestion_window, | 37 QuicPacketCount initial_tcp_congestion_window, |
39 QuicPacketCount max_tcp_congestion_window, | |
40 QuicConnectionStats* stats); | 38 QuicConnectionStats* stats); |
41 ~TcpCubicSender() override; | 39 ~TcpCubicSender() override; |
42 | 40 |
43 // Start implementation of SendAlgorithmInterface. | 41 // Start implementation of SendAlgorithmInterface. |
44 void SetFromConfig(const QuicConfig& config, | 42 void SetFromConfig(const QuicConfig& config, |
45 bool is_server, | 43 bool is_server, |
46 bool using_pacing) override; | 44 bool using_pacing) override; |
47 bool ResumeConnectionState( | 45 bool ResumeConnectionState( |
48 const CachedNetworkParameters& cached_network_params) override; | 46 const CachedNetworkParameters& cached_network_params) override; |
49 void SetNumEmulatedConnections(int num_connections) override; | 47 void SetNumEmulatedConnections(int num_connections) override; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const RttStats* rtt_stats_; | 93 const RttStats* rtt_stats_; |
96 QuicConnectionStats* stats_; | 94 QuicConnectionStats* stats_; |
97 | 95 |
98 // If true, Reno congestion control is used instead of Cubic. | 96 // If true, Reno congestion control is used instead of Cubic. |
99 const bool reno_; | 97 const bool reno_; |
100 | 98 |
101 // Number of connections to simulate. | 99 // Number of connections to simulate. |
102 uint32 num_connections_; | 100 uint32 num_connections_; |
103 | 101 |
104 // ACK counter for the Reno implementation. | 102 // ACK counter for the Reno implementation. |
105 uint64 congestion_window_count_; | 103 uint64 num_acked_packets_; |
106 | 104 |
107 // Track the largest packet that has been sent. | 105 // Track the largest packet that has been sent. |
108 QuicPacketSequenceNumber largest_sent_sequence_number_; | 106 QuicPacketSequenceNumber largest_sent_sequence_number_; |
109 | 107 |
110 // Track the largest packet that has been acked. | 108 // Track the largest packet that has been acked. |
111 QuicPacketSequenceNumber largest_acked_sequence_number_; | 109 QuicPacketSequenceNumber largest_acked_sequence_number_; |
112 | 110 |
113 // Track the largest sequence number outstanding when a CWND cutback occurs. | 111 // Track the largest sequence number outstanding when a CWND cutback occurs. |
114 QuicPacketSequenceNumber largest_sent_at_last_cutback_; | 112 QuicPacketSequenceNumber largest_sent_at_last_cutback_; |
115 | 113 |
116 // Congestion window in packets. | 114 // Congestion window in packets. |
117 QuicPacketCount congestion_window_; | 115 QuicPacketCount congestion_window_; |
118 | 116 |
119 // Slow start congestion window in packets, aka ssthresh. | 117 // Slow start congestion window in packets, aka ssthresh. |
120 QuicPacketCount slowstart_threshold_; | 118 QuicPacketCount slowstart_threshold_; |
121 | 119 |
122 // Whether the last loss event caused us to exit slowstart. | 120 // Whether the last loss event caused us to exit slowstart. |
123 // Used for stats collection of slowstart_packets_lost | 121 // Used for stats collection of slowstart_packets_lost |
124 bool last_cutback_exited_slowstart_; | 122 bool last_cutback_exited_slowstart_; |
125 | 123 |
126 // Maximum number of outstanding packets for tcp. | |
127 QuicPacketCount max_tcp_congestion_window_; | |
128 | |
129 const QuicClock* clock_; | 124 const QuicClock* clock_; |
130 | 125 |
131 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); | 126 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); |
132 }; | 127 }; |
133 | 128 |
134 } // namespace net | 129 } // namespace net |
135 | 130 |
136 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 131 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
OLD | NEW |