From d861b5c7534e12590e731433304d87b453c3613f Mon Sep 17 00:00:00 2001 From: Pengcheng Yang Date: Mon, 16 Mar 2020 14:35:09 +0800 Subject: tcp: stretch ACK fixes in Veno prep No code logic has been changed in this patch. Signed-off-by: Pengcheng Yang Acked-by: Neal Cardwell Signed-off-by: David S. Miller --- net/ipv4/tcp_veno.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'net/ipv4/tcp_veno.c') diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c index 3b36bb1a0dda..857491c5b856 100644 --- a/net/ipv4/tcp_veno.c +++ b/net/ipv4/tcp_veno.c @@ -153,31 +153,33 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked) veno->diff = (tp->snd_cwnd << V_PARAM_SHIFT) - target_cwnd; if (tcp_in_slow_start(tp)) { - /* Slow start. */ + /* Slow start. */ tcp_slow_start(tp, acked); + goto done; + } + + /* Congestion avoidance. */ + if (veno->diff < beta) { + /* In the "non-congestive state", increase cwnd + * every rtt. + */ + tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1); } else { - /* Congestion avoidance. */ - if (veno->diff < beta) { - /* In the "non-congestive state", increase cwnd - * every rtt. - */ - tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1); - } else { - /* In the "congestive state", increase cwnd - * every other rtt. - */ - if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { - if (veno->inc && - tp->snd_cwnd < tp->snd_cwnd_clamp) { - tp->snd_cwnd++; - veno->inc = 0; - } else - veno->inc = 1; - tp->snd_cwnd_cnt = 0; + /* In the "congestive state", increase cwnd + * every other rtt. + */ + if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { + if (veno->inc && + tp->snd_cwnd < tp->snd_cwnd_clamp) { + tp->snd_cwnd++; + veno->inc = 0; } else - tp->snd_cwnd_cnt++; - } + veno->inc = 1; + tp->snd_cwnd_cnt = 0; + } else + tp->snd_cwnd_cnt++; } +done: if (tp->snd_cwnd < 2) tp->snd_cwnd = 2; else if (tp->snd_cwnd > tp->snd_cwnd_clamp) -- cgit From ca04f5d4bb79ef22b708ebb8ab147fc5abb25300 Mon Sep 17 00:00:00 2001 From: Pengcheng Yang Date: Mon, 16 Mar 2020 14:35:10 +0800 Subject: tcp: fix stretch ACK bugs in Veno Change Veno to properly handle stretch ACKs in additive increase mode by passing in the count of ACKed packets to tcp_cong_avoid_ai(). Signed-off-by: Pengcheng Yang Acked-by: Neal Cardwell Signed-off-by: David S. Miller --- net/ipv4/tcp_veno.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'net/ipv4/tcp_veno.c') diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c index 857491c5b856..50a9a6e2c4cd 100644 --- a/net/ipv4/tcp_veno.c +++ b/net/ipv4/tcp_veno.c @@ -154,8 +154,9 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked) if (tcp_in_slow_start(tp)) { /* Slow start. */ - tcp_slow_start(tp, acked); - goto done; + acked = tcp_slow_start(tp, acked); + if (!acked) + goto done; } /* Congestion avoidance. */ @@ -163,7 +164,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked) /* In the "non-congestive state", increase cwnd * every rtt. */ - tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1); + tcp_cong_avoid_ai(tp, tp->snd_cwnd, acked); } else { /* In the "congestive state", increase cwnd * every other rtt. @@ -177,7 +178,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked) veno->inc = 1; tp->snd_cwnd_cnt = 0; } else - tp->snd_cwnd_cnt++; + tp->snd_cwnd_cnt += acked; } done: if (tp->snd_cwnd < 2) -- cgit