| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * TCP Veno congestion control |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * "TCP Veno: TCP Enhancement for Transmission over Wireless Access Networks." |
|---|
| 7 | 8 | * IEEE Journal on Selected Areas in Communication, |
|---|
| 8 | 9 | * Feb. 2003. |
|---|
| 9 | | - * See http://www.ie.cuhk.edu.hk/fileadmin/staff_upload/soung/Journal/J3.pdf |
|---|
| 10 | + * See https://www.ie.cuhk.edu.hk/fileadmin/staff_upload/soung/Journal/J3.pdf |
|---|
| 10 | 11 | */ |
|---|
| 11 | 12 | |
|---|
| 12 | 13 | #include <linux/mm.h> |
|---|
| .. | .. |
|---|
| 152 | 153 | veno->diff = (tp->snd_cwnd << V_PARAM_SHIFT) - target_cwnd; |
|---|
| 153 | 154 | |
|---|
| 154 | 155 | if (tcp_in_slow_start(tp)) { |
|---|
| 155 | | - /* Slow start. */ |
|---|
| 156 | | - tcp_slow_start(tp, acked); |
|---|
| 157 | | - } else { |
|---|
| 158 | | - /* Congestion avoidance. */ |
|---|
| 159 | | - if (veno->diff < beta) { |
|---|
| 160 | | - /* In the "non-congestive state", increase cwnd |
|---|
| 161 | | - * every rtt. |
|---|
| 162 | | - */ |
|---|
| 163 | | - tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1); |
|---|
| 164 | | - } else { |
|---|
| 165 | | - /* In the "congestive state", increase cwnd |
|---|
| 166 | | - * every other rtt. |
|---|
| 167 | | - */ |
|---|
| 168 | | - if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { |
|---|
| 169 | | - if (veno->inc && |
|---|
| 170 | | - tp->snd_cwnd < tp->snd_cwnd_clamp) { |
|---|
| 171 | | - tp->snd_cwnd++; |
|---|
| 172 | | - veno->inc = 0; |
|---|
| 173 | | - } else |
|---|
| 174 | | - veno->inc = 1; |
|---|
| 175 | | - tp->snd_cwnd_cnt = 0; |
|---|
| 176 | | - } else |
|---|
| 177 | | - tp->snd_cwnd_cnt++; |
|---|
| 178 | | - } |
|---|
| 156 | + /* Slow start. */ |
|---|
| 157 | + acked = tcp_slow_start(tp, acked); |
|---|
| 158 | + if (!acked) |
|---|
| 159 | + goto done; |
|---|
| 179 | 160 | } |
|---|
| 161 | + |
|---|
| 162 | + /* Congestion avoidance. */ |
|---|
| 163 | + if (veno->diff < beta) { |
|---|
| 164 | + /* In the "non-congestive state", increase cwnd |
|---|
| 165 | + * every rtt. |
|---|
| 166 | + */ |
|---|
| 167 | + tcp_cong_avoid_ai(tp, tp->snd_cwnd, acked); |
|---|
| 168 | + } else { |
|---|
| 169 | + /* In the "congestive state", increase cwnd |
|---|
| 170 | + * every other rtt. |
|---|
| 171 | + */ |
|---|
| 172 | + if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { |
|---|
| 173 | + if (veno->inc && |
|---|
| 174 | + tp->snd_cwnd < tp->snd_cwnd_clamp) { |
|---|
| 175 | + tp->snd_cwnd++; |
|---|
| 176 | + veno->inc = 0; |
|---|
| 177 | + } else |
|---|
| 178 | + veno->inc = 1; |
|---|
| 179 | + tp->snd_cwnd_cnt = 0; |
|---|
| 180 | + } else |
|---|
| 181 | + tp->snd_cwnd_cnt += acked; |
|---|
| 182 | + } |
|---|
| 183 | +done: |
|---|
| 180 | 184 | if (tp->snd_cwnd < 2) |
|---|
| 181 | 185 | tp->snd_cwnd = 2; |
|---|
| 182 | 186 | else if (tp->snd_cwnd > tp->snd_cwnd_clamp) |
|---|