gfe-relnote: In QUIC, add probe timeout mode, which unifies TLP and RTO. Protected by gfe2_reloadable_flag_quic_enable_pto.

PTO mode is enabled on client side if gfe2_reloadable_flag_quic_enable_pto is true and client sends 1PTO or 2PTO. PTO mode is enabled on server side if gfe2_reloadable_flag_quic_enable_pto is true and server receives 1PTO or 2PTO from client.

Connection is closed after 7 or 8 PTO depending on connection option 7PTO or 8PTO, respectively.

PiperOrigin-RevId: 263574963
Change-Id: Id952a3e4640146c3fe72e3d6745cbac5ee16dcdc
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h
index 1373646..ee285e8 100644
--- a/quic/core/quic_sent_packet_manager.h
+++ b/quic/core/quic_sent_packet_manager.h
@@ -103,6 +103,9 @@
     // Re-invoke the loss detection when a packet is not acked before the
     // loss detection algorithm expects.
     LOSS_MODE,
+    // A probe timeout. At least one probe packet must be sent when timer
+    // expires.
+    PTO_MODE,
   };
 
   QuicSentPacketManager(Perspective perspective,
@@ -337,6 +340,8 @@
 
   size_t GetConsecutiveTlpCount() const { return consecutive_tlp_count_; }
 
+  size_t GetConsecutivePtoCount() const { return consecutive_pto_count_; }
+
   void OnApplicationLimited();
 
   const SendAlgorithmInterface* GetSendAlgorithm() const {
@@ -390,6 +395,12 @@
   // Setting the send algorithm once the connection is underway is dangerous.
   void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm);
 
+  // Sends up to max_probe_packets_per_pto_ probe packets.
+  void MaybeSendProbePackets();
+
+  // Called to adjust pending_timer_transmission_count_ accordingly.
+  void AdjustPendingTimerTransmissions();
+
   bool supports_multiple_packet_number_spaces() const {
     return unacked_packets_.supports_multiple_packet_number_spaces();
   }
@@ -400,6 +411,8 @@
 
   bool fix_rto_retransmission() const { return fix_rto_retransmission_; }
 
+  bool enable_pto() const { return enable_pto_; }
+
  private:
   friend class test::QuicConnectionPeer;
   friend class test::QuicSentPacketManagerPeer;
@@ -445,6 +458,9 @@
     return GetRetransmissionDelay(consecutive_rto_count_);
   }
 
+  // Returns the probe timeout.
+  const QuicTime::Delta GetProbeTimeoutDelay() const;
+
   // Returns the newest transmission associated with a packet.
   QuicPacketNumber GetNewestRetransmission(
       QuicPacketNumber packet_number,
@@ -623,6 +639,15 @@
   // OnAckRangeStart, and gradually moves in OnAckRange..
   PacketNumberQueue::const_reverse_iterator acked_packets_iter_;
 
+  // If true, enable PTO mode which unifies TLP and RTO modes.
+  bool enable_pto_;
+
+  // Maximum number of probes to send when PTO fires.
+  size_t max_probe_packets_per_pto_;
+
+  // Number of times the PTO timer has fired in a row without receiving an ack.
+  size_t consecutive_pto_count_;
+
   // Latched value of quic_loss_removes_from_inflight.
   const bool loss_removes_from_inflight_;