Skip to contentSkip to conversation

TCP changes for 2.6.18

PATCH In review Stephen Hemminger 3 participants 8 messages Jun 5, 2006 – Jun 6, 2006

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

PATCH 1/1 TCP changes for 2.6.18

Dave, please consider adding these for the 2.6.18.

The following changes since commit 672c6108a51bf559d19595d9f8193dfd81f0f752:
Linus Torvalds:

        Merge master.kernel.org:/.../jejb/scsi-rc-fixes-2.6

are found in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/tcp-2.6.git

Angelo P. Castellani:
TCP Compound congestion control

Bin Zhou:
TCP Veno congestion control

Stephen Hemminger:
TCP Compound quad root function
TCP minimum congestion window consolidation
TCP Probe congestion window tracing
TCP Limited slow start for Highspeed TCP

Wong Edison:
TCP Low Priority congestion control

 include/net/tcp.h        |    4 
 net/Kconfig              |   15 ++
 net/ipv4/Kconfig         |   32 +++
 net/ipv4/Makefile        |    4 
 net/ipv4/tcp_bic.c       |    7 -
 net/ipv4/tcp_compound.c  |  448 ++++++++++++++++++++++++++++++++++++++++++++++
 net/ipv4/tcp_cong.c      |    6 -
 net/ipv4/tcp_cubic.c     |    6 -
 net/ipv4/tcp_highspeed.c |   24 ++
 net/ipv4/tcp_htcp.c      |    9 -
 net/ipv4/tcp_input.c     |   13 +
 net/ipv4/tcp_lp.c        |  338 +++++++++++++++++++++++++++++++++++
 net/ipv4/tcp_probe.c     |  179 ++++++++++++++++++
 net/ipv4/tcp_veno.c      |  231 ++++++++++++++++++++++++
 net/ipv4/tcp_westwood.c  |   18 +-
 15 files changed, 1291 insertions(+), 43 deletions(-)
 create mode 100644 net/ipv4/tcp_compound.c
 create mode 100644 net/ipv4/tcp_lp.c
 create mode 100644 net/ipv4/tcp_probe.c
 create mode 100644 net/ipv4/tcp_veno.c
include/net/tcp.h +2 -2
index 3c989db..575636f 100644
@@ -628,7 +628,7 @@ struct tcp_congestion_ops {
 	/* return slow start threshold (required) */
 	u32 (*ssthresh)(struct sock *sk);
 	/* lower bound for congestion window (optional) */
-	u32 (*min_cwnd)(struct sock *sk);
+	u32 (*min_cwnd)(const struct sock *sk);
 	/* do new cwnd calculation (required) */
 	void (*cong_avoid)(struct sock *sk, u32 ack,
 			   u32 rtt, u32 in_flight, int good_ack);
@@ -663,7 +663,7 @@ extern struct tcp_congestion_ops tcp_ini
 extern u32 tcp_reno_ssthresh(struct sock *sk);
 extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack,
 				u32 rtt, u32 in_flight, int flag);
-extern u32 tcp_reno_min_cwnd(struct sock *sk);
+extern u32 tcp_reno_min_cwnd(const struct sock *sk);
 extern struct tcp_congestion_ops tcp_reno;
 
 static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
net/Kconfig +15 -0
index 4193cdc..ff0db80 100644
@@ -215,6 +215,21 @@ config NET_PKTGEN
 	  To compile this code as a module, choose M here: the
 	  module will be called pktgen.
 
+config NET_TCPPROBE
+	tristate "TCP connection probing"
+	depends on INET && EXPERIMENTAL && PROC_FS && KPROBES
+	---help---
+	This module allows for capturing the changes to TCP connection
+	state in response to incoming patckets. It is used for debugging
+	TCP congestion avoidance modules. If you don't understand
+	what was just said, you don't need it: say N.
+
+	Documentation on how to use the packet generator can be found
+	at http://linux-net.osdl.org/index.php/TcpProbe
+
+	To compile this code as a module, choose M here: the
+	module will be called tcp_probe.
+
 endmenu
 
 endmenu
net/ipv4/Kconfig +32 -0
index e40f753..2032411 100644
@@ -532,6 +532,38 @@ config TCP_CONG_SCALABLE
 	properties, though is known to have fairness issues.
 	See http://www-lce.eng.cam.ac.uk/~ctk21/scalable/
 
+config TCP_CONG_LP
+	tristate "TCP Low Priority"
+	depends on EXPERIMENTAL
+	default n
+	---help---
+	TCP Low Priority (TCP-LP), a distributed algorithm whose goal is
+	to utiliza only the excess network bandwidth as compared to the
+	``fair share`` of bandwidth as targeted by TCP.
+	See http://www-ece.rice.edu/networks/TCP-LP/
+
+config TCP_CONG_VENO
+	tristate "TCP Veno"
+	depends on EXPERIMENTAL
+	default n
+	---help---
+	TCP Veno is a sender-side only enhancement of TCP to obtain better
+	throughput over wireless networks. TCP Veno makes use of state
+	distinguishing to circumvent the difficult judgment of the packet loss
+	type. TCP Veno cuts down less congestion window in response to random
+	loss packets.
+	See http://www.ntu.edu.sg/home5/ZHOU0022/papers/CPFu03a.pdf
+
+config TCP_CONG_COMPOUND
+	tristate "TCP Compound"
+	depends on EXPERIMENTAL
+	default n
+	---help---
+	TCP Compound is a sender-side only change to TCP that uses
+	a mixed Reno/Vegas approach to calculate the cwnd.
+	For further details look here:
+	  ftp://ftp.research.microsoft.com/pub/tr/TR-2005-86.pdf
+
 endmenu
 
 config TCP_CONG_BIC
net/ipv4/Makefile +4 -0
index 9ef50a0..ac7eb0e 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_IP_VS) += ipvs/
 obj-$(CONFIG_INET_DIAG) += inet_diag.o 
 obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o
 obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o
+obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o
 obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
 obj-$(CONFIG_TCP_CONG_CUBIC) += tcp_cubic.o
 obj-$(CONFIG_TCP_CONG_WESTWOOD) += tcp_westwood.o
@@ -41,7 +42,10 @@ obj-$(CONFIG_TCP_CONG_HSTCP) += tcp_high
 obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybla.o
 obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o
 obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o
+obj-$(CONFIG_TCP_CONG_VENO) += tcp_veno.o
 obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o
+obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o
+obj-$(CONFIG_TCP_CONG_COMPOUND) += tcp_compound.o
 
 obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
 		      xfrm4_output.o
net/ipv4/tcp_bic.c +0 -7
index 035f209..b2d9021 100644
@@ -198,12 +198,6 @@ static u32 bictcp_undo_cwnd(struct sock 
 	return max(tp->snd_cwnd, ca->last_max_cwnd);
 }
 
-static u32 bictcp_min_cwnd(struct sock *sk)
-{
-	const struct tcp_sock *tp = tcp_sk(sk);
-	return tp->snd_ssthresh;
-}
-
 static void bictcp_state(struct sock *sk, u8 new_state)
 {
 	if (new_state == TCP_CA_Loss)
@@ -231,7 +225,6 @@ static struct tcp_congestion_ops bictcp 
 	.cong_avoid	= bictcp_cong_avoid,
 	.set_state	= bictcp_state,
 	.undo_cwnd	= bictcp_undo_cwnd,
-	.min_cwnd	= bictcp_min_cwnd,
 	.pkts_acked     = bictcp_acked,
 	.owner		= THIS_MODULE,
 	.name		= "bic",
net/ipv4/tcp_compound.c new file +448 -0

448 lines not on this page · raw message

net/ipv4/tcp_cong.c +3 -3
index 91c2f41..857eefc 100644
@@ -38,7 +38,7 @@ int tcp_register_congestion_control(stru
 	int ret = 0;
 
 	/* all algorithms must implement ssthresh and cong_avoid ops */
-	if (!ca->ssthresh || !ca->cong_avoid || !ca->min_cwnd) {
+	if (!ca->ssthresh || !ca->cong_avoid) {
 		printk(KERN_ERR "TCP %s does not implement required ops\n",
 		       ca->name);
 		return -EINVAL;
@@ -251,8 +251,8 @@ u32 tcp_reno_ssthresh(struct sock *sk)
 }
 EXPORT_SYMBOL_GPL(tcp_reno_ssthresh);
 
-/* Lower bound on congestion window. */
-u32 tcp_reno_min_cwnd(struct sock *sk)
+/* Lower bound on congestion window with halving. */
+u32 tcp_reno_min_cwnd(const struct sock *sk)
 {
 	const struct tcp_sock *tp = tcp_sk(sk);
 	return tp->snd_ssthresh/2;
net/ipv4/tcp_cubic.c +0 -6
index 31a4986..78b7a6b 100644
@@ -325,11 +325,6 @@ static u32 bictcp_undo_cwnd(struct sock 
 	return max(tcp_sk(sk)->snd_cwnd, ca->last_max_cwnd);
 }
 
-static u32 bictcp_min_cwnd(struct sock *sk)
-{
-	return tcp_sk(sk)->snd_ssthresh;
-}
-
 static void bictcp_state(struct sock *sk, u8 new_state)
 {
 	if (new_state == TCP_CA_Loss)
@@ -357,7 +352,6 @@ static struct tcp_congestion_ops cubictc
 	.cong_avoid	= bictcp_cong_avoid,
 	.set_state	= bictcp_state,
 	.undo_cwnd	= bictcp_undo_cwnd,
-	.min_cwnd	= bictcp_min_cwnd,
 	.pkts_acked     = bictcp_acked,
 	.owner		= THIS_MODULE,
 	.name		= "cubic",
net/ipv4/tcp_highspeed.c +21 -3
index ba7c63c..1120245 100644
@@ -98,6 +98,10 @@ struct hstcp {
 	u32	ai;
 };
 
+static int max_ssthresh = 100;
+module_param(max_ssthresh, int, 0644);
+MODULE_PARM_DESC(max_ssthresh, "limited slow start threshold (RFC3742)");
+
 static void hstcp_init(struct sock *sk)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
@@ -119,9 +123,23 @@ static void hstcp_cong_avoid(struct sock
 	if (!tcp_is_cwnd_limited(sk, in_flight))
 		return;
 
-	if (tp->snd_cwnd <= tp->snd_ssthresh)
-		tcp_slow_start(tp);
-	else {
+	if (tp->snd_cwnd <= tp->snd_ssthresh) {
+		/* RFC3742: limited slow start
+		 * the window is increased by 1/K MSS for each arriving ACK,
+		 * for K = int(cwnd/(0.5 max_ssthresh))
+		 */
+		if (max_ssthresh > 0 && tp->snd_cwnd > max_ssthresh) {
+			u32 k = max(tp->snd_cwnd / (max_ssthresh >> 1), 1U);
+			if (++tp->snd_cwnd_cnt >= k) {
+				if (tp->snd_cwnd < tp->snd_cwnd_clamp)
+					tp->snd_cwnd++;
+				tp->snd_cwnd_cnt = 0;
+			}
+		} else {
+			if (tp->snd_cwnd < tp->snd_cwnd_clamp)
+				tp->snd_cwnd++;
+		}
+	} else {
 		/* Update AIMD parameters */
 		if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) {
 			while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd &&
net/ipv4/tcp_htcp.c +0 -9
index 1b2ff53..3d92c18 100644
@@ -246,14 +246,6 @@ static void htcp_cong_avoid(struct sock 
 	}
 }
 
-/* Lower bound on congestion window. */
-static u32 htcp_min_cwnd(struct sock *sk)
-{
-	const struct tcp_sock *tp = tcp_sk(sk);
-	return tp->snd_ssthresh;
-}
-
-
 static void htcp_init(struct sock *sk)
 {
 	struct htcp *ca = inet_csk_ca(sk);
@@ -285,7 +277,6 @@ static void htcp_state(struct sock *sk, 
 static struct tcp_congestion_ops htcp = {
 	.init		= htcp_init,
 	.ssthresh	= htcp_recalc_ssthresh,
-	.min_cwnd	= htcp_min_cwnd,
 	.cong_avoid	= htcp_cong_avoid,
 	.set_state	= htcp_state,
 	.undo_cwnd	= htcp_cwnd_undo,
net/ipv4/tcp_input.c +11 -2
index 4a538bc..718d0f2 100644
@@ -1690,17 +1690,26 @@ static inline void tcp_moderate_cwnd(str
 	tp->snd_cwnd_stamp = tcp_time_stamp;
 }
 
+/* Lower bound on congestion window is slow start threshold
+ * unless congestion avoidance choice decides to overide it.
+ */
+static inline u32 tcp_cwnd_min(const struct sock *sk)
+{
+	const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops;
+
+	return ca_ops->min_cwnd ? ca_ops->min_cwnd(sk) : tcp_sk(sk)->snd_ssthresh;
+}
+
 /* Decrease cwnd each second ack. */
 static void tcp_cwnd_down(struct sock *sk)
 {
-	const struct inet_connection_sock *icsk = inet_csk(sk);
 	struct tcp_sock *tp = tcp_sk(sk);
 	int decr = tp->snd_cwnd_cnt + 1;
 
 	tp->snd_cwnd_cnt = decr&1;
 	decr >>= 1;
 
-	if (decr && tp->snd_cwnd > icsk->icsk_ca_ops->min_cwnd(sk))
+	if (decr && tp->snd_cwnd > tcp_cwnd_min(sk))
 		tp->snd_cwnd -= decr;
 
 	tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
net/ipv4/tcp_lp.c new file +338 -0

338 lines not on this page · raw message

net/ipv4/tcp_probe.c new file +179 -0

179 lines not on this page · raw message

net/ipv4/tcp_veno.c new file +231 -0

231 lines not on this page · raw message

net/ipv4/tcp_westwood.c +7 -11
index 0c340c3..29eb258 100644
@@ -162,12 +162,6 @@ static inline u32 westwood_acked_count(s
 	return w->cumul_ack;
 }
 
-static inline u32 westwood_bw_rttmin(const struct sock *sk)
-{
-	const struct tcp_sock *tp = tcp_sk(sk);
-	const struct westwood *w = inet_csk_ca(sk);
-	return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2);
-}
 
 /*
  * TCP Westwood
@@ -175,9 +169,11 @@ static inline u32 westwood_bw_rttmin(con
  * in packets we use mss_cache). Rttmin is guaranteed to be >= 2
  * so avoids ever returning 0.
  */
-static u32 tcp_westwood_cwnd_min(struct sock *sk)
+static u32 tcp_westwood_bw_rttmin(const struct sock *sk)
 {
-	return westwood_bw_rttmin(sk);
+	const struct tcp_sock *tp = tcp_sk(sk);
+	const struct westwood *w = inet_csk_ca(sk);
+	return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2);
 }
 
 static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
@@ -191,11 +187,11 @@ static void tcp_westwood_event(struct so
 		break;
 
 	case CA_EVENT_COMPLETE_CWR:
-		tp->snd_cwnd = tp->snd_ssthresh = westwood_bw_rttmin(sk);
+		tp->snd_cwnd = tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk);
 		break;
 
 	case CA_EVENT_FRTO:
-		tp->snd_ssthresh = westwood_bw_rttmin(sk);
+		tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk);
 		break;
 
 	case CA_EVENT_SLOW_ACK:
@@ -235,7 +231,7 @@ static struct tcp_congestion_ops tcp_wes
 	.init		= tcp_westwood_init,
 	.ssthresh	= tcp_reno_ssthresh,
 	.cong_avoid	= tcp_reno_cong_avoid,
-	.min_cwnd	= tcp_westwood_cwnd_min,
+	.min_cwnd	= tcp_westwood_bw_rttmin,
 	.cwnd_event	= tcp_westwood_event,
 	.get_info	= tcp_westwood_info,
 	.pkts_acked	= tcp_westwood_pkts_acked,
#1 lore raw

PATCH 1/1 TCP: removal of unused label

net/ipv4/tcp_compound.c +1 -1
index bc54f7e..a3c36c0 100644
@@ -401,6 +401,7 @@ static void tcp_compound_cong_avoid(stru
 static void tcp_compound_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
 {
 	const struct compound *ca = inet_csk_ca(sk);
+
 	if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
 		struct tcpvegas_info *info;
 
@@ -411,7 +412,6 @@ static void tcp_compound_get_info(struct
 		info->tcpv_rttcnt = ca->cntRTT;
 		info->tcpv_rtt = ca->baseRTT;
 		info->tcpv_minrtt = ca->minRTT;
-	rtattr_failure:;
 	}
 }
 
#2 lore raw

Re: [PATCH] TCP: removal of unused label

Quoted 16 lines · On Mon, 5 Jun 2006 21:55:49 +0200 Francois Romieu <[email protected]> wrote:
net/ipv4/tcp_compound.c +1 -0
index bc54f7e..a3c36c0 100644
@@ -401,6 +401,7 @@ static void tcp_compound_cong_avoid(stru
 static void tcp_compound_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
 {
 	const struct compound *ca = inet_csk_ca(sk);
+
 	if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
 		struct tcpvegas_info *info;
 

net/ipv4/tcp_compound.c static void tcp_compound_get_info(struct · line 417

Quoted 7 lines
net/ipv4/tcp_compound.c +0 -1
@@ -411,7 +412,6 @@ static void tcp_compound_get_info(struct
 		info->tcpv_rttcnt = ca->cntRTT;
 		info->tcpv_rtt = ca->baseRTT;
 		info->tcpv_minrtt = ca->minRTT;
-	rtattr_failure:;
 	}
 }
 

rtattr_failure is used inside __RTA_PUT() macro. It's gross, but there are those who love it..

maintainer
#3 lore raw

Re: [PATCH] TCP: removal of unused label

From: Stephen Hemminger <[email protected]>
Date: Mon, 5 Jun 2006 16:02:40 -0700

Quoted 2 lines

rtattr_failure is used inside __RTA_PUT() macro. It's gross, but there are those who love it..

Yes, it was clear that this patch wasn't build tested.

And GCC usually warns very loudly about truly unused labels.

maintainer
#4 lore raw
In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Mon, 5 Jun 2006 11:03:31 -0700

Quoted 1 line

Dave, please consider adding these for the 2.6.18.

I'll pick these into my tree by extracting out the patches. Your tree wasn't based upon the net-2.6.18 tree, so if I just pull it into mine I'll get all the upstream changes since I cut the net-2.6.18 which at the current time I don't want :)

BTW, it seems we now have at least 3 instances "VEGAS + stuff" and thus the core vegas logic is duplicated that many times. Would be nice to have some core vegas infrastructure in the generic congestion avoidance layer at some point.

#5 lore raw
Quoted 10 lines · On Mon, 05 Jun 2006 16:58:59 -0700 (PDT) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Mon, 5 Jun 2006 11:03:31 -0700

Quoted 1 line

Dave, please consider adding these for the 2.6.18.

I'll pick these into my tree by extracting out the patches. Your tree wasn't based upon the net-2.6.18 tree, so if I just pull it into mine I'll get all the upstream changes since I cut the net-2.6.18 which at the current time I don't want :)

I will rebase it on your tree today.

Quoted 4 lines

BTW, it seems we now have at least 3 instances "VEGAS + stuff" and thus the core vegas logic is duplicated that many times. Would be nice to have some core vegas infrastructure in the generic congestion avoidance layer at some point.

Agreed, and the vegas stuff needs some work as well. It should have more smoothing like Westwood+

maintainer
#6 lore raw

From: Stephen Hemminger <[email protected]>
Date: Tue, 6 Jun 2006 09:46:55 -0700

Quoted 10 lines
Quoted 4 lines · On Mon, 05 Jun 2006 16:58:59 -0700 (PDT) David Miller <[email protected]>…

BTW, it seems we now have at least 3 instances "VEGAS + stuff" and thus the core vegas logic is duplicated that many times. Would be nice to have some core vegas infrastructure in the generic congestion avoidance layer at some point.

Agreed, and the vegas stuff needs some work as well. It should have more smoothing like Westwood+

And that Westwood+ "smoothing" is the same sample smoothing algorithm used in other parts of the generic TCP input processing, for example in functions such as tcp_rtt_estimator() :-)

#7 lore raw
Quoted 11 lines · On Tue, 06 Jun 2006 12:29:24 -0700 (PDT) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Tue, 6 Jun 2006 09:46:55 -0700

Quoted 8 lines
Quoted 4 lines · On Mon, 05 Jun 2006 16:58:59 -0700 (PDT) David Miller <[email protected]>…

BTW, it seems we now have at least 3 instances "VEGAS + stuff" and thus the core vegas logic is duplicated that many times. Would be nice to have some core vegas infrastructure in the generic congestion avoidance layer at some point.

Quoted 6 lines
Quoted 2 lines

Agreed, and the vegas stuff needs some work as well. It should have more smoothing like Westwood+

And that Westwood+ "smoothing" is the same sample smoothing algorithm used in other parts of the generic TCP input processing, for example in functions such as tcp_rtt_estimator() :-)

We could even support different (or smarter) smoothing functions??? The vegas stuff needs to be smarter that's for sure. Time to go catch up on my reading.