aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_highspeed.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_highspeed.c')
-rw-r--r--net/ipv4/tcp_highspeed.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c
index 1120245b2373..c4fc811bf377 100644
--- a/net/ipv4/tcp_highspeed.c
+++ b/net/ipv4/tcp_highspeed.c
@@ -6,7 +6,6 @@
6 * John Heffner <jheffner@psc.edu> 6 * John Heffner <jheffner@psc.edu>
7 */ 7 */
8 8
9#include <linux/config.h>
10#include <linux/module.h> 9#include <linux/module.h>
11#include <net/tcp.h> 10#include <net/tcp.h>
12 11
@@ -140,14 +139,19 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt,
140 tp->snd_cwnd++; 139 tp->snd_cwnd++;
141 } 140 }
142 } else { 141 } else {
143 /* Update AIMD parameters */ 142 /* Update AIMD parameters.
143 *
144 * We want to guarantee that:
145 * hstcp_aimd_vals[ca->ai-1].cwnd <
146 * snd_cwnd <=
147 * hstcp_aimd_vals[ca->ai].cwnd
148 */
144 if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) { 149 if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) {
145 while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd && 150 while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd &&
146 ca->ai < HSTCP_AIMD_MAX - 1) 151 ca->ai < HSTCP_AIMD_MAX - 1)
147 ca->ai++; 152 ca->ai++;
148 } else if (tp->snd_cwnd < hstcp_aimd_vals[ca->ai].cwnd) { 153 } else if (ca->ai && tp->snd_cwnd <= hstcp_aimd_vals[ca->ai-1].cwnd) {
149 while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd && 154 while (ca->ai && tp->snd_cwnd <= hstcp_aimd_vals[ca->ai-1].cwnd)
150 ca->ai > 0)
151 ca->ai--; 155 ca->ai--;
152 } 156 }
153 157
@@ -185,7 +189,7 @@ static struct tcp_congestion_ops tcp_highspeed = {
185 189
186static int __init hstcp_register(void) 190static int __init hstcp_register(void)
187{ 191{
188 BUG_ON(sizeof(struct hstcp) > ICSK_CA_PRIV_SIZE); 192 BUILD_BUG_ON(sizeof(struct hstcp) > ICSK_CA_PRIV_SIZE);
189 return tcp_register_congestion_control(&tcp_highspeed); 193 return tcp_register_congestion_control(&tcp_highspeed);
190} 194}
191 195