All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tcp: make TCP quick ACK behavior modifiable
@ 2010-08-23 19:00 Hagen Paul Pfeifer
  2010-08-23 19:14 ` Stephen Hemminger
  2010-08-23 20:44 ` Eric Dumazet
  0 siblings, 2 replies; 17+ messages in thread
From: Hagen Paul Pfeifer @ 2010-08-23 19:00 UTC (permalink / raw)
  To: netdev
  Cc: Hagen Paul Pfeifer, David S. Miller, Eric Dumazet,
	Ilpo Järvinen

The TCP quick ACK mechanism analyze if a connection is interactive or
not. Per default the quick ACK mechanism is enabled and ACK packets are
triggered instantly to raise the CWND fast - which is clever for
bulk data (non-interactive) flows. On the other hand interactive protocols
like HTTP, SMTP or XMPP will suffer from the quick ACK mechanism
because one additional packets is generated. A simple heuristic
detects if a connection is interactive (pingpong) and if so,
disable the quick ACK. But, the mechanism is not in the ability to
blindly guess if a connection is interactive, and so it must wait for at
least one return packet with payload.

For the server side this requires one additional packet because (packet
number 5 and 6 can be combined):

192.168.1.35.44833 > 78.47.222.210.80: Flags [S], seq 2854340018, win 5840, options [mss 1460,sackOK,TS val 4382726 ecr 0,nop,wscale 7], length 0
78.47.222.210.80 > 192.168.1.35.44833: Flags [S.], seq 719041385, ack 2854340019, win 5792, options [mss 1452,sackOK,TS val 2606891996 ecr 4382726,nop,wscale 7], length 0
192.168.1.35.44833 > 78.47.222.210.80: Flags [.], ack 1, win 46, options [nop,nop,TS val 4382730 ecr 2606891996], length 0
192.168.1.35.44833 > 78.47.222.210.80: Flags [P.], seq 1:682, ack 1, win 46, options [nop,nop,TS val 4382730 ecr 2606891996], length 681
78.47.222.210.80 > 192.168.1.35.44833: Flags [.], ack 682, win 56, options [nop,nop,TS val 2606892002 ecr 4382730], length 0
78.47.222.210.80 > 192.168.1.35.44833: Flags [.], seq 1:1441, ack 682, win 56, options [nop,nop,TS val 2606892002 ecr 4382730], length 1440
192.168.1.35.44833 > 78.47.222.210.80: Flags [.], ack 1441, win 69, options [nop,nop,TS val 4382737 ecr 2606892002], length 0

This patch provides a sysctl interface for the administrator to globally
enable or disable TCP quick ACKs. Short lived protocols like HTTP will
save a non unimportant portion of packets!

Disable TCP Quick ACK:
$ echo 0 > /proc/sys/net/ipv4/tcp_quickack

Enable TCP Quick ACK:
$ echo 1 > /proc/sys/net/ipv4/tcp_quickack

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 include/net/inet_connection_sock.h |    3 +++
 net/ipv4/sysctl_net_ipv4.c         |    7 +++++++
 net/ipv4/tcp.c                     |    2 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b6d3b55..da2fbaf 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -170,9 +170,12 @@ static inline int inet_csk_ack_scheduled(const struct sock *sk)
 	return inet_csk(sk)->icsk_ack.pending & ICSK_ACK_SCHED;
 }
 
+extern int sysctl_tcp_quickack;
+
 static inline void inet_csk_delack_init(struct sock *sk)
 {
 	memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack));
+	inet_csk(sk)->icsk_ack.pingpong = sysctl_tcp_quickack ? 0 : 1;
 }
 
 extern void inet_csk_delete_keepalive_timer(struct sock *sk);
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index d96c1da..8923ca8 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -394,6 +394,13 @@ static struct ctl_table ipv4_table[] = {
 		.proc_handler	= proc_dointvec
 	},
 	{
+		.procname	= "tcp_quickack",
+		.data		= &sysctl_tcp_quickack,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec
+	},
+	{
 		.procname	= "tcp_mem",
 		.data		= &sysctl_tcp_mem,
 		.maxlen		= sizeof(sysctl_tcp_mem),
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 176e11a..5161689 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -279,6 +279,8 @@
 
 int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT;
 
+int sysctl_tcp_quickack __read_mostly = 1;
+
 struct percpu_counter tcp_orphan_count;
 EXPORT_SYMBOL_GPL(tcp_orphan_count);
 
-- 
1.7.2.1.95.g3d045.dirty


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

end of thread, other threads:[~2010-08-23 23:18 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-23 19:00 [PATCH] tcp: make TCP quick ACK behavior modifiable Hagen Paul Pfeifer
2010-08-23 19:14 ` Stephen Hemminger
2010-08-23 19:57   ` Hagen Paul Pfeifer
2010-08-23 20:08   ` Hagen Paul Pfeifer
2010-08-23 21:21     ` David Miller
2010-08-23 21:51       ` Hagen Paul Pfeifer
2010-08-23 22:04         ` Chris Snook
2010-08-23 22:16         ` David Miller
2010-08-23 20:44 ` Eric Dumazet
2010-08-23 20:49   ` Hagen Paul Pfeifer
2010-08-23 21:10   ` Chris Snook
2010-08-23 22:01     ` Hagen Paul Pfeifer
2010-08-23 22:19       ` Chris Snook
2010-08-23 22:23         ` David Miller
2010-08-23 22:26           ` Hagen Paul Pfeifer
2010-08-23 23:17           ` Arnaldo Carvalho de Melo
2010-08-23 23:18             ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.