Skip to contentSkip to conversation

fix pushed_seq in keepalive / zero window probe timer

PATCH In review Li Yu 2 participants 3 messages Aug 22, 2011

Subsystems (3)
lore
Share & tools
lore

Li Yu

author
#0 lore raw

PATCH 1/1 fix pushed_seq in keepalive / zero window probe timer

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.

CC Ilpo Järvinen <[email protected]>
CC David S. Miller <[email protected]>
net/ipv4/tcp_output.c +4 -4
index 882e0b0..659a71f 100644
@@ -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))
#1 lore raw
Quoted 3 lines · Li Yu

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.

Quoted 35 lines
CC Ilpo Järvinen <[email protected]>
CC David S. Miller <[email protected]>
net/ipv4/tcp_output.c +4 -5
index 882e0b0..659a71f 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw

2011/8/22 Eric Dumazet <[email protected]>:

Quoted 11 lines · Li Yu
Quoted 3 lines

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.

Quoted 38 lines
Quoted 35 lines
CC Ilpo Järvinen <[email protected]>
CC David S. Miller <[email protected]>
net/ipv4/tcp_output.c +4 -5
index 882e0b0..659a71f 100644
@@ -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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html