Skip to contentSkip to conversation

tcp: add NV congestion control

PATCH In review Lawrence Brakmo 2 participants 4 messages May 18, 2016 – May 19, 2016

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

cover tcp: add NV congestion control

This patchset adds support for NV congestion control.

This version of NV does much better than previous versions when things are very congested.

Tested in a rack using between 1 and 380 active TCP-NV flows.

Consists of the following patches:
[PATCH net-next 1/2] tcp: add in_flight to tcp_skb_cb [PATCH net-next 2/2] tcp: add NV congestion control

include/net/tcp.h     |   2 +
net/ipv4/Kconfig      |  16 ++
net/ipv4/Makefile     |   1 +
net/ipv4/tcp_input.c  |   6 +-
net/ipv4/tcp_nv.c     | 592 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
net/ipv4/tcp_output.c |   4 +-
6 files changed, 619 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/2 tcp: add in_flight to tcp_skb_cb

Add in_flight (bytes in flight when packet was sent) field to tx component of tcp_skb_cb and make it available to congestion modules' pkts_acked() function through the ack_sample function argument.

---
 include/net/tcp.h     | 2 ++
 net/ipv4/tcp_input.c  | 6 +++++-
 net/ipv4/tcp_output.c | 4 +++-
 3 files changed, 10 insertions(+), 2 deletions(-)
include/net/tcp.h +2 -0
index c9ab561..5fd0541 100644
@@ -767,6 +767,7 @@ struct tcp_skb_cb {
 	union {
 		struct {
 			/* There is space for up to 20 bytes */
+			__u32 in_flight;/* Bytes in flight when packet sent */
 		} tx;   /* only used for outgoing skbs */
 		union {
 			struct inet_skb_parm	h4;
@@ -857,6 +858,7 @@ union tcp_cc_info;
 struct ack_sample {
 	u32 pkts_acked;
 	s32 rtt_us;
+	u32 in_flight;
 };
 
 struct tcp_congestion_ops {
net/ipv4/tcp_input.c +5 -1
index ba8bf5c..0486606 100644
@@ -3115,6 +3115,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 	long ca_rtt_us = -1L;
 	struct sk_buff *skb;
 	u32 pkts_acked = 0;
+	u32 last_in_flight = 0;
 	bool rtt_update;
 	int flag = 0;
 
@@ -3154,6 +3155,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 			if (!first_ackt.v64)
 				first_ackt = last_ackt;
 
+			last_in_flight = TCP_SKB_CB(skb)->tx.in_flight;
 			reord = min(pkts_acked, reord);
 			if (!after(scb->end_seq, tp->high_seq))
 				flag |= FLAG_ORIG_SACK_ACKED;
@@ -3249,7 +3251,9 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 	}
 
 	if (icsk->icsk_ca_ops->pkts_acked) {
-		struct ack_sample sample = {pkts_acked, ca_rtt_us};
+		struct ack_sample sample = {.pkts_acked = pkts_acked,
+					    .rtt_us = ca_rtt_us,
+					    .in_flight = last_in_flight};
 
 		icsk->icsk_ca_ops->pkts_acked(sk, &sample);
 	}
net/ipv4/tcp_output.c +3 -1
index 8daefd8..c615218 100644
@@ -911,9 +911,12 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
 	int err;
 
 	BUG_ON(!skb || !tcp_skb_pcount(skb));
+	tp = tcp_sk(sk);
 
 	if (clone_it) {
 		skb_mstamp_get(&skb->skb_mstamp);
+		TCP_SKB_CB(skb)->tx.in_flight = TCP_SKB_CB(skb)->end_seq
+			- tp->snd_una;
 
 		if (unlikely(skb_cloned(skb)))
 			skb = pskb_copy(skb, gfp_mask);
@@ -924,7 +927,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
 	}
 
 	inet = inet_sk(sk);
-	tp = tcp_sk(sk);
 	tcb = TCP_SKB_CB(skb);
 	memset(&opts, 0, sizeof(opts));
 
Signature · 1 line
2.8.0.rc2
#2 lore raw

PATCH 2/2 tcp: add NV congestion control

In reply to Lawrence Brakmo

TCP-NV (New Vegas) is a major update to TCP-Vegas. An earlier version of NV was presented at 2010's LPC. It is a delayed based congestion avoidance for the data center. This version has been tested within a 10G rack where the HW RTTs are 20-50us.

A description of TCP-NV, including implementation details as well as experimental results, can be found at:
http://www.brakmo.org/networking/tcp-nv/TCPNV.html

The current version includes many module parameters to support experimentation with the parameters.

---
 net/ipv4/Kconfig  |  16 ++
 net/ipv4/Makefile |   1 +
 net/ipv4/tcp_nv.c | 592 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 609 insertions(+)
 create mode 100644 net/ipv4/tcp_nv.c
net/ipv4/Kconfig +16 -0
index 238225b..50d6a9b 100644
@@ -532,6 +532,22 @@ config TCP_CONG_VEGAS
 	window. TCP Vegas should provide less packet loss, but it is
 	not as aggressive as TCP Reno.
 
+config TCP_CONG_NV
+       tristate "TCP NV"
+       default n
+       ---help---
+       TCP NV is a follow up to TCP Vegas. It has been modified to deal with
+       10G networks, measurement noise introduced by LRO, GRO and interrupt
+       coalescence. In addition, it will decrease its cwnd multiplicatively
+       instead of linearly.
+
+       Note that in general congestion avoidance (cwnd decreased when # packets
+       queued grows) cannot coexist with congestion control (cwnd decreased only
+       when there is packet loss) due to fairness issues. One scenario when they
+       can coexist safely is when the CA flows have RTTs << CC flows RTTs.
+
+       For further details see http://www.brakmo.org/networking/tcp-nv/
+
 config TCP_CONG_SCALABLE
 	tristate "Scalable TCP"
 	default n
net/ipv4/Makefile +1 -0
index bfa1336..24629b6 100644
@@ -50,6 +50,7 @@ obj-$(CONFIG_TCP_CONG_HSTCP) += tcp_highspeed.o
 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_NV) += tcp_nv.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
net/ipv4/tcp_nv.c new file +592 -0

592 lines not on this page · raw message

Signature · 1 line
2.8.0.rc2
#3 lore raw
In reply to Lawrence Brakmo

From: Lawrence Brakmo <[email protected]>
Date: Tue, 17 May 2016 18:25:34 -0700

Quoted 5 lines

This patchset adds support for NV congestion control.

This version of NV does much better than previous versions when things are very congested.

Quoted 7 lines

Tested in a rack using between 1 and 380 active TCP-NV flows.

Consists of the following patches:
[PATCH net-next 1/2] tcp: add in_flight to tcp_skb_cb [PATCH net-next 2/2] tcp: add NV congestion control

Sorry this is too late for the current merge window, please resubmit when the net-next tree opens back up.