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