diff options
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2900e58738cd..fefb46c16de7 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -601,26 +601,17 @@ void tcp_rcv_space_adjust(struct sock *sk) | |||
601 | if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf && | 601 | if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf && |
602 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { | 602 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { |
603 | int rcvmem, rcvbuf; | 603 | int rcvmem, rcvbuf; |
604 | u64 rcvwin; | 604 | u64 rcvwin, grow; |
605 | 605 | ||
606 | /* minimal window to cope with packet losses, assuming | 606 | /* minimal window to cope with packet losses, assuming |
607 | * steady state. Add some cushion because of small variations. | 607 | * steady state. Add some cushion because of small variations. |
608 | */ | 608 | */ |
609 | rcvwin = ((u64)copied << 1) + 16 * tp->advmss; | 609 | rcvwin = ((u64)copied << 1) + 16 * tp->advmss; |
610 | 610 | ||
611 | /* If rate increased by 25%, | 611 | /* Accommodate for sender rate increase (eg. slow start) */ |
612 | * assume slow start, rcvwin = 3 * copied | 612 | grow = rcvwin * (copied - tp->rcvq_space.space); |
613 | * If rate increased by 50%, | 613 | do_div(grow, tp->rcvq_space.space); |
614 | * assume sender can use 2x growth, rcvwin = 4 * copied | 614 | rcvwin += (grow << 1); |
615 | */ | ||
616 | if (copied >= | ||
617 | tp->rcvq_space.space + (tp->rcvq_space.space >> 2)) { | ||
618 | if (copied >= | ||
619 | tp->rcvq_space.space + (tp->rcvq_space.space >> 1)) | ||
620 | rcvwin <<= 1; | ||
621 | else | ||
622 | rcvwin += (rcvwin >> 1); | ||
623 | } | ||
624 | 615 | ||
625 | rcvmem = SKB_TRUESIZE(tp->advmss + MAX_TCP_HEADER); | 616 | rcvmem = SKB_TRUESIZE(tp->advmss + MAX_TCP_HEADER); |
626 | while (tcp_win_from_space(sk, rcvmem) < tp->advmss) | 617 | while (tcp_win_from_space(sk, rcvmem) < tp->advmss) |