diff options
author | John Heffner <jheffner@psc.edu> | 2005-06-23 15:24:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-23 15:24:58 -0400 |
commit | a628d29b56d3f420bf3ff1d7543a9caf3ce3b994 (patch) | |
tree | 251238b1abe5f8c77922b0953b268c81abd04387 /net | |
parent | 8727076289ec55298a05cabddf02b374d13c1624 (diff) |
[TCP]: Add High Speed TCP congestion control module.
Sally Floyd's high speed TCP congestion control.
This is useful for comparison and research.
Signed-off-by: John Heffner <jheffner@psc.edu>
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/Kconfig | 11 | ||||
-rw-r--r-- | net/ipv4/Makefile | 1 | ||||
-rw-r--r-- | net/ipv4/tcp_highspeed.c | 181 |
3 files changed, 193 insertions, 0 deletions
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index adbe855d931a..910e25b65756 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -467,6 +467,17 @@ config TCP_CONG_WESTWOOD | |||
467 | TCP Westwood+ significantly increases fairness wrt TCP Reno in | 467 | TCP Westwood+ significantly increases fairness wrt TCP Reno in |
468 | wired networks and throughput over wireless links. | 468 | wired networks and throughput over wireless links. |
469 | 469 | ||
470 | config TCP_CONG_HSTCP | ||
471 | tristate "High Speed TCP" | ||
472 | depends on INET && EXPERIMENTAL | ||
473 | default n | ||
474 | ---help--- | ||
475 | Sally Floyd's High Speed TCP (RFC 3649) congestion control. | ||
476 | A modification to TCP's congestion control mechanism for use | ||
477 | with large congestion windows. A table indicates how much to | ||
478 | increase the congestion window by when an ACK is received. | ||
479 | For more detail see http://www.icir.org/floyd/hstcp.html | ||
480 | |||
470 | endmenu | 481 | endmenu |
471 | 482 | ||
472 | source "net/ipv4/ipvs/Kconfig" | 483 | source "net/ipv4/ipvs/Kconfig" |
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index dedfbe62a104..ddf5d7785bf4 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile | |||
@@ -33,6 +33,7 @@ obj-$(CONFIG_IP_TCPDIAG) += tcp_diag.o | |||
33 | obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o | 33 | obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o |
34 | obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o | 34 | obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o |
35 | obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o | 35 | obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o |
36 | obj-$(CONFIG_TCP_CONG_HSTCP) += tcp_highspeed.o | ||
36 | 37 | ||
37 | obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \ | 38 | obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \ |
38 | xfrm4_output.o | 39 | xfrm4_output.o |
diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c new file mode 100644 index 000000000000..36c51f8136bf --- /dev/null +++ b/net/ipv4/tcp_highspeed.c | |||
@@ -0,0 +1,181 @@ | |||
1 | /* | ||
2 | * Sally Floyd's High Speed TCP (RFC 3649) congestion control | ||
3 | * | ||
4 | * See http://www.icir.org/floyd/hstcp.html | ||
5 | * | ||
6 | * John Heffner <jheffner@psc.edu> | ||
7 | */ | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <net/tcp.h> | ||
12 | |||
13 | |||
14 | /* From AIMD tables from RFC 3649 appendix B, | ||
15 | * with fixed-point MD scaled <<8. | ||
16 | */ | ||
17 | static const struct hstcp_aimd_val { | ||
18 | unsigned int cwnd; | ||
19 | unsigned int md; | ||
20 | } hstcp_aimd_vals[] = { | ||
21 | { 38, 128, /* 0.50 */ }, | ||
22 | { 118, 112, /* 0.44 */ }, | ||
23 | { 221, 104, /* 0.41 */ }, | ||
24 | { 347, 98, /* 0.38 */ }, | ||
25 | { 495, 93, /* 0.37 */ }, | ||
26 | { 663, 89, /* 0.35 */ }, | ||
27 | { 851, 86, /* 0.34 */ }, | ||
28 | { 1058, 83, /* 0.33 */ }, | ||
29 | { 1284, 81, /* 0.32 */ }, | ||
30 | { 1529, 78, /* 0.31 */ }, | ||
31 | { 1793, 76, /* 0.30 */ }, | ||
32 | { 2076, 74, /* 0.29 */ }, | ||
33 | { 2378, 72, /* 0.28 */ }, | ||
34 | { 2699, 71, /* 0.28 */ }, | ||
35 | { 3039, 69, /* 0.27 */ }, | ||
36 | { 3399, 68, /* 0.27 */ }, | ||
37 | { 3778, 66, /* 0.26 */ }, | ||
38 | { 4177, 65, /* 0.26 */ }, | ||
39 | { 4596, 64, /* 0.25 */ }, | ||
40 | { 5036, 62, /* 0.25 */ }, | ||
41 | { 5497, 61, /* 0.24 */ }, | ||
42 | { 5979, 60, /* 0.24 */ }, | ||
43 | { 6483, 59, /* 0.23 */ }, | ||
44 | { 7009, 58, /* 0.23 */ }, | ||
45 | { 7558, 57, /* 0.22 */ }, | ||
46 | { 8130, 56, /* 0.22 */ }, | ||
47 | { 8726, 55, /* 0.22 */ }, | ||
48 | { 9346, 54, /* 0.21 */ }, | ||
49 | { 9991, 53, /* 0.21 */ }, | ||
50 | { 10661, 52, /* 0.21 */ }, | ||
51 | { 11358, 52, /* 0.20 */ }, | ||
52 | { 12082, 51, /* 0.20 */ }, | ||
53 | { 12834, 50, /* 0.20 */ }, | ||
54 | { 13614, 49, /* 0.19 */ }, | ||
55 | { 14424, 48, /* 0.19 */ }, | ||
56 | { 15265, 48, /* 0.19 */ }, | ||
57 | { 16137, 47, /* 0.19 */ }, | ||
58 | { 17042, 46, /* 0.18 */ }, | ||
59 | { 17981, 45, /* 0.18 */ }, | ||
60 | { 18955, 45, /* 0.18 */ }, | ||
61 | { 19965, 44, /* 0.17 */ }, | ||
62 | { 21013, 43, /* 0.17 */ }, | ||
63 | { 22101, 43, /* 0.17 */ }, | ||
64 | { 23230, 42, /* 0.17 */ }, | ||
65 | { 24402, 41, /* 0.16 */ }, | ||
66 | { 25618, 41, /* 0.16 */ }, | ||
67 | { 26881, 40, /* 0.16 */ }, | ||
68 | { 28193, 39, /* 0.16 */ }, | ||
69 | { 29557, 39, /* 0.15 */ }, | ||
70 | { 30975, 38, /* 0.15 */ }, | ||
71 | { 32450, 38, /* 0.15 */ }, | ||
72 | { 33986, 37, /* 0.15 */ }, | ||
73 | { 35586, 36, /* 0.14 */ }, | ||
74 | { 37253, 36, /* 0.14 */ }, | ||
75 | { 38992, 35, /* 0.14 */ }, | ||
76 | { 40808, 35, /* 0.14 */ }, | ||
77 | { 42707, 34, /* 0.13 */ }, | ||
78 | { 44694, 33, /* 0.13 */ }, | ||
79 | { 46776, 33, /* 0.13 */ }, | ||
80 | { 48961, 32, /* 0.13 */ }, | ||
81 | { 51258, 32, /* 0.13 */ }, | ||
82 | { 53677, 31, /* 0.12 */ }, | ||
83 | { 56230, 30, /* 0.12 */ }, | ||
84 | { 58932, 30, /* 0.12 */ }, | ||
85 | { 61799, 29, /* 0.12 */ }, | ||
86 | { 64851, 28, /* 0.11 */ }, | ||
87 | { 68113, 28, /* 0.11 */ }, | ||
88 | { 71617, 27, /* 0.11 */ }, | ||
89 | { 75401, 26, /* 0.10 */ }, | ||
90 | { 79517, 26, /* 0.10 */ }, | ||
91 | { 84035, 25, /* 0.10 */ }, | ||
92 | { 89053, 24, /* 0.10 */ }, | ||
93 | }; | ||
94 | |||
95 | #define HSTCP_AIMD_MAX ARRAY_SIZE(hstcp_aimd_vals) | ||
96 | |||
97 | struct hstcp { | ||
98 | u32 ai; | ||
99 | }; | ||
100 | |||
101 | static void hstcp_init(struct tcp_sock *tp) | ||
102 | { | ||
103 | struct hstcp *ca = tcp_ca(tp); | ||
104 | |||
105 | ca->ai = 0; | ||
106 | |||
107 | /* Ensure the MD arithmetic works. This is somewhat pedantic, | ||
108 | * since I don't think we will see a cwnd this large. :) */ | ||
109 | tp->snd_cwnd_clamp = min_t(u32, tp->snd_cwnd_clamp, 0xffffffff/128); | ||
110 | } | ||
111 | |||
112 | static void hstcp_cong_avoid(struct tcp_sock *tp, u32 adk, u32 rtt, | ||
113 | u32 in_flight, int good) | ||
114 | { | ||
115 | struct hstcp *ca = tcp_ca(tp); | ||
116 | |||
117 | if (in_flight < tp->snd_cwnd) | ||
118 | return; | ||
119 | |||
120 | if (tp->snd_cwnd <= tp->snd_ssthresh) { | ||
121 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) | ||
122 | tp->snd_cwnd++; | ||
123 | } else { | ||
124 | /* Update AIMD parameters */ | ||
125 | if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) { | ||
126 | while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd && | ||
127 | ca->ai < HSTCP_AIMD_MAX) | ||
128 | ca->ai++; | ||
129 | } else if (tp->snd_cwnd < hstcp_aimd_vals[ca->ai].cwnd) { | ||
130 | while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd && | ||
131 | ca->ai > 0) | ||
132 | ca->ai--; | ||
133 | } | ||
134 | |||
135 | /* Do additive increase */ | ||
136 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) { | ||
137 | tp->snd_cwnd_cnt += ca->ai; | ||
138 | if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { | ||
139 | tp->snd_cwnd++; | ||
140 | tp->snd_cwnd_cnt -= tp->snd_cwnd; | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | |||
146 | static u32 hstcp_ssthresh(struct tcp_sock *tp) | ||
147 | { | ||
148 | struct hstcp *ca = tcp_ca(tp); | ||
149 | |||
150 | /* Do multiplicative decrease */ | ||
151 | return max(tp->snd_cwnd - ((tp->snd_cwnd * hstcp_aimd_vals[ca->ai].md) >> 8), 2U); | ||
152 | } | ||
153 | |||
154 | |||
155 | static struct tcp_congestion_ops tcp_highspeed = { | ||
156 | .init = hstcp_init, | ||
157 | .ssthresh = hstcp_ssthresh, | ||
158 | .cong_avoid = hstcp_cong_avoid, | ||
159 | .min_cwnd = tcp_reno_min_cwnd, | ||
160 | |||
161 | .owner = THIS_MODULE, | ||
162 | .name = "highspeed" | ||
163 | }; | ||
164 | |||
165 | static int __init hstcp_register(void) | ||
166 | { | ||
167 | BUG_ON(sizeof(struct hstcp) > TCP_CA_PRIV_SIZE); | ||
168 | return tcp_register_congestion_control(&tcp_highspeed); | ||
169 | } | ||
170 | |||
171 | static void __exit hstcp_unregister(void) | ||
172 | { | ||
173 | tcp_unregister_congestion_control(&tcp_highspeed); | ||
174 | } | ||
175 | |||
176 | module_init(hstcp_register); | ||
177 | module_exit(hstcp_unregister); | ||
178 | |||
179 | MODULE_AUTHOR("John Heffner"); | ||
180 | MODULE_LICENSE("GPL"); | ||
181 | MODULE_DESCRIPTION("High Speed TCP"); | ||