Lines Matching refs:tp

279 	struct tcpcb *tp = xtp;
281 CURVNET_SET(tp->t_vnet);
283 inp = tp->t_inpcb;
284 KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
286 if (callout_pending(&tp->t_timers->tt_delack) ||
287 !callout_active(&tp->t_timers->tt_delack)) {
292 callout_deactivate(&tp->t_timers->tt_delack);
298 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
299 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
300 KASSERT((tp->t_timers->tt_flags & TT_DELACK) != 0,
301 ("%s: tp %p delack callout should be running", __func__, tp));
303 tp->t_flags |= TF_ACKNOW;
305 (void) tp->t_fb->tfb_tcp_output(tp);
313 struct tcpcb *tp = xtp;
315 CURVNET_SET(tp->t_vnet);
319 ostate = tp->t_state;
322 inp = tp->t_inpcb;
323 KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
325 tcp_free_sackholes(tp);
326 if (callout_pending(&tp->t_timers->tt_2msl) ||
327 !callout_active(&tp->t_timers->tt_2msl)) {
328 INP_WUNLOCK(tp->t_inpcb);
333 callout_deactivate(&tp->t_timers->tt_2msl);
340 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
341 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
342 KASSERT((tp->t_timers->tt_flags & TT_2MSL) != 0,
343 ("%s: tp %p 2msl callout should be running", __func__, tp));
363 if (tcp_fast_finwait2_recycle && tp->t_state == TCPS_FIN_WAIT_2 &&
364 tp->t_inpcb && tp->t_inpcb->inp_socket &&
365 (tp->t_inpcb->inp_socket->so_rcv.sb_state & SBS_CANTRCVMORE)) {
367 tp = tcp_close(tp);
369 if (ticks - tp->t_rcvtime <= TP_MAXIDLE(tp)) {
370 if (!callout_reset(&tp->t_timers->tt_2msl,
371 TP_KEEPINTVL(tp), tcp_timer_2msl, tp)) {
372 tp->t_timers->tt_flags &= ~TT_2MSL_RST;
375 tp = tcp_close(tp);
379 if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
380 tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
383 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
385 if (tp != NULL)
394 struct tcpcb *tp = xtp;
397 CURVNET_SET(tp->t_vnet);
401 ostate = tp->t_state;
404 inp = tp->t_inpcb;
405 KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
407 if (callout_pending(&tp->t_timers->tt_keep) ||
408 !callout_active(&tp->t_timers->tt_keep)) {
414 callout_deactivate(&tp->t_timers->tt_keep);
421 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
422 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
423 KASSERT((tp->t_timers->tt_flags & TT_KEEP) != 0,
424 ("%s: tp %p keep callout should be running", __func__, tp));
430 if (tp->t_state < TCPS_ESTABLISHED)
434 tp->t_state <= TCPS_CLOSING) {
435 if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp))
443 * Using sequence number tp->snd_una-1
452 tcp_respond(tp, t_template->tt_ipgen,
454 tp->rcv_nxt, tp->snd_una - 1, 0);
457 if (!callout_reset(&tp->t_timers->tt_keep, TP_KEEPINTVL(tp),
458 tcp_timer_keep, tp)) {
459 tp->t_timers->tt_flags &= ~TT_KEEP_RST;
461 } else if (!callout_reset(&tp->t_timers->tt_keep, TP_KEEPIDLE(tp),
462 tcp_timer_keep, tp)) {
463 tp->t_timers->tt_flags &= ~TT_KEEP_RST;
468 tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
471 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
479 tp = tcp_drop(tp, ETIMEDOUT);
482 if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
483 tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
486 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
487 if (tp != NULL)
488 INP_WUNLOCK(tp->t_inpcb);
496 struct tcpcb *tp = xtp;
498 CURVNET_SET(tp->t_vnet);
502 ostate = tp->t_state;
505 inp = tp->t_inpcb;
506 KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
508 if (callout_pending(&tp->t_timers->tt_persist) ||
509 !callout_active(&tp->t_timers->tt_persist)) {
515 callout_deactivate(&tp->t_timers->tt_persist);
522 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
523 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
524 KASSERT((tp->t_timers->tt_flags & TT_PERSIST) != 0,
525 ("%s: tp %p persist callout should be running", __func__, tp));
538 if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
539 (ticks - tp->t_rcvtime >= tcp_maxpersistidle ||
540 ticks - tp->t_rcvtime >= TCP_REXMTVAL(tp) * tcp_totbackoff)) {
542 tp = tcp_drop(tp, ETIMEDOUT);
549 if (tp->t_state > TCPS_CLOSE_WAIT &&
550 (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) {
552 tp = tcp_drop(tp, ETIMEDOUT);
555 tcp_setpersist(tp);
556 tp->t_flags |= TF_FORCEDATA;
557 (void) tp->t_fb->tfb_tcp_output(tp);
558 tp->t_flags &= ~TF_FORCEDATA;
562 if (tp != NULL && tp->t_inpcb->inp_socket->so_options & SO_DEBUG)
563 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO);
565 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
566 if (tp != NULL)
575 struct tcpcb *tp = xtp;
576 CURVNET_SET(tp->t_vnet);
583 ostate = tp->t_state;
587 inp = tp->t_inpcb;
588 KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
590 if (callout_pending(&tp->t_timers->tt_rexmt) ||
591 !callout_active(&tp->t_timers->tt_rexmt)) {
597 callout_deactivate(&tp->t_timers->tt_rexmt);
604 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
605 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
606 KASSERT((tp->t_timers->tt_flags & TT_REXMT) != 0,
607 ("%s: tp %p rexmt callout should be running", __func__, tp));
608 tcp_free_sackholes(tp);
609 if (tp->t_fb->tfb_tcp_rexmit_tmr) {
611 (*tp->t_fb->tfb_tcp_rexmit_tmr)(tp);
618 if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
619 tp->t_rxtshift = TCP_MAXRXTSHIFT;
622 tp = tcp_drop(tp, ETIMEDOUT);
628 if (tp->t_state == TCPS_SYN_SENT) {
633 tp->snd_cwnd = 1;
634 } else if (tp->t_rxtshift == 1) {
644 tp->snd_cwnd_prev = tp->snd_cwnd;
645 tp->snd_ssthresh_prev = tp->snd_ssthresh;
646 tp->snd_recover_prev = tp->snd_recover;
647 if (IN_FASTRECOVERY(tp->t_flags))
648 tp->t_flags |= TF_WASFRECOVERY;
650 tp->t_flags &= ~TF_WASFRECOVERY;
651 if (IN_CONGRECOVERY(tp->t_flags))
652 tp->t_flags |= TF_WASCRECOVERY;
654 tp->t_flags &= ~TF_WASCRECOVERY;
655 tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1));
656 tp->t_flags |= TF_PREVVALID;
658 tp->t_flags &= ~TF_PREVVALID;
660 if ((tp->t_state == TCPS_SYN_SENT) ||
661 (tp->t_state == TCPS_SYN_RECEIVED))
662 rexmt = TCPTV_RTOBASE * tcp_syn_backoff[tp->t_rxtshift];
664 rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
665 TCPT_RANGESET(tp->t_rxtcur, rexmt,
666 tp->t_rttmin, TCPTV_REXMTMAX);
675 if (V_tcp_pmtud_blackhole_detect && (((tp->t_state == TCPS_ESTABLISHED))
676 || (tp->t_state == TCPS_FIN_WAIT_1))) {
684 * further clamping down. 'tp->t_rxtshift % 2 == 0' should
687 if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) ==
689 (tp->t_rxtshift >= 2 && tp->t_rxtshift < 6 &&
690 tp->t_rxtshift % 2 == 0)) {
697 if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) == 0) {
699 tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE;
701 tp->t_pmtud_saved_maxseg = tp->t_maxseg;
709 isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) ? 1 : 0;
711 tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss) {
713 tp->t_maxseg = V_tcp_v6pmtud_blackhole_mss;
717 tp->t_maxseg = V_tcp_v6mssdflt;
722 tp->t_flags2 &= ~TF2_PLPMTU_PMTUD;
730 if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss) {
732 tp->t_maxseg = V_tcp_pmtud_blackhole_mss;
736 tp->t_maxseg = V_tcp_mssdflt;
741 tp->t_flags2 &= ~TF2_PLPMTU_PMTUD;
749 if (CC_ALGO(tp)->conn_init != NULL)
750 CC_ALGO(tp)->conn_init(tp->ccv);
760 if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) &&
761 (tp->t_rxtshift >= 6)) {
762 tp->t_flags2 |= TF2_PLPMTU_PMTUD;
763 tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
764 tp->t_maxseg = tp->t_pmtud_saved_maxseg;
770 if (CC_ALGO(tp)->conn_init != NULL)
771 CC_ALGO(tp)->conn_init(tp->ccv);
783 if (tcp_rexmit_drop_options && (tp->t_state == TCPS_SYN_SENT) &&
784 (tp->t_rxtshift == 3))
785 tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_SACK_PERMIT);
792 if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) {
794 if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0)
795 in6_losing(tp->t_inpcb);
798 in_losing(tp->t_inpcb);
799 tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT);
800 tp->t_srtt = 0;
802 tp->snd_nxt = tp->snd_una;
803 tp->snd_recover = tp->snd_max;
807 tp->t_flags |= TF_ACKNOW;
811 tp->t_rtttime = 0;
813 cc_cong_signal(tp, NULL, CC_RTO);
815 (void) tp->t_fb->tfb_tcp_output(tp);
819 if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
820 tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
823 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);
824 if (tp != NULL)
832 tcp_timer_activate(struct tcpcb *tp, uint32_t timer_type, u_int delta)
836 struct inpcb *inp = tp->t_inpcb;
841 if (tp->t_flags & TF_TOE)
845 if (tp->t_timers->tt_flags & TT_STOPPED)
850 t_callout = &tp->t_timers->tt_delack;
855 t_callout = &tp->t_timers->tt_rexmt;
860 t_callout = &tp->t_timers->tt_persist;
865 t_callout = &tp->t_timers->tt_keep;
870 t_callout = &tp->t_timers->tt_2msl;
875 if (tp->t_fb->tfb_tcp_timer_activate) {
876 tp->t_fb->tfb_tcp_timer_activate(tp, timer_type, delta);
879 panic("tp %p bad timer_type %#x", tp, timer_type);
882 if ((tp->t_timers->tt_flags & timer_type) &&
884 (tp->t_timers->tt_flags & f_reset)) {
885 tp->t_timers->tt_flags &= ~(timer_type | f_reset);
888 if ((tp->t_timers->tt_flags & timer_type) == 0) {
889 tp->t_timers->tt_flags |= (timer_type | f_reset);
890 callout_reset_on(t_callout, delta, f_callout, tp, cpu);
893 if (!callout_reset(t_callout, delta, f_callout, tp)) {
897 tp->t_timers->tt_flags &= ~f_reset;
904 tcp_timer_active(struct tcpcb *tp, uint32_t timer_type)
910 t_callout = &tp->t_timers->tt_delack;
913 t_callout = &tp->t_timers->tt_rexmt;
916 t_callout = &tp->t_timers->tt_persist;
919 t_callout = &tp->t_timers->tt_keep;
922 t_callout = &tp->t_timers->tt_2msl;
925 if (tp->t_fb->tfb_tcp_timer_active) {
926 return(tp->t_fb->tfb_tcp_timer_active(tp, timer_type));
928 panic("tp %p bad timer_type %#x", tp, timer_type);
934 tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
939 tp->t_timers->tt_flags |= TT_STOPPED;
943 t_callout = &tp->t_timers->tt_delack;
947 t_callout = &tp->t_timers->tt_rexmt;
951 t_callout = &tp->t_timers->tt_persist;
955 t_callout = &tp->t_timers->tt_keep;
959 t_callout = &tp->t_timers->tt_2msl;
963 if (tp->t_fb->tfb_tcp_timer_stop) {
968 tp->t_fb->tfb_tcp_timer_stop(tp, timer_type);
971 panic("tp %p bad timer_type %#x", tp, timer_type);
974 if (tp->t_timers->tt_flags & timer_type) {
981 tp->t_timers->tt_draincnt++;
989 tcp_timer_to_xtimer(struct tcpcb *tp, struct tcp_timer *timer,
1008 xtimer->t_rcvtime = ticks_to_msecs(ticks - tp->t_rcvtime);