Lines Matching refs:tp
204 tcp_canceltimers(struct tcpcb *tp) in tcp_canceltimers() argument
206 tcp_callout_stop(tp, tp->tt_2msl); in tcp_canceltimers()
207 tcp_callout_stop(tp, tp->tt_persist); in tcp_canceltimers()
208 tcp_callout_stop(tp, tp->tt_keep); in tcp_canceltimers()
209 tcp_callout_stop(tp, tp->tt_rexmt); in tcp_canceltimers()
216 tcp_send_timermsg(struct tcpcb *tp, uint32_t task) in tcp_send_timermsg() argument
218 struct netmsg_tcp_timer *tmsg = tp->tt_msg; in tcp_send_timermsg()
241 tcp_timer_delack_handler(struct tcpcb *tp) in tcp_timer_delack_handler() argument
243 tp->t_flags |= TF_ACKNOW; in tcp_timer_delack_handler()
245 tcp_output(tp); in tcp_timer_delack_handler()
246 return tp; in tcp_timer_delack_handler()
255 struct tcpcb *tp = xtp; in tcp_timer_delack() local
256 struct callout *co = &tp->tt_delack->tc_callout; in tcp_timer_delack()
264 tcp_send_timermsg(tp, TCP_TIMER_DELACK); in tcp_timer_delack()
270 tcp_timer_2msl_handler(struct tcpcb *tp) in tcp_timer_2msl_handler() argument
277 ostate = tp->t_state; in tcp_timer_2msl_handler()
285 if (tp->t_state != TCPS_TIME_WAIT && in tcp_timer_2msl_handler()
286 (ticks - tp->t_rcvtime) <= tp->t_maxidle) { in tcp_timer_2msl_handler()
287 tcp_callout_reset(tp, tp->tt_2msl, tp->t_keepintvl, in tcp_timer_2msl_handler()
290 tp = tcp_close(tp); in tcp_timer_2msl_handler()
294 if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) in tcp_timer_2msl_handler()
295 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO); in tcp_timer_2msl_handler()
297 return tp; in tcp_timer_2msl_handler()
303 struct tcpcb *tp = xtp; in tcp_timer_2msl() local
304 struct callout *co = &tp->tt_2msl->tc_callout; in tcp_timer_2msl()
312 tcp_send_timermsg(tp, TCP_TIMER_2MSL); in tcp_timer_2msl()
318 tcp_timer_keep_handler(struct tcpcb *tp) in tcp_timer_keep_handler() argument
322 int ostate = tp->t_state; in tcp_timer_keep_handler()
330 if (tp->t_state < TCPS_ESTABLISHED) in tcp_timer_keep_handler()
332 if ((always_keepalive || (tp->t_flags & TF_KEEPALIVE) || in tcp_timer_keep_handler()
333 (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE)) && in tcp_timer_keep_handler()
334 tp->t_state <= TCPS_CLOSING) { in tcp_timer_keep_handler()
335 if ((ticks - tp->t_rcvtime) >= tp->t_keepidle + tp->t_maxidle) in tcp_timer_keep_handler()
350 t_template = tcp_maketemplate(tp); in tcp_timer_keep_handler()
352 tcp_respond(tp, t_template->tt_ipgen, in tcp_timer_keep_handler()
354 tp->rcv_nxt, tp->snd_una - 1, 0); in tcp_timer_keep_handler()
357 tcp_callout_reset(tp, tp->tt_keep, tp->t_keepintvl, in tcp_timer_keep_handler()
360 tcp_callout_reset(tp, tp->tt_keep, tp->t_keepidle, in tcp_timer_keep_handler()
365 if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) in tcp_timer_keep_handler()
366 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO); in tcp_timer_keep_handler()
368 return tp; in tcp_timer_keep_handler()
372 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_keep_handler()
375 if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) in tcp_timer_keep_handler()
376 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO); in tcp_timer_keep_handler()
378 return tp; in tcp_timer_keep_handler()
384 struct tcpcb *tp = xtp; in tcp_timer_keep() local
385 struct callout *co = &tp->tt_keep->tc_callout; in tcp_timer_keep()
393 tcp_send_timermsg(tp, TCP_TIMER_KEEP); in tcp_timer_keep()
399 tcp_timer_persist_handler(struct tcpcb *tp) in tcp_timer_persist_handler() argument
406 ostate = tp->t_state; in tcp_timer_persist_handler()
420 if (tp->t_rxtshift == TCP_MAXRXTSHIFT && in tcp_timer_persist_handler()
421 ((ticks - tp->t_rcvtime) >= tcp_maxpersistidle || in tcp_timer_persist_handler()
422 (ticks - tp->t_rcvtime) >= TCP_REXMTVAL(tp) * tcp_totbackoff)) { in tcp_timer_persist_handler()
424 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_persist_handler()
427 tcp_setpersist(tp); in tcp_timer_persist_handler()
428 tp->t_flags |= TF_FORCE; in tcp_timer_persist_handler()
429 tcp_output(tp); in tcp_timer_persist_handler()
430 tp->t_flags &= ~TF_FORCE; in tcp_timer_persist_handler()
434 if (tp && tp->t_inpcb->inp_socket->so_options & SO_DEBUG) in tcp_timer_persist_handler()
435 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO); in tcp_timer_persist_handler()
437 return tp; in tcp_timer_persist_handler()
443 struct tcpcb *tp = xtp; in tcp_timer_persist() local
444 struct callout *co = &tp->tt_persist->tc_callout; in tcp_timer_persist()
452 tcp_send_timermsg(tp, TCP_TIMER_PERSIST); in tcp_timer_persist()
457 tcp_save_congestion_state(struct tcpcb *tp) in tcp_save_congestion_state() argument
463 tp->snd_cwnd_prev = tp->snd_cwnd; in tcp_save_congestion_state()
464 tp->snd_wacked_prev = tp->snd_wacked; in tcp_save_congestion_state()
465 tp->snd_ssthresh_prev = tp->snd_ssthresh; in tcp_save_congestion_state()
466 tp->snd_recover_prev = tp->snd_recover; in tcp_save_congestion_state()
475 tp->snd_max_prev = tp->snd_max; in tcp_save_congestion_state()
477 if (IN_FASTRECOVERY(tp)) in tcp_save_congestion_state()
478 tp->rxt_flags |= TRXT_F_WASFRECOVERY; in tcp_save_congestion_state()
480 tp->rxt_flags &= ~TRXT_F_WASFRECOVERY; in tcp_save_congestion_state()
481 if (tp->t_flags & TF_RCVD_TSTMP) { in tcp_save_congestion_state()
483 tp->t_rexmtTS = ticks; in tcp_save_congestion_state()
484 tp->rxt_flags |= TRXT_F_FIRSTACCACK; in tcp_save_congestion_state()
487 tcp_sack_save_scoreboard(&tp->scb); in tcp_save_congestion_state()
492 tcp_revert_congestion_state(struct tcpcb *tp) in tcp_revert_congestion_state() argument
494 tp->snd_cwnd = tp->snd_cwnd_prev; in tcp_revert_congestion_state()
495 tp->snd_wacked = tp->snd_wacked_prev; in tcp_revert_congestion_state()
496 tp->snd_ssthresh = tp->snd_ssthresh_prev; in tcp_revert_congestion_state()
497 tp->snd_recover = tp->snd_recover_prev; in tcp_revert_congestion_state()
498 if (tp->rxt_flags & TRXT_F_WASFRECOVERY) in tcp_revert_congestion_state()
499 ENTER_FASTRECOVERY(tp); in tcp_revert_congestion_state()
500 if (tp->rxt_flags & TRXT_F_FASTREXMT) { in tcp_revert_congestion_state()
502 if (tp->rxt_flags & TRXT_F_EARLYREXMT) in tcp_revert_congestion_state()
506 tp->snd_last = ticks; in tcp_revert_congestion_state()
508 tp->rxt_flags |= TRXT_F_REBASERTO; in tcp_revert_congestion_state()
510 tp->t_badrxtwin = 0; in tcp_revert_congestion_state()
511 tp->t_rxtshift = 0; in tcp_revert_congestion_state()
512 tp->snd_nxt = tp->snd_max; in tcp_revert_congestion_state()
514 tcp_sack_revert_scoreboard(&tp->scb, tp->snd_una); in tcp_revert_congestion_state()
520 tcp_timer_rexmt_handler(struct tcpcb *tp) in tcp_timer_rexmt_handler() argument
528 ostate = tp->t_state; in tcp_timer_rexmt_handler()
535 if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) { in tcp_timer_rexmt_handler()
536 tp->t_rxtshift = TCP_MAXRXTSHIFT; in tcp_timer_rexmt_handler()
538 tp = tcp_drop(tp, tp->t_softerror ? in tcp_timer_rexmt_handler()
539 tp->t_softerror : ETIMEDOUT); in tcp_timer_rexmt_handler()
542 if (tp->t_rxtshift == 1) { in tcp_timer_rexmt_handler()
557 tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1)); in tcp_timer_rexmt_handler()
563 tp->t_rxtcur_prev = tp->t_rxtcur; in tcp_timer_rexmt_handler()
564 tp->t_srtt_prev = tp->t_srtt + in tcp_timer_rexmt_handler()
566 tp->t_rttvar_prev = tp->t_rttvar; in tcp_timer_rexmt_handler()
568 tcp_save_congestion_state(tp); in tcp_timer_rexmt_handler()
569 tp->rxt_flags &= ~(TRXT_F_FASTREXMT | TRXT_F_EARLYREXMT | in tcp_timer_rexmt_handler()
572 if (tp->t_state == TCPS_SYN_SENT || tp->t_state == TCPS_SYN_RECEIVED) { in tcp_timer_rexmt_handler()
579 tp->t_rxtsyn += tp->t_rxtcur; in tcp_timer_rexmt_handler()
582 tcp_sack_discard(tp); in tcp_timer_rexmt_handler()
584 if (tp->t_state == TCPS_SYN_SENT) { in tcp_timer_rexmt_handler()
586 rexmt = TCP_REXMTVAL(tp) * in tcp_timer_rexmt_handler()
587 tcp_syn_backoff_low[tp->t_rxtshift]; in tcp_timer_rexmt_handler()
589 rexmt = TCP_REXMTVAL(tp) * in tcp_timer_rexmt_handler()
590 tcp_syn_backoff[tp->t_rxtshift]; in tcp_timer_rexmt_handler()
593 rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; in tcp_timer_rexmt_handler()
595 TCPT_RANGESET(tp->t_rxtcur, rexmt, in tcp_timer_rexmt_handler()
596 tp->t_rttmin, TCPTV_REXMTMAX); in tcp_timer_rexmt_handler()
605 if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) { in tcp_timer_rexmt_handler()
607 if (INP_ISIPV6(tp->t_inpcb)) in tcp_timer_rexmt_handler()
608 in6_losing(tp->t_inpcb); in tcp_timer_rexmt_handler()
611 in_losing(tp->t_inpcb); in tcp_timer_rexmt_handler()
612 tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT); in tcp_timer_rexmt_handler()
613 tp->t_srtt = 0; in tcp_timer_rexmt_handler()
615 tp->snd_nxt = tp->snd_una; in tcp_timer_rexmt_handler()
616 tp->snd_recover = tp->snd_max; in tcp_timer_rexmt_handler()
620 tp->t_flags |= TF_ACKNOW; in tcp_timer_rexmt_handler()
624 tp->t_rtttime = 0; in tcp_timer_rexmt_handler()
650 u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg; in tcp_timer_rexmt_handler()
654 tp->snd_cwnd = tp->t_maxseg; in tcp_timer_rexmt_handler()
655 tp->snd_wacked = 0; in tcp_timer_rexmt_handler()
656 tp->snd_ssthresh = win * tp->t_maxseg; in tcp_timer_rexmt_handler()
657 tp->t_dupacks = 0; in tcp_timer_rexmt_handler()
659 EXIT_FASTRECOVERY(tp); in tcp_timer_rexmt_handler()
660 tcp_output(tp); in tcp_timer_rexmt_handler()
664 if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) in tcp_timer_rexmt_handler()
665 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO); in tcp_timer_rexmt_handler()
667 return tp; in tcp_timer_rexmt_handler()
673 struct tcpcb *tp = xtp; in tcp_timer_rexmt() local
674 struct callout *co = &tp->tt_rexmt->tc_callout; in tcp_timer_rexmt()
682 tcp_send_timermsg(tp, TCP_TIMER_REXMT); in tcp_timer_rexmt()
691 struct tcpcb *tp; in tcp_timer_handler() local
696 tp = tmsg->tt_tcb; in tcp_timer_handler()
720 tp = tt->tt_handler(tp); in tcp_timer_handler()
721 if (tp == NULL) in tcp_timer_handler()
732 tcp_create_timermsg(struct tcpcb *tp, struct lwkt_port *msgport) in tcp_create_timermsg() argument
734 struct netmsg_tcp_timer *tmsg = tp->tt_msg; in tcp_create_timermsg()
740 tmsg->tt_tcb = tp; in tcp_create_timermsg()
745 tcp_destroy_timermsg(struct tcpcb *tp) in tcp_destroy_timermsg() argument
747 struct netmsg_tcp_timer *tmsg = tp->tt_msg; in tcp_destroy_timermsg()
774 tcp_inittimers(struct tcpcb *tp) in tcp_inittimers() argument
776 tcp_callout_init(tp->tt_rexmt, TCP_TIMER_REXMT); in tcp_inittimers()
777 tcp_callout_init(tp->tt_persist, TCP_TIMER_PERSIST); in tcp_inittimers()
778 tcp_callout_init(tp->tt_keep, TCP_TIMER_KEEP); in tcp_inittimers()
779 tcp_callout_init(tp->tt_2msl, TCP_TIMER_2MSL); in tcp_inittimers()
780 tcp_callout_init(tp->tt_delack, TCP_TIMER_DELACK); in tcp_inittimers()