aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_lp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_lp.c')
-rw-r--r--net/ipv4/tcp_lp.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index 1f977b6ee9a1..f0ebaf0e21cb 100644
--- a/net/ipv4/tcp_lp.c
+++ b/net/ipv4/tcp_lp.c
@@ -3,13 +3,8 @@
3 * 3 *
4 * TCP Low Priority is a distributed algorithm whose goal is to utilize only 4 * TCP Low Priority is a distributed algorithm whose goal is to utilize only
5 * the excess network bandwidth as compared to the ``fair share`` of 5 * the excess network bandwidth as compared to the ``fair share`` of
6 * bandwidth as targeted by TCP. Available from: 6 * bandwidth as targeted by TCP.
7 * http://www.ece.rice.edu/~akuzma/Doc/akuzma/TCP-LP.pdf
8 * 7 *
9 * Original Author:
10 * Aleksandar Kuzmanovic <akuzma@northwestern.edu>
11 *
12 * See http://www-ece.rice.edu/networks/TCP-LP/ for their implementation.
13 * As of 2.6.13, Linux supports pluggable congestion control algorithms. 8 * As of 2.6.13, Linux supports pluggable congestion control algorithms.
14 * Due to the limitation of the API, we take the following changes from 9 * Due to the limitation of the API, we take the following changes from
15 * the original TCP-LP implementation: 10 * the original TCP-LP implementation:
@@ -24,14 +19,20 @@
24 * o OWD is handled in relative format, where local time stamp will in 19 * o OWD is handled in relative format, where local time stamp will in
25 * tcp_time_stamp format. 20 * tcp_time_stamp format.
26 * 21 *
27 * Port from 2.4.19 to 2.6.16 as module by: 22 * Original Author:
28 * Wong Hoi Sing Edison <hswong3i@gmail.com> 23 * Aleksandar Kuzmanovic <akuzma@northwestern.edu>
29 * Hung Hing Lun <hlhung3i@gmail.com> 24 * Available from:
25 * http://www.ece.rice.edu/~akuzma/Doc/akuzma/TCP-LP.pdf
26 * Original implementation for 2.4.19:
27 * http://www-ece.rice.edu/networks/TCP-LP/
30 * 28 *
31 * Version: $Id: tcp_lp.c,v 1.22 2006-05-02 18:18:19 hswong3i Exp $ 29 * 2.6.x module Authors:
30 * Wong Hoi Sing, Edison <hswong3i@gmail.com>
31 * Hung Hing Lun, Mike <hlhung3i@gmail.com>
32 * SourceForge project page:
33 * http://tcp-lp-mod.sourceforge.net/
32 */ 34 */
33 35
34#include <linux/config.h>
35#include <linux/module.h> 36#include <linux/module.h>
36#include <net/tcp.h> 37#include <net/tcp.h>
37 38
@@ -153,16 +154,19 @@ static u32 tcp_lp_remote_hz_estimator(struct sock *sk)
153 if (m < 0) 154 if (m < 0)
154 m = -m; 155 m = -m;
155 156
156 if (rhz != 0) { 157 if (rhz > 0) {
157 m -= rhz >> 6; /* m is now error in remote HZ est */ 158 m -= rhz >> 6; /* m is now error in remote HZ est */
158 rhz += m; /* 63/64 old + 1/64 new */ 159 rhz += m; /* 63/64 old + 1/64 new */
159 } else 160 } else
160 rhz = m << 6; 161 rhz = m << 6;
161 162
163 out:
162 /* record time for successful remote HZ calc */ 164 /* record time for successful remote HZ calc */
163 lp->flag |= LP_VALID_RHZ; 165 if ((rhz >> 6) > 0)
166 lp->flag |= LP_VALID_RHZ;
167 else
168 lp->flag &= ~LP_VALID_RHZ;
164 169
165 out:
166 /* record reference time stamp */ 170 /* record reference time stamp */
167 lp->remote_ref_time = tp->rx_opt.rcv_tsval; 171 lp->remote_ref_time = tp->rx_opt.rcv_tsval;
168 lp->local_ref_time = tp->rx_opt.rcv_tsecr; 172 lp->local_ref_time = tp->rx_opt.rcv_tsecr;
@@ -321,7 +325,7 @@ static struct tcp_congestion_ops tcp_lp = {
321 325
322static int __init tcp_lp_register(void) 326static int __init tcp_lp_register(void)
323{ 327{
324 BUG_ON(sizeof(struct lp) > ICSK_CA_PRIV_SIZE); 328 BUILD_BUG_ON(sizeof(struct lp) > ICSK_CA_PRIV_SIZE);
325 return tcp_register_congestion_control(&tcp_lp); 329 return tcp_register_congestion_control(&tcp_lp);
326} 330}
327 331
@@ -333,6 +337,6 @@ static void __exit tcp_lp_unregister(void)
333module_init(tcp_lp_register); 337module_init(tcp_lp_register);
334module_exit(tcp_lp_unregister); 338module_exit(tcp_lp_unregister);
335 339
336MODULE_AUTHOR("Wong Hoi Sing Edison, Hung Hing Lun"); 340MODULE_AUTHOR("Wong Hoi Sing Edison, Hung Hing Lun Mike");
337MODULE_LICENSE("GPL"); 341MODULE_LICENSE("GPL");
338MODULE_DESCRIPTION("TCP Low Priority"); 342MODULE_DESCRIPTION("TCP Low Priority");