Re: Re: Re: Re: limited network bandwidth with 3.2.x kernels

Eric Dumazet
2012-02-21T18:41:27Z

Le vendredi 17 février 2012 à 11:41 -0500, Neal Cardwell a écrit :
> On Thu, Feb 16, 2012 at 5:35 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > An incoming skb is considered as "good citizen" in term of memory usage
> > if its truesize is no more than
> > len + len/4 (if adv_win_scale == 2)
> >
> > That was true when truesize was 1500+NET_SKB_PAD+sizeof(sk_buff),
> > but not true anymore when truesize is 2048+sizeof(sk_buff), or even more
> > when its 4096+sizeof(sk_buff)
> >
> > So receiver doesnt increase rcv_ssthresh and cannot open its window.
> >
> > tcp_grow_window() should be tweaked to :
> >
> > 1) Relax the requirements
> > 2) Allow bigger increase in case of super packets (LRO/GRO)
>
> That sounds great. Is this something you're planning on tackling?
>

Hmm, I thought about following (untested) patch :

Idea is to increase rcv_sshthresh by 2*len * (len/truesize), instead of
2*mss.

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 53c8ce4..3fcea17 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -327,11 +327,17 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)
/* Check #2. Increase window, if skb with such overhead
* will fit to rcvbuf in future.
*/
- if (tcp_win_from_space(skb->truesize) <= skb->len)
- incr = 2 * tp->advmss;
- else
- incr = __tcp_grow_window(sk, skb);
+ if (tp->rx_opt.rcv_wscale) {
+ u64 scaled = (u64)skb->len * skb->len;

+ do_div(scaled, skb->truesize >> 1);
+ incr = (int)scaled;
+ } else {
+ if (tcp_win_from_space(skb->truesize) <= skb->len)
+ incr = 2 * tp->advmss;
+ else
+ incr = __tcp_grow_window(sk, skb);
+ }
if (incr) {
tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr,
tp->window_clamp);