Skip to contentSkip to conversation

tcp: initialize passive-side sk_pacing_rate after 3WHS

PATCH Applied Neal Cardwell 3 participants 3 messages Oct 21, 2013

Subsystems (3)
lore
Share & tools
lore

Neal Cardwell

author maintainer
#0 lore raw

PATCH 1/1 tcp: initialize passive-side sk_pacing_rate after 3WHS

For passive TCP connections, upon receiving the ACK that completes the 3WHS, make sure we set our pacing rate after we get our first RTT sample.

On passive TCP connections, when we receive the ACK completing the 3WHS we do not take an RTT sample in tcp_ack(), but rather in tcp_synack_rtt_meas(). So upon receiving the ACK that completes the 3WHS, tcp_ack() leaves sk_pacing_rate at its initial value.

Originally the initial sk_pacing_rate value was 0, so passive-side connections defaulted to sysctl_tcp_min_tso_segs (2 segs) in skbuffs made in the first RTT. With a default initial cwnd of 10 packets, this happened to be correct for RTTs 5ms or bigger, so it was hard to see problems in WAN or emulated WAN testing.

Since 7eec4174ff ("pkt_sched: fq: fix non TCP flows pacing"), the initial sk_pacing_rate is 0xffffffff. So after that change, passive TCP connections were keeping this value (and using large numbers of segments per skbuff) until receiving an ACK for data.

Cc Eric Dumazet <[email protected]>
Cc Yuchung Cheng <[email protected]>
---
 net/ipv4/tcp_input.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/tcp_input.c +2 -0
index 53974c7..a16b01b 100644
@@ -5712,6 +5712,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
 		} else
 			tcp_init_metrics(sk);
 
+		tcp_update_pacing_rate(sk);
+
 		/* Prevent spurious tcp_cwnd_restart() on first data packet */
 		tp->lsndtime = tcp_time_stamp;
 
Signature · 1 line
1.8.4
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Neal Cardwell

For passive TCP connections, upon receiving the ACK that completes the 3WHS, make sure we set our pacing rate after we get our first RTT sample.

Cc Eric Dumazet <[email protected]>
Cc Yuchung Cheng <[email protected]>
---
 net/ipv4/tcp_input.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/tcp_input.c +0 -0
index 53974c7..a16b01b 100644

net/ipv4/tcp_input.c int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, · line 5719

Quoted 8 lines
net/ipv4/tcp_input.c +2 -0
@@ -5712,6 +5712,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
 		} else
 			tcp_init_metrics(sk);
 
+		tcp_update_pacing_rate(sk);
+
 		/* Prevent spurious tcp_cwnd_restart() on first data packet */
 		tp->lsndtime = tcp_time_stamp;
 

Seems good to me, thanks !

maintainer Applied
#2 lore raw

From: Eric Dumazet <[email protected]>
Date: Mon, 21 Oct 2013 13:36:34 -0700

Quoted 28 lines · Neal Cardwell
Quoted 16 lines

For passive TCP connections, upon receiving the ACK that completes the 3WHS, make sure we set our pacing rate after we get our first RTT sample.

Cc Eric Dumazet <[email protected]>
Cc Yuchung Cheng <[email protected]>
---
 net/ipv4/tcp_input.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/tcp_input.c +0 -0
index 53974c7..a16b01b 100644

net/ipv4/tcp_input.c int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, · line 5719

Quoted 8 lines
net/ipv4/tcp_input.c +2 -0
@@ -5712,6 +5712,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
 		} else
 			tcp_init_metrics(sk);
 
+		tcp_update_pacing_rate(sk);
+
 		/* Prevent spurious tcp_cwnd_restart() on first data packet */
 		tp->lsndtime = tcp_time_stamp;
 

Seems good to me, thanks !

Quoted 1 line

Applied, thanks everyone.