Lines Matching refs:tp

58 int tcp_ledbat_init(struct tcpcb *tp);
59 int tcp_ledbat_cleanup(struct tcpcb *tp);
60 void tcp_ledbat_cwnd_init(struct tcpcb *tp);
61 void tcp_ledbat_inseq_ack_rcvd(struct tcpcb *tp, struct tcphdr *th);
62 void tcp_ledbat_ack_rcvd(struct tcpcb *tp, struct tcphdr *th);
63 void tcp_ledbat_pre_fr(struct tcpcb *tp);
64 void tcp_ledbat_post_fr(struct tcpcb *tp, struct tcphdr *th);
65 void tcp_ledbat_after_idle(struct tcpcb *tp);
66 void tcp_ledbat_after_timeout(struct tcpcb *tp);
67 int tcp_ledbat_delay_ack(struct tcpcb *tp, struct tcphdr *th);
68 void tcp_ledbat_switch_cc(struct tcpcb *tp, uint16_t old_cc_index);
87 extern uint32_t get_base_rtt(struct tcpcb *tp);
139 static void update_cwnd(struct tcpcb *tp, uint32_t incr) {
144 base_rtt = get_base_rtt(tp);
149 if (base_rtt == 0 || tp->t_rttcur == 0) {
150 tp->snd_cwnd += incr;
154 qdelay = tp->t_rttcur - base_rtt;
166 if (tp->bg_ssthresh < tp->snd_cwnd)
167 tp->bg_ssthresh = tp->snd_cwnd;
168 tp->snd_cwnd += incr;
177 redwin = tp->snd_cwnd >> 3;
178 tp->snd_cwnd -= redwin;
179 if (tp->snd_cwnd < bg_ss_fltsz * tp->t_maxseg)
180 tp->snd_cwnd = bg_ss_fltsz * tp->t_maxseg;
185 if (tp->bg_ssthresh > tp->snd_cwnd)
186 tp->bg_ssthresh = tp->snd_cwnd;
192 flight_size = tp->snd_max - tp->snd_una;
194 max_allowed_cwnd = (allowed_increase * tp->t_maxseg)
196 tp->snd_cwnd = min(tp->snd_cwnd, max_allowed_cwnd);
200 int tcp_ledbat_init(struct tcpcb *tp) {
201 #pragma unused(tp)
206 int tcp_ledbat_cleanup(struct tcpcb *tp) {
207 #pragma unused(tp)
217 tcp_ledbat_cwnd_init(struct tcpcb *tp) {
218 tp->snd_cwnd = tp->t_maxseg * bg_ss_fltsz;
219 tp->bg_ssthresh = tp->snd_ssthresh;
227 tcp_ledbat_inseq_ack_rcvd(struct tcpcb *tp, struct tcphdr *th) {
231 acked = th->th_ack - tp->snd_una;
232 tp->t_bytes_acked += acked;
233 if (tp->t_bytes_acked > tp->snd_cwnd) {
234 tp->t_bytes_acked -= tp->snd_cwnd;
235 incr = tp->t_maxseg;
238 if (tp->snd_cwnd < tp->snd_wnd && incr > 0) {
239 update_cwnd(tp, incr);
245 tcp_ledbat_ack_rcvd(struct tcpcb *tp, struct tcphdr *th) {
259 register u_int cw = tp->snd_cwnd;
260 register u_int incr = tp->t_maxseg;
263 acked = th->th_ack - tp->snd_una;
264 tp->t_bytes_acked += acked;
265 if (cw >= tp->bg_ssthresh) {
267 if (tp->t_bytes_acked < cw) {
282 tp->snd_nxt == tp->snd_max) ? incr * 2 : incr;
286 if (tp->t_bytes_acked >= cw)
287 tp->t_bytes_acked -= cw;
289 update_cwnd(tp, incr);
293 tcp_ledbat_pre_fr(struct tcpcb *tp) {
296 win = min(tp->snd_wnd, tp->snd_cwnd) /
297 2 / tp->t_maxseg;
300 tp->snd_ssthresh = win * tp->t_maxseg;
301 if (tp->bg_ssthresh > tp->snd_ssthresh)
302 tp->bg_ssthresh = tp->snd_ssthresh;
304 tcp_cc_resize_sndbuf(tp);
308 tcp_ledbat_post_fr(struct tcpcb *tp, struct tcphdr *th) {
311 ss = tp->snd_max - th->th_ack;
322 if (ss < (int32_t)tp->snd_ssthresh)
323 tp->snd_cwnd = ss + tp->t_maxseg;
325 tp->snd_cwnd = tp->snd_ssthresh;
326 tp->t_bytes_acked = 0;
335 tcp_ledbat_after_idle(struct tcpcb *tp) {
342 if (tp->t_rttcur > 0) {
345 idle_time = tcp_now - tp->t_rcvtime;
346 nrtt = idle_time / tp->t_rttcur;
352 tp->rtt_hist[i] = 0;
355 tp->rtt_hist[n] = tp->rtt_hist[i];
356 tp->rtt_hist[i] = 0;
360 tp->snd_cwnd = tp->t_maxseg * bg_ss_fltsz;
371 tcp_ledbat_after_timeout(struct tcpcb *tp) {
372 if (tp->t_state >= TCPS_ESTABLISHED) {
373 u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg;
376 tp->snd_cwnd = tp->t_maxseg;
377 tp->snd_ssthresh = win * tp->t_maxseg;
378 tp->t_bytes_acked = 0;
379 tp->t_dupacks = 0;
381 if (tp->bg_ssthresh > tp->snd_ssthresh)
382 tp->bg_ssthresh = tp->snd_ssthresh;
384 tcp_cc_resize_sndbuf(tp);
403 tcp_ledbat_delay_ack(struct tcpcb *tp, struct tcphdr *th) {
404 if ((tp->t_flags & TF_RXWIN0SENT) == 0 &&
406 (tp->t_unacksegs == 1))
415 tcp_ledbat_switch_cc(struct tcpcb *tp, uint16_t old_cc_index) {
419 if (tp->bg_ssthresh == 0 || tp->bg_ssthresh > tp->snd_ssthresh)
420 tp->bg_ssthresh = tp->snd_ssthresh;
422 cwnd = min(tp->snd_wnd, tp->snd_cwnd);
424 if (tp->snd_cwnd > tp->bg_ssthresh)
425 cwnd = cwnd / tp->t_maxseg;
427 cwnd = cwnd / 2 / tp->t_maxseg;
432 tp->snd_cwnd = cwnd * tp->t_maxseg;
433 tp->t_bytes_acked = 0;