Lines Matching refs:tp

294 tcp_output_locked(struct tcpcb *tp)  in tcp_output_locked()  argument
298 INP_WLOCK_ASSERT(tptoinpcb(tp)); in tcp_output_locked()
300 if ((rv = tp->t_fb->tfb_tcp_output(tp)) < 0) { in tcp_output_locked()
301 KASSERT(tp->t_fb->tfb_flags & TCP_FUNC_OUTPUT_CANDROP, in tcp_output_locked()
303 tp->t_fb->tfb_tcp_block_name, tp)); in tcp_output_locked()
304 tp = tcp_drop(tp, rv); in tcp_output_locked()
307 return (tp != NULL); in tcp_output_locked()
311 tcp_timer_delack(struct tcpcb *tp) in tcp_timer_delack() argument
315 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_delack()
322 tp->t_flags |= TF_ACKNOW; in tcp_timer_delack()
325 rv = tcp_output_locked(tp); in tcp_timer_delack()
333 tcp_timer_2msl(struct tcpcb *tp) in tcp_timer_2msl() argument
335 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_2msl()
340 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_2msl()
342 tcp_log_end_status(tp, TCP_EI_STATUS_2MSL); in tcp_timer_2msl()
343 tcp_free_sackholes(tp); in tcp_timer_2msl()
356 if (tp->t_state == TCPS_TIME_WAIT) { in tcp_timer_2msl()
358 } else if (tp->t_state == TCPS_FIN_WAIT_2 && in tcp_timer_2msl()
364 if (ticks - tp->t_rcvtime <= TP_MAXIDLE(tp)) in tcp_timer_2msl()
365 tcp_timer_activate(tp, TT_2MSL, TP_KEEPINTVL(tp)); in tcp_timer_2msl()
373 tp = tcp_close(tp); in tcp_timer_2msl()
378 return (tp != NULL); in tcp_timer_2msl()
382 tcp_timer_keep(struct tcpcb *tp) in tcp_timer_keep() argument
385 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_keep()
390 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_keep()
398 if (TCPS_HAVEESTABLISHED(tp->t_state)) { in tcp_timer_keep()
401 idletime = ticks - tp->t_rcvtime; in tcp_timer_keep()
402 if (idletime < TP_KEEPIDLE(tp)) { in tcp_timer_keep()
403 tcp_timer_activate(tp, TT_KEEP, in tcp_timer_keep()
404 TP_KEEPIDLE(tp) - idletime); in tcp_timer_keep()
415 if (tp->t_state < TCPS_ESTABLISHED) in tcp_timer_keep()
419 tp->t_state <= TCPS_CLOSING) { in tcp_timer_keep()
420 if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp)) in tcp_timer_keep()
438 tcp_respond(tp, t_template->tt_ipgen, in tcp_timer_keep()
440 tp->rcv_nxt, tp->snd_una - 1, 0); in tcp_timer_keep()
444 tcp_timer_activate(tp, TT_KEEP, TP_KEEPINTVL(tp)); in tcp_timer_keep()
446 tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp)); in tcp_timer_keep()
454 tcp_log_end_status(tp, TCP_EI_STATUS_KEEP_MAX); in tcp_timer_keep()
455 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_keep()
459 return (tp != NULL); in tcp_timer_keep()
467 tcp_maxunacktime_check(struct tcpcb *tp) in tcp_maxunacktime_check() argument
471 if (TP_MAXUNACKTIME(tp) == 0) in tcp_maxunacktime_check()
475 if (tp->t_acktime == 0) in tcp_maxunacktime_check()
479 if (TSTMP_GT(TP_MAXUNACKTIME(tp) + tp->t_acktime, (u_int)ticks)) in tcp_maxunacktime_check()
488 tcp_timer_persist(struct tcpcb *tp) in tcp_timer_persist() argument
492 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_persist()
498 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_persist()
514 progdrop = tcp_maxunacktime_check(tp); in tcp_timer_persist()
515 if (progdrop || (tp->t_rxtshift >= V_tcp_retries && in tcp_timer_persist()
516 (ticks - tp->t_rcvtime >= tcp_maxpersistidle || in tcp_timer_persist()
517 ticks - tp->t_rcvtime >= TCP_REXMTVAL(tp) * tcp_totbackoff))) { in tcp_timer_persist()
520 tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); in tcp_timer_persist()
527 if (tp->t_state > TCPS_CLOSE_WAIT && in tcp_timer_persist()
528 (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) { in tcp_timer_persist()
530 tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); in tcp_timer_persist()
533 tcp_setpersist(tp); in tcp_timer_persist()
534 tp->t_flags |= TF_FORCEDATA; in tcp_timer_persist()
536 if ((rv = tcp_output_locked(tp))) in tcp_timer_persist()
537 tp->t_flags &= ~TF_FORCEDATA; in tcp_timer_persist()
545 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_persist()
549 return (tp != NULL); in tcp_timer_persist()
553 tcp_timer_rexmt(struct tcpcb *tp) in tcp_timer_rexmt() argument
556 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_rexmt()
562 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_rexmt()
564 tcp_free_sackholes(tp); in tcp_timer_rexmt()
565 if (tp->t_fb->tfb_tcp_rexmit_tmr) { in tcp_timer_rexmt()
567 (*tp->t_fb->tfb_tcp_rexmit_tmr)(tp); in tcp_timer_rexmt()
578 if (++tp->t_rxtshift > V_tcp_retries || tcp_maxunacktime_check(tp)) { in tcp_timer_rexmt()
579 if (tp->t_rxtshift > V_tcp_retries) in tcp_timer_rexmt()
581 tp->t_rxtshift = V_tcp_retries; in tcp_timer_rexmt()
582 tcp_log_end_status(tp, TCP_EI_STATUS_RETRAN); in tcp_timer_rexmt()
584 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_rexmt()
588 return (tp != NULL); in tcp_timer_rexmt()
590 if (tp->t_state == TCPS_SYN_SENT) { in tcp_timer_rexmt()
595 tp->snd_cwnd = 1; in tcp_timer_rexmt()
596 } else if (tp->t_rxtshift == 1) { in tcp_timer_rexmt()
606 tp->snd_cwnd_prev = tp->snd_cwnd; in tcp_timer_rexmt()
607 tp->snd_ssthresh_prev = tp->snd_ssthresh; in tcp_timer_rexmt()
608 tp->snd_recover_prev = tp->snd_recover; in tcp_timer_rexmt()
609 if (IN_FASTRECOVERY(tp->t_flags)) in tcp_timer_rexmt()
610 tp->t_flags |= TF_WASFRECOVERY; in tcp_timer_rexmt()
612 tp->t_flags &= ~TF_WASFRECOVERY; in tcp_timer_rexmt()
613 if (IN_CONGRECOVERY(tp->t_flags)) in tcp_timer_rexmt()
614 tp->t_flags |= TF_WASCRECOVERY; in tcp_timer_rexmt()
616 tp->t_flags &= ~TF_WASCRECOVERY; in tcp_timer_rexmt()
617 if ((tp->t_flags & TF_RCVD_TSTMP) == 0) in tcp_timer_rexmt()
618 tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1)); in tcp_timer_rexmt()
623 tp->t_flags |= TF_PREVVALID; in tcp_timer_rexmt()
625 tp->t_flags &= ~TF_PREVVALID; in tcp_timer_rexmt()
627 if ((tp->t_state == TCPS_SYN_SENT) || in tcp_timer_rexmt()
628 (tp->t_state == TCPS_SYN_RECEIVED)) in tcp_timer_rexmt()
629 rexmt = tcp_rexmit_initial * tcp_backoff[tp->t_rxtshift]; in tcp_timer_rexmt()
631 rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; in tcp_timer_rexmt()
632 TCPT_RANGESET(tp->t_rxtcur, rexmt, in tcp_timer_rexmt()
633 tp->t_rttmin, TCPTV_REXMTMAX); in tcp_timer_rexmt()
650 ((tp->t_state == TCPS_ESTABLISHED) || in tcp_timer_rexmt()
651 (tp->t_state == TCPS_FIN_WAIT_1))) { in tcp_timer_rexmt()
652 if (tp->t_rxtshift == 1) { in tcp_timer_rexmt()
661 tp->t_blackhole_enter = 2; in tcp_timer_rexmt()
662 tp->t_blackhole_exit = tp->t_blackhole_enter; in tcp_timer_rexmt()
665 if (tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss) in tcp_timer_rexmt()
666 tp->t_blackhole_exit += 2; in tcp_timer_rexmt()
667 if (tp->t_maxseg > V_tcp_v6mssdflt && in tcp_timer_rexmt()
669 tp->t_blackhole_exit += 2; in tcp_timer_rexmt()
673 if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss) in tcp_timer_rexmt()
674 tp->t_blackhole_exit += 2; in tcp_timer_rexmt()
675 if (tp->t_maxseg > V_tcp_mssdflt && in tcp_timer_rexmt()
677 tp->t_blackhole_exit += 2; in tcp_timer_rexmt()
681 if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) == in tcp_timer_rexmt()
683 (tp->t_rxtshift >= tp->t_blackhole_enter && in tcp_timer_rexmt()
684 tp->t_rxtshift < tp->t_blackhole_exit && in tcp_timer_rexmt()
685 (tp->t_rxtshift - tp->t_blackhole_enter) % 2 == 0)) { in tcp_timer_rexmt()
692 if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) == 0) { in tcp_timer_rexmt()
694 tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; in tcp_timer_rexmt()
696 tp->t_pmtud_saved_maxseg = tp->t_maxseg; in tcp_timer_rexmt()
705 tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss && in tcp_timer_rexmt()
708 tp->t_maxseg = V_tcp_v6pmtud_blackhole_mss; in tcp_timer_rexmt()
712 tp->t_maxseg = V_tcp_v6mssdflt; in tcp_timer_rexmt()
717 tp->t_flags2 &= ~TF2_PLPMTU_PMTUD; in tcp_timer_rexmt()
725 if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss && in tcp_timer_rexmt()
728 tp->t_maxseg = V_tcp_pmtud_blackhole_mss; in tcp_timer_rexmt()
732 tp->t_maxseg = V_tcp_mssdflt; in tcp_timer_rexmt()
737 tp->t_flags2 &= ~TF2_PLPMTU_PMTUD; in tcp_timer_rexmt()
745 if (CC_ALGO(tp)->conn_init != NULL) in tcp_timer_rexmt()
746 CC_ALGO(tp)->conn_init(&tp->t_ccv); in tcp_timer_rexmt()
754 if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) && in tcp_timer_rexmt()
755 (tp->t_rxtshift >= tp->t_blackhole_exit)) { in tcp_timer_rexmt()
756 tp->t_flags2 |= TF2_PLPMTU_PMTUD; in tcp_timer_rexmt()
757 tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE; in tcp_timer_rexmt()
758 tp->t_maxseg = tp->t_pmtud_saved_maxseg; in tcp_timer_rexmt()
764 if (CC_ALGO(tp)->conn_init != NULL) in tcp_timer_rexmt()
765 CC_ALGO(tp)->conn_init(&tp->t_ccv); in tcp_timer_rexmt()
777 if (tcp_rexmit_drop_options && (tp->t_state == TCPS_SYN_SENT) && in tcp_timer_rexmt()
778 (tp->t_rxtshift == 3)) in tcp_timer_rexmt()
779 tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_SACK_PERMIT); in tcp_timer_rexmt()
784 if (tp->t_rxtshift > TCP_RTT_INVALIDATE) { in tcp_timer_rexmt()
792 tp->snd_nxt = tp->snd_una; in tcp_timer_rexmt()
793 tp->snd_recover = tp->snd_max; in tcp_timer_rexmt()
797 tp->t_flags |= TF_ACKNOW; in tcp_timer_rexmt()
801 tp->t_rtttime = 0; in tcp_timer_rexmt()
803 cc_cong_signal(tp, NULL, CC_RTO); in tcp_timer_rexmt()
805 rv = tcp_output_locked(tp); in tcp_timer_rexmt()
813 tcp_bblog_timer(struct tcpcb *tp, tt_which which, tt_what what, uint32_t ticks) in tcp_bblog_timer() argument
818 INP_WLOCK_ASSERT(tptoinpcb(tp)); in tcp_bblog_timer()
819 if (tcp_bblogging_on(tp)) in tcp_bblog_timer()
820 lgb = tcp_log_event(tp, NULL, NULL, NULL, TCP_LOG_RTO, 0, 0, in tcp_bblog_timer()
842 tcp_timer_next(struct tcpcb *tp, sbintime_t *precision) in tcp_timer_next() argument
848 if (tp->t_timers[i] < after) { in tcp_timer_next()
849 after = tp->t_timers[i]; in tcp_timer_next()
852 before = MIN(before, tp->t_timers[i] + tp->t_precisions[i]); in tcp_timer_next()
863 struct tcpcb *tp = xtp; in tcp_timer_enter() local
864 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_enter()
874 which = tcp_timer_next(tp, NULL); in tcp_timer_enter()
876 tp->t_timers[which] = SBT_MAX; in tcp_timer_enter()
877 tp->t_precisions[which] = 0; in tcp_timer_enter()
879 tcp_bblog_timer(tp, which, TT_PROCESSING, 0); in tcp_timer_enter()
880 tp_valid = tcp_timersw[which](tp); in tcp_timer_enter()
882 tcp_bblog_timer(tp, which, TT_PROCESSED, 0); in tcp_timer_enter()
883 if ((which = tcp_timer_next(tp, &precision)) != TT_N) { in tcp_timer_enter()
884 callout_reset_sbt_on(&tp->t_callout, in tcp_timer_enter()
885 tp->t_timers[which], precision, tcp_timer_enter, in tcp_timer_enter()
886 tp, inp_to_cpuid(inp), C_ABSOLUTE); in tcp_timer_enter()
898 tcp_timer_activate(struct tcpcb *tp, tt_which which, u_int delta) in tcp_timer_activate() argument
900 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_activate()
905 if (tp->t_flags & TF_TOE) in tcp_timer_activate()
914 &tp->t_timers[which], &tp->t_precisions[which]); in tcp_timer_activate()
917 tp->t_timers[which] = SBT_MAX; in tcp_timer_activate()
919 tcp_bblog_timer(tp, which, what, delta); in tcp_timer_activate()
921 if ((which = tcp_timer_next(tp, &precision)) != TT_N) in tcp_timer_activate()
922 callout_reset_sbt_on(&tp->t_callout, tp->t_timers[which], in tcp_timer_activate()
923 precision, tcp_timer_enter, tp, inp_to_cpuid(inp), in tcp_timer_activate()
926 callout_stop(&tp->t_callout); in tcp_timer_activate()
930 tcp_timer_active(struct tcpcb *tp, tt_which which) in tcp_timer_active() argument
933 INP_WLOCK_ASSERT(tptoinpcb(tp)); in tcp_timer_active()
935 return (tp->t_timers[which] != SBT_MAX); in tcp_timer_active()
954 tcp_timer_stop(struct tcpcb *tp) in tcp_timer_stop() argument
956 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_stop()
963 stopped = callout_stop(&tp->t_callout); in tcp_timer_stop()
965 } else while(__predict_false(callout_stop(&tp->t_callout) == 0)) { in tcp_timer_stop()