tcp: add NV congestion control
Subsystems (4)
Changes from v5: cleaning of NV code, changing some default parameters
I've run more extensive tests, I'm working on updating the NV website
(http://www.brakmo.org/networking/tcp-nv/TCPNV.html) should be updated by tomorrow (8/26).
The updated tests include Reno, Cubic, NV and CDG and include more types of traffic. Overview of results:
1) NV has a little lower throughput (2-3% less) with small number of flows as compared to Reno, Cubic and CDG
2) NV is less fair with few flows but becomes more fair with more flows
3) Less losses with NV (none in many cases) as compared to all others. One exception is when things get very congested (64 flows into one server), NV has 50% more losses than CDG, Cubic has 1.8x to 10x more losses than CDG. Reno has about the same losses as CDG.
4) In mixed traffic (1M and 10K RPCs), 10K flows achieve much higher average throughput with NV than with the others (which are very similar). In one example, 2 clients sending 1M and 10K to 2 servers, with NV 10K flows average 1Gbps and 1M flows 3.7Gbps, whereas they average about 226Mbps and 4.4Gbps for Reno, Cubic and CDG. They all have similar link utilization.
Consists of the following patches:
[RFC PATCH v6 net-next 1/4] tcp: replace cnt & rtt with struct in [RFC PATCH v6 net-next 2/4] tcp: refactor struct tcp_skb_cb [RFC PATCH v6 net-next 3/4] tcp: add in_flight to tcp_skb_cb [RFC PATCH v6 net-next 4/4] tcp: add NV congestion control
include/net/tcp.h | 20 ++- net/ipv4/Kconfig | 16 ++ net/ipv4/Makefile | 1 + net/ipv4/tcp_bic.c | 6 +- net/ipv4/tcp_cdg.c | 14 +- net/ipv4/tcp_cubic.c | 6 +- net/ipv4/tcp_htcp.c | 10 +- net/ipv4/tcp_illinois.c | 20 +-- net/ipv4/tcp_input.c | 10 +- net/ipv4/tcp_lp.c | 6 +- net/ipv4/tcp_nv.c | 489 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ net/ipv4/tcp_output.c | 4 +- net/ipv4/tcp_vegas.c | 6 +- net/ipv4/tcp_vegas.h | 2 +- net/ipv4/tcp_veno.c | 7 +- net/ipv4/tcp_westwood.c | 7 +- net/ipv4/tcp_yeah.c | 7 +- 17 files changed, 580 insertions(+), 51 deletions(-)
RFC PATCH v6 1/4 tcp: replace cnt & rtt with struct in pkts_acked()
Replace 2 arguments (cnt and rtt) in the congestion control modules' pkts_acked() function with a struct. This will allow adding more information without having to modify existing congestion control modules (tcp_nv in particular needs bytes in flight when packet was sent).
As proposed by Neal Cardwell in his comments to the tcp_nv patch.
--- include/net/tcp.h | 7 ++++++- net/ipv4/tcp_bic.c | 6 +++--- net/ipv4/tcp_cdg.c | 14 +++++++------- net/ipv4/tcp_cubic.c | 6 +++--- net/ipv4/tcp_htcp.c | 10 +++++----- net/ipv4/tcp_illinois.c | 20 ++++++++++---------- net/ipv4/tcp_input.c | 7 +++++-- net/ipv4/tcp_lp.c | 6 +++--- net/ipv4/tcp_vegas.c | 6 +++--- net/ipv4/tcp_vegas.h | 2 +- net/ipv4/tcp_veno.c | 7 ++++--- net/ipv4/tcp_westwood.c | 7 ++++--- net/ipv4/tcp_yeah.c | 7 ++++--- 13 files changed, 58 insertions(+), 47 deletions(-)
include/net/tcp.h +6 -1
@@ -834,6 +834,11 @@ enum tcp_ca_ack_event_flags {union tcp_cc_info ; +struct ack_sample { +u32 pkts_acked; +s32 rtt_us; +}; +struct tcp_congestion_ops {struct list_head list;u32 key;
@@ -857,7 +862,7 @@ struct tcp_congestion_ops {/* new value of cwnd after loss (optional) */ u32 (*undo_cwnd)(struct sock *sk);/* hook for packet ack accounting (optional) */ -void (*pkts_acked)(struct sock *sk,u32 num_acked,s32 rtt_us); +void (*pkts_acked)(struct sock *sk,const struct ack_sample *sample);/* get info for inet_diag (optional) */ size_t (*get_info)(struct sock *sk,u32 ext,int *attr,union tcp_cc_info *info);
net/ipv4/tcp_bic.c +3 -3
@@ -197,15 +197,15 @@ static void bictcp_state(struct sock *sk, u8 new_state)/* Track delayed acknowledgment ratio using sliding window * ratio = (15*ratio + sample) / 16 */ -static void bictcp_acked (struct sock *sk,u32 cnt,s32 rtt) +static void bictcp_acked (struct sock *sk,const struct ack_sample *sample) {const struct inet_connection_sock *icsk =inet_csk (sk);if (icsk->icsk_ca_state == TCP_CA_Open) {struct bictcp *ca =inet_csk_ca (sk); - cnt -= ca->delayed_ack >>ACK_RATIO_SHIFT ; - ca->delayed_ack += cnt; + ca->delayed_ack += sample->pkts_acked - + (ca->delayed_ack >>ACK_RATIO_SHIFT ); } }
net/ipv4/tcp_cdg.c +7 -7
@@ -294,12 +294,12 @@ static void tcp_cdg_cong_avoid(struct sock *sk, u32 ack, u32 acked) ca->shadow_wnd =max (ca->shadow_wnd, ca->shadow_wnd + incr); } -static void tcp_cdg_acked (struct sock *sk,u32 num_acked,s32 rtt_us) +static void tcp_cdg_acked (struct sock *sk,const struct ack_sample *sample) {struct cdg *ca =inet_csk_ca (sk);struct tcp_sock *tp =tcp_sk (sk); -if (rtt_us <=0 ) +if (sample->rtt_us <=0 )return ;/* A heuristic for filtering delayed ACKs, adapted from:
@@ -307,20 +307,20 @@ static void tcp_cdg_acked(struct sock *sk, u32 num_acked, s32 rtt_us)* delay and rate based TCP mechanisms." TR 100219A. CAIA, 2010. */ if (tp->sacked_out ==0 ) { -if (num_acked ==1 && ca->delack) { +if (sample->pkts_acked ==1 && ca->delack) {/* A delayed ACK is only used for the minimum if it is * provenly lower than an existing non-zero minimum. */ - ca->rtt.min =min (ca->rtt.min, rtt_us); + ca->rtt.min =min (ca->rtt.min, sample->rtt_us); ca->delack--;return ; - }else if (num_acked >1 && ca->delack <5 ) { + }else if (sample->pkts_acked >1 && ca->delack <5 ) { ca->delack++; } } - ca->rtt.min =min_not_zero (ca->rtt.min, rtt_us); - ca->rtt.max =max (ca->rtt.max, rtt_us); + ca->rtt.min =min_not_zero (ca->rtt.min, sample->rtt_us); + ca->rtt.max =max (ca->rtt.max, sample->rtt_us); }static u32 tcp_cdg_ssthresh (struct sock *sk)
net/ipv4/tcp_cubic.c +3 -3
@@ -416,21 +416,21 @@ static void hystart_update(struct sock *sk, u32 delay)/* Track delayed acknowledgment ratio using sliding window * ratio = (15*ratio + sample) / 16 */ -static void bictcp_acked (struct sock *sk,u32 cnt,s32 rtt_us) +static void bictcp_acked (struct sock *sk,const struct ack_sample *sample) {const struct tcp_sock *tp =tcp_sk (sk);struct bictcp *ca =inet_csk_ca (sk);u32 delay;/* Some calls are for duplicates without timetamps */ -if (rtt_us <0 ) +if (sample->rtt_us <0 )return ;/* Discard delay samples right after fast recovery */ if (ca->epoch_start && (s32)(tcp_time_stamp - ca->epoch_start) <HZ )return ; - delay = (rtt_us <<3 ) /USEC_PER_MSEC ; + delay = (sample->rtt_us <<3 ) /USEC_PER_MSEC ;if (delay ==0 ) delay =1 ;
net/ipv4/tcp_htcp.c +5 -5
@@ -99,7 +99,7 @@ static inline void measure_rtt(struct sock *sk, u32 srtt) }static void measure_achieved_throughput (struct sock *sk, -u32 pkts_acked,s32 rtt) +const struct ack_sample *sample) {const struct inet_connection_sock *icsk =inet_csk (sk);const struct tcp_sock *tp =tcp_sk (sk);
@@ -107,10 +107,10 @@ static void measure_achieved_throughput(struct sock *sk,u32 now = tcp_time_stamp;if (icsk->icsk_ca_state == TCP_CA_Open) - ca->pkts_acked = pkts_acked; + ca->pkts_acked = sample->pkts_acked; -if (rtt >0 ) -measure_rtt (sk,usecs_to_jiffies (rtt)); +if (sample->rtt_us >0 ) +measure_rtt (sk,usecs_to_jiffies (sample->rtt_us));if (!use_bandwidth_switch)return ;
@@ -122,7 +122,7 @@ static void measure_achieved_throughput(struct sock *sk,return ; } - ca->packetcount += pkts_acked; + ca->packetcount += sample->pkts_acked; if (ca->packetcount >= tp->snd_cwnd - (ca->alpha >> 7 ? : 1) && now - ca->lasttime >= ca->minRTT &&
net/ipv4/tcp_illinois.c +10 -10
@@ -82,30 +82,30 @@ static void tcp_illinois_init(struct sock *sk) }/* Measure RTT for each ack. */ -static void tcp_illinois_acked (struct sock *sk,u32 pkts_acked,s32 rtt) +static void tcp_illinois_acked (struct sock *sk,const struct ack_sample *sample) {struct illinois *ca =inet_csk_ca (sk); - ca->acked = pkts_acked; + ca->acked = sample->pkts_acked;/* dup ack, no rtt sample */ -if (rtt <0 ) +if (sample->rtt_us <0 )return ;/* ignore bogus values, this prevents wraparound in alpha math */ -if (rtt >RTT_MAX ) - rtt =RTT_MAX ; +if (sample->rtt_us >RTT_MAX ) + sample->rtt_us =RTT_MAX ;/* keep track of minimum RTT seen so far */ -if (ca->base_rtt > rtt) - ca->base_rtt = rtt; +if (ca->base_rtt > sample->rtt_us) + ca->base_rtt = sample->rtt_us;/* and max */ -if (ca->max_rtt < rtt) - ca->max_rtt = rtt; +if (ca->max_rtt < sample->rtt_us) + ca->max_rtt = sample->rtt_us; ++ca->cnt_rtt; - ca->sum_rtt += rtt; + ca->sum_rtt += sample->rtt_us; }/* Maximum queuing delay */
net/ipv4/tcp_input.c +5 -2
@@ -3196,8 +3196,11 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,tcp_rearm_rto (sk); } -if (icsk->icsk_ca_ops->pkts_acked) - icsk->icsk_ca_ops->pkts_acked (sk, pkts_acked, ca_rtt_us); +if (icsk->icsk_ca_ops->pkts_acked) { +struct ack_sample sample = {pkts_acked, ca_rtt_us}; + + icsk->icsk_ca_ops->pkts_acked (sk, &sample); + }#if FASTRETRANS_DEBUG >0 WARN_ON ((int )tp->sacked_out <0 );
net/ipv4/tcp_lp.c +3 -3
@@ -260,13 +260,13 @@ static void tcp_lp_rtt_sample(struct sock *sk, u32 rtt)* newReno in increase case. * We work it out by following the idea from TCP-LP's paper directly */ -static void tcp_lp_pkts_acked (struct sock *sk,u32 num_acked,s32 rtt_us) +static void tcp_lp_pkts_acked (struct sock *sk,const struct ack_sample *sample) {struct tcp_sock *tp =tcp_sk (sk);struct lp *lp =inet_csk_ca (sk); -if (rtt_us >0 ) -tcp_lp_rtt_sample (sk, rtt_us); +if (sample->rtt_us >0 ) +tcp_lp_rtt_sample (sk, sample->rtt_us);/* calc inference */ if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
net/ipv4/tcp_vegas.c +3 -3
@@ -107,16 +107,16 @@ EXPORT_SYMBOL_GPL(tcp_vegas_init);* o min-filter RTT samples from a much longer window (forever for now) * to find the propagation delay (baseRTT) */ -void tcp_vegas_pkts_acked (struct sock *sk,u32 cnt,s32 rtt_us) +void tcp_vegas_pkts_acked (struct sock *sk,const struct ack_sample *sample) {struct vegas *vegas =inet_csk_ca (sk);u32 vrtt; -if (rtt_us <0 ) +if (sample->rtt_us <0 )return ;/* Never allow zero rtt or baseRTT */ - vrtt = rtt_us +1 ; + vrtt = sample->rtt_us +1 ;/* Filter to find propagation delay: */ if (vrtt < vegas->baseRTT)
net/ipv4/tcp_vegas.h +1 -1
@@ -17,7 +17,7 @@ struct vegas {void tcp_vegas_init (struct sock *sk);void tcp_vegas_state (struct sock *sk,u8 ca_state); -void tcp_vegas_pkts_acked (struct sock *sk,u32 cnt,s32 rtt_us); +void tcp_vegas_pkts_acked (struct sock *sk,const struct ack_sample *sample);void tcp_vegas_cwnd_event (struct sock *sk,enum tcp_ca_event event);size_t tcp_vegas_get_info (struct sock *sk,u32 ext,int *attr,union tcp_cc_info *info);
net/ipv4/tcp_veno.c +4 -3
@@ -69,16 +69,17 @@ static void tcp_veno_init(struct sock *sk) }/* Do rtt sampling needed for Veno. */ -static void tcp_veno_pkts_acked (struct sock *sk,u32 cnt,s32 rtt_us) +static void tcp_veno_pkts_acked (struct sock *sk, +const struct ack_sample *sample) {struct veno *veno =inet_csk_ca (sk);u32 vrtt; -if (rtt_us <0 ) +if (sample->rtt_us <0 )return ;/* Never allow zero rtt or baseRTT */ - vrtt = rtt_us +1 ; + vrtt = sample->rtt_us +1 ;/* Filter to find propagation delay: */ if (vrtt < veno->basertt)
net/ipv4/tcp_westwood.c +4 -3
@@ -99,12 +99,13 @@ static void westwood_filter(struct westwood *w, u32 delta)* Called after processing group of packets. * but all westwood needs is the last sample of srtt. */ -static void tcp_westwood_pkts_acked (struct sock *sk,u32 cnt,s32 rtt) +static void tcp_westwood_pkts_acked (struct sock *sk, +const struct ack_sample *sample) {struct westwood *w =inet_csk_ca (sk); -if (rtt >0 ) - w->rtt =usecs_to_jiffies (rtt); +if (sample->rtt_us >0 ) + w->rtt =usecs_to_jiffies (sample->rtt_us); }/*
net/ipv4/tcp_yeah.c +4 -3
@@ -56,15 +56,16 @@ static void tcp_yeah_init(struct sock *sk) tp->snd_cwnd_clamp =min_t (u32, tp->snd_cwnd_clamp,0xffffffff /128 ); } -static void tcp_yeah_pkts_acked (struct sock *sk,u32 pkts_acked,s32 rtt_us) +static void tcp_yeah_pkts_acked (struct sock *sk, +const struct ack_sample *sample) {const struct inet_connection_sock *icsk =inet_csk (sk);struct yeah *yeah =inet_csk_ca (sk);if (icsk->icsk_ca_state == TCP_CA_Open) - yeah->pkts_acked = pkts_acked; + yeah->pkts_acked = sample->pkts_acked; -tcp_vegas_pkts_acked (sk, pkts_acked, rtt_us); +tcp_vegas_pkts_acked (sk, sample); }static void tcp_yeah_cong_avoid (struct sock *sk,u32 ack,u32 acked)
Signature · 1 line
1.8.1
Re: [RFC PATCH v6 net-next 1/4] tcp: replace cnt & rtt with struct in pkts_acked()
Quoted 9 lines · Lawrence Brakmo
Replace 2 arguments (cnt and rtt) in the congestion control modules'
pkts_acked()function with a struct. This will allow adding more information without having to modify existing congestion control modules (tcp_nvin particular needs bytes in flight when packet was sent).As proposed by Neal Cardwell in his comments to the
tcp_nvpatch.Signed-off-by Lawrence Brakmo <[email protected]>
Quoted 368 lines
--- include/net/tcp.h | 7 ++++++- net/ipv4/tcp_bic.c | 6 +++--- net/ipv4/tcp_cdg.c | 14 +++++++------- net/ipv4/tcp_cubic.c | 6 +++--- net/ipv4/tcp_htcp.c | 10 +++++----- net/ipv4/tcp_illinois.c | 20 ++++++++++---------- net/ipv4/tcp_input.c | 7 +++++-- net/ipv4/tcp_lp.c | 6 +++--- net/ipv4/tcp_vegas.c | 6 +++--- net/ipv4/tcp_vegas.h | 2 +- net/ipv4/tcp_veno.c | 7 ++++--- net/ipv4/tcp_westwood.c | 7 ++++--- net/ipv4/tcp_yeah.c | 7 ++++--- 13 files changed, 58 insertions(+), 47 deletions(-)include/net/tcp.h +6
-1@@ -834,6 +834,11 @@ enum tcp_ca_ack_event_flags {union tcp_cc_info ; +struct ack_sample { +u32 pkts_acked; +s32 rtt_us; +}; +struct tcp_congestion_ops {struct list_head list;u32 key;@@ -857,7 +862,7 @@ struct tcp_congestion_ops {/* new value of cwnd after loss (optional) */ u32 (*undo_cwnd)(struct sock *sk);/* hook for packet ack accounting (optional) */ -void (*pkts_acked)(struct sock *sk,u32 num_acked,s32 rtt_us); +void (*pkts_acked)(struct sock *sk,const struct ack_sample *sample);/* get info for inet_diag (optional) */ size_t (*get_info)(struct sock *sk,u32 ext,int *attr,union tcp_cc_info *info);net/ipv4/tcp_bic.c +3
-3@@ -197,15 +197,15 @@ static void bictcp_state(struct sock *sk, u8 new_state)/* Track delayed acknowledgment ratio using sliding window * ratio = (15*ratio + sample) / 16 */ -static void bictcp_acked (struct sock *sk,u32 cnt,s32 rtt) +static void bictcp_acked (struct sock *sk,const struct ack_sample *sample) {const struct inet_connection_sock *icsk =inet_csk (sk);if (icsk->icsk_ca_state == TCP_CA_Open) {struct bictcp *ca =inet_csk_ca (sk); - cnt -= ca->delayed_ack >>ACK_RATIO_SHIFT ; - ca->delayed_ack += cnt; + ca->delayed_ack += sample->pkts_acked - + (ca->delayed_ack >>ACK_RATIO_SHIFT ); } }net/ipv4/tcp_cdg.c +7
-7@@ -294,12 +294,12 @@ static void tcp_cdg_cong_avoid(struct sock *sk, u32 ack, u32 acked) ca->shadow_wnd =max (ca->shadow_wnd, ca->shadow_wnd + incr); } -static void tcp_cdg_acked (struct sock *sk,u32 num_acked,s32 rtt_us) +static void tcp_cdg_acked (struct sock *sk,const struct ack_sample *sample) {struct cdg *ca =inet_csk_ca (sk);struct tcp_sock *tp =tcp_sk (sk); -if (rtt_us <=0 ) +if (sample->rtt_us <=0 )return ;/* A heuristic for filtering delayed ACKs, adapted from: @@ -307,20 +307,20 @@ static void tcp_cdg_acked(struct sock *sk, u32 num_acked, s32 rtt_us)* delay and rate based TCP mechanisms." TR 100219A. CAIA, 2010. */ if (tp->sacked_out ==0 ) { -if (num_acked ==1 && ca->delack) { +if (sample->pkts_acked ==1 && ca->delack) {/* A delayed ACK is only used for the minimum if it is * provenly lower than an existing non-zero minimum. */ - ca->rtt.min =min (ca->rtt.min, rtt_us); + ca->rtt.min =min (ca->rtt.min, sample->rtt_us); ca->delack--;return ; - }else if (num_acked >1 && ca->delack <5 ) { + }else if (sample->pkts_acked >1 && ca->delack <5 ) { ca->delack++; } } - ca->rtt.min =min_not_zero (ca->rtt.min, rtt_us); - ca->rtt.max =max (ca->rtt.max, rtt_us); + ca->rtt.min =min_not_zero (ca->rtt.min, sample->rtt_us); + ca->rtt.max =max (ca->rtt.max, sample->rtt_us); }static u32 tcp_cdg_ssthresh (struct sock *sk)net/ipv4/tcp_cubic.c +3
-3@@ -416,21 +416,21 @@ static void hystart_update(struct sock *sk, u32 delay)/* Track delayed acknowledgment ratio using sliding window * ratio = (15*ratio + sample) / 16 */ -static void bictcp_acked (struct sock *sk,u32 cnt,s32 rtt_us) +static void bictcp_acked (struct sock *sk,const struct ack_sample *sample) {const struct tcp_sock *tp =tcp_sk (sk);struct bictcp *ca =inet_csk_ca (sk);u32 delay;/* Some calls are for duplicates without timetamps */ -if (rtt_us <0 ) +if (sample->rtt_us <0 )return ;/* Discard delay samples right after fast recovery */ if (ca->epoch_start && (s32)(tcp_time_stamp - ca->epoch_start) <HZ )return ; - delay = (rtt_us <<3 ) /USEC_PER_MSEC ; + delay = (sample->rtt_us <<3 ) /USEC_PER_MSEC ;if (delay ==0 ) delay =1 ;net/ipv4/tcp_htcp.c +5
-5@@ -99,7 +99,7 @@ static inline void measure_rtt(struct sock *sk, u32 srtt) }static void measure_achieved_throughput (struct sock *sk, -u32 pkts_acked,s32 rtt) +const struct ack_sample *sample) {const struct inet_connection_sock *icsk =inet_csk (sk);const struct tcp_sock *tp =tcp_sk (sk);@@ -107,10 +107,10 @@ static void measure_achieved_throughput(struct sock *sk,u32 now = tcp_time_stamp;if (icsk->icsk_ca_state == TCP_CA_Open) - ca->pkts_acked = pkts_acked; + ca->pkts_acked = sample->pkts_acked; -if (rtt >0 ) -measure_rtt (sk,usecs_to_jiffies (rtt)); +if (sample->rtt_us >0 ) +measure_rtt (sk,usecs_to_jiffies (sample->rtt_us));if (!use_bandwidth_switch)return ;@@ -122,7 +122,7 @@ static void measure_achieved_throughput(struct sock *sk,return ; } - ca->packetcount += pkts_acked; + ca->packetcount += sample->pkts_acked; if (ca->packetcount >= tp->snd_cwnd - (ca->alpha >> 7 ? : 1) && now - ca->lasttime >= ca->minRTT &&net/ipv4/tcp_illinois.c +10
-10@@ -82,30 +82,30 @@ static void tcp_illinois_init(struct sock *sk) }/* Measure RTT for each ack. */ -static void tcp_illinois_acked (struct sock *sk,u32 pkts_acked,s32 rtt) +static void tcp_illinois_acked (struct sock *sk,const struct ack_sample *sample) {struct illinois *ca =inet_csk_ca (sk); - ca->acked = pkts_acked; + ca->acked = sample->pkts_acked;/* dup ack, no rtt sample */ -if (rtt <0 ) +if (sample->rtt_us <0 )return ;/* ignore bogus values, this prevents wraparound in alpha math */ -if (rtt >RTT_MAX ) - rtt =RTT_MAX ; +if (sample->rtt_us >RTT_MAX ) + sample->rtt_us =RTT_MAX ;/* keep track of minimum RTT seen so far */ -if (ca->base_rtt > rtt) - ca->base_rtt = rtt; +if (ca->base_rtt > sample->rtt_us) + ca->base_rtt = sample->rtt_us;/* and max */ -if (ca->max_rtt < rtt) - ca->max_rtt = rtt; +if (ca->max_rtt < sample->rtt_us) + ca->max_rtt = sample->rtt_us; ++ca->cnt_rtt; - ca->sum_rtt += rtt; + ca->sum_rtt += sample->rtt_us; }/* Maximum queuing delay */ net/ipv4/tcp_input.c +5
-2@@ -3196,8 +3196,11 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,tcp_rearm_rto (sk); } -if (icsk->icsk_ca_ops->pkts_acked) - icsk->icsk_ca_ops->pkts_acked (sk, pkts_acked, ca_rtt_us); +if (icsk->icsk_ca_ops->pkts_acked) { +struct ack_sample sample = {pkts_acked, ca_rtt_us}; + + icsk->icsk_ca_ops->pkts_acked (sk, &sample); + }#if FASTRETRANS_DEBUG >0 WARN_ON ((int )tp->sacked_out <0 );net/ipv4/tcp_lp.c +3
-3@@ -260,13 +260,13 @@ static void tcp_lp_rtt_sample(struct sock *sk, u32 rtt)* newReno in increase case. * We work it out by following the idea from TCP-LP's paper directly */ -static void tcp_lp_pkts_acked (struct sock *sk,u32 num_acked,s32 rtt_us) +static void tcp_lp_pkts_acked (struct sock *sk,const struct ack_sample *sample) {struct tcp_sock *tp =tcp_sk (sk);struct lp *lp =inet_csk_ca (sk); -if (rtt_us >0 ) -tcp_lp_rtt_sample (sk, rtt_us); +if (sample->rtt_us >0 ) +tcp_lp_rtt_sample (sk, sample->rtt_us);/* calc inference */ if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)net/ipv4/tcp_vegas.c +3
-3@@ -107,16 +107,16 @@ EXPORT_SYMBOL_GPL(tcp_vegas_init);* o min-filter RTT samples from a much longer window (forever for now) * to find the propagation delay (baseRTT) */ -void tcp_vegas_pkts_acked (struct sock *sk,u32 cnt,s32 rtt_us) +void tcp_vegas_pkts_acked (struct sock *sk,const struct ack_sample *sample) {struct vegas *vegas =inet_csk_ca (sk);u32 vrtt; -if (rtt_us <0 ) +if (sample->rtt_us <0 )return ;/* Never allow zero rtt or baseRTT */ - vrtt = rtt_us +1 ; + vrtt = sample->rtt_us +1 ;/* Filter to find propagation delay: */ if (vrtt < vegas->baseRTT)net/ipv4/tcp_vegas.h +1
-1@@ -17,7 +17,7 @@ struct vegas {void tcp_vegas_init (struct sock *sk);void tcp_vegas_state (struct sock *sk,u8 ca_state); -void tcp_vegas_pkts_acked (struct sock *sk,u32 cnt,s32 rtt_us); +void tcp_vegas_pkts_acked (struct sock *sk,const struct ack_sample *sample);void tcp_vegas_cwnd_event (struct sock *sk,enum tcp_ca_event event);size_t tcp_vegas_get_info (struct sock *sk,u32 ext,int *attr,union tcp_cc_info *info);net/ipv4/tcp_veno.c +4
-3@@ -69,16 +69,17 @@ static void tcp_veno_init(struct sock *sk) }/* Do rtt sampling needed for Veno. */ -static void tcp_veno_pkts_acked (struct sock *sk,u32 cnt,s32 rtt_us) +static void tcp_veno_pkts_acked (struct sock *sk, +const struct ack_sample *sample) {struct veno *veno =inet_csk_ca (sk);u32 vrtt; -if (rtt_us <0 ) +if (sample->rtt_us <0 )return ;/* Never allow zero rtt or baseRTT */ - vrtt = rtt_us +1 ; + vrtt = sample->rtt_us +1 ;/* Filter to find propagation delay: */ if (vrtt < veno->basertt)net/ipv4/tcp_westwood.c +4
-3@@ -99,12 +99,13 @@ static void westwood_filter(struct westwood *w, u32 delta)* Called after processing group of packets. * but all westwood needs is the last sample of srtt. */ -static void tcp_westwood_pkts_acked (struct sock *sk,u32 cnt,s32 rtt) +static void tcp_westwood_pkts_acked (struct sock *sk, +const struct ack_sample *sample) {struct westwood *w =inet_csk_ca (sk); -if (rtt >0 ) - w->rtt =usecs_to_jiffies (rtt); +if (sample->rtt_us >0 ) + w->rtt =usecs_to_jiffies (sample->rtt_us); }/* net/ipv4/tcp_yeah.c +4
-4@@ -56,15 +56,16 @@ static void tcp_yeah_init(struct sock *sk) tp->snd_cwnd_clamp =min_t (u32, tp->snd_cwnd_clamp,0xffffffff /128 ); } -static void tcp_yeah_pkts_acked (struct sock *sk,u32 pkts_acked,s32 rtt_us) +static void tcp_yeah_pkts_acked (struct sock *sk, +const struct ack_sample *sample) {const struct inet_connection_sock *icsk =inet_csk (sk);struct yeah *yeah =inet_csk_ca (sk);if (icsk->icsk_ca_state == TCP_CA_Open) - yeah->pkts_acked = pkts_acked; + yeah->pkts_acked = sample->pkts_acked; -tcp_vegas_pkts_acked (sk, pkts_acked, rtt_us); +tcp_vegas_pkts_acked (sk, sample); }static void tcp_yeah_cong_avoid (struct sock *sk,u32 ack,u32 acked) --1.8.1
RFC PATCH v6 2/4 tcp: refactor struct tcp_skb_cb
In reply to Lawrence BrakmoRefactor tcp_skb_cb to create two overlaping areas to store state for incoming or outgoing skbs based on comments by Neal Cardwell to tcp_nv patch:
AFAICT this patch would not require an increase in the size of sk_buff cb[] if it were to take advantage of the fact that the tcp_skb_cb header.h4 and header.h6 fields are only used in the packet reception code path, and this in_flight field is only used on the transmit side.
--- include/net/tcp.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
include/net/tcp.h +8 -3
@@ -755,11 +755,16 @@ struct tcp_skb_cb {/* 1 byte hole */ __u32 ack_seq;/* Sequence number ACK'd */ union { -struct inet_skb_parm h4; +struct { +/* There is space for up to 20 bytes */ + } tx;/* only used for outgoing skbs */ +union { +struct inet_skb_parm h4;#if IS_ENABLED (CONFIG_IPV6 ) -struct inet6_skb_parm h6; +struct inet6_skb_parm h6;#endif - } header;/* For incoming frames */ + } header;/* For incoming skbs */ + }; };#define TCP_SKB_CB (__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
Signature · 1 line
1.8.1
Re: [RFC PATCH v6 net-next 2/4] tcp: refactor struct tcp_skb_cb
Quoted 5 lines · Lawrence Brakmo
Refactor
tcp_skb_cbto create two overlaping areas to store state for incoming or outgoing skbs based on comments by Neal Cardwell totcp_nvpatch:
Quoted 7 lines
AFAICT this patch would not require an increase in the size of
sk_buffcb[] if it were to take advantage of the fact that thetcp_skb_cbheader.h4 and header.h6 fields are only used in the packet reception code path, and thisin_flightfield is only used on the transmit side.Signed-off-by Lawrence Brakmo <[email protected]>
Quoted 31 lines
--- include/net/tcp.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)include/net/tcp.h +8
-4@@ -755,11 +755,16 @@ struct tcp_skb_cb {/* 1 byte hole */ __u32 ack_seq;/* Sequence number ACK'd */ union { -struct inet_skb_parm h4; +struct { +/* There is space for up to 20 bytes */ + } tx;/* only used for outgoing skbs */ +union { +struct inet_skb_parm h4;#if IS_ENABLED (CONFIG_IPV6 ) -struct inet6_skb_parm h6; +struct inet6_skb_parm h6;#endif - } header;/* For incoming frames */ + } header;/* For incoming skbs */ + }; };#define TCP_SKB_CB (__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) --1.8.1
RFC PATCH v6 3/4 tcp: add in_flight to tcp_skb_cb
In reply to Lawrence BrakmoAdd 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 | 5 ++++- net/ipv4/tcp_output.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)
include/net/tcp.h +2 -0
@@ -757,6 +757,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;
@@ -842,6 +843,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 +4 -1
@@ -3069,6 +3069,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 ;
@@ -3108,6 +3109,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 ;
@@ -3197,7 +3199,8 @@ 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, ca_rtt_us, + last_in_flight}; icsk->icsk_ca_ops->pkts_acked (sk, &sample); }
net/ipv4/tcp_output.c +3 -1
@@ -920,9 +920,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);
@@ -933,7 +936,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
1.8.1
Re: [RFC PATCH v6 net-next 3/4] tcp: add in_flight to tcp_skb_cb
Quoted 67 lines · Lawrence Brakmo
Add
in_flight(bytes in flight when packet was sent) field to tx component oftcp_skb_cband make it available to congestion modules'pkts_acked()function through theack_samplefunction argument.Signed-off-by Lawrence Brakmo <[email protected]>--- include/net/tcp.h | 2 ++ net/ipv4/tcp_input.c | 5 ++++- net/ipv4/tcp_output.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)include/net/tcp.h +2
-0@@ -757,6 +757,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;@@ -842,6 +843,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 +4
-1@@ -3069,6 +3069,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 ;@@ -3108,6 +3109,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 ;@@ -3197,7 +3199,8 @@ 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, ca_rtt_us, + last_in_flight}; icsk->icsk_ca_ops->pkts_acked (sk, &sample); }net/ipv4/tcp_output.c +0
-0
net/ipv4/tcp_output.c static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, · line 928
Quoted 9 lines
net/ipv4/tcp_output.c +3
-0@@ -920,9 +920,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;
what if skb is a retransmitted packet? e.g. the first retransmission in fast recovery would always record an inflight of 1 packet?
Quoted 14 lines
net/ipv4/tcp_output.c +0
-2if (unlikely (skb_cloned (skb))) skb =pskb_copy (skb, gfp_mask);@@ -933,7 +936,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)); --1.8.1
Re: [RFC PATCH v6 net-next 3/4] tcp: add in_flight to tcp_skb_cb
Yuchung, thank you for reviewing these patches. Response inline below.
Quoted 78 lines · Yuchung Cheng
Quoted 77 lines · Lawrence Brakmo
Add
in_flight(bytes in flight when packet was sent) field to tx component oftcp_skb_cband make it available to congestion modules'pkts_acked()function through theack_samplefunction argument.Signed-off-by Lawrence Brakmo <[email protected]>--- include/net/tcp.h | 2 ++ net/ipv4/tcp_input.c | 5 ++++- net/ipv4/tcp_output.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)include/net/tcp.h +1
-0@@ -757,6 +757,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;include/net/tcp.h +1
-0@@ -842,6 +843,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 +2
-0@@ -3069,6 +3069,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 ;@@ -3108,6 +3109,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;net/ipv4/tcp_input.c +2
-1@@ -3197,7 +3199,8 @@ 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, ca_rtt_us, + last_in_flight}; icsk->icsk_ca_ops->pkts_acked (sk, &sample);}net/ipv4/tcp_output.c +1
-0@@ -920,9 +920,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);
Quoted 6 lines
net/ipv4/tcp_output.c static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, · line 928
Quoted 4 lines
net/ipv4/tcp_output.c +2
-0if (clone_it) {skb_mstamp_get (&skb->skb_mstamp); +TCP_SKB_CB (skb)->tx.in_flight =TCP_SKB_CB (skb)->end_seq + - tp->snd_una;what if skb is a retransmitted packet? e.g. the first retransmission in fast recovery would always record an inflight of 1 packet?
Yes.
This does not affect NV for 2 reasons: 1) NV does not use ACKs when ca_state is not Open or Disorder to determine congestion state, 2) even if we used it, the small inflight means that the computed throughput will be small so it will not cause a non-congestion signal, but will not cause a congestion signal either because NV needs many (~60) measurements before determining there is congestion.
However, other consumers may prefer a different value. From a congestion avoidance perspective, it is unclear we will be able to compute an accurate throughput when retransmitting, so we may as well give a lower bound.
What do you think?
Quoted 16 lines
Quoted 16 lines
net/ipv4/tcp_output.c +0
-2if (unlikely (skb_cloned (skb))) skb =pskb_copy (skb, gfp_mask);@@ -933,7 +936,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)); --1.8.1
Yuchung Cheng
Acked-byRe: [RFC PATCH v6 net-next 3/4] tcp: add in_flight to tcp_skb_cb
Quoted 11 lines · Lawrence Brakmo
Yuchung, thank you for reviewing these patches. Response inline below.
Quoted 7 lines · Yuchung Cheng
Quoted 6 lines · Lawrence Brakmo
Add
in_flight(bytes in flight when packet was sent) field to tx component oftcp_skb_cband make it available to congestion modules'pkts_acked()function through theack_samplefunction argument.Signed-off-by Lawrence Brakmo <[email protected]>
Quoted 86 lines
Quoted 71 lines
Quoted 71 lines
--- include/net/tcp.h | 2 ++ net/ipv4/tcp_input.c | 5 ++++- net/ipv4/tcp_output.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)include/net/tcp.h +1
-0@@ -757,6 +757,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;include/net/tcp.h +1
-0@@ -842,6 +843,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 +2
-0@@ -3069,6 +3069,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 ;@@ -3108,6 +3109,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;net/ipv4/tcp_input.c +2
-1@@ -3197,7 +3199,8 @@ 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, ca_rtt_us, + last_in_flight}; icsk->icsk_ca_ops->pkts_acked (sk, &sample);}net/ipv4/tcp_output.c +1
-0@@ -920,9 +920,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);Quoted 6 lines
net/ipv4/tcp_output.c static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, · line 928
Quoted 4 lines
net/ipv4/tcp_output.c +2
-0if (clone_it) {skb_mstamp_get (&skb->skb_mstamp); +TCP_SKB_CB (skb)->tx.in_flight =TCP_SKB_CB (skb)->end_seq + - tp->snd_una;what if skb is a retransmitted packet? e.g. the first retransmission in fast recovery would always record an inflight of 1 packet?
Yes.
This does not affect NV for 2 reasons: 1) NV does not use ACKs whenca_stateis not Open or Disorder to determine congestion state, 2) even if we used it, the small inflight means that the computed throughput will be small so it will not cause a non-congestion signal, but will not cause a congestion signal either because NV needs many (~60) measurements before determining there is congestion.
Quoted 4 lines
However, other consumers may prefer a different value. From a congestion avoidance perspective, it is unclear we will be able to compute an accurate throughput when retransmitting, so we may as well give a lower bound.
I see. Then this is OK for now since only NV uses it. We can enhance and track tput even during other CA states later. Would that be a useful feature for NV as well?
Quoted 20 lines
What do you think?
Quoted 16 lines
Quoted 16 lines
net/ipv4/tcp_output.c +0
-2if (unlikely (skb_cloned (skb))) skb =pskb_copy (skb, gfp_mask);@@ -933,7 +936,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)); --1.8.1
Re: [RFC PATCH v6 net-next 3/4] tcp: add in_flight to tcp_skb_cb
Quoted 100 lines · Yuchung Cheng
Quoted 11 lines · Lawrence Brakmo
Yuchung, thank you for reviewing these patches. Response inline below.
Quoted 7 lines · Yuchung Cheng
Quoted 6 lines · Lawrence Brakmo
Add
in_flight(bytes in flight when packet was sent) field to tx component oftcp_skb_cband make it available to congestion modules'pkts_acked()function through theack_samplefunction argument.Signed-off-by Lawrence Brakmo <[email protected]>Acked-by Yuchung Cheng <[email protected]>Quoted 86 lines
Quoted 71 lines
Quoted 71 lines
--- include/net/tcp.h | 2 ++ net/ipv4/tcp_input.c | 5 ++++- net/ipv4/tcp_output.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)include/net/tcp.h +1
-0@@ -757,6 +757,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;include/net/tcp.h +1
-0@@ -842,6 +843,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 +2
-0@@ -3069,6 +3069,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 ;@@ -3108,6 +3109,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;net/ipv4/tcp_input.c +2
-1@@ -3197,7 +3199,8 @@ 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, ca_rtt_us, + last_in_flight}; icsk->icsk_ca_ops->pkts_acked (sk, &sample);}net/ipv4/tcp_output.c +1
-0@@ -920,9 +920,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);Quoted 6 lines
net/ipv4/tcp_output.c static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, · line 928
Quoted 4 lines
net/ipv4/tcp_output.c +2
-0if (clone_it) {skb_mstamp_get (&skb->skb_mstamp); +TCP_SKB_CB (skb)->tx.in_flight =TCP_SKB_CB (skb)->end_seq + - tp->snd_una;what if skb is a retransmitted packet? e.g. the first retransmission in fast recovery would always record an inflight of 1 packet?
Yes.
This does not affect NV for 2 reasons: 1) NV does not use ACKs whenca_stateis not Open or Disorder to determine congestion state, 2) even if we used it, the small inflight means that the computed throughput will be small so it will not cause a non-congestion signal, but will not cause a congestion signal either because NV needs many (~60) measurements before determining there is congestion.
Quoted 7 lines
Quoted 4 lines
However, other consumers may prefer a different value. From a congestion avoidance perspective, it is unclear we will be able to compute an accurate throughput when retransmitting, so we may as well give a lower bound.
I see. Then this is OK for now since only NV uses it. We can enhance and track tput even during other CA states later. Would that be a useful feature for NV as well?
For example, we (at Google servers) have seen some flows staying in very long CA_Recovery due to rate limiter or CA_Disorder state due to high path reordering. It'd be beneficial to have CC continue to operate in these circumstances in the future.
Quoted 21 lines
Quoted 21 lines
What do you think?
Quoted 16 lines
Quoted 16 lines
net/ipv4/tcp_output.c +0
-2if (unlikely (skb_cloned (skb))) skb =pskb_copy (skb, gfp_mask);@@ -933,7 +936,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)); --1.8.1
Re: [RFC PATCH v6 net-next 3/4] tcp: add in_flight to tcp_skb_cb
Quoted 113 lines · Yuchung Cheng
Quoted 112 lines · Yuchung Cheng
Quoted 11 lines · Lawrence Brakmo
Yuchung, thank you for reviewing these patches. Response inline below.
Quoted 7 lines · Yuchung Cheng
Quoted 6 lines · Lawrence Brakmo
Add
in_flight(bytes in flight when packet was sent) field to tx component oftcp_skb_cband make it available to congestion modules'pkts_acked()function through theack_samplefunction argument.Signed-off-by Lawrence Brakmo <[email protected]>Acked-by Yuchung Cheng <[email protected]>Quoted 98 lines
Quoted 73 lines
Quoted 73 lines
--- include/net/tcp.h | 2 ++ net/ipv4/tcp_input.c | 5 ++++- net/ipv4/tcp_output.c | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-)include/net/tcp.h +1
-0@@ -757,6 +757,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;include/net/tcp.h +1
-0@@ -842,6 +843,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 +2
-0@@ -3069,6 +3069,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 ;@@ -3108,6 +3109,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;net/ipv4/tcp_input.c +2
-1@@ -3197,7 +3199,8 @@ 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, ca_rtt_us, + last_in_flight}; icsk->icsk_ca_ops->pkts_acked (sk, &sample);}net/ipv4/tcp_output.c +1
-0@@ -920,9 +920,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);Quoted 7 lines
Quoted 5 lines
net/ipv4/tcp_output.c +1
-0if (clone_it) {skb_mstamp_get (&skb->skb_mstamp); + TCP_SKB_CB(skb)->tx.in_flight =TCP_SKB_CB(skb)->end_seq
+ -tp->snd_una;what if skb is a retransmitted packet? e.g. the first retransmission in fast recovery would always record an inflight of 1 packet?
Yes.
This does not affect NV for 2 reasons: 1) NV does not use ACKs whenca_stateis not Open or Disorder to determine congestion state, 2) even if
we used it, the small inflight means that the computed throughput will be
small so it will not cause a non-congestion signal, but will not cause a
congestion signal either because NV needs many (~60) measurements before
determining there is congestion.However, other consumers may prefer a different value. From a congestion
avoidance perspective, it is unclear we will be able to compute an accurate throughput when retransmitting, so we may as well give a lower bound.
Quoted 7 lines
Quoted 3 lines
I see. Then this is OK for now since only NV uses it. We can enhance and track tput even during other CA states later. Would that be a useful feature for NV as well?
For example, we (at Google servers) have seen some flows staying in very long
CA_Recoverydue to rate limiter orCA_Disorderstate due to high path reordering. It'd be beneficial to have CC continue to operate in these circumstances in the future.
Hopefully congestion avoidance in NV would adapt to a rate limiter and prevent
losses or large queues.
However, for the time being NV is only recommended for data center traffic since 1) I¹ve only tested in small RTT environments and 2) cannot compete fairly with Cubic (at least in small RTT environments).
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
What do you think?
Quoted 17 lines
Quoted 17 lines
if (unlikely(skb_cloned(skb))) skb = pskb_copy(skb, gfp_mask);net/ipv4/tcp_output.c +0
-0@@ -933,7 +936,6 @@ static int tcp_transmit_skb(struct sock *sk,struct
sk_buff*skb, intclone_it,} inet = inet_sk(sk); - tp = tcp_sk(sk); tcb = TCP_SKB_CB(skb); memset(&opts, 0, sizeof(opts));--
1.8.1
RFC PATCH v6 4/4 tcp: add NV congestion control
In reply to Lawrence BrakmoThis is a request for comments.
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 | 489 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 506 insertions(+) create mode 100644 net/ipv4/tcp_nv.c
net/ipv4/Kconfig +16 -0
@@ -539,6 +539,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
@@ -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 +489 -0
489 lines not on this page · raw message
Signature · 1 line
1.8.1
David Miller
maintainerFrom: Lawrence Brakmo <[email protected]>
Date: Tue, 25 Aug 2015 16:33:50 -0700
Quoted 1 line
Changes from v5: cleaning of NV code, changing some default parameters
I have no fundamental objections to this patch series.