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