1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-09-22 11:40:56 +03:00
Files
mvfst/quic/congestion_control/EcnL4sTracker.h
Joseph Beshay ac37a74094 Separate function for normalized l4s weight in EcnL4sTracker
Summary: As title. This exposes the l4s weight with and without rtt scaling. The normalized signal is useful for congestion controllers that are reacting to CE marks once per RTT. The unscaled signal is useful for other observers.

Reviewed By: mjoras

Differential Revision: D58022362

fbshipit-source-id: d1c65036dc632d683c71847b012a3ea55e34ebb5
2024-05-31 18:01:18 -07:00

42 lines
1.2 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <quic/congestion_control/PacketProcessor.h>
#include <quic/state/StateData.h>
namespace quic {
// This class tracks the L4S weight (alpha) according to the latest Prague
// Congestion Control Draft
// (https://datatracker.ietf.org/doc/draft-briscoe-iccrg-prague-congestion-control/)
class EcnL4sTracker : public PacketProcessor {
public:
explicit EcnL4sTracker(QuicConnectionStateBase& conn);
void onPacketAck(const AckEvent* FOLLY_NULLABLE /* ackEvent */) override;
// The latest l4s weight calculated by the tracker.
[[nodiscard]] double getL4sWeight() const;
// The latest l4s weight normalized by the RTT. This is the value
// the congestion controller uses to react to the ECN markings once per RTT.
[[nodiscard]] double getNormalizedL4sWeight() const;
private:
QuicConnectionStateBase& conn_;
std::chrono::microseconds rttVirt_;
double l4sWeight_{0.0};
TimePoint lastUpdateTime_{Clock::now()};
uint32_t lastECT1Echoed_{0};
uint32_t lastCEEchoed_{0};
};
} // namespace quic