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 // This does not implement ack train detection because it interacts poorly with
13 // http://netsrv.csc.ncsu.edu/export/hybridstart_pfldnet08.pdf
14 // http://research.csc.ncsu.edu/netsrv/sites/default/files/hystart_techreport_2008.pdf
16 #ifndef NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_
17 #define NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_
19 #include "base/basictypes.h"
20 #include "net/base/net_export.h"
21 #include "net/quic/quic_protocol.h"
22 #include "net/quic/quic_time.h"
26 class NET_EXPORT_PRIVATE HybridSlowStart
{
30 void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number
,
33 void OnPacketSent(QuicPacketSequenceNumber sequence_number
);
35 // ShouldExitSlowStart should be called on every new ack frame, since a new
36 // RTT measurement can be made then.
37 // rtt: the RTT for this ack packet.
38 // min_rtt: is the lowest delay (RTT) we have seen during the session.
39 // congestion_window: the congestion window in packets.
40 bool ShouldExitSlowStart(QuicTime::Delta rtt
,
41 QuicTime::Delta min_rtt
,
42 QuicPacketCount congestion_window
);
44 // Start a new slow start phase.
47 // TODO(ianswett): The following methods should be private, but that requires
48 // a follow up CL to update the unit test.
49 // Returns true if this ack the last sequence number of our current slow start
51 // Call Reset if this returns true.
52 bool IsEndOfRound(QuicPacketSequenceNumber ack
) const;
54 // Call for the start of each receive round (burst) in the slow start phase.
55 void StartReceiveRound(QuicPacketSequenceNumber last_sent
);
57 // Whether slow start has started.
58 bool started() const {
63 // Whether a condition for exiting slow start has been found.
66 DELAY
, // Too much increase in the round's min_rtt was observed.
69 // Whether the hybrid slow start has been started.
71 HystartState hystart_found_
;
72 // Last sequence number sent which was CWND limited.
73 QuicPacketSequenceNumber last_sent_sequence_number_
;
75 // Variables for tracking acks received during a slow start round.
76 QuicPacketSequenceNumber end_sequence_number_
; // End of the receive round.
77 uint32 rtt_sample_count_
; // Number of rtt samples in the current round.
78 QuicTime::Delta current_min_rtt_
; // The minimum rtt of current round.
80 DISALLOW_COPY_AND_ASSIGN(HybridSlowStart
);
85 #endif // NET_QUIC_CONGESTION_CONTROL_HYBRID_SLOW_START_H_