6b13f685e
김민수
BSP 최초 추가
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
#include <linux/module.h>
#include <net/tcp.h>
static const struct hstcp_aimd_val {
unsigned int cwnd;
unsigned int md;
} hstcp_aimd_vals[] = {
{ 38, 128, },
{ 118, 112, },
{ 221, 104, },
{ 347, 98, },
{ 495, 93, },
{ 663, 89, },
{ 851, 86, },
{ 1058, 83, },
{ 1284, 81, },
{ 1529, 78, },
{ 1793, 76, },
{ 2076, 74, },
{ 2378, 72, },
{ 2699, 71, },
{ 3039, 69, },
{ 3399, 68, },
{ 3778, 66, },
{ 4177, 65, },
{ 4596, 64, },
{ 5036, 62, },
{ 5497, 61, },
{ 5979, 60, },
{ 6483, 59, },
{ 7009, 58, },
{ 7558, 57, },
{ 8130, 56, },
{ 8726, 55, },
{ 9346, 54, },
{ 9991, 53, },
{ 10661, 52, },
{ 11358, 52, },
{ 12082, 51, },
{ 12834, 50, },
{ 13614, 49, },
{ 14424, 48, },
{ 15265, 48, },
{ 16137, 47, },
{ 17042, 46, },
{ 17981, 45, },
{ 18955, 45, },
{ 19965, 44, },
{ 21013, 43, },
{ 22101, 43, },
{ 23230, 42, },
{ 24402, 41, },
{ 25618, 41, },
{ 26881, 40, },
{ 28193, 39, },
{ 29557, 39, },
{ 30975, 38, },
{ 32450, 38, },
{ 33986, 37, },
{ 35586, 36, },
{ 37253, 36, },
{ 38992, 35, },
{ 40808, 35, },
{ 42707, 34, },
{ 44694, 33, },
{ 46776, 33, },
{ 48961, 32, },
{ 51258, 32, },
{ 53677, 31, },
{ 56230, 30, },
{ 58932, 30, },
{ 61799, 29, },
{ 64851, 28, },
{ 68113, 28, },
{ 71617, 27, },
{ 75401, 26, },
{ 79517, 26, },
{ 84035, 25, },
{ 89053, 24, },
};
#define HSTCP_AIMD_MAX ARRAY_SIZE(hstcp_aimd_vals)
struct hstcp {
u32 ai;
};
static void hstcp_init(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
struct hstcp *ca = inet_csk_ca(sk);
ca->ai = 0;
tp->snd_cwnd_clamp = min_t(u32, tp->snd_cwnd_clamp, 0xffffffff/128);
}
static void hstcp_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight)
{
struct tcp_sock *tp = tcp_sk(sk);
struct hstcp *ca = inet_csk_ca(sk);
if (!tcp_is_cwnd_limited(sk, in_flight))
return;
if (tp->snd_cwnd <= tp->snd_ssthresh)
tcp_slow_start(tp, acked);
else {
if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) {
while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd &&
ca->ai < HSTCP_AIMD_MAX - 1)
ca->ai++;
} else if (ca->ai && tp->snd_cwnd <= hstcp_aimd_vals[ca->ai-1].cwnd) {
while (ca->ai && tp->snd_cwnd <= hstcp_aimd_vals[ca->ai-1].cwnd)
ca->ai--;
}
if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
tp->snd_cwnd_cnt += ca->ai + 1;
if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
tp->snd_cwnd_cnt -= tp->snd_cwnd;
tp->snd_cwnd++;
}
}
}
}
static u32 hstcp_ssthresh(struct sock *sk)
{
const struct tcp_sock *tp = tcp_sk(sk);
const struct hstcp *ca = inet_csk_ca(sk);
return max(tp->snd_cwnd - ((tp->snd_cwnd * hstcp_aimd_vals[ca->ai].md) >> 8), 2U);
}
static struct tcp_congestion_ops tcp_highspeed __read_mostly = {
.init = hstcp_init,
.ssthresh = hstcp_ssthresh,
.cong_avoid = hstcp_cong_avoid,
.min_cwnd = tcp_reno_min_cwnd,
.owner = THIS_MODULE,
.name = "highspeed"
};
static int __init hstcp_register(void)
{
BUILD_BUG_ON(sizeof(struct hstcp) > ICSK_CA_PRIV_SIZE);
return tcp_register_congestion_control(&tcp_highspeed);
}
static void __exit hstcp_unregister(void)
{
tcp_unregister_congestion_control(&tcp_highspeed);
}
module_init(hstcp_register);
module_exit(hstcp_unregister);
MODULE_AUTHOR("John Heffner");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("High Speed TCP");
|