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.
5 // This class is a helper class to TcpCubicSender.
6 // Slow start is the initial startup phase of TCP, it lasts until first packet
7 // loss. This class implements hybrid slow start of the TCP cubic send side
8 // congestion algorithm. The key feaure of hybrid slow start is that it tries to
9 // avoid running into the wall too hard during the slow start phase, which
10 // the traditional TCP implementation does.
11 // http://netsrv.csc.ncsu.edu/export/hybridstart_pfldnet08.pdf
12 // http://research.csc.ncsu.edu/netsrv/sites/default/files/hystart_techreport_2008.pdf
14 #ifndef NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_
15 #define NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_
17 #include "base/basictypes.h"
18 #include "net/base/net_export.h"
19 #include "net/quic/quic_clock.h"
20 #include "net/quic/quic_protocol.h"
21 #include "net/quic/quic_time.h"
25 class NET_EXPORT_PRIVATE HybridSlowStart {
27 explicit HybridSlowStart(const QuicClock* clock);
29 // Start a new slow start phase.
32 // Returns true if this ack the last sequence number of our current slow start
34 // Call Reset if this returns true.
35 bool EndOfRound(QuicPacketSequenceNumber ack);
37 // Call for each round (burst) in the slow start phase.
38 void Reset(QuicPacketSequenceNumber end_sequence_number);
40 // rtt: it the RTT for this ack packet.
41 // delay_min: is the lowest delay (RTT) we have seen during the session.
42 void Update(QuicTime::Delta rtt, QuicTime::Delta delay_min);
44 // Returns true when we should exit slow start.
47 bool started() { return started_; }
50 const QuicClock* clock_;
52 bool found_ack_train_;
54 QuicTime round_start_; // Beginning of each slow start round.
55 QuicPacketSequenceNumber end_sequence_number_; // End of slow start round.
56 QuicTime last_time_; // Last time when the ACK spacing was close.
57 uint8 sample_count_; // Number of samples to decide current RTT.
58 QuicTime::Delta current_rtt_; // The minimum rtt of current round.
60 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart);
65 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_