Lines Matching +full:min +full:- +full:sample +full:- +full:time

1 // SPDX-License-Identifier: GPL-2.0-only
3 * TCP Westwood+: end-to-end bandwidth estimation for TCP
10 * - Mascolo S, Casetti, M. Gerla et al.
13 * - A. Grieco, s. Mascolo
17 * - A. Dell'Aera, L. Grieco, S. Mascolo.
18 * "Linux 2.4 Implementation of Westwood+ TCP with Rate-Halving :
21 * Westwood+ employs end-to-end bandwidth measurement to set cwnd and
43 u8 reset_rtt_min; /* Reset RTT min to next RTT sample*/
55 * information about RTTmin at this time so we simply set it to
65 w->bk = 0; in tcp_westwood_init()
66 w->bw_ns_est = 0; in tcp_westwood_init()
67 w->bw_est = 0; in tcp_westwood_init()
68 w->accounted = 0; in tcp_westwood_init()
69 w->cumul_ack = 0; in tcp_westwood_init()
70 w->reset_rtt_min = 1; in tcp_westwood_init()
71 w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT; in tcp_westwood_init()
72 w->rtt_win_sx = tcp_jiffies32; in tcp_westwood_init()
73 w->snd_una = tcp_sk(sk)->snd_una; in tcp_westwood_init()
74 w->first_ack = 1; in tcp_westwood_init()
79 * Low-pass filter. Implemented using constant coefficients.
88 /* If the filter is empty fill it with the first sample of bandwidth */ in westwood_filter()
89 if (w->bw_ns_est == 0 && w->bw_est == 0) { in westwood_filter()
90 w->bw_ns_est = w->bk / delta; in westwood_filter()
91 w->bw_est = w->bw_ns_est; in westwood_filter()
93 w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta); in westwood_filter()
94 w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est); in westwood_filter()
101 * but all westwood needs is the last sample of srtt.
104 const struct ack_sample *sample) in tcp_westwood_pkts_acked() argument
108 if (sample->rtt_us > 0) in tcp_westwood_pkts_acked()
109 w->rtt = usecs_to_jiffies(sample->rtt_us); in tcp_westwood_pkts_acked()
120 s32 delta = tcp_jiffies32 - w->rtt_win_sx; in westwood_update_window()
122 /* Initialize w->snd_una with the first acked sequence number in order in westwood_update_window()
123 * to fix mismatch between tp->snd_una and w->snd_una for the first in westwood_update_window()
124 * bandwidth sample in westwood_update_window()
126 if (w->first_ack) { in westwood_update_window()
127 w->snd_una = tcp_sk(sk)->snd_una; in westwood_update_window()
128 w->first_ack = 0; in westwood_update_window()
132 * See if a RTT-window has passed. in westwood_update_window()
134 * 50ms we don't filter but we continue 'building the sample'. in westwood_update_window()
136 * time intervals is better to avoid... in westwood_update_window()
140 if (w->rtt && delta > max_t(u32, w->rtt, TCP_WESTWOOD_RTT_MIN)) { in westwood_update_window()
143 w->bk = 0; in westwood_update_window()
144 w->rtt_win_sx = tcp_jiffies32; in westwood_update_window()
150 if (w->reset_rtt_min) { in update_rtt_min()
151 w->rtt_min = w->rtt; in update_rtt_min()
152 w->reset_rtt_min = 0; in update_rtt_min()
154 w->rtt_min = min(w->rtt, w->rtt_min); in update_rtt_min()
170 w->bk += tp->snd_una - w->snd_una; in westwood_fast_bw()
171 w->snd_una = tp->snd_una; in westwood_fast_bw()
185 w->cumul_ack = tp->snd_una - w->snd_una; in westwood_acked_count()
188 * tp->snd_una. in westwood_acked_count()
190 if (!w->cumul_ack) { in westwood_acked_count()
191 w->accounted += tp->mss_cache; in westwood_acked_count()
192 w->cumul_ack = tp->mss_cache; in westwood_acked_count()
195 if (w->cumul_ack > tp->mss_cache) { in westwood_acked_count()
197 if (w->accounted >= w->cumul_ack) { in westwood_acked_count()
198 w->accounted -= w->cumul_ack; in westwood_acked_count()
199 w->cumul_ack = tp->mss_cache; in westwood_acked_count()
201 w->cumul_ack -= w->accounted; in westwood_acked_count()
202 w->accounted = 0; in westwood_acked_count()
206 w->snd_una = tp->snd_una; in westwood_acked_count()
208 return w->cumul_ack; in westwood_acked_count()
222 return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2); in tcp_westwood_bw_rttmin()
231 w->bk += westwood_acked_count(sk); in tcp_westwood_ack()
247 tp->snd_cwnd = tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk); in tcp_westwood_event()
250 tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk); in tcp_westwood_event()
252 w->reset_rtt_min = 1; in tcp_westwood_event()
266 if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { in tcp_westwood_info()
267 info->vegas.tcpv_enabled = 1; in tcp_westwood_info()
268 info->vegas.tcpv_rttcnt = 0; in tcp_westwood_info()
269 info->vegas.tcpv_rtt = jiffies_to_usecs(ca->rtt); in tcp_westwood_info()
270 info->vegas.tcpv_minrtt = jiffies_to_usecs(ca->rtt_min); in tcp_westwood_info()