| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/congestion_control/cubic_bytes.h" | 5 #include "net/quic/congestion_control/cubic_bytes.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 7 #include <algorithm> | 8 #include <algorithm> |
| 8 #include <cmath> | 9 #include <cmath> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
| 13 #include "net/quic/quic_time.h" | 14 #include "net/quic/quic_time.h" |
| 14 | 15 |
| 15 using std::max; | 16 using std::max; |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // Constants based on TCP defaults. | 22 // Constants based on TCP defaults. |
| 22 // The following constants are in 2^10 fractions of a second instead of ms to | 23 // The following constants are in 2^10 fractions of a second instead of ms to |
| 23 // allow a 10 shift right to divide. | 24 // allow a 10 shift right to divide. |
| 24 const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3) | 25 const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3) |
| 25 // where 0.100 is 100 ms which is the scaling | 26 // where 0.100 is 100 ms which is the scaling |
| 26 // round trip time. | 27 // round trip time. |
| 27 const int kCubeCongestionWindowScale = 410; | 28 const int kCubeCongestionWindowScale = 410; |
| 28 // The cube factor for packets in bytes. | 29 // The cube factor for packets in bytes. |
| 29 const uint64 kCubeFactor = (GG_UINT64_C(1) << kCubeScale) / | 30 const uint64 kCubeFactor = (UINT64_C(1) << kCubeScale) / |
| 30 kCubeCongestionWindowScale / kDefaultTCPMSS; | 31 kCubeCongestionWindowScale / kDefaultTCPMSS; |
| 31 | 32 |
| 32 const uint32 kDefaultNumConnections = 2; | 33 const uint32 kDefaultNumConnections = 2; |
| 33 const float kBeta = 0.7f; // Default Cubic backoff factor. | 34 const float kBeta = 0.7f; // Default Cubic backoff factor. |
| 34 // Additional backoff factor when loss occurs in the concave part of the Cubic | 35 // Additional backoff factor when loss occurs in the concave part of the Cubic |
| 35 // curve. This additional backoff factor is expected to give up bandwidth to | 36 // curve. This additional backoff factor is expected to give up bandwidth to |
| 36 // new concurrent flows and speed up convergence. | 37 // new concurrent flows and speed up convergence. |
| 37 const float kBetaLastMax = 0.85f; | 38 const float kBetaLastMax = 0.85f; |
| 38 | 39 |
| 39 } // namespace | 40 } // namespace |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // congestion_window, use highest (fastest). | 156 // congestion_window, use highest (fastest). |
| 156 if (target_congestion_window < estimated_tcp_congestion_window_) { | 157 if (target_congestion_window < estimated_tcp_congestion_window_) { |
| 157 target_congestion_window = estimated_tcp_congestion_window_; | 158 target_congestion_window = estimated_tcp_congestion_window_; |
| 158 } | 159 } |
| 159 | 160 |
| 160 DVLOG(1) << "Target congestion_window: " << target_congestion_window; | 161 DVLOG(1) << "Target congestion_window: " << target_congestion_window; |
| 161 return target_congestion_window; | 162 return target_congestion_window; |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace net | 165 } // namespace net |
| OLD | NEW |