Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender.h

Issue 1785663003: Deprecate FLAG_quic_use_new_tcp_sender (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@115885351
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_H_
8 #define NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_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/send_algorithm_interface.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 TcpCubicSenderPeer;
30 } // namespace test
31
32 class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface {
33 public:
34 // Reno option and max_tcp_congestion_window are provided for testing.
35 TcpCubicSender(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 ~TcpCubicSender() override;
42
43 // Start implementation of SendAlgorithmInterface.
44 void SetFromConfig(const QuicConfig& config,
45 Perspective perspective) override;
46 void ResumeConnectionState(
47 const CachedNetworkParameters& cached_network_params,
48 bool max_bandwidth_resumption) override;
49 void SetNumEmulatedConnections(int num_connections) override;
50 void SetMaxCongestionWindow(QuicByteCount max_congestion_window) override;
51 void OnCongestionEvent(bool rtt_updated,
52 QuicByteCount bytes_in_flight,
53 const CongestionVector& acked_packets,
54 const CongestionVector& lost_packets) override;
55 bool OnPacketSent(QuicTime sent_time,
56 QuicByteCount bytes_in_flight,
57 QuicPacketNumber packet_number,
58 QuicByteCount bytes,
59 HasRetransmittableData is_retransmittable) override;
60 void OnRetransmissionTimeout(bool packets_retransmitted) override;
61 void OnConnectionMigration() override;
62 QuicTime::Delta TimeUntilSend(
63 QuicTime now,
64 QuicByteCount bytes_in_flight,
65 HasRetransmittableData has_retransmittable_data) const override;
66 QuicBandwidth PacingRate() const override;
67 QuicBandwidth BandwidthEstimate() const override;
68 QuicTime::Delta RetransmissionDelay() const override;
69 QuicByteCount GetCongestionWindow() const override;
70 bool InSlowStart() const override;
71 bool InRecovery() const override;
72 QuicByteCount GetSlowStartThreshold() const override;
73 CongestionControlType GetCongestionControlType() const override;
74 // End implementation of SendAlgorithmInterface.
75
76 private:
77 friend class test::TcpCubicSenderPeer;
78
79 // Compute the TCP Reno beta based on the current number of connections.
80 float RenoBeta() const;
81
82 // TODO(ianswett): Remove these and migrate to OnCongestionEvent.
83 void OnPacketAcked(QuicPacketNumber acked_packet_number,
84 QuicByteCount acked_bytes,
85 QuicByteCount bytes_in_flight);
86 void OnPacketLost(QuicPacketNumber largest_loss,
87 QuicByteCount bytes_in_flight);
88
89 void MaybeIncreaseCwnd(QuicPacketNumber acked_packet_number,
90 QuicByteCount bytes_in_flight);
91 bool IsCwndLimited(QuicByteCount bytes_in_flight) const;
92
93 HybridSlowStart hybrid_slow_start_;
94 Cubic cubic_;
95 PrrSender prr_;
96 const RttStats* rtt_stats_;
97 QuicConnectionStats* stats_;
98
99 // If true, Reno congestion control is used instead of Cubic.
100 const bool reno_;
101
102 // Number of connections to simulate.
103 uint32_t num_connections_;
104
105 // ACK counter for the Reno implementation.
106 uint64_t congestion_window_count_;
107
108 // Track the largest packet that has been sent.
109 QuicPacketNumber largest_sent_packet_number_;
110
111 // Track the largest packet that has been acked.
112 QuicPacketNumber largest_acked_packet_number_;
113
114 // Track the largest packet number outstanding when a CWND cutback occurs.
115 QuicPacketNumber largest_sent_at_last_cutback_;
116
117 // Congestion window in packets.
118 QuicPacketCount congestion_window_;
119
120 // Minimum congestion window in packets.
121 QuicPacketCount min_congestion_window_;
122
123 // Whether to use 4 packets as the actual min, but pace lower.
124 bool min4_mode_;
125
126 // Slow start congestion window in packets, aka ssthresh.
127 QuicPacketCount slowstart_threshold_;
128
129 // Whether the last loss event caused us to exit slowstart.
130 // Used for stats collection of slowstart_packets_lost
131 bool last_cutback_exited_slowstart_;
132
133 // Maximum number of outstanding packets for tcp.
134 QuicPacketCount max_tcp_congestion_window_;
135
136 // Initial TCP congestion window. This variable can only be set when this
137 // algorithm is created.
138 const QuicPacketCount initial_tcp_congestion_window_;
139
140 // Initial maximum TCP congestion window. This variable can only be set when
141 // this algorithm is created.
142 const QuicPacketCount initial_max_tcp_congestion_window_;
143
144 // When true, exit slow start with large cutback of congestion window.
145 bool slow_start_large_reduction_;
146
147 DISALLOW_COPY_AND_ASSIGN(TcpCubicSender);
148 };
149
150 } // namespace net
151
152 #endif // NET_QUIC_CONGESTION_CONTROL_TCP_CUBIC_SENDER_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_bytes_sender_test.cc ('k') | net/quic/congestion_control/tcp_cubic_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698