gfe-relnote: (n/a) Deprecate --gfe2_reloadable_flag_quic_mtu_discovery_v2. PiperOrigin-RevId: 282836116 Change-Id: I00dc26c5fe75410109913ce7897b4b129c8880ba
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index d4ba114..ed1fac4 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -308,10 +308,7 @@ perspective_(perspective), connected_(true), can_truncate_connection_ids_(perspective == Perspective::IS_SERVER), - mtu_discovery_target_(0), mtu_probe_count_(0), - packets_between_mtu_probes_(kPacketsBetweenMtuProbesBase), - next_mtu_probe_at_(kPacketsBetweenMtuProbesBase), largest_received_packet_size_(0), write_error_occurred_(false), no_stop_waiting_frames_( @@ -336,7 +333,6 @@ treat_queued_packets_as_sent_( GetQuicReloadableFlag(quic_treat_queued_packets_as_sent) || version().CanSendCoalescedPackets()), - mtu_discovery_v2_(GetQuicReloadableFlag(quic_mtu_discovery_v2)), quic_version_negotiated_by_default_at_server_( GetQuicReloadableFlag(quic_version_negotiated_by_default_at_server)), use_handshake_delegate_( @@ -2376,17 +2372,13 @@ // In some cases, an MTU probe can cause EMSGSIZE. This indicates that the // MTU discovery is permanently unsuccessful. if (IsMsgTooBig(result) && looks_like_mtu_probe) { - if (mtu_discovery_v2_) { - // When MSG_TOO_BIG is returned, the system typically knows what the - // actual MTU is, so there is no need to probe further. - // TODO(wub): Reduce max packet size to a safe default, or the actual MTU. - QUIC_DVLOG(1) << ENDPOINT << " MTU probe packet too big, size:" - << packet->encrypted_length - << ", long_term_mtu_:" << long_term_mtu_; - mtu_discoverer_.Disable(); - } else { - mtu_discovery_target_ = 0; - } + // When MSG_TOO_BIG is returned, the system typically knows what the + // actual MTU is, so there is no need to probe further. + // TODO(wub): Reduce max packet size to a safe default, or the actual MTU. + QUIC_DVLOG(1) << ENDPOINT << " MTU probe packet too big, size:" + << packet->encrypted_length + << ", long_term_mtu_:" << long_term_mtu_; + mtu_discoverer_.Disable(); mtu_discovery_alarm_->Cancel(); // The write failed, but the writer is not blocked, so return true. return true; @@ -2612,10 +2604,8 @@ if (packet_size > max_packet_length()) { const QuicByteCount old_max_packet_length = max_packet_length(); SetMaxPacketLength(packet_size); - if (mtu_discovery_v2_) { - mtu_discoverer_.OnMaxPacketLengthUpdated(old_max_packet_length, - max_packet_length()); - } + mtu_discoverer_.OnMaxPacketLengthUpdated(old_max_packet_length, + max_packet_length()); } } @@ -3279,35 +3269,11 @@ } void QuicConnection::MaybeSetMtuAlarm(QuicPacketNumber sent_packet_number) { - if (mtu_discovery_v2_) { - if (mtu_discovery_alarm_->IsSet() || - !mtu_discoverer_.ShouldProbeMtu(sent_packet_number)) { - return; - } - mtu_discovery_alarm_->Set(clock_->ApproximateNow()); + if (mtu_discovery_alarm_->IsSet() || + !mtu_discoverer_.ShouldProbeMtu(sent_packet_number)) { return; } - - // Do not set the alarm if the target size is less than the current size. - // This covers the case when |mtu_discovery_target_| is at its default value, - // zero. - if (mtu_discovery_target_ <= max_packet_length()) { - return; - } - - if (mtu_probe_count_ >= kMtuDiscoveryAttempts) { - return; - } - - if (mtu_discovery_alarm_->IsSet()) { - return; - } - - if (sent_packet_number >= next_mtu_probe_at_) { - // Use an alarm to send the MTU probe to ensure that no ScopedPacketFlushers - // are active. - mtu_discovery_alarm_->Set(clock_->ApproximateNow()); - } + mtu_discovery_alarm_->Set(clock_->ApproximateNow()); } void QuicConnection::MaybeSetAckAlarmTo(QuicTime time) { @@ -3450,13 +3416,8 @@ void QuicConnection::SetMtuDiscoveryTarget(QuicByteCount target) { QUIC_DVLOG(2) << ENDPOINT << "SetMtuDiscoveryTarget: " << target; - if (mtu_discovery_v2_) { - mtu_discoverer_.Disable(); - mtu_discoverer_.Enable(max_packet_length(), - GetLimitedMaxPacketSize(target)); - } else { - mtu_discovery_target_ = GetLimitedMaxPacketSize(target); - } + mtu_discoverer_.Disable(); + mtu_discoverer_.Enable(max_packet_length(), GetLimitedMaxPacketSize(target)); } QuicByteCount QuicConnection::GetLimitedMaxPacketSize( @@ -3625,35 +3586,13 @@ void QuicConnection::DiscoverMtu() { DCHECK(!mtu_discovery_alarm_->IsSet()); - if (mtu_discovery_v2_) { - const QuicPacketNumber largest_sent_packet = - sent_packet_manager_.GetLargestSentPacket(); - if (mtu_discoverer_.ShouldProbeMtu(largest_sent_packet)) { - ++mtu_probe_count_; - SendMtuDiscoveryPacket( - mtu_discoverer_.GetUpdatedMtuProbeSize(largest_sent_packet)); - } - DCHECK(!mtu_discovery_alarm_->IsSet()); - return; + const QuicPacketNumber largest_sent_packet = + sent_packet_manager_.GetLargestSentPacket(); + if (mtu_discoverer_.ShouldProbeMtu(largest_sent_packet)) { + ++mtu_probe_count_; + SendMtuDiscoveryPacket( + mtu_discoverer_.GetUpdatedMtuProbeSize(largest_sent_packet)); } - - // Check if the MTU has been already increased. - if (mtu_discovery_target_ <= max_packet_length()) { - return; - } - - // Calculate the packet number of the next probe *before* sending the current - // one. Otherwise, when SendMtuDiscoveryPacket() is called, - // MaybeSetMtuAlarm() will not realize that the probe has been just sent, and - // will reschedule this probe again. - packets_between_mtu_probes_ *= 2; - next_mtu_probe_at_ = sent_packet_manager_.GetLargestSentPacket() + - packets_between_mtu_probes_ + 1; - ++mtu_probe_count_; - - QUIC_DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; - SendMtuDiscoveryPacket(mtu_discovery_target_); - DCHECK(!mtu_discovery_alarm_->IsSet()); }
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h index a99f401..2fcc604 100644 --- a/quic/core/quic_connection.h +++ b/quic/core/quic_connection.h
@@ -747,8 +747,7 @@ virtual void SendConnectivityProbingResponsePacket( const QuicSocketAddress& peer_address); - // Sends an MTU discovery packet of size |mtu_discovery_target_| and updates - // the MTU discovery alarm. + // Sends an MTU discovery packet and updates the MTU discovery alarm. void DiscoverMtu(); // Sets the session notifier on the SentPacketManager. @@ -1409,19 +1408,9 @@ // version negotiation packet. ParsedQuicVersionVector server_supported_versions_; - // The size of the packet we are targeting while doing path MTU discovery. - QuicByteCount mtu_discovery_target_; - // The number of MTU probes already sent. size_t mtu_probe_count_; - // The number of packets between MTU probes. - QuicPacketCount packets_between_mtu_probes_; - - // The packet number of the packet after which the next MTU probe will be - // sent. - QuicPacketNumber next_mtu_probe_at_; - // The value of the MTU regularly used by the connection. This is different // from the value returned by max_packet_size(), as max_packet_size() returns // the value of the MTU as currently used by the serializer, so if @@ -1533,9 +1522,6 @@ // Latched value of quic_treat_queued_packets_as_sent. const bool treat_queued_packets_as_sent_; - // Latched value of quic_mtu_discovery_v2. - const bool mtu_discovery_v2_; - // Only used if quic_mtu_discovery_v2 is true. QuicConnectionMtuDiscoverer mtu_discoverer_; // Latched value of quic_version_negotiated_by_default_at_server.
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc index e1a304b..0c6c542 100644 --- a/quic/core/quic_connection_test.cc +++ b/quic/core/quic_connection_test.cc
@@ -1566,16 +1566,9 @@ void set_packets_between_probes_base( const QuicPacketCount packets_between_probes_base) { - if (GetQuicReloadableFlag(quic_mtu_discovery_v2)) { - QuicConnectionPeer::ReInitializeMtuDiscoverer( - &connection_, packets_between_probes_base, - QuicPacketNumber(packets_between_probes_base)); - } else { - QuicConnectionPeer::SetPacketsBetweenMtuProbes( - &connection_, packets_between_probes_base); - QuicConnectionPeer::SetNextMtuProbeAt( - &connection_, QuicPacketNumber(packets_between_probes_base)); - } + QuicConnectionPeer::ReInitializeMtuDiscoverer( + &connection_, packets_between_probes_base, + QuicPacketNumber(packets_between_probes_base)); } bool IsDefaultTestConfiguration() { @@ -4894,12 +4887,9 @@ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) .WillOnce(SaveArg<3>(&probe_size)); connection_.GetMtuDiscoveryAlarm()->Fire(); - if (GetQuicReloadableFlag(quic_mtu_discovery_v2)) { - EXPECT_THAT(probe_size, InRange(connection_.max_packet_length(), - kMtuDiscoveryTargetPacketSizeHigh)); - } else { - EXPECT_EQ(kMtuDiscoveryTargetPacketSizeHigh, probe_size); - } + + EXPECT_THAT(probe_size, InRange(connection_.max_packet_length(), + kMtuDiscoveryTargetPacketSizeHigh)); const QuicPacketNumber probe_packet_number = FirstSendingPacketNumber() + packets_between_probes_base; @@ -4915,17 +4905,6 @@ EXPECT_EQ(1u, connection_.mtu_probe_count()); - if (!GetQuicReloadableFlag(quic_mtu_discovery_v2)) { - // Send more packets, and ensure that none of them sets the alarm. - for (QuicPacketCount i = 0; i < 4 * packets_between_probes_base; i++) { - SendStreamDataToPeer(3, ".", packets_between_probes_base + i, NO_FIN, - nullptr); - ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet()); - } - - return; - } - QuicStreamOffset stream_offset = packets_between_probes_base; for (size_t num_probes = 1; num_probes < kMtuDiscoveryAttempts; ++num_probes) { @@ -5083,9 +5062,6 @@ // Probe 3 times, the first one succeeds, then fails, then succeeds again. TEST_P(QuicConnectionTest, MtuDiscoverySecondProbeFailed) { - if (!GetQuicReloadableFlag(quic_mtu_discovery_v2)) { - return; - } MtuDiscoveryTestInit(); const QuicPacketCount packets_between_probes_base = 5; @@ -5198,12 +5174,8 @@ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) .WillOnce(SaveArg<3>(&probe_size)); connection_.GetMtuDiscoveryAlarm()->Fire(); - if (GetQuicReloadableFlag(quic_mtu_discovery_v2)) { - EXPECT_THAT(probe_size, - InRange(connection_.max_packet_length(), mtu_limit)); - } else { - EXPECT_EQ(mtu_limit, probe_size); - } + + EXPECT_THAT(probe_size, InRange(connection_.max_packet_length(), mtu_limit)); const QuicPacketNumber probe_sequence_number = FirstSendingPacketNumber() + packets_between_probes_base; @@ -5219,17 +5191,6 @@ EXPECT_EQ(1u, connection_.mtu_probe_count()); - if (!GetQuicReloadableFlag(quic_mtu_discovery_v2)) { - // Send more packets, and ensure that none of them sets the alarm. - for (QuicPacketCount i = 0; i < 4 * packets_between_probes_base; i++) { - SendStreamDataToPeer(3, ".", packets_between_probes_base + i, NO_FIN, - nullptr); - ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet()); - } - - return; - } - QuicStreamOffset stream_offset = packets_between_probes_base; for (size_t num_probes = 1; num_probes < kMtuDiscoveryAttempts; ++num_probes) {
diff --git a/quic/core/quic_mtu_discovery.cc b/quic/core/quic_mtu_discovery.cc index c89b41a..bbf18b6 100644 --- a/quic/core/quic_mtu_discovery.cc +++ b/quic/core/quic_mtu_discovery.cc
@@ -77,10 +77,8 @@ // The next probe packet is as big as the previous one. Assuming the // previous one exceeded MTU, we need to decrease the probe packet length. max_probe_length_ = probe_packet_length; - QUIC_RELOADABLE_FLAG_COUNT_N(quic_mtu_discovery_v2, 1, 3); } else { DCHECK_GT(probe_packet_length, last_probe_length_); - QUIC_RELOADABLE_FLAG_COUNT_N(quic_mtu_discovery_v2, 2, 3); } last_probe_length_ = next_probe_packet_length(); @@ -125,7 +123,6 @@ DCHECK_EQ(old_value, min_probe_length_); min_probe_length_ = new_value; - QUIC_RELOADABLE_FLAG_COUNT_N(quic_mtu_discovery_v2, 3, 3); } std::ostream& operator<<(std::ostream& os,
diff --git a/quic/test_tools/quic_connection_peer.cc b/quic/test_tools/quic_connection_peer.cc index d48ff05..79fc7e3 100644 --- a/quic/test_tools/quic_connection_peer.cc +++ b/quic/test_tools/quic_connection_peer.cc
@@ -212,22 +212,7 @@ // static QuicPacketCount QuicConnectionPeer::GetPacketsBetweenMtuProbes( QuicConnection* connection) { - if (connection->mtu_discovery_v2_) { - return connection->mtu_discoverer_.packets_between_probes(); - } - return connection->packets_between_mtu_probes_; -} - -// static -void QuicConnectionPeer::SetPacketsBetweenMtuProbes(QuicConnection* connection, - QuicPacketCount packets) { - connection->packets_between_mtu_probes_ = packets; -} - -// static -void QuicConnectionPeer::SetNextMtuProbeAt(QuicConnection* connection, - QuicPacketNumber number) { - connection->next_mtu_probe_at_ = number; + return connection->mtu_discoverer_.packets_between_probes(); } // static
diff --git a/quic/test_tools/quic_connection_peer.h b/quic/test_tools/quic_connection_peer.h index 8eb1c40..3ded2e0 100644 --- a/quic/test_tools/quic_connection_peer.h +++ b/quic/test_tools/quic_connection_peer.h
@@ -102,10 +102,6 @@ static QuicPacketCount GetPacketsBetweenMtuProbes(QuicConnection* connection); - static void SetPacketsBetweenMtuProbes(QuicConnection* connection, - QuicPacketCount packets); - static void SetNextMtuProbeAt(QuicConnection* connection, - QuicPacketNumber number); static void ReInitializeMtuDiscoverer( QuicConnection* connection, QuicPacketCount packets_between_probes_base,