Lines Matching +full:we +full:- +full:extra +full:- +full:delay
1 // SPDX-License-Identifier: GPL-2.0-only
8 * IEEE Journal on Selected Areas in Communication, 13(8):1465--1480,
15 * o We do not change the loss detection or recovery mechanisms of
17 * using fine-grained timers, NewReno, and FACK.
19 * only every-other RTT during slow start, we increase during
22 * we use the rate at which ACKs come back as the "actual"
24 * o To speed convergence to the right rate, we set the cwnd
25 * to achieve the right ("actual") rate when we exit slow start.
26 * o To filter out the noise caused by delayed ACKs, we use the
29 * o When the sender re-starts from idle, it waits until it has
55 /* There are several situations when we must "re-start" Vegas:
60 * o when we send a packet and there is no outstanding
63 * In these circumstances we cannot do a Vegas calculation at the
64 * end of the first RTT, because any calculation we do is using
65 * stale info -- both the saved cwnd and congestion feedback are
68 * Instead we must wait until the completion of an RTT during
69 * which we actually receive ACKs.
76 /* Begin taking Vegas samples next time we send something. */ in vegas_enable()
77 vegas->doing_vegas_now = 1; in vegas_enable()
80 vegas->beg_snd_nxt = tp->snd_nxt; in vegas_enable()
82 vegas->cntRTT = 0; in vegas_enable()
83 vegas->minRTT = 0x7fffffff; in vegas_enable()
91 vegas->doing_vegas_now = 0; in vegas_disable()
98 vegas->baseRTT = 0x7fffffff; in tcp_vegas_init()
104 * Basically we:
105 * o min-filter RTT samples from within an RTT to get the current
106 * propagation delay + queuing delay (we are min-filtering to try to
108 * o min-filter RTT samples from a much longer window (forever for now)
109 * to find the propagation delay (baseRTT)
116 if (sample->rtt_us < 0) in tcp_vegas_pkts_acked()
120 vrtt = sample->rtt_us + 1; in tcp_vegas_pkts_acked()
122 /* Filter to find propagation delay: */ in tcp_vegas_pkts_acked()
123 if (vrtt < vegas->baseRTT) in tcp_vegas_pkts_acked()
124 vegas->baseRTT = vrtt; in tcp_vegas_pkts_acked()
127 * the current prop. delay + queuing delay: in tcp_vegas_pkts_acked()
129 vegas->minRTT = min(vegas->minRTT, vrtt); in tcp_vegas_pkts_acked()
130 vegas->cntRTT++; in tcp_vegas_pkts_acked()
144 * If the connection is idle and we are restarting,
145 * then we don't want to do any Vegas calculations
146 * until we get fresh RTT samples. So when we
147 * restart, we reset our Vegas state to a clean
148 * slate. After we get acks for this flight of
149 * packets, _then_ we can make Vegas calculations
162 return min(tp->snd_ssthresh, tcp_snd_cwnd(tp)); in tcp_vegas_ssthresh()
170 if (!vegas->doing_vegas_now) { in tcp_vegas_cong_avoid()
175 if (after(ack, vegas->beg_snd_nxt)) { in tcp_vegas_cong_avoid()
176 /* Do the Vegas once-per-RTT cwnd adjustment. */ in tcp_vegas_cong_avoid()
178 /* Save the extent of the current window so we can use this in tcp_vegas_cong_avoid()
181 vegas->beg_snd_nxt = tp->snd_nxt; in tcp_vegas_cong_avoid()
183 /* We do the Vegas calculations only if we got enough RTT in tcp_vegas_cong_avoid()
184 * samples that we can be reasonably sure that we got in tcp_vegas_cong_avoid()
186 * If we only had 2 samples total, in tcp_vegas_cong_avoid()
187 * then that means we're getting only 1 ACK per RTT, which in tcp_vegas_cong_avoid()
189 * If we have 3 samples, we should be OK. in tcp_vegas_cong_avoid()
192 if (vegas->cntRTT <= 2) { in tcp_vegas_cong_avoid()
193 /* We don't have enough RTT samples to do the Vegas in tcp_vegas_cong_avoid()
194 * calculation, so we'll behave like Reno. in tcp_vegas_cong_avoid()
201 /* We have enough RTT samples, so, using the Vegas in tcp_vegas_cong_avoid()
202 * algorithm, we determine if we should increase or in tcp_vegas_cong_avoid()
206 /* Pluck out the RTT we are using for the Vegas in tcp_vegas_cong_avoid()
212 rtt = vegas->minRTT; in tcp_vegas_cong_avoid()
214 /* Calculate the cwnd we should have, if we weren't in tcp_vegas_cong_avoid()
220 target_cwnd = (u64)tcp_snd_cwnd(tp) * vegas->baseRTT; in tcp_vegas_cong_avoid()
223 /* Calculate the difference between the window we had, in tcp_vegas_cong_avoid()
224 * and the window we would like to have. This quantity in tcp_vegas_cong_avoid()
227 diff = tcp_snd_cwnd(tp) * (rtt-vegas->baseRTT) / vegas->baseRTT; in tcp_vegas_cong_avoid()
237 * Then we add 1 because the integer in tcp_vegas_cong_avoid()
243 tp->snd_ssthresh = tcp_vegas_ssthresh(tp); in tcp_vegas_cong_avoid()
251 /* Figure out where we would like cwnd in tcp_vegas_cong_avoid()
256 * we slow down. in tcp_vegas_cong_avoid()
258 tcp_snd_cwnd_set(tp, tcp_snd_cwnd(tp) - 1); in tcp_vegas_cong_avoid()
259 tp->snd_ssthresh in tcp_vegas_cong_avoid()
262 /* We don't have enough extra packets in tcp_vegas_cong_avoid()
267 /* Sending just as fast as we in tcp_vegas_cong_avoid()
275 else if (tcp_snd_cwnd(tp) > tp->snd_cwnd_clamp) in tcp_vegas_cong_avoid()
276 tcp_snd_cwnd_set(tp, tp->snd_cwnd_clamp); in tcp_vegas_cong_avoid()
278 tp->snd_ssthresh = tcp_current_ssthresh(sk); in tcp_vegas_cong_avoid()
282 vegas->cntRTT = 0; in tcp_vegas_cong_avoid()
283 vegas->minRTT = 0x7fffffff; in tcp_vegas_cong_avoid()
296 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { in tcp_vegas_get_info()
297 info->vegas.tcpv_enabled = ca->doing_vegas_now; in tcp_vegas_get_info()
298 info->vegas.tcpv_rttcnt = ca->cntRTT; in tcp_vegas_get_info()
299 info->vegas.tcpv_rtt = ca->baseRTT; in tcp_vegas_get_info()
300 info->vegas.tcpv_minrtt = ca->minRTT; in tcp_vegas_get_info()