blob: df3f9a747c78db7da0015fb22cee35da37840a12 [file] [log] [blame]
QUICHE team7872c772019-07-23 10:19:37 -04001// Copyright 2019 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#ifndef QUICHE_QUIC_CORE_CONGESTION_CONTROL_BBR2_STARTUP_H_
6#define QUICHE_QUIC_CORE_CONGESTION_CONTROL_BBR2_STARTUP_H_
7
8#include "net/third_party/quiche/src/quic/core/congestion_control/bbr2_misc.h"
9#include "net/third_party/quiche/src/quic/core/quic_bandwidth.h"
10#include "net/third_party/quiche/src/quic/core/quic_time.h"
11#include "net/third_party/quiche/src/quic/core/quic_types.h"
12#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
13
14namespace quic {
15
16class Bbr2Sender;
17class QUIC_EXPORT_PRIVATE Bbr2StartupMode final : public Bbr2ModeBase {
18 public:
19 Bbr2StartupMode(const Bbr2Sender* sender, Bbr2NetworkModel* model);
20
21 void Enter(const Bbr2CongestionEvent& congestion_event) override;
22
23 Bbr2Mode OnCongestionEvent(
24 QuicByteCount prior_in_flight,
25 QuicTime event_time,
26 const AckedPacketVector& acked_packets,
27 const LostPacketVector& lost_packets,
28 const Bbr2CongestionEvent& congestion_event) override;
29
30 Limits<QuicByteCount> GetCwndLimits() const override {
31 return NoGreaterThan(model_->inflight_lo());
32 }
33
34 bool IsProbingForBandwidth() const override { return true; }
35
36 bool FullBandwidthReached() const { return full_bandwidth_reached_; }
37
38 struct DebugState {
39 bool full_bandwidth_reached;
40 QuicBandwidth full_bandwidth_baseline = QuicBandwidth::Zero();
41 QuicRoundTripCount round_trips_without_bandwidth_growth;
42 };
43
44 DebugState ExportDebugState() const;
45
46 private:
47 const Bbr2Params& Params() const;
48
49 void CheckFullBandwidthReached(const Bbr2CongestionEvent& congestion_event);
50
51 void CheckExcessiveLosses(const LostPacketVector& lost_packets,
52 const Bbr2CongestionEvent& congestion_event);
53
54 bool full_bandwidth_reached_;
55 QuicBandwidth full_bandwidth_baseline_;
56 QuicRoundTripCount rounds_without_bandwidth_growth_;
57
58 // Number of loss events in the current round trip.
59 int64_t loss_events_in_round_;
60};
61
62QUIC_EXPORT_PRIVATE std::ostream& operator<<(
63 std::ostream& os,
64 const Bbr2StartupMode::DebugState& state);
65
66} // namespace quic
67
68#endif // QUICHE_QUIC_CORE_CONGESTION_CONTROL_BBR2_STARTUP_H_