Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1032)

Side by Side Diff: net/quic/core/congestion_control/bbr_sender.cc

Issue 2848633002: Fix packet conservation logic in QUIC BBR. Protected by FLAGS_quic_reloadable_flag_quic_bbr_fix_co… (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/core/congestion_control/bbr_sender_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/core/congestion_control/bbr_sender.h" 5 #include "net/quic/core/congestion_control/bbr_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "net/quic/core/congestion_control/rtt_stats.h" 10 #include "net/quic/core/congestion_control/rtt_stats.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 // Exit recovery when there are no losses for a round. 546 // Exit recovery when there are no losses for a round.
547 if (has_losses) { 547 if (has_losses) {
548 end_recovery_at_ = last_sent_packet_; 548 end_recovery_at_ = last_sent_packet_;
549 } 549 }
550 550
551 switch (recovery_state_) { 551 switch (recovery_state_) {
552 case NOT_IN_RECOVERY: 552 case NOT_IN_RECOVERY:
553 // Enter conservation on the first loss. 553 // Enter conservation on the first loss.
554 if (has_losses) { 554 if (has_losses) {
555 recovery_state_ = CONSERVATION; 555 recovery_state_ = CONSERVATION;
556 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation) {
557 // This will cause the |recovery_window_| to be set to the correct
558 // value in CalculateRecoveryWindow().
559 recovery_window_ = 0;
560 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation, 1,
561 3);
562 }
556 // Since the conservation phase is meant to be lasting for a whole 563 // Since the conservation phase is meant to be lasting for a whole
557 // round, extend the current round as if it were started right now. 564 // round, extend the current round as if it were started right now.
558 current_round_trip_end_ = last_sent_packet_; 565 current_round_trip_end_ = last_sent_packet_;
559 } 566 }
560 break; 567 break;
561 568
562 case CONSERVATION: 569 case CONSERVATION:
563 if (is_round_start) { 570 if (is_round_start) {
564 recovery_state_ = GROWTH; 571 recovery_state_ = GROWTH;
565 } 572 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 712 }
706 713
707 // Enforce the limits on the congestion window. 714 // Enforce the limits on the congestion window.
708 congestion_window_ = std::max(congestion_window_, kMinimumCongestionWindow); 715 congestion_window_ = std::max(congestion_window_, kMinimumCongestionWindow);
709 congestion_window_ = std::min(congestion_window_, max_congestion_window_); 716 congestion_window_ = std::min(congestion_window_, max_congestion_window_);
710 } 717 }
711 718
712 void BbrSender::CalculateRecoveryWindow(QuicByteCount bytes_acked) { 719 void BbrSender::CalculateRecoveryWindow(QuicByteCount bytes_acked) {
713 switch (recovery_state_) { 720 switch (recovery_state_) {
714 case CONSERVATION: 721 case CONSERVATION:
715 recovery_window_ = unacked_packets_->bytes_in_flight() + bytes_acked; 722 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation) {
723 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation, 2, 3);
724 recovery_window_ =
725 std::max(unacked_packets_->bytes_in_flight() + bytes_acked,
726 recovery_window_);
727 } else {
728 recovery_window_ = unacked_packets_->bytes_in_flight() + bytes_acked;
729 }
716 break; 730 break;
717 case GROWTH: 731 case GROWTH:
718 recovery_window_ = unacked_packets_->bytes_in_flight() + 2 * bytes_acked; 732 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation) {
733 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation, 3, 3);
734 recovery_window_ =
735 std::max(unacked_packets_->bytes_in_flight() + 2 * bytes_acked,
736 recovery_window_ + bytes_acked);
737 } else {
738 recovery_window_ =
739 unacked_packets_->bytes_in_flight() + 2 * bytes_acked;
740 }
719 break; 741 break;
720 default: 742 default:
721 break; 743 break;
722 } 744 }
723 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_); 745 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_);
724 } 746 }
725 747
726 std::string BbrSender::GetDebugState() const { 748 std::string BbrSender::GetDebugState() const {
727 std::ostringstream stream; 749 std::ostringstream stream;
728 stream << ExportDebugState(); 750 stream << ExportDebugState();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() 804 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue()
783 << std::endl; 805 << std::endl;
784 806
785 os << "Last sample is app-limited: " 807 os << "Last sample is app-limited: "
786 << (state.last_sample_is_app_limited ? "yes" : "no"); 808 << (state.last_sample_is_app_limited ? "yes" : "no");
787 809
788 return os; 810 return os;
789 } 811 }
790 812
791 } // namespace net 813 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/core/congestion_control/bbr_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698