Lines Matching refs:tp

292 tcp_output_locked(struct tcpcb *tp)  in tcp_output_locked()  argument
296 INP_WLOCK_ASSERT(tptoinpcb(tp)); in tcp_output_locked()
298 if ((rv = tp->t_fb->tfb_tcp_output(tp)) < 0) { in tcp_output_locked()
299 KASSERT(tp->t_fb->tfb_flags & TCP_FUNC_OUTPUT_CANDROP, in tcp_output_locked()
301 tp->t_fb->tfb_tcp_block_name, tp)); in tcp_output_locked()
302 tp = tcp_drop(tp, -rv); in tcp_output_locked()
305 return (tp != NULL); in tcp_output_locked()
309 tcp_timer_delack(struct tcpcb *tp) in tcp_timer_delack() argument
313 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_delack()
320 tp->t_flags |= TF_ACKNOW; in tcp_timer_delack()
323 rv = tcp_output_locked(tp); in tcp_timer_delack()
331 tcp_timer_2msl(struct tcpcb *tp) in tcp_timer_2msl() argument
333 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_2msl()
338 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_2msl()
340 tcp_log_end_status(tp, TCP_EI_STATUS_2MSL); in tcp_timer_2msl()
341 tcp_free_sackholes(tp); in tcp_timer_2msl()
354 if (tp->t_state == TCPS_TIME_WAIT) { in tcp_timer_2msl()
356 } else if (tp->t_state == TCPS_FIN_WAIT_2 && in tcp_timer_2msl()
362 if (ticks - tp->t_rcvtime <= TP_MAXIDLE(tp)) in tcp_timer_2msl()
363 tcp_timer_activate(tp, TT_2MSL, TP_KEEPINTVL(tp)); in tcp_timer_2msl()
371 tp = tcp_close(tp); in tcp_timer_2msl()
376 return (tp != NULL); in tcp_timer_2msl()
380 tcp_timer_keep(struct tcpcb *tp) in tcp_timer_keep() argument
383 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_keep()
388 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_keep()
396 if (TCPS_HAVEESTABLISHED(tp->t_state)) { in tcp_timer_keep()
399 idletime = ticks - tp->t_rcvtime; in tcp_timer_keep()
400 if (idletime < TP_KEEPIDLE(tp)) { in tcp_timer_keep()
401 tcp_timer_activate(tp, TT_KEEP, in tcp_timer_keep()
402 TP_KEEPIDLE(tp) - idletime); in tcp_timer_keep()
413 if (tp->t_state < TCPS_ESTABLISHED) in tcp_timer_keep()
417 tp->t_state <= TCPS_CLOSING) { in tcp_timer_keep()
418 if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp)) in tcp_timer_keep()
436 tcp_respond(tp, t_template->tt_ipgen, in tcp_timer_keep()
438 tp->rcv_nxt, tp->snd_una - 1, 0); in tcp_timer_keep()
442 tcp_timer_activate(tp, TT_KEEP, TP_KEEPINTVL(tp)); in tcp_timer_keep()
444 tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp)); in tcp_timer_keep()
452 tcp_log_end_status(tp, TCP_EI_STATUS_KEEP_MAX); in tcp_timer_keep()
453 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_keep()
457 return (tp != NULL); in tcp_timer_keep()
465 tcp_maxunacktime_check(struct tcpcb *tp) in tcp_maxunacktime_check() argument
469 if (TP_MAXUNACKTIME(tp) == 0) in tcp_maxunacktime_check()
473 if (tp->t_acktime == 0) in tcp_maxunacktime_check()
477 if (TSTMP_GT(TP_MAXUNACKTIME(tp) + tp->t_acktime, (u_int)ticks)) in tcp_maxunacktime_check()
486 tcp_timer_persist(struct tcpcb *tp) in tcp_timer_persist() argument
490 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_persist()
496 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_persist()
512 progdrop = tcp_maxunacktime_check(tp); in tcp_timer_persist()
513 if (progdrop || (tp->t_rxtshift >= V_tcp_retries && in tcp_timer_persist()
514 (ticks - tp->t_rcvtime >= tcp_maxpersistidle || in tcp_timer_persist()
515 ticks - tp->t_rcvtime >= TCP_REXMTVAL(tp) * tcp_totbackoff))) { in tcp_timer_persist()
518 tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); in tcp_timer_persist()
525 if (tp->t_state > TCPS_CLOSE_WAIT && in tcp_timer_persist()
526 (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) { in tcp_timer_persist()
528 tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); in tcp_timer_persist()
531 tcp_setpersist(tp); in tcp_timer_persist()
532 tp->t_flags |= TF_FORCEDATA; in tcp_timer_persist()
534 if ((rv = tcp_output_locked(tp))) in tcp_timer_persist()
535 tp->t_flags &= ~TF_FORCEDATA; in tcp_timer_persist()
543 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_persist()
547 return (tp != NULL); in tcp_timer_persist()
551 tcp_timer_rexmt(struct tcpcb *tp) in tcp_timer_rexmt() argument
554 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_rexmt()
560 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); in tcp_timer_rexmt()
562 if (tp->t_fb->tfb_tcp_rexmit_tmr) { in tcp_timer_rexmt()
564 (*tp->t_fb->tfb_tcp_rexmit_tmr)(tp); in tcp_timer_rexmt()
575 if (++tp->t_rxtshift > V_tcp_retries || tcp_maxunacktime_check(tp)) { in tcp_timer_rexmt()
576 if (tp->t_rxtshift > V_tcp_retries) in tcp_timer_rexmt()
578 tp->t_rxtshift = V_tcp_retries; in tcp_timer_rexmt()
579 tcp_log_end_status(tp, TCP_EI_STATUS_RETRAN); in tcp_timer_rexmt()
581 tp = tcp_drop(tp, ETIMEDOUT); in tcp_timer_rexmt()
585 return (tp != NULL); in tcp_timer_rexmt()
587 if (tp->t_state == TCPS_SYN_SENT) { in tcp_timer_rexmt()
592 tp->snd_cwnd = 1; in tcp_timer_rexmt()
593 } else if (tp->t_rxtshift == 1) { in tcp_timer_rexmt()
603 tp->snd_cwnd_prev = tp->snd_cwnd; in tcp_timer_rexmt()
604 tp->snd_ssthresh_prev = tp->snd_ssthresh; in tcp_timer_rexmt()
605 tp->snd_recover_prev = tp->snd_recover; in tcp_timer_rexmt()
606 if (IN_FASTRECOVERY(tp->t_flags)) in tcp_timer_rexmt()
607 tp->t_flags |= TF_WASFRECOVERY; in tcp_timer_rexmt()
609 tp->t_flags &= ~TF_WASFRECOVERY; in tcp_timer_rexmt()
610 if (IN_CONGRECOVERY(tp->t_flags)) in tcp_timer_rexmt()
611 tp->t_flags |= TF_WASCRECOVERY; in tcp_timer_rexmt()
613 tp->t_flags &= ~TF_WASCRECOVERY; in tcp_timer_rexmt()
614 if ((tp->t_flags & TF_RCVD_TSTMP) == 0) in tcp_timer_rexmt()
615 tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1)); in tcp_timer_rexmt()
620 tp->t_flags |= TF_PREVVALID; in tcp_timer_rexmt()
621 tcp_resend_sackholes(tp); in tcp_timer_rexmt()
623 tp->t_flags &= ~TF_PREVVALID; in tcp_timer_rexmt()
624 tcp_free_sackholes(tp); 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()
759 if (tp->t_maxseg < V_tcp_mssdflt) { in tcp_timer_rexmt()
765 tp->t_flags2 |= TF2_PROC_SACK_PROHIBIT; in tcp_timer_rexmt()
767 tp->t_flags2 &= ~TF2_PROC_SACK_PROHIBIT; in tcp_timer_rexmt()
774 if (CC_ALGO(tp)->conn_init != NULL) in tcp_timer_rexmt()
775 CC_ALGO(tp)->conn_init(&tp->t_ccv); in tcp_timer_rexmt()
787 if (tcp_rexmit_drop_options && (tp->t_state == TCPS_SYN_SENT) && in tcp_timer_rexmt()
788 (tp->t_rxtshift == 3)) in tcp_timer_rexmt()
789 tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_SACK_PERMIT); in tcp_timer_rexmt()
794 if (tp->t_rxtshift > TCP_RTT_INVALIDATE) { in tcp_timer_rexmt()
802 tp->snd_nxt = tp->snd_una; in tcp_timer_rexmt()
803 tp->snd_recover = tp->snd_max; in tcp_timer_rexmt()
807 tp->t_flags |= TF_ACKNOW; in tcp_timer_rexmt()
811 tp->t_rtttime = 0; in tcp_timer_rexmt()
813 cc_cong_signal(tp, NULL, CC_RTO); in tcp_timer_rexmt()
815 rv = tcp_output_locked(tp); in tcp_timer_rexmt()
823 tcp_bblog_timer(struct tcpcb *tp, tt_which which, tt_what what, uint32_t ticks) in tcp_bblog_timer() argument
828 INP_WLOCK_ASSERT(tptoinpcb(tp)); in tcp_bblog_timer()
829 if (tcp_bblogging_on(tp)) in tcp_bblog_timer()
830 lgb = tcp_log_event(tp, NULL, NULL, NULL, TCP_LOG_RTO, 0, 0, in tcp_bblog_timer()
852 tcp_timer_next(struct tcpcb *tp, sbintime_t *precision) in tcp_timer_next() argument
858 if (tp->t_timers[i] < after) { in tcp_timer_next()
859 after = tp->t_timers[i]; in tcp_timer_next()
862 before = MIN(before, tp->t_timers[i] + tp->t_precisions[i]); in tcp_timer_next()
873 struct tcpcb *tp = xtp; in tcp_timer_enter() local
874 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_enter()
884 which = tcp_timer_next(tp, NULL); in tcp_timer_enter()
886 tp->t_timers[which] = SBT_MAX; in tcp_timer_enter()
887 tp->t_precisions[which] = 0; in tcp_timer_enter()
889 tcp_bblog_timer(tp, which, TT_PROCESSING, 0); in tcp_timer_enter()
890 tp_valid = tcp_timersw[which](tp); in tcp_timer_enter()
892 tcp_bblog_timer(tp, which, TT_PROCESSED, 0); in tcp_timer_enter()
893 if ((which = tcp_timer_next(tp, &precision)) != TT_N) { in tcp_timer_enter()
894 MPASS(tp->t_state > TCPS_CLOSED); in tcp_timer_enter()
895 callout_reset_sbt_on(&tp->t_callout, in tcp_timer_enter()
896 tp->t_timers[which], precision, tcp_timer_enter, in tcp_timer_enter()
897 tp, inp_to_cpuid(inp), C_ABSOLUTE); in tcp_timer_enter()
909 tcp_timer_activate(struct tcpcb *tp, tt_which which, u_int delta) in tcp_timer_activate() argument
911 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_activate()
916 if (tp->t_flags & TF_TOE) in tcp_timer_activate()
921 MPASS(tp->t_state > TCPS_CLOSED); in tcp_timer_activate()
926 &tp->t_timers[which], &tp->t_precisions[which]); in tcp_timer_activate()
929 tp->t_timers[which] = SBT_MAX; in tcp_timer_activate()
931 tcp_bblog_timer(tp, which, what, delta); in tcp_timer_activate()
933 if ((which = tcp_timer_next(tp, &precision)) != TT_N) in tcp_timer_activate()
934 callout_reset_sbt_on(&tp->t_callout, tp->t_timers[which], in tcp_timer_activate()
935 precision, tcp_timer_enter, tp, inp_to_cpuid(inp), in tcp_timer_activate()
938 callout_stop(&tp->t_callout); in tcp_timer_activate()
942 tcp_timer_active(struct tcpcb *tp, tt_which which) in tcp_timer_active() argument
945 INP_WLOCK_ASSERT(tptoinpcb(tp)); in tcp_timer_active()
947 return (tp->t_timers[which] != SBT_MAX); in tcp_timer_active()
965 tcp_timer_stop(struct tcpcb *tp) in tcp_timer_stop() argument
967 struct inpcb *inp = tptoinpcb(tp); in tcp_timer_stop()
974 stopped = callout_stop(&tp->t_callout); in tcp_timer_stop()
977 tp->t_timers[i] = SBT_MAX; in tcp_timer_stop()
978 } else while(__predict_false(callout_stop(&tp->t_callout) == 0)) { in tcp_timer_stop()