diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-01 18:02:27 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-01 18:02:27 -0400 |
commit | ceeec3dc375e3b0618f16b34efc56fe093918f8b (patch) | |
tree | 2293d02721ee05131aaf1c60e4fba7e281585eec /net/ipv4/tcp_bic.c | |
parent | fbff868db3a4cc6a89d51da9a6d49b26c29d04fb (diff) | |
parent | e3ee3b78f83688a0ae4315e8be71b2eac559904a (diff) |
/spare/repo/netdev-2.6 branch 'ieee80211'
Diffstat (limited to 'net/ipv4/tcp_bic.c')
-rw-r--r-- | net/ipv4/tcp_bic.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c index ec38d45d6649..b940346de4e7 100644 --- a/net/ipv4/tcp_bic.c +++ b/net/ipv4/tcp_bic.c | |||
@@ -86,11 +86,11 @@ static inline void bictcp_reset(struct bictcp *ca) | |||
86 | ca->delayed_ack = 2 << ACK_RATIO_SHIFT; | 86 | ca->delayed_ack = 2 << ACK_RATIO_SHIFT; |
87 | } | 87 | } |
88 | 88 | ||
89 | static void bictcp_init(struct tcp_sock *tp) | 89 | static void bictcp_init(struct sock *sk) |
90 | { | 90 | { |
91 | bictcp_reset(tcp_ca(tp)); | 91 | bictcp_reset(inet_csk_ca(sk)); |
92 | if (initial_ssthresh) | 92 | if (initial_ssthresh) |
93 | tp->snd_ssthresh = initial_ssthresh; | 93 | tcp_sk(sk)->snd_ssthresh = initial_ssthresh; |
94 | } | 94 | } |
95 | 95 | ||
96 | /* | 96 | /* |
@@ -156,9 +156,10 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) | |||
156 | 156 | ||
157 | 157 | ||
158 | /* Detect low utilization in congestion avoidance */ | 158 | /* Detect low utilization in congestion avoidance */ |
159 | static inline void bictcp_low_utilization(struct tcp_sock *tp, int flag) | 159 | static inline void bictcp_low_utilization(struct sock *sk, int flag) |
160 | { | 160 | { |
161 | struct bictcp *ca = tcp_ca(tp); | 161 | const struct tcp_sock *tp = tcp_sk(sk); |
162 | struct bictcp *ca = inet_csk_ca(sk); | ||
162 | u32 dist, delay; | 163 | u32 dist, delay; |
163 | 164 | ||
164 | /* No time stamp */ | 165 | /* No time stamp */ |
@@ -208,12 +209,13 @@ static inline void bictcp_low_utilization(struct tcp_sock *tp, int flag) | |||
208 | 209 | ||
209 | } | 210 | } |
210 | 211 | ||
211 | static void bictcp_cong_avoid(struct tcp_sock *tp, u32 ack, | 212 | static void bictcp_cong_avoid(struct sock *sk, u32 ack, |
212 | u32 seq_rtt, u32 in_flight, int data_acked) | 213 | u32 seq_rtt, u32 in_flight, int data_acked) |
213 | { | 214 | { |
214 | struct bictcp *ca = tcp_ca(tp); | 215 | struct tcp_sock *tp = tcp_sk(sk); |
216 | struct bictcp *ca = inet_csk_ca(sk); | ||
215 | 217 | ||
216 | bictcp_low_utilization(tp, data_acked); | 218 | bictcp_low_utilization(sk, data_acked); |
217 | 219 | ||
218 | if (in_flight < tp->snd_cwnd) | 220 | if (in_flight < tp->snd_cwnd) |
219 | return; | 221 | return; |
@@ -242,9 +244,10 @@ static void bictcp_cong_avoid(struct tcp_sock *tp, u32 ack, | |||
242 | * behave like Reno until low_window is reached, | 244 | * behave like Reno until low_window is reached, |
243 | * then increase congestion window slowly | 245 | * then increase congestion window slowly |
244 | */ | 246 | */ |
245 | static u32 bictcp_recalc_ssthresh(struct tcp_sock *tp) | 247 | static u32 bictcp_recalc_ssthresh(struct sock *sk) |
246 | { | 248 | { |
247 | struct bictcp *ca = tcp_ca(tp); | 249 | const struct tcp_sock *tp = tcp_sk(sk); |
250 | struct bictcp *ca = inet_csk_ca(sk); | ||
248 | 251 | ||
249 | ca->epoch_start = 0; /* end of epoch */ | 252 | ca->epoch_start = 0; /* end of epoch */ |
250 | 253 | ||
@@ -269,31 +272,34 @@ static u32 bictcp_recalc_ssthresh(struct tcp_sock *tp) | |||
269 | return max((tp->snd_cwnd * beta) / BICTCP_BETA_SCALE, 2U); | 272 | return max((tp->snd_cwnd * beta) / BICTCP_BETA_SCALE, 2U); |
270 | } | 273 | } |
271 | 274 | ||
272 | static u32 bictcp_undo_cwnd(struct tcp_sock *tp) | 275 | static u32 bictcp_undo_cwnd(struct sock *sk) |
273 | { | 276 | { |
274 | struct bictcp *ca = tcp_ca(tp); | 277 | const struct tcp_sock *tp = tcp_sk(sk); |
275 | 278 | const struct bictcp *ca = inet_csk_ca(sk); | |
276 | return max(tp->snd_cwnd, ca->last_max_cwnd); | 279 | return max(tp->snd_cwnd, ca->last_max_cwnd); |
277 | } | 280 | } |
278 | 281 | ||
279 | static u32 bictcp_min_cwnd(struct tcp_sock *tp) | 282 | static u32 bictcp_min_cwnd(struct sock *sk) |
280 | { | 283 | { |
284 | const struct tcp_sock *tp = tcp_sk(sk); | ||
281 | return tp->snd_ssthresh; | 285 | return tp->snd_ssthresh; |
282 | } | 286 | } |
283 | 287 | ||
284 | static void bictcp_state(struct tcp_sock *tp, u8 new_state) | 288 | static void bictcp_state(struct sock *sk, u8 new_state) |
285 | { | 289 | { |
286 | if (new_state == TCP_CA_Loss) | 290 | if (new_state == TCP_CA_Loss) |
287 | bictcp_reset(tcp_ca(tp)); | 291 | bictcp_reset(inet_csk_ca(sk)); |
288 | } | 292 | } |
289 | 293 | ||
290 | /* Track delayed acknowledgement ratio using sliding window | 294 | /* Track delayed acknowledgement ratio using sliding window |
291 | * ratio = (15*ratio + sample) / 16 | 295 | * ratio = (15*ratio + sample) / 16 |
292 | */ | 296 | */ |
293 | static void bictcp_acked(struct tcp_sock *tp, u32 cnt) | 297 | static void bictcp_acked(struct sock *sk, u32 cnt) |
294 | { | 298 | { |
295 | if (cnt > 0 && tp->ca_state == TCP_CA_Open) { | 299 | const struct inet_connection_sock *icsk = inet_csk(sk); |
296 | struct bictcp *ca = tcp_ca(tp); | 300 | |
301 | if (cnt > 0 && icsk->icsk_ca_state == TCP_CA_Open) { | ||
302 | struct bictcp *ca = inet_csk_ca(sk); | ||
297 | cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; | 303 | cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; |
298 | ca->delayed_ack += cnt; | 304 | ca->delayed_ack += cnt; |
299 | } | 305 | } |
@@ -314,7 +320,7 @@ static struct tcp_congestion_ops bictcp = { | |||
314 | 320 | ||
315 | static int __init bictcp_register(void) | 321 | static int __init bictcp_register(void) |
316 | { | 322 | { |
317 | BUG_ON(sizeof(struct bictcp) > TCP_CA_PRIV_SIZE); | 323 | BUG_ON(sizeof(struct bictcp) > ICSK_CA_PRIV_SIZE); |
318 | return tcp_register_congestion_control(&bictcp); | 324 | return tcp_register_congestion_control(&bictcp); |
319 | } | 325 | } |
320 | 326 | ||