Skip to contentSkip to conversation

2.6.10 TCP troubles -- suggested patch

DISCUSSION Hubert Tonneau 3 participants 3 messages Feb 10, 2005 – Feb 11, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

It does not seem to solve the problem:
. Linux 2.6.9 takes 15 seconds to copy 105 MB to the Mac OSX . Linux 2.6.10 with the TCP patch still takes 325 seconds.

Quoted 37 lines · Stephen Hemminger

Please try this patch, based on Alexey's suggestion:

Quoted 3 lines

That's one quick and simple idea: set PSH on each tso segment. Seems, it is always good. Hardware will preserve it only on the last skb and everyone will be happy.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet

#   2005/02/09 11:00:57-08:00 [email protected] 
#   Always set PUSH on TSO multi-segment frames
#   to workaround bugs in MacOSX
# 
# net/ipv4/tcp_output.c
#   2005/02/09 11:00:44-08:00 [email protected] +8 -0
#   Always set PUSH on TSO multi-segment frames
#   to workaround bugs in MacOSX
# 
diff -Nru a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
net/ipv4/tcp_output.c +8 -0
@@ -754,6 +754,14 @@
 					break;
 			}
 
+			/* Force push to be on for any large TSO frames
+			 * to workaround problems with busted implementations
+			 * like MacOSX that hold off delivery of data until
+			 * push.
+			 */
+			if (tcp_skb_pcount(skb) > 1)
+			    TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
+
 			TCP_SKB_CB(skb)->when = tcp_time_stamp;
 			if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)))
 				break;
#1 lore raw
Quoted 3 lines · Hubert Tonneau

It does not seem to solve the problem:
. Linux 2.6.9 takes 15 seconds to copy 105 MB to the Mac OSX . Linux 2.6.10 with the TCP patch still takes 325 seconds.

is there a packet trace somewhere?
rick jones

maintainer
#2 lore raw
Quoted 7 lines · On Thu, 10 Feb 2005 14:36:40 -0800 Rick Jones <[email protected]> wrote:
Quoted 3 lines · Hubert Tonneau

It does not seem to solve the problem:
. Linux 2.6.9 takes 15 seconds to copy 105 MB to the Mac OSX . Linux 2.6.10 with the TCP patch still takes 325 seconds.

is there a packet trace somewhere?

I know what's wrong, no trace needed, Stephen's patch misses tcp_push_one() and similar.

He only added the PSH bit setting to tcp_write_xmit().

Hubert, try this patch instead.

===== net/ipv4/tcp_output.c 1.77 vs edited =====

net/ipv4/tcp_output.c +14 -0
@@ -408,6 +408,16 @@
 		sk->sk_send_head = skb;
 }
 
+static inline void tcp_tso_set_push(struct sk_buff *skb)
+{
+	/* Force push to be on for any TSO frames to workaround
+	 * problems with busted implementations like Mac OS-X that
+	 * hold off socket reveive wakeups until push is seen.
+	 */
+	if (tcp_skb_pcount(skb) > 1)
+		TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
+}
+
 /* Send _single_ skb sitting at the send head. This function requires
  * true push pending frames to setup probe timer etc.
  */
@@ -419,6 +429,7 @@
 	if (tcp_snd_test(tp, skb, cur_mss, TCP_NAGLE_PUSH)) {
 		/* Send it out now. */
 		TCP_SKB_CB(skb)->when = tcp_time_stamp;
+		tcp_tso_set_push(skb);
 		if (!tcp_transmit_skb(sk, skb_clone(skb, sk->sk_allocation))) {
 			sk->sk_send_head = NULL;
 			tp->snd_nxt = TCP_SKB_CB(skb)->end_seq;
@@ -755,6 +766,7 @@
 			}
 
 			TCP_SKB_CB(skb)->when = tcp_time_stamp;
+			tcp_tso_set_push(skb);
 			if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)))
 				break;
 
@@ -1096,6 +1108,7 @@
 	 * is still in somebody's hands, else make a clone.
 	 */
 	TCP_SKB_CB(skb)->when = tcp_time_stamp;
+	tcp_tso_set_push(skb);
 
 	err = tcp_transmit_skb(sk, (skb_cloned(skb) ?
 				    pskb_copy(skb, GFP_ATOMIC):
@@ -1668,6 +1681,7 @@
 
 			TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
 			TCP_SKB_CB(skb)->when = tcp_time_stamp;
+			tcp_tso_set_push(skb);
 			err = tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC));
 			if (!err) {
 				update_send_head(sk, tp, skb);