| 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 22 matching lines...) Expand all Loading... |
| 33 TcpCubicSender(const QuicClock* clock, | 33 TcpCubicSender(const QuicClock* clock, |
| 34 const RttStats* rtt_stats, | 34 const RttStats* rtt_stats, |
| 35 bool reno, | 35 bool reno, |
| 36 QuicPacketCount max_tcp_congestion_window, | 36 QuicPacketCount max_tcp_congestion_window, |
| 37 QuicConnectionStats* stats); | 37 QuicConnectionStats* stats); |
| 38 ~TcpCubicSender() override; | 38 ~TcpCubicSender() override; |
| 39 | 39 |
| 40 // Start implementation of SendAlgorithmInterface. | 40 // Start implementation of SendAlgorithmInterface. |
| 41 void SetFromConfig(const QuicConfig& config, bool is_server) override; | 41 void SetFromConfig(const QuicConfig& config, bool is_server) override; |
| 42 void SetNumEmulatedConnections(int num_connections) override; | 42 void SetNumEmulatedConnections(int num_connections) override; |
| 43 void OnIncomingQuicCongestionFeedbackFrame( | |
| 44 const QuicCongestionFeedbackFrame& feedback, | |
| 45 QuicTime feedback_receive_time) override; | |
| 46 void OnCongestionEvent(bool rtt_updated, | 43 void OnCongestionEvent(bool rtt_updated, |
| 47 QuicByteCount bytes_in_flight, | 44 QuicByteCount bytes_in_flight, |
| 48 const CongestionVector& acked_packets, | 45 const CongestionVector& acked_packets, |
| 49 const CongestionVector& lost_packets) override; | 46 const CongestionVector& lost_packets) override; |
| 50 bool OnPacketSent(QuicTime sent_time, | 47 bool OnPacketSent(QuicTime sent_time, |
| 51 QuicByteCount bytes_in_flight, | 48 QuicByteCount bytes_in_flight, |
| 52 QuicPacketSequenceNumber sequence_number, | 49 QuicPacketSequenceNumber sequence_number, |
| 53 QuicByteCount bytes, | 50 QuicByteCount bytes, |
| 54 HasRetransmittableData is_retransmittable) override; | 51 HasRetransmittableData is_retransmittable) override; |
| 55 void OnRetransmissionTimeout(bool packets_retransmitted) override; | 52 void OnRetransmissionTimeout(bool packets_retransmitted) override; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 72 private: | 69 private: |
| 73 friend class test::TcpCubicSenderPeer; | 70 friend class test::TcpCubicSenderPeer; |
| 74 | 71 |
| 75 // TODO(ianswett): Remove these and migrate to OnCongestionEvent. | 72 // TODO(ianswett): Remove these and migrate to OnCongestionEvent. |
| 76 void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, | 73 void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, |
| 77 QuicByteCount acked_bytes, | 74 QuicByteCount acked_bytes, |
| 78 QuicByteCount bytes_in_flight); | 75 QuicByteCount bytes_in_flight); |
| 79 void OnPacketLost(QuicPacketSequenceNumber largest_loss, | 76 void OnPacketLost(QuicPacketSequenceNumber largest_loss, |
| 80 QuicByteCount bytes_in_flight); | 77 QuicByteCount bytes_in_flight); |
| 81 | 78 |
| 82 QuicByteCount SendWindow() const; | |
| 83 void MaybeIncreaseCwnd(QuicPacketSequenceNumber acked_sequence_number, | 79 void MaybeIncreaseCwnd(QuicPacketSequenceNumber acked_sequence_number, |
| 84 QuicByteCount bytes_in_flight); | 80 QuicByteCount bytes_in_flight); |
| 85 bool IsCwndLimited(QuicByteCount bytes_in_flight) const; | 81 bool IsCwndLimited(QuicByteCount bytes_in_flight) const; |
| 86 // Methods for isolating PRR from the rest of TCP Cubic. | 82 // Methods for isolating PRR from the rest of TCP Cubic. |
| 87 void PrrOnPacketLost(QuicByteCount bytes_in_flight); | 83 void PrrOnPacketLost(QuicByteCount bytes_in_flight); |
| 88 void PrrOnPacketAcked(QuicByteCount acked_bytes); | 84 void PrrOnPacketAcked(QuicByteCount acked_bytes); |
| 89 QuicTime::Delta PrrTimeUntilSend(QuicByteCount bytes_in_flight) const; | 85 QuicTime::Delta PrrTimeUntilSend(QuicByteCount bytes_in_flight) const; |
| 90 | 86 |
| 91 | 87 |
| 92 HybridSlowStart hybrid_slow_start_; | 88 HybridSlowStart hybrid_slow_start_; |
| 93 Cubic cubic_; | 89 Cubic cubic_; |
| 94 const RttStats* rtt_stats_; | 90 const RttStats* rtt_stats_; |
| 95 QuicConnectionStats* stats_; | 91 QuicConnectionStats* stats_; |
| 96 | 92 |
| 97 // If true, Reno congestion control is used instead of Cubic. | 93 // If true, Reno congestion control is used instead of Cubic. |
| 98 const bool reno_; | 94 const bool reno_; |
| 99 | 95 |
| 100 // Number of connections to simulate. | 96 // Number of connections to simulate. |
| 101 uint32 num_connections_; | 97 uint32 num_connections_; |
| 102 | 98 |
| 103 // ACK counter for the Reno implementation. | 99 // ACK counter for the Reno implementation. |
| 104 uint64 congestion_window_count_; | 100 uint64 congestion_window_count_; |
| 105 | 101 |
| 106 // Receiver side advertised window. | |
| 107 // TODO (jri): Change this variable name to receive_window_bytes_, to avoid | |
| 108 // confusion in operations with QuicPacketCount variables | |
| 109 // (eg., congestion_window_). | |
| 110 QuicByteCount receive_window_; | |
| 111 | |
| 112 // Bytes sent and acked since the last loss event. Used for PRR. | 102 // Bytes sent and acked since the last loss event. Used for PRR. |
| 113 QuicByteCount prr_out_; | 103 QuicByteCount prr_out_; |
| 114 QuicByteCount prr_delivered_; | 104 QuicByteCount prr_delivered_; |
| 115 size_t ack_count_since_loss_; | 105 size_t ack_count_since_loss_; |
| 116 | 106 |
| 117 // The congestion window before the last loss event. | 107 // The congestion window before the last loss event. |
| 118 QuicByteCount bytes_in_flight_before_loss_; | 108 QuicByteCount bytes_in_flight_before_loss_; |
| 119 | 109 |
| 120 // Track the largest packet that has been sent. | 110 // Track the largest packet that has been sent. |
| 121 QuicPacketSequenceNumber largest_sent_sequence_number_; | 111 QuicPacketSequenceNumber largest_sent_sequence_number_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 144 | 134 |
| 145 // Maximum number of outstanding packets for tcp. | 135 // Maximum number of outstanding packets for tcp. |
| 146 QuicPacketCount max_tcp_congestion_window_; | 136 QuicPacketCount max_tcp_congestion_window_; |
| 147 | 137 |
| 148 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); | 138 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender); |
| 149 }; | 139 }; |
| 150 | 140 |
| 151 } // namespace net | 141 } // namespace net |
| 152 | 142 |
| 153 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ | 143 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_ |
| OLD | NEW |