Internal QUICHE change PiperOrigin-RevId: 305876425 Change-Id: I9f527f30c7ea89351757d12be6036fe274d1b792
diff --git a/quic/core/congestion_control/general_loss_algorithm.cc b/quic/core/congestion_control/general_loss_algorithm.cc index 7354f50..d54f620 100644 --- a/quic/core/congestion_control/general_loss_algorithm.cc +++ b/quic/core/congestion_control/general_loss_algorithm.cc
@@ -15,7 +15,7 @@ GeneralLossAlgorithm::GeneralLossAlgorithm() : loss_detection_timeout_(QuicTime::Zero()), reordering_shift_(kDefaultLossDelayShift), - reordering_threshold_(kNumberOfNacksBeforeRetransmission), + reordering_threshold_(kDefaultPacketReorderingThreshold), use_adaptive_reordering_threshold_(true), use_adaptive_time_threshold_(false), use_packet_threshold_for_runt_packets_(true),
diff --git a/quic/core/congestion_control/general_loss_algorithm.h b/quic/core/congestion_control/general_loss_algorithm.h index 046a01d..b9e5d8e 100644 --- a/quic/core/congestion_control/general_loss_algorithm.h +++ b/quic/core/congestion_control/general_loss_algorithm.h
@@ -11,6 +11,7 @@ #include "net/third_party/quiche/src/quic/core/congestion_control/loss_detection_interface.h" #include "net/third_party/quiche/src/quic/core/quic_packets.h" #include "net/third_party/quiche/src/quic/core/quic_time.h" +#include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/core/quic_unacked_packet_map.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" @@ -21,9 +22,6 @@ // Also implements TCP's early retransmit(RFC5827). class QUIC_EXPORT_PRIVATE GeneralLossAlgorithm : public LossDetectionInterface { public: - // TCP retransmits after 3 nacks. - static const QuicPacketCount kNumberOfNacksBeforeRetransmission = 3; - GeneralLossAlgorithm(); GeneralLossAlgorithm(const GeneralLossAlgorithm&) = delete; GeneralLossAlgorithm& operator=(const GeneralLossAlgorithm&) = delete; @@ -69,6 +67,8 @@ void Reset(); + QuicPacketCount reordering_threshold() const { return reordering_threshold_; } + int reordering_shift() const { return reordering_shift_; } void set_reordering_shift(int reordering_shift) {
diff --git a/quic/core/congestion_control/uber_loss_algorithm.cc b/quic/core/congestion_control/uber_loss_algorithm.cc index 0bbc2b1..5059a81 100644 --- a/quic/core/congestion_control/uber_loss_algorithm.cc +++ b/quic/core/congestion_control/uber_loss_algorithm.cc
@@ -139,6 +139,10 @@ } } +QuicPacketCount UberLossAlgorithm::GetPacketReorderingThreshold() const { + return general_loss_algorithms_[APPLICATION_DATA].reordering_threshold(); +} + void UberLossAlgorithm::DisablePacketThresholdForRuntPackets() { for (int8_t i = INITIAL_DATA; i < NUM_PACKET_NUMBER_SPACES; ++i) { general_loss_algorithms_[i].disable_packet_threshold_for_runt_packets();
diff --git a/quic/core/congestion_control/uber_loss_algorithm.h b/quic/core/congestion_control/uber_loss_algorithm.h index 29d68ae..1b1c1e8 100644 --- a/quic/core/congestion_control/uber_loss_algorithm.h +++ b/quic/core/congestion_control/uber_loss_algorithm.h
@@ -6,6 +6,7 @@ #define QUICHE_QUIC_CORE_CONGESTION_CONTROL_UBER_LOSS_ALGORITHM_H_ #include "net/third_party/quiche/src/quic/core/congestion_control/general_loss_algorithm.h" +#include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -88,6 +89,10 @@ // Enable adaptive time threshold of all packet number spaces. void EnableAdaptiveTimeThreshold(); + // Get the packet reordering threshold from the APPLICATION_DATA PN space. + // Always 3 when adaptive reordering is not enabled. + QuicPacketCount GetPacketReorderingThreshold() const; + // Disable packet threshold loss detection for *runt* packets. void DisablePacketThresholdForRuntPackets();
diff --git a/quic/core/quic_constants.h b/quic/core/quic_constants.h index 15f0abb..b6b6c74 100644 --- a/quic/core/quic_constants.h +++ b/quic/core/quic_constants.h
@@ -250,6 +250,9 @@ // Default initial rtt used before any samples are received. const int kInitialRttMs = 100; +// Default threshold of packet reordering before a packet is declared lost. +static const QuicPacketCount kDefaultPacketReorderingThreshold = 3; + // Default fraction (1/4) of an RTT the algorithm waits before determining a // packet is lost due to early retransmission by time based loss detection. static const int kDefaultLossDelayShift = 2;
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc index b5c15db..3f290ae 100644 --- a/quic/core/quic_sent_packet_manager.cc +++ b/quic/core/quic_sent_packet_manager.cc
@@ -77,7 +77,7 @@ debug_delegate_(nullptr), network_change_visitor_(nullptr), initial_congestion_window_(kInitialCongestionWindow), - loss_algorithm_(GetInitialLossAlgorithm()), + loss_algorithm_(&uber_loss_algorithm_), consecutive_rto_count_(0), consecutive_tlp_count_(0), consecutive_crypto_retransmission_count_(0), @@ -114,10 +114,6 @@ SetSendAlgorithm(congestion_control_type); } -LossDetectionInterface* QuicSentPacketManager::GetInitialLossAlgorithm() { - return &uber_loss_algorithm_; -} - QuicSentPacketManager::~QuicSentPacketManager() {} void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h index 5f1de70..54cf737 100644 --- a/quic/core/quic_sent_packet_manager.h +++ b/quic/core/quic_sent_packet_manager.h
@@ -366,6 +366,10 @@ return unacked_packets_; } + const UberLossAlgorithm* uber_loss_algorithm() const { + return &uber_loss_algorithm_; + } + // Sets the send algorithm to the given congestion control type and points the // pacing sender at |send_algorithm_|. Can be called any number of times. void SetSendAlgorithm(CongestionControlType congestion_control_type); @@ -490,9 +494,6 @@ // Sets the initial RTT of the connection. void SetInitialRtt(QuicTime::Delta rtt); - // Should only be called from constructor. - LossDetectionInterface* GetInitialLossAlgorithm(); - // Called when handshake is confirmed to remove the retransmittable frames // from all packets of HANDSHAKE_DATA packet number space to ensure they don't // get retransmitted and will eventually be removed from unacked packets map.