OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "net/quic/congestion_control/cubic.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // The following constants are in 2^10 fractions of a second instead of ms to | 21 // The following constants are in 2^10 fractions of a second instead of ms to |
22 // allow a 10 shift right to divide. | 22 // allow a 10 shift right to divide. |
23 const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3) | 23 const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3) |
24 // where 0.100 is 100 ms which is the scaling | 24 // where 0.100 is 100 ms which is the scaling |
25 // round trip time. | 25 // round trip time. |
26 const int kCubeCongestionWindowScale = 410; | 26 const int kCubeCongestionWindowScale = 410; |
27 const uint64 kCubeFactor = (GG_UINT64_C(1) << kCubeScale) / | 27 const uint64 kCubeFactor = (GG_UINT64_C(1) << kCubeScale) / |
28 kCubeCongestionWindowScale; | 28 kCubeCongestionWindowScale; |
29 | 29 |
30 const uint32 kNumConnections = 2; | 30 const uint32 kNumConnections = 2; |
31 const float kBeta = static_cast<float>(0.7); // Default Cubic backoff factor. | 31 const float kBeta = 0.7f; // Default Cubic backoff factor. |
32 // Additional backoff factor when loss occurs in the concave part of the Cubic | 32 // Additional backoff factor when loss occurs in the concave part of the Cubic |
33 // curve. This additional backoff factor is expected to give up bandwidth to | 33 // curve. This additional backoff factor is expected to give up bandwidth to |
34 // new concurrent flows and speed up convergence. | 34 // new concurrent flows and speed up convergence. |
35 const float kBetaLastMax = static_cast<float>(0.85); | 35 const float kBetaLastMax = 0.85f; |
36 | 36 |
37 // kNConnectionBeta is the backoff factor after loss for our N-connection | 37 // kNConnectionBeta is the backoff factor after loss for our N-connection |
38 // emulation, which emulates the effective backoff of an ensemble of N TCP-Reno | 38 // emulation, which emulates the effective backoff of an ensemble of N TCP-Reno |
39 // connections on a single loss event. The effective multiplier is computed as: | 39 // connections on a single loss event. The effective multiplier is computed as: |
40 const float kNConnectionBeta = (kNumConnections - 1 + kBeta) / kNumConnections; | 40 const float kNConnectionBeta = (kNumConnections - 1 + kBeta) / kNumConnections; |
41 | 41 |
42 // TCPFriendly alpha is described in Section 3.3 of the CUBIC paper. Note that | 42 // TCPFriendly alpha is described in Section 3.3 of the CUBIC paper. Note that |
43 // kBeta here is a cwnd multiplier, and is equal to 1-beta from the CUBIC paper. | 43 // kBeta here is a cwnd multiplier, and is equal to 1-beta from the CUBIC paper. |
44 // We derive the equivalent kNConnectionAlpha for an N-connection emulation as: | 44 // We derive the equivalent kNConnectionAlpha for an N-connection emulation as: |
45 const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections * | 45 const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections * |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // Compute target congestion_window based on cubic target and estimated TCP | 148 // Compute target congestion_window based on cubic target and estimated TCP |
149 // congestion_window, use highest (fastest). | 149 // congestion_window, use highest (fastest). |
150 if (target_congestion_window < estimated_tcp_congestion_window_) { | 150 if (target_congestion_window < estimated_tcp_congestion_window_) { |
151 target_congestion_window = estimated_tcp_congestion_window_; | 151 target_congestion_window = estimated_tcp_congestion_window_; |
152 } | 152 } |
153 DVLOG(1) << "Target congestion_window:" << target_congestion_window; | 153 DVLOG(1) << "Target congestion_window:" << target_congestion_window; |
154 return target_congestion_window; | 154 return target_congestion_window; |
155 } | 155 } |
156 | 156 |
157 } // namespace net | 157 } // namespace net |
OLD | NEW |