Lines Matching refs:ca
123 static inline void tcpnv_reset(struct tcpnv *ca, struct sock *sk) in tcpnv_reset() argument
127 ca->nv_reset = 0; in tcpnv_reset()
128 ca->nv_no_cong_cnt = 0; in tcpnv_reset()
129 ca->nv_rtt_cnt = 0; in tcpnv_reset()
130 ca->nv_last_rtt = 0; in tcpnv_reset()
131 ca->nv_rtt_max_rate = 0; in tcpnv_reset()
132 ca->nv_rtt_start_seq = tp->snd_una; in tcpnv_reset()
133 ca->nv_eval_call_cnt = 0; in tcpnv_reset()
134 ca->nv_last_snd_una = tp->snd_una; in tcpnv_reset()
139 struct tcpnv *ca = inet_csk_ca(sk); in tcpnv_init() local
142 tcpnv_reset(ca, sk); in tcpnv_init()
151 ca->nv_base_rtt = base_rtt; in tcpnv_init()
152 ca->nv_lower_bound_rtt = (base_rtt * 205) >> 8; /* 80% */ in tcpnv_init()
154 ca->nv_base_rtt = 0; in tcpnv_init()
155 ca->nv_lower_bound_rtt = 0; in tcpnv_init()
158 ca->nv_allow_cwnd_growth = 1; in tcpnv_init()
159 ca->nv_min_rtt_reset_jiffies = jiffies + 2 * HZ; in tcpnv_init()
160 ca->nv_min_rtt = NV_INIT_RTT; in tcpnv_init()
161 ca->nv_min_rtt_new = NV_INIT_RTT; in tcpnv_init()
162 ca->nv_min_cwnd = NV_MIN_CWND; in tcpnv_init()
163 ca->nv_catchup = 0; in tcpnv_init()
164 ca->cwnd_growth_factor = 0; in tcpnv_init()
170 inline u32 nv_get_bounded_rtt(struct tcpnv *ca, u32 val) in nv_get_bounded_rtt() argument
172 if (ca->nv_lower_bound_rtt > 0 && val < ca->nv_lower_bound_rtt) in nv_get_bounded_rtt()
173 return ca->nv_lower_bound_rtt; in nv_get_bounded_rtt()
174 else if (ca->nv_base_rtt > 0 && val > ca->nv_base_rtt) in nv_get_bounded_rtt()
175 return ca->nv_base_rtt; in nv_get_bounded_rtt()
183 struct tcpnv *ca = inet_csk_ca(sk); in tcpnv_cong_avoid() local
190 if (!ca->nv_allow_cwnd_growth) in tcpnv_cong_avoid()
199 if (ca->cwnd_growth_factor < 0) { in tcpnv_cong_avoid()
200 cnt = tcp_snd_cwnd(tp) << -ca->cwnd_growth_factor; in tcpnv_cong_avoid()
203 cnt = max(4U, tcp_snd_cwnd(tp) >> ca->cwnd_growth_factor); in tcpnv_cong_avoid()
217 struct tcpnv *ca = inet_csk_ca(sk); in tcpnv_state() local
219 if (new_state == TCP_CA_Open && ca->nv_reset) { in tcpnv_state()
220 tcpnv_reset(ca, sk); in tcpnv_state()
223 ca->nv_reset = 1; in tcpnv_state()
224 ca->nv_allow_cwnd_growth = 0; in tcpnv_state()
227 if (ca->cwnd_growth_factor > 0) in tcpnv_state()
228 ca->cwnd_growth_factor = 0; in tcpnv_state()
231 ca->cwnd_growth_factor > -8) in tcpnv_state()
232 ca->cwnd_growth_factor--; in tcpnv_state()
243 struct tcpnv *ca = inet_csk_ca(sk); in tcpnv_acked() local
260 if (ca->nv_catchup && tcp_snd_cwnd(tp) >= nv_min_cwnd) { in tcpnv_acked()
261 ca->nv_catchup = 0; in tcpnv_acked()
262 ca->nv_allow_cwnd_growth = 0; in tcpnv_acked()
265 bytes_acked = tp->snd_una - ca->nv_last_snd_una; in tcpnv_acked()
266 ca->nv_last_snd_una = tp->snd_una; in tcpnv_acked()
273 if (ca->nv_last_rtt > 0) { in tcpnv_acked()
275 ((u64)ca->nv_last_rtt) in tcpnv_acked()
279 ca->nv_min_rtt = avg_rtt << 1; in tcpnv_acked()
281 ca->nv_last_rtt = avg_rtt; in tcpnv_acked()
295 if (ca->nv_rtt_max_rate < rate) in tcpnv_acked()
296 ca->nv_rtt_max_rate = rate; in tcpnv_acked()
299 if (ca->nv_eval_call_cnt < 255) in tcpnv_acked()
300 ca->nv_eval_call_cnt++; in tcpnv_acked()
303 avg_rtt = nv_get_bounded_rtt(ca, avg_rtt); in tcpnv_acked()
306 if (avg_rtt < ca->nv_min_rtt) in tcpnv_acked()
307 ca->nv_min_rtt = avg_rtt; in tcpnv_acked()
310 if (avg_rtt < ca->nv_min_rtt_new) in tcpnv_acked()
311 ca->nv_min_rtt_new = avg_rtt; in tcpnv_acked()
322 if (time_after_eq(now, ca->nv_min_rtt_reset_jiffies)) { in tcpnv_acked()
325 ca->nv_min_rtt = ca->nv_min_rtt_new; in tcpnv_acked()
326 ca->nv_min_rtt_new = NV_INIT_RTT; in tcpnv_acked()
328 ca->nv_min_rtt_reset_jiffies = in tcpnv_acked()
333 ca->nv_min_cwnd = max(ca->nv_min_cwnd / 2, NV_MIN_CWND); in tcpnv_acked()
337 if (before(ca->nv_rtt_start_seq, tp->snd_una)) { in tcpnv_acked()
338 ca->nv_rtt_start_seq = tp->snd_nxt; in tcpnv_acked()
339 if (ca->nv_rtt_cnt < 0xff) in tcpnv_acked()
341 ca->nv_rtt_cnt++; in tcpnv_acked()
348 if (ca->nv_eval_call_cnt == 1 && in tcpnv_acked()
349 bytes_acked >= (ca->nv_min_cwnd - 1) * tp->mss_cache && in tcpnv_acked()
350 ca->nv_min_cwnd < (NV_TSO_CWND_BOUND + 1)) { in tcpnv_acked()
351 ca->nv_min_cwnd = min(ca->nv_min_cwnd in tcpnv_acked()
354 ca->nv_rtt_start_seq = tp->snd_nxt + in tcpnv_acked()
355 ca->nv_min_cwnd * tp->mss_cache; in tcpnv_acked()
356 ca->nv_eval_call_cnt = 0; in tcpnv_acked()
357 ca->nv_allow_cwnd_growth = 1; in tcpnv_acked()
366 div64_u64(((u64)ca->nv_rtt_max_rate) * ca->nv_min_rtt, in tcpnv_acked()
382 if (ca->nv_rtt_cnt < nv_rtt_min_cnt) { in tcpnv_acked()
385 if (ca->nv_eval_call_cnt < in tcpnv_acked()
389 } else if (ca->nv_eval_call_cnt < in tcpnv_acked()
391 if (ca->nv_allow_cwnd_growth && in tcpnv_acked()
392 ca->nv_rtt_cnt > nv_stop_rtt_cnt) in tcpnv_acked()
393 ca->nv_allow_cwnd_growth = 0; in tcpnv_acked()
398 ca->nv_allow_cwnd_growth = 0; in tcpnv_acked()
411 if (ca->cwnd_growth_factor > 0) in tcpnv_acked()
412 ca->cwnd_growth_factor = 0; in tcpnv_acked()
413 ca->nv_no_cong_cnt = 0; in tcpnv_acked()
416 if (ca->nv_eval_call_cnt < nv_inc_eval_min_calls) in tcpnv_acked()
419 ca->nv_allow_cwnd_growth = 1; in tcpnv_acked()
420 ca->nv_no_cong_cnt++; in tcpnv_acked()
421 if (ca->cwnd_growth_factor < 0 && in tcpnv_acked()
423 ca->nv_no_cong_cnt > nv_cwnd_growth_rate_neg) { in tcpnv_acked()
424 ca->cwnd_growth_factor++; in tcpnv_acked()
425 ca->nv_no_cong_cnt = 0; in tcpnv_acked()
426 } else if (ca->cwnd_growth_factor >= 0 && in tcpnv_acked()
428 ca->nv_no_cong_cnt > in tcpnv_acked()
430 ca->cwnd_growth_factor++; in tcpnv_acked()
431 ca->nv_no_cong_cnt = 0; in tcpnv_acked()
439 ca->nv_eval_call_cnt = 0; in tcpnv_acked()
440 ca->nv_rtt_cnt = 0; in tcpnv_acked()
441 ca->nv_rtt_max_rate = 0; in tcpnv_acked()
456 const struct tcpnv *ca = inet_csk_ca(sk); in tcpnv_get_info() local
460 info->vegas.tcpv_rttcnt = ca->nv_rtt_cnt; in tcpnv_get_info()
461 info->vegas.tcpv_rtt = ca->nv_last_rtt; in tcpnv_get_info()
462 info->vegas.tcpv_minrtt = ca->nv_min_rtt; in tcpnv_get_info()