diff options
Diffstat (limited to 'net/ipv4/tcp_westwood.c')
-rw-r--r-- | net/ipv4/tcp_westwood.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c index 0c340c3756c2..29eb258b6d82 100644 --- a/net/ipv4/tcp_westwood.c +++ b/net/ipv4/tcp_westwood.c | |||
@@ -162,12 +162,6 @@ static inline u32 westwood_acked_count(struct sock *sk) | |||
162 | return w->cumul_ack; | 162 | return w->cumul_ack; |
163 | } | 163 | } |
164 | 164 | ||
165 | static inline u32 westwood_bw_rttmin(const struct sock *sk) | ||
166 | { | ||
167 | const struct tcp_sock *tp = tcp_sk(sk); | ||
168 | const struct westwood *w = inet_csk_ca(sk); | ||
169 | return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2); | ||
170 | } | ||
171 | 165 | ||
172 | /* | 166 | /* |
173 | * TCP Westwood | 167 | * TCP Westwood |
@@ -175,9 +169,11 @@ static inline u32 westwood_bw_rttmin(const struct sock *sk) | |||
175 | * in packets we use mss_cache). Rttmin is guaranteed to be >= 2 | 169 | * in packets we use mss_cache). Rttmin is guaranteed to be >= 2 |
176 | * so avoids ever returning 0. | 170 | * so avoids ever returning 0. |
177 | */ | 171 | */ |
178 | static u32 tcp_westwood_cwnd_min(struct sock *sk) | 172 | static u32 tcp_westwood_bw_rttmin(const struct sock *sk) |
179 | { | 173 | { |
180 | return westwood_bw_rttmin(sk); | 174 | const struct tcp_sock *tp = tcp_sk(sk); |
175 | const struct westwood *w = inet_csk_ca(sk); | ||
176 | return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2); | ||
181 | } | 177 | } |
182 | 178 | ||
183 | static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) | 179 | static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) |
@@ -191,11 +187,11 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) | |||
191 | break; | 187 | break; |
192 | 188 | ||
193 | case CA_EVENT_COMPLETE_CWR: | 189 | case CA_EVENT_COMPLETE_CWR: |
194 | tp->snd_cwnd = tp->snd_ssthresh = westwood_bw_rttmin(sk); | 190 | tp->snd_cwnd = tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk); |
195 | break; | 191 | break; |
196 | 192 | ||
197 | case CA_EVENT_FRTO: | 193 | case CA_EVENT_FRTO: |
198 | tp->snd_ssthresh = westwood_bw_rttmin(sk); | 194 | tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk); |
199 | break; | 195 | break; |
200 | 196 | ||
201 | case CA_EVENT_SLOW_ACK: | 197 | case CA_EVENT_SLOW_ACK: |
@@ -235,7 +231,7 @@ static struct tcp_congestion_ops tcp_westwood = { | |||
235 | .init = tcp_westwood_init, | 231 | .init = tcp_westwood_init, |
236 | .ssthresh = tcp_reno_ssthresh, | 232 | .ssthresh = tcp_reno_ssthresh, |
237 | .cong_avoid = tcp_reno_cong_avoid, | 233 | .cong_avoid = tcp_reno_cong_avoid, |
238 | .min_cwnd = tcp_westwood_cwnd_min, | 234 | .min_cwnd = tcp_westwood_bw_rttmin, |
239 | .cwnd_event = tcp_westwood_event, | 235 | .cwnd_event = tcp_westwood_event, |
240 | .get_info = tcp_westwood_info, | 236 | .get_info = tcp_westwood_info, |
241 | .pkts_acked = tcp_westwood_pkts_acked, | 237 | .pkts_acked = tcp_westwood_pkts_acked, |