netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix pushed_seq in keepalive / zero window probe timer
@ 2011-08-22  6:57 Li Yu
  2011-08-22 11:25 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Li Yu @ 2011-08-22  6:57 UTC (permalink / raw)
  Cc: netdev@vger.kernel.org, davem, ilpo.jarvinen


In tcp_write_wakeup(), we may split the probe segment since send window or mss is larger than it.
so I think that we should update tp->pushed_seq after tcp_fragment(), is it right? thanks.

Signed-off-by: Li Yu <raise.sail@gmail.com>
CC: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
CC: David S. Miller <davem@davemloft.net>
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 882e0b0..659a71f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2784,9 +2784,6 @@ int tcp_write_wakeup(struct sock *sk)
 		unsigned int mss = tcp_current_mss(sk);
 		unsigned int seg_size = tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq;
 
-		if (before(tp->pushed_seq, TCP_SKB_CB(skb)->end_seq))
-			tp->pushed_seq = TCP_SKB_CB(skb)->end_seq;
-
 		/* We are probing the opening of a window
 		 * but the window size is != 0
 		 * must have been a result SWS avoidance ( sender )
@@ -2803,8 +2800,11 @@ int tcp_write_wakeup(struct sock *sk)
 		TCP_SKB_CB(skb)->flags |= TCPHDR_PSH;
 		TCP_SKB_CB(skb)->when = tcp_time_stamp;
 		err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC);
-		if (!err)
+		if (!err) {
 			tcp_event_new_data_sent(sk, skb);
+			if (before(tp->pushed_seq, TCP_SKB_CB(skb)->end_seq))
+				tp->pushed_seq = TCP_SKB_CB(skb)->end_seq;
+		}
 		return err;
 	} else {
 		if (between(tp->snd_up, tp->snd_una + 1, tp->snd_una + 0xFFFF))


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix pushed_seq in keepalive / zero window probe timer
  2011-08-22  6:57 [PATCH] fix pushed_seq in keepalive / zero window probe timer Li Yu
@ 2011-08-22 11:25 ` Eric Dumazet
  2011-08-22 13:41   ` Li Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2011-08-22 11:25 UTC (permalink / raw)
  To: Li Yu; +Cc: netdev@vger.kernel.org, davem, ilpo.jarvinen

Le lundi 22 août 2011 à 14:57 +0800, Li Yu a écrit :
> In tcp_write_wakeup(), we may split the probe segment since send window or mss is larger than it.
> so I think that we should update tp->pushed_seq after tcp_fragment(), is it right? thanks.
> 

I am not sure what you want to fix.

Fact is the skb has the TCPHDR_PSH, even if tcp_transmit_skb() (or
tcp_fragment()) is/are not able to clone/split it.


> Signed-off-by: Li Yu <raise.sail@gmail.com>
> CC: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> CC: David S. Miller <davem@davemloft.net>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 882e0b0..659a71f 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -2784,9 +2784,6 @@ int tcp_write_wakeup(struct sock *sk)
>  		unsigned int mss = tcp_current_mss(sk);
>  		unsigned int seg_size = tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq;
>  
> -		if (before(tp->pushed_seq, TCP_SKB_CB(skb)->end_seq))
> -			tp->pushed_seq = TCP_SKB_CB(skb)->end_seq;
> -
>  		/* We are probing the opening of a window
>  		 * but the window size is != 0
>  		 * must have been a result SWS avoidance ( sender )
> @@ -2803,8 +2800,11 @@ int tcp_write_wakeup(struct sock *sk)
>  		TCP_SKB_CB(skb)->flags |= TCPHDR_PSH;
>  		TCP_SKB_CB(skb)->when = tcp_time_stamp;
>  		err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC);
> -		if (!err)
> +		if (!err) {
>  			tcp_event_new_data_sent(sk, skb);
> +			if (before(tp->pushed_seq, TCP_SKB_CB(skb)->end_seq))
> +				tp->pushed_seq = TCP_SKB_CB(skb)->end_seq;
> +		}
>  		return err;
>  	} else {
>  		if (between(tp->snd_up, tp->snd_una + 1, tp->snd_una + 0xFFFF))
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix pushed_seq in keepalive / zero window probe timer
  2011-08-22 11:25 ` Eric Dumazet
@ 2011-08-22 13:41   ` Li Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Li Yu @ 2011-08-22 13:41 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev@vger.kernel.org, davem, ilpo.jarvinen

2011/8/22 Eric Dumazet <eric.dumazet@gmail.com>:
> Le lundi 22 août 2011 à 14:57 +0800, Li Yu a écrit :
>> In tcp_write_wakeup(), we may split the probe segment since send window or mss is larger than it.
>> so I think that we should update tp->pushed_seq after tcp_fragment(), is it right? thanks.
>>
>
> I am not sure what you want to fix.
>
> Fact is the skb has the TCPHDR_PSH, even if tcp_transmit_skb() (or
> tcp_fragment()) is/are not able to clone/split it.
>
>

Indeed, you are right. The goal of this patch is to fix tp->pushed_seq
may point to unsent byte seq number.

>> Signed-off-by: Li Yu <raise.sail@gmail.com>
>> CC: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
>> CC: David S. Miller <davem@davemloft.net>
>> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
>> index 882e0b0..659a71f 100644
>> --- a/net/ipv4/tcp_output.c
>> +++ b/net/ipv4/tcp_output.c
>> @@ -2784,9 +2784,6 @@ int tcp_write_wakeup(struct sock *sk)
>>               unsigned int mss = tcp_current_mss(sk);
>>               unsigned int seg_size = tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq;
>>
>> -             if (before(tp->pushed_seq, TCP_SKB_CB(skb)->end_seq))
>> -                     tp->pushed_seq = TCP_SKB_CB(skb)->end_seq;
>> -
>>               /* We are probing the opening of a window
>>                * but the window size is != 0
>>                * must have been a result SWS avoidance ( sender )
>> @@ -2803,8 +2800,11 @@ int tcp_write_wakeup(struct sock *sk)
>>               TCP_SKB_CB(skb)->flags |= TCPHDR_PSH;
>>               TCP_SKB_CB(skb)->when = tcp_time_stamp;
>>               err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC);
>> -             if (!err)
>> +             if (!err) {
>>                       tcp_event_new_data_sent(sk, skb);
>> +                     if (before(tp->pushed_seq, TCP_SKB_CB(skb)->end_seq))
>> +                             tp->pushed_seq = TCP_SKB_CB(skb)->end_seq;
>> +             }
>>               return err;
>>       } else {
>>               if (between(tp->snd_up, tp->snd_una + 1, tp->snd_una + 0xFFFF))
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-22 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-22  6:57 [PATCH] fix pushed_seq in keepalive / zero window probe timer Li Yu
2011-08-22 11:25 ` Eric Dumazet
2011-08-22 13:41   ` Li Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).