diff options
-rw-r--r-- | include/net/tcp.h | 22 | ||||
-rw-r--r-- | net/ipv4/tcp_cong.c | 21 |
2 files changed, 22 insertions, 21 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 306580ce1e53..7de4ea3a04d9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -786,27 +786,7 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp) | |||
786 | { | 786 | { |
787 | return tp->snd_una + tp->snd_wnd; | 787 | return tp->snd_una + tp->snd_wnd; |
788 | } | 788 | } |
789 | 789 | extern int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); | |
790 | /* RFC2861 Check whether we are limited by application or congestion window | ||
791 | * This is the inverse of cwnd check in tcp_tso_should_defer | ||
792 | */ | ||
793 | static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | ||
794 | { | ||
795 | const struct tcp_sock *tp = tcp_sk(sk); | ||
796 | u32 left; | ||
797 | |||
798 | if (in_flight >= tp->snd_cwnd) | ||
799 | return 1; | ||
800 | |||
801 | if (!sk_can_gso(sk)) | ||
802 | return 0; | ||
803 | |||
804 | left = tp->snd_cwnd - in_flight; | ||
805 | if (sysctl_tcp_tso_win_divisor) | ||
806 | return left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd; | ||
807 | else | ||
808 | return left <= tcp_max_burst(tp); | ||
809 | } | ||
810 | 790 | ||
811 | static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, | 791 | static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, |
812 | const struct sk_buff *skb) | 792 | const struct sk_buff *skb) |
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 4451750b478c..3a6be23d222f 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -274,6 +274,27 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) | |||
274 | return err; | 274 | return err; |
275 | } | 275 | } |
276 | 276 | ||
277 | /* RFC2861 Check whether we are limited by application or congestion window | ||
278 | * This is the inverse of cwnd check in tcp_tso_should_defer | ||
279 | */ | ||
280 | int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | ||
281 | { | ||
282 | const struct tcp_sock *tp = tcp_sk(sk); | ||
283 | u32 left; | ||
284 | |||
285 | if (in_flight >= tp->snd_cwnd) | ||
286 | return 1; | ||
287 | |||
288 | if (!sk_can_gso(sk)) | ||
289 | return 0; | ||
290 | |||
291 | left = tp->snd_cwnd - in_flight; | ||
292 | if (sysctl_tcp_tso_win_divisor) | ||
293 | return left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd; | ||
294 | else | ||
295 | return left <= tcp_max_burst(tp); | ||
296 | } | ||
297 | EXPORT_SYMBOL_GPL(tcp_is_cwnd_limited); | ||
277 | 298 | ||
278 | /* | 299 | /* |
279 | * Slow start is used when congestion window is less than slow start | 300 | * Slow start is used when congestion window is less than slow start |